Page MenuHome

Allow pinned gpencil materials to be changed from the topbar.
Needs ReviewPublic

Authored by matc (matc) on Apr 10 2019, 11:11 PM.

Details

Summary

Allowing pinned materials to be changed from the topbar. We previously disabled this, as there was no reasonable way to have the object material slot selector and the brush material property not looking entirely differently.

I changed uiTemplateList to be able to work with active pointer and index. This allows to display bpy.data.materials while highlighting the brush material. When a item in the list gets selected but->funcN will set the value of but->rnaprop (active property) to but->func_argN (represented item). For lists with active index everything is working as before.

Unpinned

Pinned

Diff Detail

Repository
rB Blender

Event Timeline

matc (matc) created this revision.Apr 10 2019, 11:11 PM

Updated the api documentation to reflect the changes.

I'm still not a big fan of using different formats for Material list when pinned, and this patch uses different UI layouts.

Also, change uiTemplateList is something that can affect whole Blender UI, so you need the opinion of @Brecht Van Lommel (brecht), and maybe @Bastien Montagne (mont29) . Not sure it worth change this template only for this small UI problem... really, the user only need unpin and select new material, not a big deal.

It just feels weird, having a brush setting that allows you to change the active object material but not its own material.

I'm still not a big fan of using different formats for Material list when pinned, and this patch uses different UI layouts.

It should be pretty easy to remove or show and disable the extra buttons in each case.

Also, change uiTemplateList is something that can affect whole Blender UI, so you need the opinion of @Brecht Van Lommel (brecht), and maybe @Bastien Montagne (mont29) . Not sure it worth change this template only for this small UI problem... really, the user only need unpin and select new material, not a big deal.

Previously uiTemplateList refused to work with active properties that weren't of PROP_INT type. Every change in logic in uiTemplateList is dependent on the active property type.

Problems I see, are

  1. The rename functionality (which is not working in popover) would have to be optional (tooltip should be over-writable).
  2. That there is no warning for incompatible properties (for example listing bpy.data.objects but highlighting a material). Currently this results in an empty list, and is depending on the poll method of the active property. I don't think there is a way change this though.
source/blender/editors/interface/interface.c
1773

Highlighting the active item is the only change not directly guarded by the active property type. But UI_BTYPE_LISTROW is only used in uiTemplateList, which makes it guarded as well.

Unless the grease pencil team thinks this is important issue to solve, I'd rather not add this additional complexity to the code.