Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@gmail.com>2018-12-20 16:29:01 +0300
committerLukas Toenne <lukas.toenne@gmail.com>2018-12-20 16:29:01 +0300
commit96e40fef46b923625c419bf2aa687c8bd25260da (patch)
treeeaa4dd5766794994484839d0b3c5f3640fc8e3ea
parentcb7d8a4a0f40603c7e98ff70d488edca41c38fef (diff)
Fix tool system integration of hair edit brushes.hair_object
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c12
-rw-r--r--source/blender/windowmanager/intern/wm_toolsystem.c30
3 files changed, 37 insertions, 6 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index f2eaa9d075f..735dca17822 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -128,6 +128,7 @@ extern const EnumPropertyItem rna_enum_brush_image_tool_items[];
extern const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[];
extern const EnumPropertyItem rna_enum_particle_edit_disconnected_hair_brush_items[];
+extern const EnumPropertyItem rna_enum_hair_edit_brush_items[];
extern const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[];
extern const EnumPropertyItem rna_enum_gpencil_weight_brush_items[];
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 08248d8542a..f19a30d66a3 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -65,6 +65,11 @@ const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = {
{0, NULL, 0, NULL, NULL}
};
+const EnumPropertyItem rna_enum_hair_edit_brush_items[] = {
+ {HAIR_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
+ {0, NULL, 0, NULL, NULL}
+};
+
const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
{GP_SCULPT_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"},
{GP_SCULPT_TYPE_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", "Adjust thickness of strokes"},
@@ -1216,11 +1221,6 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static const EnumPropertyItem hair_brush_items[] = {
- {HAIR_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
- {0, NULL, 0, NULL, NULL}
- };
-
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"},
@@ -1242,7 +1242,7 @@ static void rna_def_hair_edit_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "brushtype");
- RNA_def_property_enum_items(prop, hair_brush_items);
+ RNA_def_property_enum_items(prop, rna_enum_hair_edit_brush_items);
RNA_def_property_ui_text(prop, "Tool", "");
prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/windowmanager/intern/wm_toolsystem.c b/source/blender/windowmanager/intern/wm_toolsystem.c
index ef8a57a1255..49d4b4e52cb 100644
--- a/source/blender/windowmanager/intern/wm_toolsystem.c
+++ b/source/blender/windowmanager/intern/wm_toolsystem.c
@@ -255,6 +255,23 @@ static void toolsystem_ref_link(bContext *C, WorkSpace *workspace, bToolRef *tre
}
}
}
+ else if ((tref->space_type == SPACE_VIEW3D) &&
+ (tref->mode == CTX_MODE_EDIT_HAIR))
+ {
+ const EnumPropertyItem *items = rna_enum_hair_edit_brush_items;
+ const int i = RNA_enum_from_identifier(items, tref_rt->data_block);
+ if (i != -1) {
+ const int value = items[i].value;
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ if (workspace == WM_window_get_active_workspace(win)) {
+ Scene *scene = WM_window_get_active_scene(win);
+ ToolSettings *ts = scene->toolsettings;
+ ts->hair_edit.brushtype = value;
+ }
+ }
+ }
+ }
else if ((tref->space_type == SPACE_IMAGE) &&
(tref->mode == SI_MODE_UV))
{
@@ -509,6 +526,19 @@ void WM_toolsystem_ref_sync_from_context(
}
}
}
+ else if ((tref->space_type == SPACE_VIEW3D) &&
+ (tref->mode == CTX_MODE_EDIT_HAIR))
+ {
+ if (ob->mode & OB_MODE_EDIT) {
+ const EnumPropertyItem *items = rna_enum_hair_edit_brush_items;
+ const int i = RNA_enum_from_value(items, ts->hair_edit.brushtype);
+ const EnumPropertyItem *item = &items[i];
+ if (!STREQ(tref_rt->data_block, item->identifier)) {
+ STRNCPY(tref_rt->data_block, item->identifier);
+ STRNCPY(tref->idname, item->name);
+ }
+ }
+ }
else if ((tref->space_type == SPACE_IMAGE) &&
(tref->mode == SI_MODE_UV))
{