Object: add Shade Auto Smooth operator #121494

Merged
Hans Goudey merged 15 commits from JacquesLucke/blender:shade-auto-smooth into main 2024-05-08 20:24:21 +02:00
Member

Based on the design in #120230.

  • Replaces the Shade Smooth by Angle with Shade Auto Smooth in the menu.
  • The new operator automatically adds and removes the modifier instead of being a destructive operation.
  • The Shade Smooth and Shade Flat operators now remove the Smooth by Angle modifier automatically.
  • Add a pin option to modifiers, which limits dragging and keeps the modifier after newly added modifiers in the list.

image

Based on the design in #120230. * Replaces the `Shade Smooth by Angle` with `Shade Auto Smooth` in the menu. * The new operator automatically adds and removes the modifier instead of being a destructive operation. * The `Shade Smooth` and `Shade Flat` operators now remove the `Smooth by Angle` modifier automatically. * Add a pin option to modifiers, which limits dragging and keeps the modifier after newly added modifiers in the list. ![image](/attachments/24bc7f30-b9b2-45be-a53b-8f0e4a4bb99f)
Jacques Lucke added 3 commits 2024-05-06 18:53:47 +02:00
Jacques Lucke added 1 commit 2024-05-06 19:00:35 +02:00
Jacques Lucke requested review from Dalai Felinto 2024-05-06 19:02:57 +02:00
Jacques Lucke requested review from Hans Goudey 2024-05-06 19:02:58 +02:00
Jacques Lucke added 2 commits 2024-05-06 20:10:17 +02:00
Jacques Lucke changed title from WIP: Object: add Shade Auto Smooth operator to Object: add Shade Auto Smooth operator 2024-05-06 20:12:00 +02:00
Hans Goudey approved these changes 2024-05-07 00:05:41 +02:00
Hans Goudey left a comment
Member

Thanks. This works well. We'll be in an intermediate state until the "Shade Smooth" and "Shade Flat" operators remove the modifier too. But that can be done separately using parts of this code.

Thanks. This works well. We'll be in an intermediate state until the "Shade Smooth" and "Shade Flat" operators remove the modifier too. But that can be done separately using parts of this code.
@ -1713,0 +1772,4 @@
bNodeTree *node_group = reinterpret_cast<bNodeTree *>(node_group_id);
node_group->ensure_topology_cache();
const StringRefNull angle_identifier = node_group->interface_inputs()[1]->identifier;
Member

Missing BKE_node_runtime.hh include

Missing `BKE_node_runtime.hh` include
JacquesLucke marked this conversation as resolved

Besides the Shade Smooth/Shade Flat changes appointed by Hans we also the "stick to bottom" option is required for this to really shine. I think we should wait for this all to be tested together before we merge.

Besides the Shade Smooth/Shade Flat changes appointed by Hans we also the "stick to bottom" option is required for this to really shine. I think we should wait for this all to be tested together before we merge.
Jacques Lucke added 2 commits 2024-05-07 11:22:07 +02:00
Jacques Lucke added 2 commits 2024-05-07 12:19:00 +02:00
remove modifier in Shade Smooth/Flat operator
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
5693565ecb

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121494) when ready.

I think the "Auto Smooth" option on the operation should not be saved (PROP_SKIP_SAVE).
Right now if I do:

  • Shade Auto Smooth
  • Shade Auto Smooth + on the redo panel set it to False
  • Shade Flat
  • Shade Auto Smooth

The last time this is call it does nothing. This is also how it works in 4.0.

I think the "Auto Smooth" option on the operation should not be saved (PROP_SKIP_SAVE). Right now if I do: * Shade Auto Smooth * Shade Auto Smooth + on the redo panel set it to False * Shade Flat * Shade Auto Smooth The last time this is call it does nothing. This is also how it works in 4.0.
Hans Goudey added 1 commit 2024-05-07 20:43:17 +02:00
Member

I think the "Auto Smooth" option on the operation should not be saved (PROP_SKIP_SAVE).

Looked into implementing this, and actually I'm having a bunch of trouble filling the operator's value from the active modifier. Menus seem hardcoded to use exec rather than invoke, so I can't give the angle a starting value.

But anyway, in the angle was saved with the operator properties in 4.0 (PROP_SKIP_SAVE) was not used.

The last time this is call it does nothing

Not sure what you mean by this. "Shade Auto Smooth" after "Shade Flat" will do the same thing as it always does.

In conclusion, I'd leave the angle-saving as-is.

>I think the "Auto Smooth" option on the operation should not be saved (PROP_SKIP_SAVE). Looked into implementing this, and actually I'm having a bunch of trouble filling the operator's value from the active modifier. Menus seem hardcoded to use `exec` rather than `invoke`, so I can't give the angle a starting value. But anyway, in the angle was saved with the operator properties in 4.0 (PROP_SKIP_SAVE) was not used. >The last time this is call it does nothing Not sure what you mean by this. "Shade Auto Smooth" after "Shade Flat" will do the same thing as it always does. In conclusion, I'd leave the angle-saving as-is.
Author
Member

I don't think you need to initialize the angle value from the modifier to justify adding PROP_SKIP_SAVE to the "Auto Smooth" option.

I don't think you need to initialize the angle value from the modifier to justify adding `PROP_SKIP_SAVE` to the "Auto Smooth" option.
Member

Agh, sorry, I was talking about the angle, everyone else was talking about the boolean option!

Agh, sorry, I was talking about the angle, everyone else was talking about the boolean option!
Hans Goudey added 1 commit 2024-05-07 23:06:11 +02:00
Use PROP_SKIP_SAVE for use_auto_smooth
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
777e41f89a
Just like 4.0

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121494) when ready.
Hans Goudey added 1 commit 2024-05-08 14:04:21 +02:00
Hans Goudey added 2 commits 2024-05-08 15:28:47 +02:00
Enable Pin Last when creating the modifier
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
7b460fbf83

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121494) when ready.
Dalai Felinto approved these changes 2024-05-08 19:29:38 +02:00
Dalai Felinto left a comment
Owner

Ship it!

Ship it!
Hans Goudey merged commit 2f289857af into main 2024-05-08 20:24:21 +02:00
Hans Goudey deleted branch shade-auto-smooth 2024-05-08 20:24:24 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
Asset Browser Project
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
4 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#121494
No description provided.