diff --git a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp index 11d4120..79fb470 100644 --- a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp +++ b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp @@ -566,11 +566,15 @@ Advanced_Outline::sync_vfunc() } else { // make tails longer for proper trunc AdvancedLine::const_iterator i = aline.begin(); - if (i->second.side0 == WidthPoint::TYPE_INTERPOLATE) + AdvancedLine::const_iterator j = aline.end(); --j; + if (i->second.side0 == WidthPoint::TYPE_INTERPOLATE) { + aline.add(-2, i->second.w, WidthPoint::TYPE_FLAT, WidthPoint::TYPE_INTERPOLATE); aline.add(-1, i->second.w, WidthPoint::TYPE_FLAT, WidthPoint::TYPE_INTERPOLATE); - i = aline.end(); --i; - if (i->second.side1 == WidthPoint::TYPE_INTERPOLATE) - aline.add(kl + 1, i->second.w, WidthPoint::TYPE_INTERPOLATE, WidthPoint::TYPE_FLAT); + } + if (i->second.side1 == WidthPoint::TYPE_INTERPOLATE) { + aline.add(kl + 1, j->second.w, WidthPoint::TYPE_INTERPOLATE, WidthPoint::TYPE_FLAT); + aline.add(kl + 2, j->second.w, WidthPoint::TYPE_INTERPOLATE, WidthPoint::TYPE_FLAT); + } aline.calc_tangents(smoothness); aline.trunc_left(0, (WidthPoint::SideType)start_tip); aline.trunc_right(kl, (WidthPoint::SideType)end_tip); diff --git a/synfig-core/src/synfig/valuenodes/valuenode_bline.cpp b/synfig-core/src/synfig/valuenodes/valuenode_bline.cpp index a0509db..7e05044 100644 --- a/synfig-core/src/synfig/valuenodes/valuenode_bline.cpp +++ b/synfig-core/src/synfig/valuenodes/valuenode_bline.cpp @@ -176,265 +176,165 @@ synfig::convert_bline_to_width_list(const ValueBase& bline) } Real -synfig::find_closest_point(const ValueBase &bline, const Point &pos, Real &radius, bool loop, Point *out_point) +synfig::find_closest_point(const ValueBase &bline, const Point &pos, Real radius, bool loop, Point *out_point) { - Real d,step; - float time = 0; - float best_time = 0; + const Real minstep = 0.01; + const Real maxstep = 0.1; + if (radius==0) radius = 10000000; + + Real closest = 10000000; + Real best_time = 0; int best_index = -1; synfig::Point best_point; - if(radius==0)radius=10000000; - Real closest(10000000); - - int i=0; - std::vector list(bline.get_list_of(BLinePoint())); - typedef std::vector::const_iterator iterT; - iterT iter, prev, first; - for(iter=list.begin(); iter!=list.end(); ++i, ++iter) - { - if( first == iterT() ) - first = iter; - - if( prev != iterT() ) - { - bezier curve; - - curve[0] = (*prev).get_vertex(); - curve[1] = curve[0] + (*prev).get_tangent2()/3; - curve[3] = (*iter).get_vertex(); - curve[2] = curve[3] - (*iter).get_tangent1()/3; - curve.sync(); - - #if 0 - // I don't know why this doesn't work - time=curve.find_closest(pos,6); - d=((curve(time)-pos).mag_squared()); - - #else - //set the step size based on the size of the picture - d = (curve[1] - curve[0]).mag() + (curve[2]-curve[1]).mag() + (curve[3]-curve[2]).mag(); - - step = d/(2*radius); //want to make the distance between lines happy - - step = max(step,0.01); //100 samples should be plenty - step = min(step,0.1); //10 is minimum - - d = find_closest(curve,pos,step,&closest,&time); - #endif - - if(d < closest) - { - closest = d; - best_time = time; - best_index = i; - best_point = curve(best_time); - } - - } - - prev = iter; - } - - // Loop if necessary - if( loop && ( first != iterT() ) && ( prev != iterT() ) ) - { - bezier curve; - - curve[0] = (*prev).get_vertex(); - curve[1] = curve[0] + (*prev).get_tangent2()/3; - curve[3] = (*first).get_vertex(); - curve[2] = curve[3] - (*first).get_tangent1()/3; + const ValueBase::List &list = bline.get_list(); + int size = (int)list.size(); + int count = loop ? size : size - 1; + if (!loop) --count; + + for(int i0 = 0; i0 < count; ++i0) { + int i1 = (i0 + 1) % size; + const BLinePoint &p0 = list[i0].get(BLinePoint()); + const BLinePoint &p1 = list[i1].get(BLinePoint()); + + bezier curve; + curve[0] = p0.get_vertex(); + curve[1] = curve[0] + p0.get_tangent2()/3; + curve[3] = p1.get_vertex(); + curve[2] = curve[3] - p1.get_tangent1()/3; curve.sync(); - #if 0 - // I don't know why this doesn't work - time=curve.find_closest(pos,6); - d=((curve(time)-pos).mag_squared()); - - #else //set the step size based on the size of the picture - d = (curve[1] - curve[0]).mag() + (curve[2]-curve[1]).mag() + (curve[3]-curve[2]).mag(); - - step = d/(2*radius); //want to make the distance between lines happy - - step = max(step,0.01); //100 samples should be plenty - step = min(step,0.1); //10 is minimum - - d = find_closest(curve,pos,step,&closest,&time); - #endif - - if(d < closest) - { - closest = d; + Real len = (curve[1] - curve[0]).mag() + + (curve[2] - curve[1]).mag() + + (curve[3] - curve[2]).mag(); + + // want to make the distance between lines happy + Real step = std::max(minstep, std::min(maxstep, len/(2*radius))); + float time = 0; + Real c = find_closest(curve, pos, step, &closest, &time); + if(c < closest) { + closest = c; best_time = time; - best_index = 0; + best_index = i0; best_point = curve(best_time); } } - if(best_index != -1) - { - if(out_point) - *out_point = best_point; - - int loop_adjust(loop ? 0 : -1); - int size = list.size(); - Real amount = (best_index + best_time + loop_adjust) / (size + loop_adjust); - return amount; - } - - return 0.0; + if (best_index < 0) return 0; + if (out_point) *out_point = best_point; + return (best_index + best_time)/count; } Real synfig::std_to_hom(const ValueBase &bline, Real pos, bool index_loop, bool bline_loop) { - BLinePoint blinepoint0, blinepoint1; - const std::vector list(bline.get_list_of(BLinePoint())); - int size = list.size(), from_vertex; - // trivial cases - if(pos == 0.0 || pos == 1.0) - return pos; - if(!bline_loop) size--; - if(size < 1) return Real(); - Real int_pos((int)pos); - Real one(0.0); - if (index_loop) - { - pos = pos - int_pos; - if (pos < 0) - { - pos++; - one=1.0; + const int segments = 16; + const Real segment_size = 1.0/segments; + + Real loops = index_loop ? floor(pos) : 0.0; + pos -= loops; + if (approximate_less_or_equal(pos, Real(0))) + return loops; + if (approximate_greater_or_equal(pos, Real(1))) + return loops + 1; + + const ValueBase::List &list = bline.get_list(); + int size = (int)list.size(); + int count = bline_loop ? size : size - 1; + if (count <= 0) return loops + pos; + + bool found = false; + Real p = pos*count; + Real length = 0; + + // calculate length + Real last_length = 0; + Point last_point = list.front().get(BLinePoint()).get_vertex(); + for(int i0 = 0; i0 < count; ++i0) { + int i1 = (i0 + 1)%count; + const BLinePoint &blinepoint0 = list[i0].get(BLinePoint()); + const BLinePoint &blinepoint1 = list[i1].get(BLinePoint()); + etl::hermite curve( + blinepoint0.get_vertex(), blinepoint1.get_vertex(), + blinepoint0.get_tangent2(), blinepoint1.get_tangent1() ); + for(int j = 1; j <= segments; ++j) { + Real t = j*segment_size; + Point point = curve(t); + Real dl = (point - last_point).mag(); + last_length += dl; + last_point = point; + + if (!found && t >= p - i0) { + length = last_length - dl*(t - p + i0)*segments; + found = true; + } } } - else - { - if (pos < 0) pos = 0; - if (pos > 1) pos = 1; - } - // Calculate the lengths and the total length - Real tl=0, pl=0; - std::vector lengths; - vector::const_iterator iter, next; - tl=bline_length(bline, bline_loop, &lengths); - // If the total length of the bline is zero return pos - if(tl==0.0) return pos; - from_vertex = int(pos*size); - // Calculate the partial length until the bezier that holds the current - std::vector::const_iterator liter(lengths.begin()); - for(int i=0;i size-1) from_vertex = size-1; // if we are at the end of the last bezier - blinepoint0 = from_vertex ? *(next+from_vertex-1) : *iter; - blinepoint1 = *(next+from_vertex); - etl::hermite curve(blinepoint0.get_vertex(), blinepoint1.get_vertex(), - blinepoint0.get_tangent2(), blinepoint1.get_tangent1()); - // add the distance on the bezier we are on. - pl+=curve.find_distance(0.0, pos*size - from_vertex); - // and return the homogeneous position - return int_pos+pl/tl-one; + + if (approximate_zero(last_length)) + return loops + pos; + if (!found) + return loops + 1.0; + + return loops + length/last_length; } Real synfig::hom_to_std(const ValueBase &bline, Real pos, bool index_loop, bool bline_loop) { - BLinePoint blinepoint0, blinepoint1; - const std::vector list(bline.get_list_of(BLinePoint())); - int size = list.size(), from_vertex(0); - // trivial cases - if(pos == 0.0 || pos == 1.0) - return pos; - if(!bline_loop) size--; - if(size < 1) return Real(); - Real int_pos=int(pos); - Real one(0.0); - if (index_loop) - { - pos = pos - int_pos; - if (pos < 0) - { - pos++; - one=1.0; - } - } - else - { - if (pos < 0) pos = 0; - if (pos > 1) pos = 1; - } - // Calculate the lengths and the total length - Real tl(0), pl(0), mpl, bl(0); + const int segments = 16; + const Real segment_size = 1.0/segments; + + Real loops = index_loop ? floor(pos) : 0.0; + pos -= loops; + if (approximate_less_or_equal(pos, Real(0))) + return loops; + if (approximate_greater_or_equal(pos, Real(1))) + return loops + 1; + + const ValueBase::List &list = bline.get_list(); + int size = (int)list.size(); + int count = bline_loop ? size : size - 1; + if (count <= 0) return loops + pos; + + // calculate and save inceremental length for each segment std::vector lengths; - vector::const_iterator iter, next; - tl=bline_length(bline, bline_loop,&lengths); - // Calculate the my partial length (the length where pos is) - mpl=pos*tl; - next=list.begin(); - iter = bline_loop ? --list.end() : next++; - std::vector::const_iterator liter(lengths.begin()); - // Find the previous bezier where we pos is placed and the sum - // of lengths to it (pl) - // also remember the bezier's length where we stop - while(mpl > pl && next!=list.end()) - { - pl+=*liter; - bl=*liter; - iter=next; - next++; - liter++; - from_vertex++; + lengths.reserve(segments*count + 1); + lengths.push_back(0); + Point last_point = list.front().get(BLinePoint()).get_vertex(); + for(int i0 = 0; i0 < count; ++i0) { + int i1 = (i0 + 1)%count; + const BLinePoint &blinepoint0 = list[i0].get(BLinePoint()); + const BLinePoint &blinepoint1 = list[i1].get(BLinePoint()); + etl::hermite curve( + blinepoint0.get_vertex(), blinepoint1.get_vertex(), + blinepoint0.get_tangent2(), blinepoint1.get_tangent1() ); + for(int j = 1; j <= segments; ++j) { + Point point = curve(j*segment_size); + lengths.push_back( lengths.back() + (point - last_point).mag() ); + last_point = point; + } } - // correct the iters and partial length in case we passed over - if(pl > mpl) - { - liter--; - next--; - if(next==list.begin()) - iter=--list.end(); - else - iter--; - pl-=*liter; - from_vertex--; + + Real full_length = lengths.back(); + if (approximate_zero(full_length)) + return loops + pos; + + // find segment + Real length = pos*full_length; + int a = 0, b = (int)lengths.size() - 1; + while(true) { + int c = (a + b)/2; + if (c == a) break; + (lengths[c] <= length ? a : b) = c; } - // set up the cureve - blinepoint0 = *iter; - blinepoint1 = *next; - etl::hermite curve(blinepoint0.get_vertex(), blinepoint1.get_vertex(), - blinepoint0.get_tangent2(), blinepoint1.get_tangent1()); - // Find the solution to which is the standard position which matches the current - // homogeneous position - // Secant method: http://en.wikipedia.org/wiki/Secant_method - Real sn(0.0); // the standard position on current bezier - Real sn1(0.0), sn2(1.0); - Real t0((mpl-pl)/bl); // the homogeneous position on the current bezier - int iterations=0; - int max_iterations=100; - Real max_error(0.00001); - Real error; - Real fsn1(t0-curve.find_distance(0.0,sn1)/bl); - Real fsn2(t0-curve.find_distance(0.0,sn2)/bl); - Real fsn; - do - { - sn=sn1-fsn1*((sn1-sn2)/(fsn1-fsn2)); - fsn=t0-curve.find_distance(0.0, sn)/bl; - sn2=sn1; - sn1=sn; - fsn2=fsn1; - fsn1=fsn; - error=fabs(fsn2-fsn1); - iterations++; - }while (error>max_error && max_iterations > iterations); - // convert the current standard index (s) to the bline's standard index - // and return it - return int_pos+Real(from_vertex + sn)/size-one; + + // calculate value + return loops + + Real(a)/lengths.size() + + (length - lengths[a])/full_length; } Real diff --git a/synfig-core/src/synfig/valuenodes/valuenode_bline.h b/synfig-core/src/synfig/valuenodes/valuenode_bline.h index 1eb18f0..e924bd6 100644 --- a/synfig-core/src/synfig/valuenodes/valuenode_bline.h +++ b/synfig-core/src/synfig/valuenodes/valuenode_bline.h @@ -52,7 +52,7 @@ ValueBase convert_bline_to_segment_list(const ValueBase &bline); ValueBase convert_bline_to_width_list(const ValueBase &bline); //! Finds the closest point to pos in bline -Real find_closest_point(const ValueBase &bline, const Point &pos, Real &radius, bool loop, Point *out_point = 0); +Real find_closest_point(const ValueBase &bline, const Point &pos, Real radius, bool loop, Point *out_point = 0); //! Converts from standard to homogeneous index (considers the length) Real std_to_hom(const ValueBase &bline, Real pos, bool index_loop, bool bline_loop); diff --git a/synfig-core/src/synfig/valuenodes/valuenode_blinecalctangent.cpp b/synfig-core/src/synfig/valuenodes/valuenode_blinecalctangent.cpp index 175c1ce..8986451 100644 --- a/synfig-core/src/synfig/valuenodes/valuenode_blinecalctangent.cpp +++ b/synfig-core/src/synfig/valuenodes/valuenode_blinecalctangent.cpp @@ -101,72 +101,52 @@ ValueNode_BLineCalcTangent::operator()(Time t, Real amount)const if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS")) printf("%s:%d operator()\n", __FILE__, __LINE__); - const std::vector bline((*bline_)(t).get_list()); + const ValueBase::List bline = (*bline_)(t).get_list(); handle bline_value_node( handle::cast_dynamic(bline_) ); assert(bline_value_node); - const bool looped(bline_value_node->get_loop()); - int size = bline.size(), from_vertex; - bool loop((*loop_)(t).get(bool())); - bool homogeneous((*homogeneous_)(t).get(bool())); - Angle offset((*offset_)(t).get(Angle())); - Real scale((*scale_)(t).get(Real())); - bool fixed_length((*fixed_length_)(t).get(bool())); - if(homogeneous) - { - amount=hom_to_std(bline, amount, loop, looped); - } - BLinePoint blinepoint0, blinepoint1; + const bool looped = bline_value_node->get_loop(); + int size = (int)bline.size(); + int count = looped ? size : size - 1; + if (count < 1) return Vector(); - if (!looped) size--; - if (size < 1) - { - Type &type(get_type()); - if (type == type_angle) return Angle(); - if (type == type_real) return Real(); - if (type == type_vector) return Vector(); - assert(0); - return ValueBase(); - } - if (loop) - { - amount = amount - int(amount); - if (amount < 0) amount++; - } - else - { - if (amount < 0) amount = 0; - if (amount > 1) amount = 1; - } + bool loop = (*loop_)(t).get(bool()); + bool homogeneous = (*homogeneous_)(t).get(bool()); + Angle offset = (*offset_)(t).get(Angle()); + Real scale = (*scale_)(t).get(Real()); + bool fixed_length = (*fixed_length_)(t).get(bool()); + + if (loop) amount -= floor(amount); + if (homogeneous) amount = hom_to_std(bline, amount, loop, looped); + if (amount < 0) amount = 0; + if (amount > 1) amount = 1; + amount *= count; - vector::const_iterator iter, next(bline.begin()); + int i0 = std::max(0, std::min(size-1, (int)floor(amount))); + int i1 = (i0 + 1) % size; + Real part = amount - i0; - iter = looped ? --bline.end() : next++; - amount = amount * size; - from_vertex = int(amount); - if (from_vertex > size-1) from_vertex = size-1; - blinepoint0 = from_vertex ? (next+from_vertex-1)->get(BLinePoint()) : iter->get(BLinePoint()); - blinepoint1 = (next+from_vertex)->get(BLinePoint()); + const BLinePoint &blinepoint0 = bline[i0].get(BLinePoint()); + const BLinePoint &blinepoint1 = bline[i1].get(BLinePoint()); etl::hermite curve(blinepoint0.get_vertex(), blinepoint1.get_vertex(), blinepoint0.get_tangent2(), blinepoint1.get_tangent1()); etl::derivative< etl::hermite > deriv(curve); + Vector tangent = deriv(part); + Type &type(get_type()); if (type == type_angle) - return deriv(amount-from_vertex).angle() + offset; - if (type == type_real) - { + return tangent.angle() + offset; + if (type == type_real) { if (fixed_length) return scale; - return deriv(amount-from_vertex).mag() * scale; + return tangent.mag() * scale; } - if (type == type_vector) - { - Vector tangent(deriv(amount-from_vertex)); + if (type == type_vector) { Angle angle(tangent.angle() + offset); Real mag = fixed_length ? scale : (tangent.mag() * scale); - return Vector(Angle::cos(angle).get()*mag, - Angle::sin(angle).get()*mag); + return Vector( Angle::cos(angle).get()*mag, + Angle::sin(angle).get()*mag ); } assert(0); diff --git a/synfig-core/src/synfig/valuenodes/valuenode_blinecalcvertex.cpp b/synfig-core/src/synfig/valuenodes/valuenode_blinecalcvertex.cpp index 28497e8..9ef1176 100644 --- a/synfig-core/src/synfig/valuenodes/valuenode_blinecalcvertex.cpp +++ b/synfig-core/src/synfig/valuenodes/valuenode_blinecalcvertex.cpp @@ -98,56 +98,37 @@ ValueNode_BLineCalcVertex::operator()(Time t)const if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS")) printf("%s:%d operator()\n", __FILE__, __LINE__); - const std::vector bline((*bline_)(t).get_list()); + const ValueBase::List bline = (*bline_)(t).get_list(); handle bline_value_node( handle::cast_dynamic(bline_) ); assert(bline_value_node); - const bool looped(bline_value_node->get_loop()); - int size = bline.size(), from_vertex; - bool loop((*loop_)(t).get(bool())); - bool homogeneous((*homogeneous_)(t).get(bool())); - Real amount((*amount_)(t).get(Real())); - if(homogeneous) - { - amount=hom_to_std(bline, amount, loop, looped); - } - BLinePoint blinepoint0, blinepoint1; + const bool looped = bline_value_node->get_loop(); + int size = (int)bline.size(); + int count = looped ? size : size - 1; + if (count < 1) return Vector(); - if (!looped) size--; - if (size < 1) return Vector(); - if (loop) - { - amount = amount - int(amount); - if (amount < 0) amount++; - } - else - { - if (amount < 0) amount = 0; - if (amount > 1) amount = 1; - } + bool loop = (*loop_)(t).get(bool()); + bool homogeneous = (*homogeneous_)(t).get(bool()); + Real amount = (*amount_)(t).get(Real()); - vector::const_iterator iter, next(bline.begin()); + if (loop) amount -= floor(amount); + if (homogeneous) amount = hom_to_std(bline, amount, loop, looped); + if (amount < 0) amount = 0; + if (amount > 1) amount = 1; + amount *= count; - iter = looped ? --bline.end() : next++; - amount = amount * size; - from_vertex = int(amount); - if (from_vertex > size-1) from_vertex = size-1; - blinepoint0 = from_vertex ? (next+from_vertex-1)->get(BLinePoint()) : iter->get(BLinePoint()); - blinepoint1 = (next+from_vertex)->get(BLinePoint()); + int i0 = std::max(0, std::min(size-1, (int)floor(amount))); + int i1 = (i0 + 1) % size; + Real part = amount - i0; + + const BLinePoint &blinepoint0 = bline[i0].get(BLinePoint()); + const BLinePoint &blinepoint1 = bline[i1].get(BLinePoint()); etl::hermite curve(blinepoint0.get_vertex(), blinepoint1.get_vertex(), blinepoint0.get_tangent2(), blinepoint1.get_tangent1()); - return curve(amount-from_vertex); + return curve(part); } - - - - - - - - bool ValueNode_BLineCalcVertex::set_link_vfunc(int i,ValueNode::Handle value) { diff --git a/synfig-core/src/synfig/valuenodes/valuenode_blinecalcwidth.cpp b/synfig-core/src/synfig/valuenodes/valuenode_blinecalcwidth.cpp index 59bfdb1..26f2e9f 100644 --- a/synfig-core/src/synfig/valuenodes/valuenode_blinecalcwidth.cpp +++ b/synfig-core/src/synfig/valuenodes/valuenode_blinecalcwidth.cpp @@ -99,47 +99,32 @@ ValueNode_BLineCalcWidth::operator()(Time t, Real amount)const if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS")) printf("%s:%d operator()\n", __FILE__, __LINE__); - const std::vector bline((*bline_)(t).get_list()); + const ValueBase::List bline = (*bline_)(t).get_list(); handle bline_value_node( handle::cast_dynamic(bline_) ); assert(bline_value_node); - const bool looped(bline_value_node->get_loop()); - int size = bline.size(), from_vertex; - bool loop((*loop_)(t).get(bool())); - bool homogeneous((*homogeneous_)(t).get(bool())); - Real scale((*scale_)(t).get(Real())); - if(homogeneous) - { - amount=hom_to_std(bline, amount, loop, looped); - } - BLinePoint blinepoint0, blinepoint1; - - if (!looped) size--; - if (size < 1) return Real(); - if (loop) - { - amount = amount - int(amount); - if (amount < 0) amount++; - } - else - { - if (amount < 0) amount = 0; - if (amount > 1) amount = 1; - } + const bool looped = bline_value_node->get_loop(); + int size = (int)bline.size(); + int count = looped ? size : size - 1; + if (count < 1) return Vector(); - vector::const_iterator iter, next(bline.begin()); + bool loop = (*loop_)(t).get(bool()); + bool homogeneous = (*homogeneous_)(t).get(bool()); + Real scale = (*scale_)(t).get(Real()); - iter = looped ? --bline.end() : next++; - amount = amount * size; - from_vertex = int(amount); - if (from_vertex > size-1) from_vertex = size-1; - blinepoint0 = from_vertex ? (next+from_vertex-1)->get(BLinePoint()) : iter->get(BLinePoint()); - blinepoint1 = (next+from_vertex)->get(BLinePoint()); + if (loop) amount -= floor(amount); + if (homogeneous) amount = hom_to_std(bline, amount, loop, looped); + if (amount < 0) amount = 0; + if (amount > 1) amount = 1; + amount *= count; - float width0 = blinepoint0.get_width(); - float width1 = blinepoint1.get_width(); + int i0 = std::max(0, std::min(size-1, (int)floor(amount))); + int i1 = (i0 + 1) % size; + Real part = amount - i0; - return Real((width0 + (amount-from_vertex) * (width1-width0)) * scale); + Real width0 = bline[i0].get(BLinePoint()).get_width(); + Real width1 = bline[i1].get(BLinePoint()).get_width(); + return (width0 + part*(width1 - width0))*scale; } ValueBase diff --git a/synfig-studio/src/gui/duckmatic.cpp b/synfig-studio/src/gui/duckmatic.cpp index 4cac098..a2ec5ec 100644 --- a/synfig-studio/src/gui/duckmatic.cpp +++ b/synfig-studio/src/gui/duckmatic.cpp @@ -112,7 +112,11 @@ void set_duck_value_desc(Duck& duck, const synfigapp::ValueDesc& value_desc, con Duckmatic::Duckmatic(etl::loose_handle canvas_interface): canvas_interface(canvas_interface), - type_mask(Duck::TYPE_ALL-Duck::TYPE_WIDTH-Duck::TYPE_BONE_RECURSIVE-Duck::TYPE_WIDTHPOINT_POSITION), + type_mask(Type( + Duck::TYPE_ALL + & ~( Duck::TYPE_WIDTH + | Duck::TYPE_BONE_RECURSIVE + | Duck::TYPE_WIDTHPOINT_POSITION ))), type_mask_state(Duck::TYPE_NONE), alternative_mode_(false), lock_animation_mode_(false), @@ -2708,12 +2712,12 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_link("bline", bline); bline_calc_vertex->set_link("loop", ValueNode_Const::create(false)); bline_calc_vertex->set_link("amount", ValueNode_Const::create(width_point.get_norm_position(value_node->get_loop()))); bline_calc_vertex->set_link("homogeneous", ValueNode_Const::create(homogeneous)); - pduck->set_point((*bline_calc_vertex)(get_time()).get(Vector())); + pduck->set_point((*bline_calc_vertex)(Time()).get(Vector())); // hack end pduck->set_editable(synfigapp::is_editable(wpoint_value_desc.get_value_node())); pduck->signal_edited().clear();