Revision: 37474
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37474
Author:   aligorith
Date:     2011-06-14 11:01:36 +0000 (Tue, 14 Jun 2011)
Log Message:
-----------
Bugfix: Distance DVar doesn't work with new Local Space

Fixed references in UI to the old property, and adapted the backend
code to work for the new options too.

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/blenkernel/intern/fcurve.c
    branches/soc-2011-pepper/source/blender/editors/space_graph/graph_buttons.c

Modified: branches/soc-2011-pepper/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/soc-2011-pepper/source/blender/blenkernel/intern/fcurve.c  
2011-06-14 09:55:38 UTC (rev 37473)
+++ branches/soc-2011-pepper/source/blender/blenkernel/intern/fcurve.c  
2011-06-14 11:01:36 UTC (rev 37474)
@@ -1153,26 +1153,51 @@
                /* check if object or bone */
                if (pchan) {
                        /* bone */
-                       if ((dtar->flag & DTAR_FLAG_LOCALSPACE) == 0) {
+                       if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
+                               if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
+                                       float mat[4][4];
+                                       
+                                       /* extract transform just like how the 
constraints do it! */
+                                       copy_m4_m4(mat, pchan->pose_mat);
+                                       constraint_mat_convertspace(ob, pchan, 
mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
+                                       
+                                       /* ... and from that, we get our 
transform */
+                                       VECCOPY(tmp_loc, mat[3]);
+                               }
+                               else {
+                                       /* transform space (use transform 
values directly) */
+                                       VECCOPY(tmp_loc, pchan->loc);
+                               }
+                       }
+                       else {
                                /* convert to worldspace */
                                VECCOPY(tmp_loc, pchan->pose_head);
                                mul_m4_v3(ob->obmat, tmp_loc);
                        }
-                       else {
-                               /* local (use transform values directly) */
-                               VECCOPY(tmp_loc, pchan->loc);
-                       }
                }
                else {
                        /* object */
-                       if ((dtar->flag & DTAR_FLAG_LOCALSPACE) == 0) {
+                       if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
+                               if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
+                                       // XXX: this should practically be the 
same as transform space...
+                                       float mat[4][4];
+                                       
+                                       /* extract transform just like how the 
constraints do it! */
+                                       copy_m4_m4(mat, ob->obmat);
+                                       constraint_mat_convertspace(ob, NULL, 
mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL);
+                                       
+                                       /* ... and from that, we get our 
transform */
+                                       VECCOPY(tmp_loc, mat[3]);
+                               }
+                               else {
+                                       /* transform space (use transform 
values directly) */
+                                       VECCOPY(tmp_loc, ob->loc);
+                               }
+                       }
+                       else {
                                /* worldspace */
                                VECCOPY(tmp_loc, ob->obmat[3]); 
                        }
-                       else {
-                               /* local (use transform values directly) */
-                               VECCOPY(tmp_loc, ob->loc);
-                       }
                }
                
                /* copy the location to the right place */

Modified: 
branches/soc-2011-pepper/source/blender/editors/space_graph/graph_buttons.c
===================================================================
--- branches/soc-2011-pepper/source/blender/editors/space_graph/graph_buttons.c 
2011-06-14 09:55:38 UTC (rev 37473)
+++ branches/soc-2011-pepper/source/blender/editors/space_graph/graph_buttons.c 
2011-06-14 11:01:36 UTC (rev 37474)
@@ -472,7 +472,7 @@
                        uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, 
"bones", "", ICON_BONE_DATA);
                }
                
-               uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 
ICON_NONE);
+               uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
        
        col= uiLayoutColumn(layout, 1);
                uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:");
@@ -484,7 +484,7 @@
                        uiItemPointerR(col, &dtar2_ptr, "bone_target", 
&tar_ptr, "bones", "", ICON_BONE_DATA);
                }
                
-               uiItemR(col, &dtar2_ptr, "use_local_space_transform", 0, NULL, 
ICON_NONE);
+               uiItemR(col, &dtar2_ptr, "transform_space", 0, NULL, ICON_NONE);
 }
 
 /* settings for 'transform channel' driver variable type */

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

Reply via email to