Commit: 38d93016746cc498f7b52ad1547de1548e3d1556
Author: Lukas Tönne
Date:   Tue May 5 14:27:44 2015 +0200
Branches: strand_editmode
https://developer.blender.org/rB38d93016746cc498f7b52ad1547de1548e3d1556

Another fix for mirror editing of strand data.

Currently strand edit mode tool use the object data 'x mirror' flag.
This flag is only available on mesh objects, but the strand editing
can be used for dupli override caches etc. as well. Eventually strand
editing should get it's own independent flag to avoid this problem.

===================================================================

M       release/scripts/startup/bl_ui/space_view3d_toolbar.py
M       source/blender/editors/hair/hair_stroke.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0c2e1d1..8a27d71 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1879,8 +1879,9 @@ class VIEW3D_PT_tools_hairmode(View3DPanel, Panel):
         settings = context.tool_settings.hair_edit
         ob = context.active_object
 
-        col = layout.column(align=True)
-        col.prop(ob.data, "use_mirror_x")
+        if ob.data:
+            col = layout.column(align=True)
+            col.prop(ob.data, "use_mirror_x")
 
 
 # Grease Pencil drawing tools
diff --git a/source/blender/editors/hair/hair_stroke.c 
b/source/blender/editors/hair/hair_stroke.c
index 76b63e8..38c1b86 100644
--- a/source/blender/editors/hair/hair_stroke.c
+++ b/source/blender/editors/hair/hair_stroke.c
@@ -264,6 +264,7 @@ static int hair_tool_apply_strand_edges(HairToolData *data, 
EdgeToolCb cb, void
        const float rad = BKE_brush_size_get(scene, brush);
        const float radsq = rad*rad;
        const float threshold = 0.0f; /* XXX could be useful, is it needed? */
+       const bool use_mirror = hair_use_mirror_x(data->ob);
        
        BMVert *v, *vprev, *v_mirr, *vprev_mirr;
        BMIter iter;
@@ -280,9 +281,11 @@ static int hair_tool_apply_strand_edges(HairToolData 
*data, EdgeToolCb cb, void
                                        cb(data, userdata, vprev, v, factor, 
lambda);
                                        ++tot;
                                        
-                                       v_mirr = 
ED_strands_mirror_get(data->edit, v);
-                                       if (vprev_mirr && v_mirr)
-                                               cb(data, userdata, vprev_mirr, 
v_mirr, factor, lambda);
+                                       if (use_mirror) {
+                                               v_mirr = 
ED_strands_mirror_get(data->edit, v);
+                                               if (vprev_mirr && v_mirr)
+                                                       cb(data, userdata, 
vprev_mirr, v_mirr, factor, lambda);
+                                       }
                                }
                        }
                }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to