[Bf-blender-cvs] [89713f0] strand_nodes: Hair edit tool settings for enabling and controlling deflection.
Lukas Tönne
noreply at git.blender.org
Sun Aug 7 10:39:41 CEST 2016
Commit: 89713f09f4cd85a91524ee1783d98885dc8c239e
Author: Lukas Tönne
Date: Fri Jul 29 08:29:01 2016 +0200
Branches: strand_nodes
https://developer.blender.org/rB89713f09f4cd85a91524ee1783d98885dc8c239e
Hair edit tool settings for enabling and controlling deflection.
Unused settings, deflection is not yet implemented.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/intern/scene.c
M source/blender/blenloader/intern/readfile.c
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_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 2f49f1a..ca70660 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1964,11 +1964,11 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel):
sub.prop(pe, "fade_frames", slider=True)
-class VIEW3D_PT_tools_hairmode(View3DPanel, Panel):
+class VIEW3D_PT_hairmode_tools(View3DPanel, Panel):
"""Tools for hair mode"""
bl_context = "hairmode"
bl_label = "Options"
- bl_category = "Tools"
+ bl_category = "Options"
def draw(self, context):
layout = self.layout
@@ -1976,11 +1976,53 @@ class VIEW3D_PT_tools_hairmode(View3DPanel, Panel):
settings = context.tool_settings.hair_edit
ob = context.active_object
+ col = layout.column(align=True)
if ob.data:
- col = layout.column(align=True)
col.prop(ob.data, "use_mirror_x")
+class VIEW3D_PT_hairmode_deflect(View3DPanel, Panel):
+ """Deflection settings for hair mode"""
+ bl_context = "hairmode"
+ bl_label = "Deflect"
+ bl_category = "Options"
+
+ def draw_header(self, context):
+ settings = context.tool_settings.hair_edit
+ self.layout.prop(settings, "use_deflect", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings.hair_edit
+ ob = context.active_object
+
+ layout.active = settings.use_deflect
+
+ col = layout.column(align=True)
+ col.prop(settings, "use_deflect_scalp")
+ col.prop(settings, "deflect_group")
+
+
+class VIEW3D_PT_hairmode_debug(View3DPanel, Panel):
+ """Debug visualization for hair mode"""
+ bl_context = "hairmode"
+ bl_label = "Debug"
+ bl_category = "Options"
+
+ def draw_header(self, context):
+ settings = context.tool_settings.hair_edit
+ self.layout.prop(settings, "show_debug", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings.hair_edit
+ ob = context.active_object
+
+ layout.active = settings.show_debug
+
+
# Grease Pencil drawing tools
class VIEW3D_PT_tools_grease_pencil_draw(GreasePencilDrawingToolsPanel, Panel):
bl_space_type = 'VIEW_3D'
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 3e37ee8..1c8827e 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -649,6 +649,9 @@ void BKE_scene_init(Scene *sce)
}
pset->brush[PE_BRUSH_CUT].strength = 1.0f;
+ HairEditSettings *hair_settings = &sce->toolsettings->hair_edit;
+ hair_settings->flag |= HAIR_EDIT_SHOW_BRUSH | HAIR_EDIT_USE_DEFLECT | HAIR_EDIT_DEFLECT_SCALP;
+
sce->r.ffcodecdata.audio_mixrate = 48000;
sce->r.ffcodecdata.audio_volume = 1.0f;
sce->r.ffcodecdata.audio_bitrate = 192;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 92e8c28..31ca0aa 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5645,6 +5645,8 @@ static void lib_link_scene(FileData *fd, Main *main)
hair_edit->brush = newlibadr(fd, sce->id.lib, hair_edit->brush);
if (hair_edit->shape_object)
hair_edit->shape_object = newlibadr(fd, sce->id.lib, hair_edit->shape_object);
+ if (hair_edit->deflect_group)
+ hair_edit->deflect_group = newlibadr(fd, sce->id.lib, hair_edit->deflect_group);
}
for (base = sce->base.first; base; base = next) {
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 64f4a0a..97b64e2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1054,6 +1054,8 @@ typedef enum HairEditSelectMode {
/* HairEditSettings->flag */
typedef enum HairEditFlag {
HAIR_EDIT_SHOW_BRUSH = (1 << 0),
+ HAIR_EDIT_USE_DEFLECT = (1 << 8),
+ HAIR_EDIT_DEFLECT_SCALP = (1 << 9),
HAIR_EDIT_SHOW_DEBUG = (1 << 16),
} HairEditFlag;
@@ -1066,6 +1068,8 @@ typedef struct HairEditSettings {
/* WM Paint cursor */
void *paint_cursor;
+
+ struct Group *deflect_group;
} HairEditSettings;
/* ------------------------------------------- */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index b16e0e5..e2cfd3a 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -407,7 +407,7 @@ static char *rna_HairEdit_path(PointerRNA *UNUSED(ptr))
return BLI_strdup("tool_settings.hair_edit");
}
-static void rna_HairEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+static void UNUSED_FUNCTION(rna_HairEdit_update)(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Object *ob = OBACT;
@@ -1114,12 +1114,32 @@ static void rna_def_hair_edit(BlenderRNA *brna)
RNA_def_property_enum_bitflag_sdna(prop, NULL, "select_mode");
RNA_def_property_enum_items(prop, select_mode_items);
RNA_def_property_ui_text(prop, "Selection Mode", "Hair selection mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_HairEdit_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_deflect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", HAIR_EDIT_USE_DEFLECT);
+ RNA_def_property_ui_text(prop, "Deflect", "Enable deflection of hair");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_deflect_scalp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", HAIR_EDIT_DEFLECT_SCALP);
+ RNA_def_property_ui_text(prop, "Deflect", "Enable deflection from the scalp mesh");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "deflect_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Deflect Group", "Collision group for deflecting hair");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "show_debug", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", HAIR_EDIT_SHOW_DEBUG);
+ RNA_def_property_ui_text(prop, "Show Debug", "Enable debugging visualization");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
void RNA_def_sculpt_paint(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list