[Bf-blender-cvs] [b29a6f1] temp_hair_flow: New `mode` enum for hair edit mode to toggle between direct mesh-style editing and flow solver editing.

Lukas Tönne noreply at git.blender.org
Wed Jan 7 19:37:36 CET 2015


Commit: b29a6f1c5b4badd4dfe8c50b6925e7e18fdf350f
Author: Lukas Tönne
Date:   Tue Jan 6 13:50:29 2015 +0100
Branches: temp_hair_flow
https://developer.blender.org/rBb29a6f1c5b4badd4dfe8c50b6925e7e18fdf350f

New `mode` enum for hair edit mode to toggle between direct mesh-style
editing and flow solver editing.

The flow mode could be used to disable mesh vertex drawing and operators
and instead enable automatic recalculation of the hair flow field and
sampling strands.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 1374bf9..cd6400c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -51,7 +51,10 @@ class VIEW3D_HT_header(Header):
             if mode == 'PARTICLE_EDIT':
                 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
             elif mode == 'HAIR_EDIT':
-                row.prop(toolsettings.hair_edit, "select_mode", text="", expand=True)
+                hair_edit = toolsettings.hair_edit
+                row.prop(hair_edit, "mode", text="")
+                if hair_edit.mode == 'MESH':
+                    row.prop(toolsettings.hair_edit, "select_mode", text="", expand=True)
 
             # Occlude geometry
             if ((view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
@@ -162,8 +165,12 @@ class VIEW3D_MT_editor_menus(Menu):
         elif obj:
             if mode_string not in {'PAINT_TEXTURE'}:
                 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
-            if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE', 'HAIR'}:
+            if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
                 layout.menu("VIEW3D_MT_brush")
+            if mode_string == 'HAIR':
+                hair_edit = context.tool_settings.hair_edit
+                if hair_edit.mode == 'MESH':
+                    layout.menu("VIEW3D_MT_brush")
             if mode_string == 'SCULPT':
                 layout.menu("VIEW3D_MT_hide_mask")
         else:
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 890fb50..b2cc043 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -889,6 +889,11 @@ typedef struct ParticleEditSettings {
 /* ------------------------------------------- */
 /* Hair Edit */
 
+typedef enum HairEditMode {
+	HAIR_EDIT_MESH      = 0, /* use mesh-based editing */
+	HAIR_EDIT_FLOW      = 1, /* use flow field construction */
+} HairEditMode;
+
 /* HairEditSettings->select_mode */
 typedef enum HairEditSelectMode {
 	HAIR_SELECT_STRAND  = 0,
@@ -903,7 +908,9 @@ typedef enum HairEditFlag {
 
 typedef struct HairEditSettings {
 	int flag;
+	int mode;
 	int select_mode;
+	int pad;
 	
 	struct Brush *brush;
 	struct Object *shape_object;
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 4e31045..e22e073 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -993,8 +993,14 @@ static void rna_def_hair_edit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
+	static EnumPropertyItem mode_items[] = {
+		{HAIR_EDIT_MESH, "MESH", ICON_MESH_DATA, "Mesh", "Strand edit mode"},
+		{HAIR_EDIT_FLOW, "FLOW", ICON_SURFACE_DATA, "Flow", "Flow edit mode"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	static EnumPropertyItem select_mode_items[] = {
-		{HAIR_SELECT_STRAND, "STRAND", ICON_PARTICLE_PATH, "Strand", "Strand edit mode"},
+		{HAIR_SELECT_STRAND, "STRAND", ICON_PARTICLE_PATH, "Strand", "Strand select mode"},
 		{HAIR_SELECT_VERTEX, "VERTEX", ICON_PARTICLE_POINT, "Vertex", "Vertex select mode"},
 		{HAIR_SELECT_TIP, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
 		{0, NULL, 0, NULL, NULL}
@@ -1011,6 +1017,12 @@ static void rna_def_hair_edit(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Brush", "Active Brush");
 	RNA_def_property_update(prop, 0, "rna_HairEdit_brush_update");
 
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
+	RNA_def_property_enum_items(prop, mode_items);
+	RNA_def_property_ui_text(prop, "Mode", "Hair editing mode");
+	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update");
+
 	prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "select_mode");
 	RNA_def_property_enum_items(prop, select_mode_items);




More information about the Bf-blender-cvs mailing list