diff options
author | Antonioya <blendergit@gmail.com> | 2019-03-25 19:02:42 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-03-25 19:06:07 +0300 |
commit | 7021bd527380b4d87cf48057f0039509326b03dd (patch) | |
tree | 55126437da17d736a789d236c8a98d199a1e6260 /source/blender/makesrna/intern/rna_object.c | |
parent | 84240ebb3ebde58f6bfba256e49d37697fb6bc9f (diff) |
GPencil: Only brushes with pinned materials have materials
Using GP_BRUSH_MATERIAL_PINNED to switch between active material and brush material, instead of updating all brushes on active material changes. This will allow brushes to have no material and therefore to not inflate the user count.
This fix T62465.
Patch contributed by @matc
Reviewers: @brecht @antoniov @billreynish @mendio
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 53bcb7e0bca..0eaddf0c44e 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -277,14 +277,10 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA static void rna_MaterialIndex_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { - /* update the material of all brushes not pinned */ Object *ob = (Object *)ptr->id.data; if (ob && ob->type == OB_GPENCIL) { - Material *ma = give_current_material(ob, ob->actcol); - if (ma != NULL) { - BKE_brush_update_material(bmain, ma, NULL); - WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL); - } + /* notifying material property in topbar */ + WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL); } } @@ -821,6 +817,11 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) BLI_assert(BKE_id_is_in_global_main(&ob->id)); BLI_assert(BKE_id_is_in_global_main(value.data)); assign_material(G_MAIN, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING); + + if (ob && ob->type == OB_GPENCIL) { + /* notifying material property in topbar */ + WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL); + } } static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info)) |