Blame bugs/open/000026.txt

Chris Moore 3d749b
Subject: edit a valuenode-valued waypoint doesn't trigger update of parent
Chris Moore 3d749b
Chris Moore ade123
Example: ~chris/Desktop/anim/dynamic-waypoints.sifz
Chris Moore 3d749b
Chris Moore 3d749b
set preview quality to 1 (best) and the time to be 5s
Chris Moore 3d749b
edit the 'left rate' child node to be 1 instead of 0.
Chris Moore 3d749b
the workarea doesn't reflect any change.
Chris Moore 3d749b
move the time slider away from 5s and back to 5s.
Chris Moore 3d749b
the workarea now reflects the change.
Chris Moore 3d749b
Chris Moore 3d749b
Usually when a node is edited, the on_changed() methods cause all
Chris Moore 3d749b
ancestors of the node to update themselves, but waypoints don't
Chris Moore 3d749b
inherit from Node, and so don't have the concept of a parent_set to
Chris Moore 3d749b
update when changed.
Chris Moore ade123
Chris Moore ade123
The use of valuenodes as the value of waypoints is unusual in synfig,
Chris Moore ade123
but the addition of bones makes it more common, since re-parenting
Chris Moore ade123
causes the use of valuenode waypoints.
Chris Moore ade123
Chris Moore ade123
Example: ~chris/Desktop/anim/bones/test2.sifz
Chris Moore ade123
Chris Moore ade123
Select either of the 'anim' layers, edit the bone ducks, note that
Chris Moore ade123
nothing gets updated.
Chris Moore acc0ba
Chris Moore acc0ba
------------------------------------------------------------------------
Chris Moore acc0ba
dooglus, Fri Jan  2 14:27:07 CET 2009
Chris Moore acc0ba
Chris Moore acc0ba
a simple recipe:
Chris Moore acc0ba
Chris Moore acc0ba
1. new document, make a circle, export the radius as 'r' ('r' is a ValueNode_Const)
Chris Moore acc0ba
2. disconnect the radius, switch to animate edit mode, edit the radius, creating a waypoint
Chris Moore acc0ba
3. in the Children tab, select 'r'
Chris Moore acc0ba
4. in the Timetrack tab, right-click the waypoint
Chris Moore acc0ba
5. 'connect' (the waypoint now has a ValueNode_Const value)
Chris Moore acc0ba
6. switch out of animate edit mode
Chris Moore acc0ba
7. in the Children tab, edit the value of 'r'
Chris Moore acc0ba
8. watch the circle's radius fail to change
Chris Moore acc0ba
9. slide the time slider, and see the radius change
Chris Moore 6f83f5
Chris Moore 6f83f5
------------------------------------------------------------------------
Chris Moore 6f83f5
dooglus, Fri Jan  2 21:03:37 CET 2009
Chris Moore 6f83f5
Chris Moore 6f83f5
Here's a patch that fixes the bug for the exact recipe above, but it
Chris Moore 6f83f5
must miss lots of similar cases.  The problem is that there's code
Chris Moore 6f83f5
spread all over that can add and modify waypoints.  We need a single
Chris Moore 6f83f5
function that does it, so we can make sure the parent_set is kept
Chris Moore 6f83f5
correctly up to date:
Chris Moore 6f83f5
Chris Moore 6f83f5
diff --git a/synfig-studio/trunk/src/synfigapp/actions/waypointconnect.cpp b/synfig-studio/trunk/src/synfigapp/actions/waypointconnect.cpp
Chris Moore 6f83f5
index f86cc1e..9b304a6 100644
Chris Moore 6f83f5
--- a/synfig-studio/trunk/src/synfigapp/actions/waypointconnect.cpp
Chris Moore 6f83f5
+++ b/synfig-studio/trunk/src/synfigapp/actions/waypointconnect.cpp
Chris Moore 6f83f5
@@ -134,6 +134,7 @@ Action::WaypointConnect::perform()
Chris Moore 6f83f5
 
Chris Moore 6f83f5
 	old_value_node=iter->get_value_node();
Chris Moore 6f83f5
 	iter->set_value_node(new_value_node);
Chris Moore 6f83f5
+	iter->get_parent_value_node()->add_child(new_value_node.get());
Chris Moore 6f83f5
 
Chris Moore 6f83f5
 	/*set_dirty(true);
Chris Moore 6f83f5