Outcome
Show Blender’s editable X, Y, and Z dimensions in a PME layout, with a useful fallback when no object is active:
L.prop(C.object, "dimensions", text="") if C.object else L.label(text="Select an object")The fields use Blender’s normal unit display and edit the active object’s standard dimensions property.
Steps
-
Open a Pie Menu or Popup Dialog in PME.
-
Add an item and set it to Custom.
-
Enter the guarded expression:
L.prop(C.object, "dimensions", text="") if C.object else L.label(text="Select an object") -
Apply the item.
-
Select an object and open the PME menu. The item displays the object’s X, Y, and Z dimensions; edit a field to use it like Blender’s native control.
For a compact aligned row with a little more horizontal room:
row = L.row(align=True); row.scale_x = 0.8; row.prop(C.object, "dimensions", text="") if C.object else row.label(text="Select an object")The 2021 discussion used PME’s old Interactive Menus workflow to extend an existing Blender menu. In PME 2.1, place the Custom-layout expression directly in a menu.
Pitfalls
- Keep the
if C.objectguard. A Pie Menu can be opened with no active object, andL.prop()requires a real Blender data owner. - Use a Custom item because
Lsupplies PME’sUILayoutobject for drawing controls. C.objectmeans the active object in the invocation context, so the expression draws one dimensions row for that object.- Blender defines
Object.dimensionsas the object’s absolute bounding-box dimensions rather than raw mesh vertex extents. - Editing dimensions changes Blender’s object property. Constraints, evaluated geometry, and object transforms can affect the resulting size.
- Very narrow pie slots may compress the three fields. Use a Popup Dialog, shorten the label, or give the row more space when readability matters.
Related
- Label enum buttons in a Custom layout
- Make a Property Editor slider
- Add a complex Blender widget to a PME Popup Dialog