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:
authorCampbell Barton <ideasman42@gmail.com>2018-08-02 10:41:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-02 12:27:26 +0300
commit3a93314753cabe176bde1cdb084afa551323321b (patch)
tree1baa4080f94673450a1a744c42b23f5caad5b5f8 /source/blender/makesrna/intern/rna_workspace_api.c
parentd79df6c0bc65e4c94a6fd24160445b98eb408949 (diff)
Tool System: initial particle system support
Diffstat (limited to 'source/blender/makesrna/intern/rna_workspace_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 4469b88da6d..aac38d05cd8 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -84,14 +84,31 @@ static void rna_WorkspaceTool_refresh_from_context(
WorkSpace *workspace = WM_window_get_active_workspace(win);
if (&workspace->id == id) {
Scene *scene = WM_window_get_active_scene(win);
+ ToolSettings *ts = scene->toolsettings;
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Paint *paint = BKE_paint_get_active(scene, view_layer);
- if (paint) {
- const ID *brush = (ID *)paint->brush;
- if (!STREQ(tref_rt->data_block, brush->name + 2)) {
- STRNCPY(tref_rt->data_block, brush->name + 2);
- STRNCPY(tref->idname, brush->name + 2);
- printf("Found\n");
+ Object *ob = OBACT(view_layer);
+ if (ob == NULL) {
+ /* pass */
+ }
+ else if (ob->mode & OB_MODE_PARTICLE_EDIT) {
+ const EnumPropertyItem *items = rna_enum_particle_edit_hair_brush_items;
+ const int i = RNA_enum_from_value(items, ts->particle.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 {
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
+ if (paint) {
+ const ID *brush = (ID *)paint->brush;
+ if (brush) {
+ if (!STREQ(tref_rt->data_block, brush->name + 2)) {
+ STRNCPY(tref_rt->data_block, brush->name + 2);
+ STRNCPY(tref->idname, brush->name + 2);
+ }
+ }
}
}
}