Revision: 22380
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22380
Author:   ben2610
Date:     2009-08-11 20:37:48 +0200 (Tue, 11 Aug 2009)

Log Message:
-----------
iTaSC: expand IK constraint to support multiple mode. Add Distance to UI (no 
backend yet): new IK type selection to choose between CopyPose and Distance and 
display corresponding fields.

Modified Paths:
--------------
    branches/itasc/intern/ghost/intern/GHOST_System.cpp
    branches/itasc/intern/ghost/intern/GHOST_System.h
    branches/itasc/release/ui/buttons_object_constraint.py
    branches/itasc/source/blender/blenkernel/intern/constraint.c
    branches/itasc/source/blender/editors/include/ED_object.h
    branches/itasc/source/blender/editors/object/editconstraint.c
    branches/itasc/source/blender/makesdna/DNA_constraint_types.h
    branches/itasc/source/blender/makesrna/intern/rna_constraint.c

Modified: branches/itasc/intern/ghost/intern/GHOST_System.cpp
===================================================================
--- branches/itasc/intern/ghost/intern/GHOST_System.cpp 2009-08-11 18:19:09 UTC 
(rev 22379)
+++ branches/itasc/intern/ghost/intern/GHOST_System.cpp 2009-08-11 18:37:48 UTC 
(rev 22380)
@@ -290,7 +290,8 @@
        
 #ifdef GHOST_DEBUG
        if (m_eventManager) {
-               m_eventManager->addConsumer(&m_eventPrinter);
+               m_eventPrinter = new GHOST_EventPrinter();
+               m_eventManager->addConsumer(m_eventPrinter);
        }
 #endif // GHOST_DEBUG
 

Modified: branches/itasc/intern/ghost/intern/GHOST_System.h
===================================================================
--- branches/itasc/intern/ghost/intern/GHOST_System.h   2009-08-11 18:19:09 UTC 
(rev 22379)
+++ branches/itasc/intern/ghost/intern/GHOST_System.h   2009-08-11 18:37:48 UTC 
(rev 22380)
@@ -335,7 +335,7 @@
 
        /** Prints all the events. */
 #ifdef GHOST_DEBUG
-       GHOST_EventPrinter m_eventPrinter;
+       GHOST_EventPrinter* m_eventPrinter;
 #endif // GHOST_DEBUG
 
        /** Settings of the display before the display went fullscreen. */

Modified: branches/itasc/release/ui/buttons_object_constraint.py
===================================================================
--- branches/itasc/release/ui/buttons_object_constraint.py      2009-08-11 
18:19:09 UTC (rev 22379)
+++ branches/itasc/release/ui/buttons_object_constraint.py      2009-08-11 
18:37:48 UTC (rev 22380)
@@ -6,14 +6,14 @@
        __region_type__ = "WINDOW"
        __context__ = "constraint"
 
-       def draw_constraint(self, con):
+       def draw_constraint(self, context, con):
                layout = self.layout
                
                box = layout.template_constraint(con)
 
                if box:
                        # match enum type to our functions, avoids a lookup 
table.
-                       getattr(self, con.type)(box, con)
+                       getattr(self, con.type)(context, box, con)
        
                        # show/key buttons here are most likely obsolete now, 
with
                        # keyframing functionality being part of every button
@@ -48,8 +48,29 @@
                                        row.itemR(con, "head_tail", text="")
                        elif con.target.type in ('MESH', 'LATTICE'):
                                layout.item_pointerR(con, "subtarget", 
con.target, "vertex_groups", text="Vertex Group")
+
+       def ik_template(self, layout, con):
+               layout.itemR(con, "pole_target")
        
-       def CHILD_OF(self, layout, con):
+               if con.pole_target and con.pole_target.type == 'ARMATURE':
+                       layout.item_pointerR(con, "pole_subtarget", 
con.pole_target.data, "bones", text="Bone")
+               
+               if con.pole_target:
+                       row = layout.row()
+                       row.itemL()
+                       row.itemR(con, "pole_angle")
+               
+               split = layout.split()
+               col = split.column()
+               col.itemR(con, "tail")
+               col.itemR(con, "stretch")
+
+               col = split.column()
+               col.itemR(con, "iterations")
+               col.itemR(con, "chain_length")
+               
+       
+       def CHILD_OF(self, context, layout, con):
                self.target_template(layout, con)
 
                split = layout.split()
@@ -76,7 +97,7 @@
                row.itemO("constraint.childof_set_inverse")
                row.itemO("constraint.childof_clear_inverse")
                
-       def TRACK_TO(self, layout, con):
+       def TRACK_TO(self, context, layout, con):
                self.target_template(layout, con)
                
                row = layout.row()
@@ -90,36 +111,41 @@
                
                self.space_template(layout, con)
                
-       def IK(self, layout, con):
+       def IK(self, context, layout, con):
+               if context.object.pose.ik_solver == "ITASC":
+                       layout.itemR(con, "ik_type")
+                       getattr(self, "IK_"+con.ik_type)(context, layout, con)
+               else:
+                       self.IK_COPY_POSE(context, layout, con)
+
+       def IK_COPY_POSE(self, context, layout, con):
                self.target_template(layout, con)
-               
-               layout.itemR(con, "pole_target")
-       
-               if con.pole_target and con.pole_target.type == 'ARMATURE':
-                       layout.item_pointerR(con, "pole_subtarget", 
con.pole_target.data, "bones", text="Bone")
-               
+               self.ik_template(layout, con)
+
                split = layout.split()
-       
                col = split.column()
-               col.itemR(con, "iterations")
-               col.itemR(con, "chain_length")
-               sub = col.column()
-               sub.active = con.pole_target
-               sub.itemR(con, "pole_angle")
+               col.itemL()
+               col.itemR(con, "targetless")
+               col.itemR(con, "rotation")
+
+               col = split.column()
                col.itemL(text="Weight:")
                col.itemR(con, "weight", text="Position", slider=True)
                sub = col.column()
                sub.active = con.rotation
                sub.itemR(con, "orient_weight", text="Rotation", slider=True)
                
-               col = split.column()
-               col.itemR(con, "tail")
-               col.itemR(con, "rotation")
-               col.itemR(con, "targetless")
-               col.itemR(con, "stretch")
-               
-       def FOLLOW_PATH(self, layout, con):
+       def IK_DISTANCE(self, context, layout, con):
                self.target_template(layout, con)
+               self.ik_template(layout, con)
+
+               layout.itemR(con, "limit_mode")
+               row = layout.row()
+               row.itemR(con, "weight", text="Weight", slider=True)
+               row.itemR(con, "distance", text="Distance", slider=True)
+
+       def FOLLOW_PATH(self, context, layout, con):
+               self.target_template(layout, con)
                
                row = layout.row()
                row.itemR(con, "curve_follow")
@@ -133,7 +159,7 @@
                row.itemR(con, "up", text="Up")
                row.itemL()
                
-       def LIMIT_ROTATION(self, layout, con):
+       def LIMIT_ROTATION(self, context, layout, con):
                
                split = layout.split()
                
@@ -166,7 +192,7 @@
                row.itemL(text="Convert:")
                row.itemR(con, "owner_space", text="")
                
-       def LIMIT_LOCATION(self, layout, con):
+       def LIMIT_LOCATION(self, context, layout, con):
                split = layout.split()
                
                col = split.column()
@@ -207,7 +233,7 @@
                row.itemL(text="Convert:")
                row.itemR(con, "owner_space", text="")
                
-       def LIMIT_SCALE(self, layout, con):
+       def LIMIT_SCALE(self, context, layout, con):
                split = layout.split()
 
                col = split.column()
@@ -248,7 +274,7 @@
                row.itemL(text="Convert:")
                row.itemR(con, "owner_space", text="")
        
-       def COPY_ROTATION(self, layout, con):
+       def COPY_ROTATION(self, context, layout, con):
                self.target_template(layout, con)
                
                split = layout.split()
@@ -275,7 +301,7 @@
                
                self.space_template(layout, con)
                
-       def COPY_LOCATION(self, layout, con):
+       def COPY_LOCATION(self, context, layout, con):
                self.target_template(layout, con)
                
                split = layout.split()
@@ -302,7 +328,7 @@
                        
                self.space_template(layout, con)
                
-       def COPY_SCALE(self, layout, con):
+       def COPY_SCALE(self, context, layout, con):
                self.target_template(layout, con)
                
                row = layout.row(align=True)
@@ -314,9 +340,9 @@
                
                self.space_template(layout, con)
                
-       #def SCRIPT(self, layout, con):
+       #def SCRIPT(self, context, layout, con):
        
-       def ACTION(self, layout, con):
+       def ACTION(self, context, layout, con):
                self.target_template(layout, con)
                
                layout.itemR(con, "action")
@@ -336,7 +362,7 @@
                row.itemL(text="Convert:")
                row.itemR(con, "owner_space", text="")
        
-       def LOCKED_TRACK(self, layout, con):
+       def LOCKED_TRACK(self, context, layout, con):
                self.target_template(layout, con)
                
                row = layout.row()
@@ -347,7 +373,7 @@
                row.itemL(text="Lock:")
                row.itemR(con, "locked", expand=True)
                
-       def LIMIT_DISTANCE(self, layout, con):
+       def LIMIT_DISTANCE(self, context, layout, con):
                self.target_template(layout, con)
                
                col = layout.column(align=True);
@@ -358,7 +384,7 @@
                row.itemL(text="Clamp Region:")
                row.itemR(con, "limit_mode", text="")
                
-       def STRETCH_TO(self, layout, con):
+       def STRETCH_TO(self, context, layout, con):
                self.target_template(layout, con)
                
                col = layout.column(align=True)
@@ -374,7 +400,7 @@
                row.itemL(text="Plane:")
                row.itemR(con, "keep_axis", expand=True)
                
-       def FLOOR(self, layout, con):
+       def FLOOR(self, context, layout, con):
                self.target_template(layout, con)
                
                row = layout.row()
@@ -387,7 +413,7 @@
                row.itemL(text="Min/Max:")
                row.itemR(con, "floor_location", expand=True)
                
-       def RIGID_BODY_JOINT(self, layout, con):
+       def RIGID_BODY_JOINT(self, context, layout, con):
                self.target_template(layout, con)
                
                layout.itemR(con, "pivot_type")
@@ -411,7 +437,7 @@
                
                #Missing: Limit arrays (not wrapped in RNA yet) 
        
-       def CLAMP_TO(self, layout, con):
+       def CLAMP_TO(self, context, layout, con):
                self.target_template(layout, con)
                
                row = layout.row()
@@ -421,7 +447,7 @@
                row = layout.row()
                row.itemR(con, "cyclic")
                
-       def TRANSFORM(self, layout, con):
+       def TRANSFORM(self, context, layout, con):
                self.target_template(layout, con)
                
                layout.itemR(con, "extrapolate_motion", text="Extrapolate")
@@ -470,7 +496,7 @@
                
                self.space_template(layout, con)
                
-       def SHRINKWRAP (self, layout, con):
+       def SHRINKWRAP (self, context, layout, con):
                self.target_template(layout, con)
                
                layout.itemR(con, "distance")
@@ -498,7 +524,7 @@
                row.itemL();
 
                for con in ob.constraints:
-                       self.draw_constraint(con)
+                       self.draw_constraint(context, con)
 
 class BONE_PT_constraints(ConstraintButtonsPanel):
        __label__ = "Constraints"
@@ -519,7 +545,7 @@
                row.itemL();
 
                for con in pchan.constraints:
-                       self.draw_constraint(con)
+                       self.draw_constraint(context, con)
 
 bpy.types.register(OBJECT_PT_constraints)
 bpy.types.register(BONE_PT_constraints)

Modified: branches/itasc/source/blender/blenkernel/intern/constraint.c
===================================================================
--- branches/itasc/source/blender/blenkernel/intern/constraint.c        
2009-08-11 18:19:09 UTC (rev 22379)
+++ branches/itasc/source/blender/blenkernel/intern/constraint.c        
2009-08-11 18:37:48 UTC (rev 22380)
@@ -1033,6 +1033,7 @@
        data->weight= (float)1.0;
        data->orientweight= (float)1.0;
        data->iterations = 500;
+       data->dist= (float)1.0;
        data->flag= CONSTRAINT_IK_TIP|CONSTRAINT_IK_STRETCH|CONSTRAINT_IK_POS;
 }
 

Modified: branches/itasc/source/blender/editors/include/ED_object.h
===================================================================
--- branches/itasc/source/blender/editors/include/ED_object.h   2009-08-11 
18:19:09 UTC (rev 22379)
+++ branches/itasc/source/blender/editors/include/ED_object.h   2009-08-11 
18:37:48 UTC (rev 22380)
@@ -84,6 +84,8 @@
 
 void ED_object_constraint_rename(struct Object *ob, struct bConstraint *con, 
char *oldname);
 void ED_object_constraint_set_active(struct Object *ob, struct bConstraint 
*con);
+void ED_object_constraint_update(struct Scene *scene, struct Object *ob);
+void ED_object_constraint_dependency_update(struct Scene *scene, struct Object 
*ob);
 
 /* editlattice.c */
 void mouse_lattice(struct bContext *C, short mval[2], int extend);

Modified: branches/itasc/source/blender/editors/object/editconstraint.c
===================================================================
--- branches/itasc/source/blender/editors/object/editconstraint.c       
2009-08-11 18:19:09 UTC (rev 22379)

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to