Geometry Nodes: Convert four nodes to use rotation socket #111482
No reviewers
Labels
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
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
Viewport & EEVEE
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111482
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "HooglyBoogly/blender:geometry-nodes-use-rotation-type"
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?
Convert the vector socket from four nodes to a rotation socket, adding
versioning to insert the conversion nodes and change the default values
where necessary.
Using rotation sockets disallows implicit conversions from vectors,
which helps avoid some common mistakes. It can also be faster,
since converting to and from Euler rotations is slow. For best
performance, the automatically added nodes should be removed.
This change is not forward compatible with 3.6, and socket values
are lost when opening 4.1 files in 4.0. The correct socket types are
added back in old versions, though newly added conversion nodes
may have to be removed.
@blender-bot build
@ -423,0 +427,4 @@
socket.type = SOCK_ROTATION;
STRNCPY(socket.idname, "NodeSocketRotation");
auto *old_value = static_cast<bNodeSocketValueVector *>(socket.default_value);
auto *new_value = MEM_new<bNodeSocketValueRotation>(__func__);
nodes::update_node_declaration_and_sockets
?That won't convert the default value. And I'd also rather not call a relatively higher level function like that in versioning code, since it makes it more difficult to change in the future.
Default values can be copied separately, but I'm surprised it's okay to do it manually when declarations already exist...
Attached file is crash when opened.
I think the most recent commit should fix the issues with your file, thanks.
@blender-bot build
I think we can only do this once we have the ability to create random rotations in one node, and to combine rotations (or if we actually do allow the implicit conversion between vector and euler).
Without those things, we make some very common workflows harder (like initializing every instance with a random rotation). Not to mention that this also breaks a very large number of tutorials that are meant for beginners.
There is an open PR that does just this, but it's rolled into the existing Random Value node. Do we want it changed to be it's own "Random Rotation" node? #109846
Agree with Jacques, the patch would be fine on its own but it needs a better plan for compatibility and ease of use with existing nodes.
I'd be ok with implicit conversions interpreting any vector as an euler and convert that to a quaternion. The alternative would be a straightforward
(x,y,z)
->(x,y,z,0)
conversion plus normalization, but that doesn't give very intuitive rotations and the normalization makes it rather useless for math purposes ("Combine Rotation" must be used for that).There are now implicit conversions from floats and vectors to rotations, using the old Euler behavior. Those are the only implicit conversions though-- others seem unnecessary at best, and a confusing waste of time at worst.
@blender-bot build
@ -426,2 +438,4 @@
add_implicit_conversion<ColorGeometry4b, ColorGeometry4f, byte_color_to_color>(conversions);
add_implicit_conversion<float, math::Quaternion, float_to_quaternion>(conversions);
add_implicit_conversion<float3, math::Quaternion, float3_to_quaternion>(conversions);
Also add rotation to float3 implicit conversion.
@ -836,0 +855,4 @@
/* Make versioning idempotent. */
continue;
}
bNode *convert = nodeAddNode(nullptr, &ntree, "FunctionNodeEulerToRotation");
Don't insert new node if the implicit conversion works as well.
@ -33,2 +32,3 @@
static bool use_translate(const math::Quaternion &rotation, const float3 scale)
{
if (compare_ff(math::length_squared(rotation), 0.0f, 1e-9f) != 1) {
if (math::angle_between(rotation, math::Quaternion::identity()).radian() > 1e-7f) {
Can this use
math::angle_of
?Yes, good to know about that!
@ -836,0 +853,4 @@
}
if (ELEM(link->fromsock->type, SOCK_VECTOR, SOCK_FLOAT) &&
link->fromnode->type != NODE_REROUTE) {
/* No need to add the conversion node when impicit conversions will work. */
typo
Hmm, sorry, where is the typo?
impicit
@blender-bot build
@blender-bot build
@HooglyBoogly Random Value node still doesn't have Rotation type. Do you have plans to add it? in would be nice to have random rotation output
For that we'll probably add a node group asset. Random rotations are a fair bit more complex than the other data types in the random value node.