Breaking shader node changes for 5.0 #96219

Open
opened 2022-03-07 14:16:51 +01:00 by Brecht Van Lommel · 26 comments

There are a number of proposed changes to shader nodes that break the Python API, mainly for add-ons that import and export shaders. The next opportunity to make these breaking changes in Blender 5.0.

Patches:

There are a number of proposed changes to shader nodes that break the Python API, mainly for add-ons that import and export shaders. The next opportunity to make these breaking changes in Blender 5.0. Patches: * [ ] [D14257: Shader Nodes: Changes to node UI and default values to improve consistency](https://archive.blender.org/developer/D14257) * [ ] [D14202: UI (Shader/Compositor): Rename "RGB" input to "Color" input](https://archive.blender.org/developer/D14202) * [ ] [D13749: Node: Mix node](https://archive.blender.org/developer/D13749) * [ ] [D13359: Rename "fac" to "factor" across all nodes](https://archive.blender.org/developer/D13359) * [ ] Use proper "Brightness" word in names
Author
Owner

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Owner

Added subscriber: @brecht

Added subscriber: @brecht
Author
Owner
Gathering feedback on devtalk here: https://devtalk.blender.org/t/feedback-on-breaking-python-api-changes-for-shader-nodes/23281
Contributor

Added subscriber: @MysteryPancake

Added subscriber: @MysteryPancake
Contributor

Is there any way the Python API could be detoured to avoid breaking changes? E.g. "Fac" in the API aliased to "Factor"?

It would be a shame to have more duplicate code for Mix/Combine/Separate nodes

Is there any way the Python API could be detoured to avoid breaking changes? E.g. "Fac" in the API aliased to "Factor"? It would be a shame to have more duplicate code for Mix/Combine/Separate nodes
Member

Added subscriber: @EAW

Added subscriber: @EAW

Added subscriber: @Diogo_Valadares

Added subscriber: @Diogo_Valadares
Author
Owner

The problem is that some scripts use .name instead of the .identifier, and worse, that node.inputs["Factor"]" actually use the name instead of the identifier currently.

The problem is that some scripts use `.name` instead of the `.identifier`, and worse, that `node.inputs["Factor"]"` actually use the name instead of the identifier currently.

Added subscriber: @Aeraglyx

Added subscriber: @Aeraglyx
Author
Owner
Added subscribers: @Ethan-Hall, @HooglyBoogly, @fclem, @CharlieJolly
Author
Owner

@CharlieJolly, @HooglyBoogly, @MysteryPancake, @Ethan-Hall, @fclem

I propose we do the following:

  • For Blender 3.2, add new Mix and Combine/Separate nodes and convert existing nodes in .blend files. Keep the old nodes available in the Python API but hidden from the menus.
  • Postpone other changes to another release where we make more breaking changes to shader nodes that. For example in the context of new textures nodes or improvements to the principled BSDF, that are likely to happen before 4.0.

That's rather conservative, but I think it's worth taking API compatibility a bit more seriously.

@CharlieJolly, @HooglyBoogly, @MysteryPancake, @Ethan-Hall, @fclem I propose we do the following: * For Blender 3.2, add new Mix and Combine/Separate nodes and convert existing nodes in .blend files. Keep the old nodes available in the Python API but hidden from the menus. * Postpone other changes to another release where we make more breaking changes to shader nodes that. For example in the context of new textures nodes or improvements to the principled BSDF, that are likely to happen before 4.0. That's rather conservative, but I think it's worth taking API compatibility a bit more seriously.
Thomas Dinges added this to the 4.0 milestone 2023-02-07 18:52:08 +01:00
Brecht Van Lommel added this to the Render & Cycles project 2023-02-07 19:08:06 +01:00
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:03:17 +01:00
Member

Adding a few more patches here for consideration

WIP: Separate ColorRamp node name into Color Ramp #104996
WIP: Rename Bright/Contrast to Brightness Contrast #104998
WIP: Rename Dilate/Erode to Dilate Erode #104999

There needs to be a consensus of the use or not use of the "/" separator. I'm not sure about it myself but the inconsistency bothers me.

Adding a few more patches here for consideration [WIP: Separate ColorRamp node name into Color Ramp #104996](https://projects.blender.org/blender/blender/pulls/104996) [WIP: Rename Bright/Contrast to Brightness Contrast #104998](https://projects.blender.org/blender/blender/pulls/104998) [WIP: Rename Dilate/Erode to Dilate Erode #104999](https://projects.blender.org/blender/blender/pulls/104999) There needs to be a consensus of the use or not use of the "/" separator. I'm not sure about it myself but the inconsistency bothers me.
Author
Owner

Changing UI names like these does not break file or API compatibility. If the names are similar enough to the previous ones and not break documentation completely, we can do them any time.

Changing UI names like these does not break file or API compatibility. If the names are similar enough to the previous ones and not break documentation completely, we can do them any time.
Member

Ah, I gave the opposite advice in #104996, since the node names are used by the Python API and the default names would change. But if that's considered an okay change, I think these names are much better, so I'd support the changes @zanqdo proposed.

Ah, I gave the opposite advice in #104996, since the node names are used by the Python API and the default names would change. But if that's considered an okay change, I think these names are much better, so I'd support the changes @zanqdo proposed.
Author
Owner

The socket names are used in the API, but the node names are not I think.

The socket names are used in the API, but the node names are not I think.
Member

The socket names are used in the API, but the node names are not I think.

Yeah, that's why I didn't change the Bright socket name. I guess that one is a change for 4.0

> The socket names are used in the API, but the node names are not I think. Yeah, that's why I didn't change the *Bright* socket name. I guess that one is a change for 4.0
Hans Goudey changed title from Breaking shader node changes to Breaking shader node changes for 4.0 2023-02-28 19:57:13 +01:00
Member

Created a WIP PR for the Brightness rename #108128

Can we add it to the list?

I might need help on do-versioning.

Created a WIP PR for the Brightness rename https://projects.blender.org/blender/blender/pulls/108128 Can we add it to the list? I might need help on do-versioning.

@brecht I just spoke to Hans in chat. I'm warming up the old changes I had to change all the instances of Fac to Factor across nodes. At that time, you had both suggested changing the Python API as well to match, and to wait until 4.0 since it was a breaking change.

Hans wanted me to confirm with you if I should include the Python changes in my work. I plan to start building out that changeset this weekend.

@brecht I just spoke to Hans in chat. I'm warming up the old changes I had to change all the instances of Fac to Factor across nodes. At that time, you had both suggested changing the Python API as well to match, and to wait until 4.0 since it was a breaking change. Hans wanted me to confirm with you if I should include the Python changes in my work. I plan to start building out that changeset this weekend.
Author
Owner

Mainly I would like to do all breaking node socket changes at once, so add-on authors don't need to update things multiple times. So whatever changes you want to propose you could already make a PR for, and then we can do all the changes at once.

I'd like to fix the API design so that socket identifiers instead of socket names are used for node.inputs["Factor"]. That way we can change names in the future without worrying about API breakage. But that would expose the rather ugly identifiers like Factor_Float and Factor_Vector, and Python scripts would need additional logic to deal with those distinctions.

I think it would be nicer if the sockets were declared more dynamically and there would exist only one Factor socket at a time. And then the Python API can stay mostly the same. In fact we could even keep identifier as Fac for compatibility if we wanted.

@HooglyBoogly do you know of any existing plans for changing the way this works? #104126 seems related but I only partially understand the description.

Mainly I would like to do all breaking node socket changes at once, so add-on authors don't need to update things multiple times. So whatever changes you want to propose you could already make a PR for, and then we can do all the changes at once. I'd like to fix the API design so that socket identifiers instead of socket names are used for `node.inputs["Factor"]`. That way we can change names in the future without worrying about API breakage. But that would expose the rather ugly identifiers like `Factor_Float` and `Factor_Vector`, and Python scripts would need additional logic to deal with those distinctions. I think it would be nicer if the sockets were declared more dynamically and there would exist only one `Factor` socket at a time. And then the Python API can stay mostly the same. In fact we could even keep identifier as `Fac` for compatibility if we wanted. @HooglyBoogly do you know of any existing plans for changing the way this works? #104126 seems related but I only partially understand the description.
Member

I'd like to fix the API design so that socket identifiers instead of socket names are used

Agreed this should be done, it's very inconsistent the way it works now.

I think it would be nicer if the sockets were declared more dynamically and there would exist only one Factor socket at a time.

Yes, this is related to the planned work on dynamic declarations. The declaration would depend on the some properties of the node like the type, and the hidden (currently "unavailable") socket just wouldn't exist. We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary.

That's all a bit related to type inference between nodes, but other than that long-term design aspect, I don't think there's much holding us back from implementing this change now.

>I'd like to fix the API design so that socket identifiers instead of socket names are used Agreed this should be done, it's very inconsistent the way it works now. >I think it would be nicer if the sockets were declared more dynamically and there would exist only one `Factor` socket at a time. Yes, this is related to the planned work on dynamic declarations. The declaration would depend on the some properties of the node like the type, and the hidden (currently "unavailable") socket just wouldn't exist. We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary. That's all a bit related to type inference between nodes, but other than that long-term design aspect, I don't think there's much holding us back from implementing this change now.
Author
Owner

We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary.

I think it's good to preserve the value of a socket that gets hidden. For example some parameter of the Principled BSDF that may get hidden when toggling a feature on or off, would be nice to keep that.

But when it gets replaced by a socket with the same name and another data type it seems not so important.

That's all a bit related to type inference between nodes, but other than that long-term design aspect, I don't think there's much holding us back from implementing this change now.

Right. Is there any time in the geometry nodes team to tackle this in 4.0 bcon1 still?

> We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary. I think it's good to preserve the value of a socket that gets hidden. For example some parameter of the Principled BSDF that may get hidden when toggling a feature on or off, would be nice to keep that. But when it gets replaced by a socket with the same name and another data type it seems not so important. > That's all a bit related to type inference between nodes, but other than that long-term design aspect, I don't think there's much holding us back from implementing this change now. Right. Is there any time in the geometry nodes team to tackle this in 4.0 bcon1 still?
Member

We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary.

I think it's good to preserve the value of a socket that gets hidden. For example some parameter of the Principled BSDF that may get hidden when toggling a feature on or off, would be nice to keep that.

Storing previous values in these cases is good UX.

Inconsistent identifier examples from Compare and Mix node. Result has also been flagged by some users who prefer Value, Vector etc

b.add_input<decl::String>("A", "A_VEC3")
b.add_input<decl::String>("A", "A_INT")
b.add_output<decl::Float>("Result", "Result_Float")
b.add_output<decl::Vector>("Result", "Result_Vector")

Having separate or dynamic declarations for each mode would hopefully avoid the ugly identifiers and remove the need for using nodeSetSocketAvailability function.

There should also be ways for the node to reuse and relink sockets when the declaration is changed, so some kind of runtime storage of socket data would be needed to enable this.

> > We wondered if we would want to store the old default values, even without the socket. Personally i don't think that's necessary. > > I think it's good to preserve the value of a socket that gets hidden. For example some parameter of the Principled BSDF that may get hidden when toggling a feature on or off, would be nice to keep that. Storing previous values in these cases is good UX. Inconsistent identifier examples from Compare and Mix node. _Result_ has also been flagged by some users who prefer _Value_, _Vector_ etc `b.add_input<decl::String>("A", "A_VEC3")` `b.add_input<decl::String>("A", "A_INT")` `b.add_output<decl::Float>("Result", "Result_Float")` `b.add_output<decl::Vector>("Result", "Result_Vector")` Having separate or dynamic declarations for each mode would hopefully avoid the ugly identifiers and remove the need for using `nodeSetSocketAvailability` function. There should also be ways for the node to reuse and relink sockets when the declaration is changed, so some kind of runtime storage of socket data would be needed to enable this.
Author
Owner

I expect we'd have some utility function to set the type of the socket, which would change it in-place and keep existing link.

I expect we'd have some utility function to set the type of the socket, which would change it in-place and keep existing link.

I just was added some a historical links to approach, related to this #104126 (comment)

I just was added some a historical links to approach, related to this https://projects.blender.org/blender/blender/issues/104126#issuecomment-978286
Member

Right. Is there any time in the geometry nodes team to tackle this in 4.0 bcon1 still?

I'm not sure. Personally I'm feeling stretched thin already, but I'll keep it in mind for when we're deciding what to do next, or maybe someone else will have the time.

I expect we'd have some utility function to set the type of the socket, which would change it in-place and keep existing link.

Yes, dynamic declarations should handle type conversions when creating updated sockets. Note for future: that's in refresh_socket_list

> Right. Is there any time in the geometry nodes team to tackle this in 4.0 bcon1 still? I'm not sure. Personally I'm feeling stretched thin already, but I'll keep it in mind for when we're deciding what to do next, or maybe someone else will have the time. > I expect we'd have some utility function to set the type of the socket, which would change it in-place and keep existing link. Yes, dynamic declarations should handle type conversions when creating updated sockets. _Note for future: that's in `refresh_socket_list`_

Hello I will take care of the changes concerning D14202

Hello I will take care of the changes concerning D14202
Brecht Van Lommel modified the milestone from 4.0 to 5.0 2023-10-05 17:48:21 +02:00
Brecht Van Lommel changed title from Breaking shader node changes for 4.0 to Breaking shader node changes for 5.0 2023-10-05 17:48:26 +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 Assignees
11 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#96219
No description provided.