Page MenuHome

UI: Improve layout of custom property edit panel
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Oct 9 2021, 8:07 AM.

Details

Summary

This patch makes the layout of the custom property panel more coherent
with the rest of the property editor interface, makes it much less busy,
allows more space for the buttons for the actual properties, and simplifies
editing values of unsupported property types or long arrays.

  • Remove the box around each property-- the spacing and buttons make it clear they are separate.
  • Use an non-embossed X icon for deleting, more consistent and looks better, emphasizing the property value instead.
  • Use an "edit" icon instead of the text for the meta-data edit operator.
  • Increase the max array length for drawing the values directly to 8
  • Add an "Edit Property Value" operator for groups (dictionaries) or longer arrays
  • Replace the "Library Override" text with an icon. The text took up too much space and was and ugly.
  • Use a proper split factor, the same as the rest of the UI
BeforeAfter

A downside of one of the changes is that the value of unsupported types isn't directly visible anymore.
I think the change is still worth it, but maybe there is some way to mitigate that.

Diff Detail

Repository
rB Blender
Branch
custom-property-panel (branched from master)
Build Status
Buildable 17776
Build 17776: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Oct 9 2021, 8:07 AM
Hans Goudey (HooglyBoogly) created this revision.

Great work, there are some good changes to this UI! I do have some suggestions:

  1. Is it possible to add the animation decoration to the property values? I mean the icons on the right here:
  2. I know Blender doesn't really have any designated icons for editing something, but I feel the edit property button should use a different icon, since the current one is already associated with modifiers in Blender. I tried some icons, and in my opinion TOOL_SETTINGS and GREASEPENCIL would work a lot better.
Aaron Carlisle (Blendify) requested changes to this revision.Oct 9 2021, 8:14 PM

Seems you forgot to update calls to rna_prop_ui.draw

Python: Traceback (most recent call last):
  File "/home/aaron/Documents/projects/blender_foundation/blender/build_linux/bin/3.0/scripts/startup/bl_ui/space_view3d.py", line 6991, in draw
    rna_prop_ui.draw(self.layout, context, member, object, use_edit=False)
AttributeError: module 'rna_prop_ui' has no attribute 'draw'
This revision now requires changes to proceed.Oct 9 2021, 8:14 PM
Hans Goudey (HooglyBoogly) planned changes to this revision.Oct 9 2021, 8:44 PM

Ah, I tried to find where that function was used, but I missed those, I'll have to revert a couple of the changes I made. Thanks.

Nice tweaks! Not totally sold on removing the Library Override indicator, better check with @Bastien Montagne (mont29) as it must have been added for a reason? We can use the Library Override icon instead (DECORATE_LIBRARY_OVERRIDE).

Some suggestions:

  • Rename Add to New with a plus icon. To match other places where we have a big New operator in panels.
  • Separator between the New button and list.
  • Use PREFERENCES icon instead of MODIFIER_ON.
  • Do not align the values with the operator buttons. (since it makes sliders right-side not rounded)


Suggestions applied:

diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index dcd883be274..b0acb661741 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -176,7 +176,7 @@ class PropertyPanel:
         else:
             value_column.prop(rna_item, '["%s"]' % escape_identifier(key), text="")
 
-        operator_row = value_row.row(align=True)
+        operator_row = value_row.row()
 
         # Do not allow editing of overridden properties (we cannot use a poll function 
         # of the operators here since they's have no access to the specific property).
@@ -185,7 +185,8 @@ class PropertyPanel:
         if use_edit and is_rna:
             operator_row.label(text="API Defined")
         elif use_edit and not is_lib_override:
-                props = operator_row.operator("wm.properties_edit", text="", icon='MODIFIER_ON', emboss=False)
+                sub_row = operator_row.row(align=True)
+                props = operator_row.operator("wm.properties_edit", text="", icon='PREFERENCES', emboss=False)
                 props.data_path = context_member
                 props.property_name = key
                 props = operator_row.operator("wm.properties_remove", text="", icon='X', emboss=False)
@@ -214,9 +215,11 @@ class PropertyPanel:
         # TODO: Allow/support adding new custom props to overrides.
         if use_edit and not is_lib_override:
             row = layout.row()
-            props = row.operator("wm.properties_add", text="Add")
+            props = row.operator("wm.properties_add", text="New", icon="ADD")
             props.data_path = context_member
             del row
+        
+        layout.separator()
 
         show_developer_ui = context.preferences.view.show_developer_ui
         rna_properties = {prop.identifier for prop in rna_item.bl_rna.properties if prop.is_runtime} if items else None

Not necessarily layout, but a couple suggestions (perhaps a bit outside the scope of this patch).

  1. Clicking on New should open the edit dialog, preferably with the cursor in the Name field to start typing right away (similar to the Rename operator or Move to Collection)
  2. A button next to Edit and X, to reset the property to its default value.
  3. Just a thought: for the property name, have you tried to have a text field instead of a label? It'd make editing faster but more prone to renaming props by mistake.

Moving get_property_type and convert_custom_property_to_string into the wm module makes it seem these might be called by external functions (as if they are part of a public API).

I'd prefer these stay static methods, (removing the _ prefix as they're no longer private).


Accepting as I don't think an extra iteration from me is needed.

release/scripts/startup/bl_operators/wm.py
1351

Again, I take issue with term "unsupported" - as a user if you see something as "unsupported" this reads as if "It doesn't work" or "It' cant be done".

This is supported, albeit without a convenient interface.

Suggest text: "Python value for custom property types that can only be edited as a Python expression." - or similar.

... same for other uses of term "unsupported" in this patch.

Tested, certainly a huge improvement!

A downside of one of the changes is that the value of unsupported types isn't directly visible anymore.

I use unsupported types a lot, and I think this is not a big issue.

Keep in mind that custom properties are also drawn in the N panel, which is currently broken. (but it seems this is the same issue that Aaron pointed out)

Other than that, LGTM!

I did run into a couple little artifacts but I think those have nothing to do with this patch, but here they are anyways:

  • The last letter of "cloudrig_parameters" is a bit shy. But hey, who doesn't want to hide from the world every now and then: F11001227
  • When editing a massive piece of data(21200 characters), the text box gets very confused and doesn't scroll to where the cursor is. The cursor is allowed to step a few steps outside the box before disappearing: F11001717
    • Note that the old Edit popup's text field would be capped at 1024 characters and could result in loss of data if not careful, so the way in which it's broken with the patch is actually an improvement over the way in which it's broken in master.

RE override text, this was added to 'keep same space' as non-overridden cases, and also to explicitly differentiate (in the future) between locale customprops added to the override, from those coming from its linked reference. Am totally fine with using e.g. the grayed out override icon instead of the editing one, and also probably the grayed out cross?

Hans Goudey (HooglyBoogly) marked an inline comment as done.EditedOct 13 2021, 12:29 AM

Thanks for all of the testing and feedback!

Is it possible to add the animation decoration to the property values? I mean the icons on the right here:

Yeah, it's possible, but to me the three icon buttons on the right is just a bit too much.

Rename Add to New with a plus icon. To match other places where we have a big New operator in panels.

I'm not sure this is more common honestly, I feel like I've mostly seen "Add" without the icon in the past. I don't have a strong opinion though, so I added it.

Separator between the New button and list.

Sure, that looks good

Do not align the values with the operator buttons. (since it makes sliders right-side not rounded)

Good point!

The last letter of "cloudrig_parameters" is a bit shy. But hey, who doesn't want to hide from the world every now and then

I think that's a more general bug with the UI code from recent master-- I noticed the same thing in nodes.

Icons

Use PREFERENCES icon instead of MODIFIER_ON.

Hmm, I'm not sure about this one. We had discussed using the preferences icon for whenever something from Blender's preferences is exposed in the UI elsewhere, maybe it's best to save it for that?
The preferences icon is very white, and takes a lot of visual weight too.

I tried some icons, and in my opinion TOOL_SETTINGS and GREASEPENCIL would work a lot better.

Reusing icons like this is pretty awkward. I don't think there's any very convincing solution. I like the tool settings icon a bit better, but it's also a bit busy.
I think it's a little worse to borrow the icon from a data type like grease pencil, I'm not sure though.

I'm not thrilled with any of the options here really. Personally I prefer MODIFIER_ON because of its simplicity. but my opinion isn't that strong.

release/scripts/startup/bl_operators/wm.py
1351

Thanks, looks like I copied from a place that I missed changing on the last patch. I like your phrasing much better.

Hans Goudey (HooglyBoogly) marked an inline comment as done.
  • Merge branch 'master' into custom-property-panel
  • Various changes based on review comments
  • Make methods static again

Great work, there are some good changes to this UI! I do have some suggestions:

  1. Is it possible to add the animation decoration to the property values? I mean the icons on the right here:

@Hans Goudey (HooglyBoogly) is there a technical reason why decorators cannot be used here?

  1. I know Blender doesn't really have any designated icons for editing something, but I feel the edit property button should use a different icon, since the current one is already associated with modifiers in Blender. I tried some icons, and in my opinion TOOL_SETTINGS and GREASEPENCIL would work a lot better.

I agree a dedicated EDIT icon should be added however, I do not think that is a show stopper here. I we have a task somewhere to request new icons. A User Interface module member will know more here.


I am still getting this import error:

  File "/home/aaron/Documents/projects/blender_foundation/blender/build_linux/bin/3.0/scripts/addons/rigify/utils/bones.py", line 24, in <module>
    from rna_prop_ui import rna_idprop_ui_prop_get
ImportError: cannot import name 'rna_idprop_ui_prop_get' from 'rna_prop_ui' (/home/aaron/Documents/projects/blender_foundation/blender/build_linux/bin/3.0/scripts/modules/rna_prop_ui.py)

@Hans Goudey (HooglyBoogly) is there a technical reason why decorators cannot be used here?

I responded to that in my last comment:

Yeah, it's possible, but to me the three icon buttons on the right is just a bit too much.

In other words, I personally don't really want to add them in this patch since I'm not sure about it myself. Could be added later though if people wanted. Or if I was convinced otherwise now.

Thanks for the report about the import error.

I am still getting this import error:

  File "/home/aaron/Documents/projects/blender_foundation/blender/build_linux/bin/3.0/scripts/addons/rigify/utils/bones.py", line 24, in <module>
    from rna_prop_ui import rna_idprop_ui_prop_get
ImportError: cannot import name 'rna_idprop_ui_prop_get' from 'rna_prop_ui' (/home/aaron/Documents/projects/blender_foundation/blender/build_linux/bin/3.0/scripts/modules/rna_prop_ui.py)

It looks like arc is resetting submodules to commits from few months ago when you use arc diff, that import is not used in master.

This revision is now accepted and ready to land.Oct 17 2021, 6:31 AM