Shading Pie menu expansion #100234

Open
opened 2022-08-05 21:58:44 +02:00 by Hidde H · 1 comment

Hi Brendon,

I've expanded upon the Shading Pie (Z) included in your add-on. Please have a look. I use this extensively and thought it might be useful to others too.

  • When shading smooth, autosmooth is applied automatically with a default of 30 degrees. A redo panel offers options to turn autosmooth off and adjust the angle manually or via preset buttons.
    The user receives a warning in the redo panel if the mesh(es) contain(s) custom normals. If only one mesh is selected and it has custom normals, Angle values are disabled in the redo panel.

  • Added a pie item for Wireframe and face orientation overlay.

  • The shade-smooth/flat pie items are enabled conditionally on having selected at least one mesh. This seems a better solution than to make them invisible as users do not need to be informed this function exists in the Pie.
    I have encountered a bug doing this I think (Or maybe it is my code?) : When holding "Z" and selecting the item, the operator is still called even that it is disabled/greyed out. When press-releasing "Z" and then clicking the Pie Item it is indeed disabled.

I might not have handled things gracefully in the code as this is my first step into Python and Blender API. But it works and does not throw exceptions as far as I've experienced/tested. (Blender 3.1 and 3.2.1)
To make the smooth angle presets work, I haven't found any other way than to store some attr() in the scene and have what boils down to a duplicate(proxy if you will) of the attr() as a property in the operator.
This seems ugly and feels like hack to me but I couldn't manage to pass on data between operators to display/update it in the redo panel any other way.

Would love to hear your thoughts and feedback !

Best Regards,

Hidde

pie_shading_menu.py

Hi Brendon, I've expanded upon the Shading Pie (Z) included in your add-on. Please have a look. I use this extensively and thought it might be useful to others too. - When shading smooth, autosmooth is applied automatically with a default of 30 degrees. A redo panel offers options to turn autosmooth off and adjust the angle manually or via preset buttons. The user receives a warning in the redo panel if the mesh(es) contain(s) custom normals. If only one mesh is selected and it has custom normals, Angle values are disabled in the redo panel. - Added a pie item for Wireframe and face orientation overlay. - The shade-smooth/flat pie items are enabled conditionally on having selected at least one mesh. This seems a better solution than to make them invisible as users do not need to be informed this function exists in the Pie. I have encountered a bug doing this I think (Or maybe it is my code?) : When holding "Z" and selecting the item, the operator is still called even that it is disabled/greyed out. When press-releasing "Z" and then clicking the Pie Item it is indeed disabled. I might not have handled things gracefully in the code as this is my first step into Python and Blender API. But it works and does not throw exceptions as far as I've experienced/tested. (Blender 3.1 and 3.2.1) To make the smooth angle presets work, I haven't found any other way than to store some attr() in the scene and have what boils down to a duplicate(proxy if you will) of the attr() as a property in the operator. This seems ugly and feels like hack to me but I couldn't manage to pass on data between operators to display/update it in the redo panel any other way. Would love to hear your thoughts and feedback ! Best Regards, Hidde [pie_shading_menu.py](https://archive.blender.org/developer/F13338392/pie_shading_menu.py)
Brendon Murphy was assigned by Hidde H 2022-08-05 21:58:44 +02:00
Author

Added subscriber: @mOOngaze

Added subscriber: @mOOngaze
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 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-addons#100234
No description provided.