Nodes: Add forward compatibility versioning for #111187 #114236
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114236
Loading…
Reference in New Issue
No description provided.
Delete Branch "Hoshinova/blender:merge-noise-versioning"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds the versioning code to convert the new combined Noise Texture node in Blender 4.1 back to the Noise and Musgrave Texture nodes in Blender 4.0.
Versioning is only done for the Musgrave exclusive noise modes, that is all modes except for
fBM
.The output of the Noise and Musgrave Texture nodes in Blender 4.0 is usually identical to that in Blender 4.1, but with a few exceptions:
Detail_{Musgrave}=Detail_{Noise} + 1.0
however when the Detail input in Blender 4.1 is set to a value>14.0
it will be clamped to a maximum of15.0
. This happens internally and can't be circumvented using nodes.10^{-5}
.1.0
.@ -1062,0 +1063,4 @@
{
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if ((node->type != SH_NODE_TEX_NOISE) ||
((static_cast<NodeTexNoise *>(node->storage))->type == SHD_NOISE_FBM))
Check that
node->storage
is not null, to avoid crashing on 4.1 files saved before the node merging.The Noise Texture already had a
node->storage
before node merging. How could it be null?Ah ok. But then isn't it a problem that when reading .blend files saved with current main (without the merged nodes),
type
will be0
? Which means it will run the versioning code for such .blend files?I increased the subversion to the one where I expect the merge will happen. So that case shouldn't happen.
But we don't know when the merge will happen, we should not guess this.
I synced #111187 to also run with subversion 4. Since were still at subversion 1 we should have it merged by then.
I added checks for the existence of the sockets to make this work also with different subversion. This was needed anyway in case future Blender versions remove or rename these sockets.
@ -1062,0 +1068,4 @@
continue;
}
LISTBASE_FOREACH_BACKWARD_MUTABLE (bNodeLink *, link, &ntree->links) {
Why not use
socket = nodeFindSocket
andsocket->link
here? I see that in other versioning code, and it seems both simpler and faster. If there is no reason, please change it.Apparently this shouldn't be done anymore because
socket->link
may not be up to date. See: #111187 (comment) and #111187 (comment)I rather doubt this is needed, but I guess it doesn't hurt.
@ -1062,0 +1080,4 @@
STRNCPY(node->idname, "ShaderNodeTexMusgrave");
node->type = SH_NODE_TEX_MUSGRAVE;
NodeTexMusgrave *data = MEM_cnew<NodeTexMusgrave>(__func__);
data->base = (static_cast<NodeTexNoise *>(node->storage))->base;
Use
const NodeTextNoise *noise_data = static_cast<const NodeTexNoise *>(node->storage);
instead of casting multiple times.@ -1062,0 +1105,4 @@
bNode *lacunarity_from_node = nullptr;
bNodeSocket *lacunarity_from_socket = nullptr;
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
Similar question here, why not use
detail_socket->link
below?Same reason as above.
@ -1062,0 +1199,4 @@
}
}
else {
*dimension = -(std::logf(*dimension) / std::logf(*lacunarity));
Use
safe_logf
andsafe_divide
to avoid potential NaN/inf.The libraries containing
safe_logf
andsafe_divide
aren't#included
in versioning_400.cc so here's a faster solution.These are inline functions from
BLI_math_base_safe.h
, it should be enough to include that header.I change it to
safe_
now, since the previous fix did not account for negative values which are also not allowed.Please be sure to check this on 4.1 files saved with and without the merged noise texture node.
I did and it works.
@blender-bot build
@blender-bot build
@ -1062,0 +1212,4 @@
}
}
else {
*dimension = -safe_divide(safe_logef(*dimension), safe_logef(*lacunarity));
This can also be changed to
*dimension = -safe_logf(*dimension, *lacunarity);