[Bf-blender-cvs] [09072775437] hair_object: Hair selection mode enum for specifying what part of hair data tools should work on.

Lukas Tönne noreply at git.blender.org
Sun Sep 23 15:14:22 CEST 2018


Commit: 090727754373a824f2c26c66dae21aafb4a80c15
Author: Lukas Tönne
Date:   Sun Sep 23 10:35:14 2018 +0100
Branches: hair_object
https://developer.blender.org/rB090727754373a824f2c26c66dae21aafb4a80c15

Hair selection mode enum for specifying what part of hair data tools should work on.

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

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 d4ba7b44563..792471983b4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -63,6 +63,7 @@ class VIEW3D_HT_header(Header):
             # Hair edit
             if object_mode == 'EDIT' and obj.type == 'HAIR':
                 row = layout.row()
+                row.prop(tool_settings.hair_edit_settings, "select_mode", text="")
                 row.prop(tool_settings.hair_edit_settings, "follicle_draw_mode", text="")
 
             # Occlude geometry
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c136056649f..76bb8ca61f9 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -875,6 +875,12 @@ typedef struct ParticleEditSettings {
 //typedef enum HairEditFlags {
 //} HairEditFlags;
 
+typedef enum HairEditSelectMode {
+	HAIR_SELECT_FOLLICLES,
+	HAIR_SELECT_VERTICES,
+	HAIR_SELECT_TIPS,
+} HairEditSelectMode;
+
 typedef enum HairEditFollicleDrawMode {
 	HAIR_FOLLICLE_DRAW_NONE,
 	HAIR_FOLLICLE_DRAW_POINT,
@@ -885,8 +891,8 @@ typedef enum HairEditFollicleDrawMode {
 /* Hair Edit Mode Settings */
 typedef struct HairEditSettings {
 	int flag;
+	short select_mode;
 	short follicle_draw_mode;
-	short pad;
 } HairEditSettings;
 
 /* ------------------------------------------- */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index cbc5d09a024..976827a7a70 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1121,6 +1121,13 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
+	static const EnumPropertyItem select_mode_items[] = {
+	    {HAIR_SELECT_FOLLICLES, "FOLLICLES", ICON_NONE, "Follicles", "Select hair follicles"},
+	    {HAIR_SELECT_VERTICES, "VERTICES", ICON_NONE, "Vertices", "Select hair curve vertices"},
+	    {HAIR_SELECT_TIPS, "TIPS", ICON_NONE, "Tips", "Select only last vertices of hair curves"},
+	    {0, NULL, 0, NULL, NULL}
+	};
+
 	static const EnumPropertyItem follicle_draw_mode_items[] = {
 	    {HAIR_FOLLICLE_DRAW_NONE, "NONE", ICON_NONE, "None", "Don't draw hair follicles"},
 	    {HAIR_FOLLICLE_DRAW_POINT, "POINT", ICON_NONE, "Point", "Draw point on follicle location"},
@@ -1133,6 +1140,14 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
 	RNA_def_struct_path_func(srna, "rna_HairEditSettings_path");
 	RNA_def_struct_ui_text(srna, "Hair Edit", "Properties of hair editing mode");
 
+	prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "select_mode");
+	RNA_def_property_enum_items(prop, select_mode_items);
+	RNA_def_property_ui_text(prop, "Selection Mode", "Mode of selecting editable hair points");
+	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_HairEditSettings_update");
+
 	prop = RNA_def_property(srna, "follicle_draw_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "follicle_draw_mode");
 	RNA_def_property_enum_items(prop, follicle_draw_mode_items);



More information about the Bf-blender-cvs mailing list