diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-03-07 17:55:03 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-03-07 23:28:25 +0300 |
commit | 92d185faebeac60ec2591c2a7c0f870e7726593d (patch) | |
tree | 4e49a15d3c4e3f0c45cd9089fdf4567084b4e26e /source/blender/editors/space_buttons | |
parent | 81a09628c29d788affb0686e9ebdce7dc6a09d2d (diff) |
Properties Editor: Grease Pencil and pinning fixes
The UI was trying to use screen_context.c for its poll and draw
functions. So the active object and active object data and active layer
was used in the UI, instead of the context one.
Besides, for the material, the wrong context path was used altogether
when the active object was a greasepencil.
This would lead to all sort of pinning problems:
* A Mesh panel is pinned, but the active object is a grease pencil, the
grease pencil panels would show.
* If a Grease Pencil (data) panel is pinned, but the active object is not
the one pinned, nothing would show.
* Material panels and pinning were totally broken, showing the material
context for pinned mesh data panels even.
I also sanitized the name of the panels, their inheritance and poll
functions.
Reviewers: antoniov, brecht
Subscribers: billrey
Differential Revision: https://developer.blender.org/D4470
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/buttons_context.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 10c0a6f4a57..152442f8671 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -494,7 +494,6 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma wmWindow *window = CTX_wm_window(C); Scene *scene = WM_window_get_active_scene(window); ViewLayer *view_layer = WM_window_get_active_view_layer(window); - Object *ob = OBACT(view_layer); ID *id; int found; @@ -562,14 +561,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found = buttons_context_path_particle(path); break; case BCONTEXT_MATERIAL: - /* NOTE: Grease Pencil materials use different panels... */ - if (ob && ob->type == OB_GPENCIL) { - /* XXX: Why path_data? */ - found = buttons_context_path_data(path, -1); - } - else { - found = buttons_context_path_material(path); - } + found = buttons_context_path_material(path); break; case BCONTEXT_TEXTURE: found = buttons_context_path_texture(C, path, sbuts->texuser); @@ -708,7 +700,7 @@ const char *buttons_context_dir[] = { "texture", "texture_user", "texture_user_property", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable", "particle_settings", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", - "line_style", "collection", NULL, + "line_style", "collection", "gpencil", NULL, }; int buttons_context(const bContext *C, const char *member, bContextDataResult *result) @@ -981,6 +973,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_FreestyleLineStyle); return 1; } + else if (CTX_data_equals(member, "gpencil")) { + set_pointer_type(path, result, &RNA_GreasePencil); + return 1; + } else { return 0; /* not found */ } |