Unexpected space between enum in pie. #112302

Open
opened 2023-09-12 21:47:03 +02:00 by ugorek · 3 comments

System Information
Operating system: Windows-10-10.0.19045-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1650/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.23

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-21 14:48, hash: 7d9214d30f3d
Broken: version: 3.6.2, branch: blender-v3.6-release, commit date: 2023-08-16 16:43, hash: e53e55951e7a

Short description of error
Pie menu draws enum property in the column with expand=True, an incomprehensible space appears between the options.
2023-09-13_02.36.53.gif

Exact steps for others to reproduce the error

  1. Get GeometryNodeSampleCurve.
  2. Copy script and run.
import bpy

def DrawProp(col):
    col.scale_x = 2
    col.scale_y = 2
    nd = bpy.data.node_groups["Geometry Nodes"].nodes["Sample Curve"]
    col.prop(nd, 'data_type', text="")
    col.box()
    col.prop(nd, 'data_type', expand=True) # <-- here

class Op(bpy.types.Operator):
    bl_idname = 'node.aa_op'
    bl_label = "Aa"
    def execute(self, context):
        pass
    def draw(self, context):
        DrawProp(self.layout.column())
    def invoke(self, context, event):
        return context.window_manager.invoke_popup(self, width=128)
class Pie(bpy.types.Menu):
    bl_idname = 'AA_MT_pie'
    bl_label = "Aa"
    def draw(self, context):
        pie = self.layout.menu_pie()
        pie.column()
#        col = pie.column()
        col = pie.box().column()
        DrawProp(col)

list_classes = [Op, Pie]

for li in list_classes:
    bpy.utils.register_class(li)

if 1==1:
    bpy.ops.wm.call_menu_pie(name=Pie.bl_idname)
else:
    bpy.ops.node.aa_op('INVOKE_DEFAULT')
**System Information** Operating system: Windows-10-10.0.19045-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1650/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 536.23 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-21 14:48, hash: `7d9214d30f3d` Broken: version: 3.6.2, branch: blender-v3.6-release, commit date: 2023-08-16 16:43, hash: `e53e55951e7a` **Short description of error** Pie menu draws enum property in the column with `expand=True`, an incomprehensible space appears between the options. ![2023-09-13_02.36.53.gif](/attachments/81a39697-fca0-4964-80d7-697aa60aada4) **Exact steps for others to reproduce the error** 1. Get `GeometryNodeSampleCurve`. 2. Copy script and run. ```python import bpy def DrawProp(col): col.scale_x = 2 col.scale_y = 2 nd = bpy.data.node_groups["Geometry Nodes"].nodes["Sample Curve"] col.prop(nd, 'data_type', text="") col.box() col.prop(nd, 'data_type', expand=True) # <-- here class Op(bpy.types.Operator): bl_idname = 'node.aa_op' bl_label = "Aa" def execute(self, context): pass def draw(self, context): DrawProp(self.layout.column()) def invoke(self, context, event): return context.window_manager.invoke_popup(self, width=128) class Pie(bpy.types.Menu): bl_idname = 'AA_MT_pie' bl_label = "Aa" def draw(self, context): pie = self.layout.menu_pie() pie.column() # col = pie.column() col = pie.box().column() DrawProp(col) list_classes = [Op, Pie] for li in list_classes: bpy.utils.register_class(li) if 1==1: bpy.ops.wm.call_menu_pie(name=Pie.bl_idname) else: bpy.ops.node.aa_op('INVOKE_DEFAULT') ```
ugorek added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-09-12 21:47:03 +02:00

The complete enum has a few more items. See https://projects.blender.org/blender/blender/src/branch/main/source/blender/makesrna/intern/rna_attribute.cc#L32-L49

These items are filtered by rna_GeometryNodeAttributeType_type_with_socket_itemf.

However, the function RNA_property_enum_items_gettexted_all checks all items, and for non-existent ones "their names/identifiers nullptr'ed out". See https://projects.blender.org/blender/blender/blame/branch/main/source/blender/makesrna/intern/rna_access.cc#L1658-L1665

This has been the case since the Pie menus code was implemented in 028fd29eeb

But I don't understand the reasons.

@Psy-Fi doesn't appear to be active anymore :\

Needs Input from Developers....

The complete enum has a few more items. See https://projects.blender.org/blender/blender/src/branch/main/source/blender/makesrna/intern/rna_attribute.cc#L32-L49 These items are filtered by `rna_GeometryNodeAttributeType_type_with_socket_itemf`. However, the function `RNA_property_enum_items_gettexted_all` checks all items, and for non-existent ones "their names/identifiers nullptr'ed out". See https://projects.blender.org/blender/blender/blame/branch/main/source/blender/makesrna/intern/rna_access.cc#L1658-L1665 This has been the case since the Pie menus code was implemented in 028fd29eeb092b6ed0625ed4d59b8100ae69596f But I don't understand the reasons. @Psy-Fi doesn't appear to be active anymore :\ Needs Input from Developers....

Hi Germano

It's been a few years, but if I remember correctly, the idea was that pie menus had a strict placement on the pie at the time depending on their order of appearance, and if you skipped any of them, the remaining items would appear in the wrong place.

This is a horrible hack and we can go and whip my past self together as soon as a time machine is invented. I think it makes sense instead for users to pass the placement they wish for along with the item/operator etc, but that will require some python API changes.

I have not kept up with how things are done in blender but if there's a process to deprecate those APIs it would be a good idea to use them and get rid of it.

Hi Germano It's been a few years, but if I remember correctly, the idea was that pie menus had a strict placement on the pie at the time depending on their order of appearance, and if you skipped any of them, the remaining items would appear in the wrong place. This is a horrible hack and we can go and whip my past self together as soon as a time machine is invented. I think it makes sense instead for users to pass the placement they wish for along with the item/operator etc, but that will require some python API changes. I have not kept up with how things are done in blender but if there's a process to deprecate those APIs it would be a good idea to use them and get rid of it.

Thanks for clarifying @Psy-Fi :)
In fact, it makes sense to maintain a strict order in the positioning of enum items (which may vary according to the property).

I admit that I'm not very familiar with the code (python or C++), but from what I can see in the example presented here, all the enums are in just one position of the pie. So, in this case, RNA_property_enum_items_gettexted_all doesn't really seem ideal.

I am then confirming the issue.

Thanks for clarifying @Psy-Fi :) In fact, it makes sense to maintain a strict order in the positioning of enum items (which may vary according to the property). I admit that I'm not very familiar with the code (python or C++), but from what I can see in the example presented here, all the enums are in just one position of the pie. So, in this case, `RNA_property_enum_items_gettexted_all` doesn't really seem ideal. I am then confirming the issue.
Germano Cavalcante added
Status
Confirmed
Interest
Python API
and removed
Status
Needs Info from Developers
labels 2023-09-13 20:49:02 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#112302
No description provided.