Geometry Nodes: Link drag search value moving improvement #107470

Merged
Hans Goudey merged 7 commits from mod_moder/blender:tmp_add_other_value_option_to_dnd_moving into main 2023-05-02 18:50:42 +02:00

This PR based on #107461.
Now, when grag and drop going be used for create new input value node, it aslo
be moved socket value in to node storage. This means, by design, that result of
evaluation on node tree will don't be change.

Right now a few nodes (in shader in many cases) implemented without node
storage, but by storing value in socket itself. Float value input node unsupported
in this way too.

For data blocks, the original value is set to null, thus avoiding the existence of unused pointers.

This PR based on https://projects.blender.org/blender/blender/pulls/107461. Now, when grag and drop going be used for create new input value node, it aslo be moved socket value in to node storage. This means, by design, that result of evaluation on node tree will don't be change. Right now a few nodes (in shader in many cases) implemented without node storage, but by storing value in socket itself. Float value input node unsupported in this way too. For data blocks, the original value is set to null, thus avoiding the existence of unused pointers. <image src="https://projects.blender.org/attachments/40bd8c66-1ce5-4cd1-a454-fe250f7fb4bb"> <image src="https://projects.blender.org/attachments/a1f08b61-8e3b-4802-866d-246e785cff83"> <image src="https://projects.blender.org/attachments/c600fb88-8096-4941-8e88-a7cee38f2596"> <image src="https://projects.blender.org/attachments/d3643bc5-7a0d-4a89-9787-19363e13705e">
Iliya Katushenock added the
Interest
Geometry Nodes
label 2023-04-29 20:12:51 +02:00
Iliya Katushenock added 3 commits 2023-04-29 20:12:56 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-04-29 20:13:07 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-04-29 20:13:11 +02:00
Contributor

Will this work for all node editors?

Will this work for all node editors?
Author
Member

Will this work for all node editors?

At the moment, some of the nodes are implemented, it seems to me strange logic. They store their values in sockets, not node storage data blocks. It's not very consistent, which is the reason I went around them. This means that all shader nodes are, at the very least, unsupported. Hopefully this can change in the near future.

> Will this work for all node editors? At the moment, some of the nodes are implemented, it seems to me strange logic. They store their values in sockets, not node storage data blocks. It's not very consistent, which is the reason I went around them. This means that all shader nodes are, at the very least, unsupported. Hopefully this can change in the near future.
Contributor

Shader Node Editor hasn't gotten any updates that Geometry Nodes Editor got. It is seemingly abandoned at the moment and developers are hesitating to work on it over difficulty of the task of the rewrite. I hope this changes soon. Shader UI is really lacking and incosistencies between node editors weakens the UX of entire Blender.

Shader Node Editor hasn't gotten any updates that Geometry Nodes Editor got. It is seemingly abandoned at the moment and developers are hesitating to work on it over difficulty of the task of the rewrite. I hope this changes soon. Shader UI is really lacking and incosistencies between node editors weakens the UX of entire Blender.
Hans Goudey reviewed 2023-05-01 00:01:23 +02:00
@ -2488,3 +2543,1 @@
for (ID **dst_value : dst_values) {
*dst_value = *src_socket_value;
id_us_plus(*dst_value);
void **src_value = static_cast<void **>(socket_value_storage(src));
Member

Why cast to void ** here? Seems like void * would be fine.

Why cast to `void **` here? Seems like `void *` would be fine.
mod_moder marked this conversation as resolved
@ -2495,0 +2555,4 @@
* C++ equivalent:
* src_value = {};
*/
BUFFER_FOR_CPP_TYPE_VALUE(src_type, src_zero_value);
Member

What about this:

src_type.destruct(src_value);
src_type.value_initialize(src_value);
What about this: ```cpp src_type.destruct(src_value); src_type.value_initialize(src_value); ```
mod_moder marked this conversation as resolved
Iliya Katushenock added 2 commits 2023-05-01 08:20:00 +02:00
Hans Goudey requested changes 2023-05-01 14:59:48 +02:00
@ -2429,0 +2440,4 @@
switch (node.type) {
case FN_NODE_INPUT_BOOL: {
return &reinterpret_cast<NodeInputBool *>(node.storage)->boolean;
}
Member

IMO the brackets don't really help here, they just make the function take more space. They aren't necessary since you aren't declaring any variables in the cases. Same with below.

IMO the brackets don't really help here, they just make the function take more space. They aren't necessary since you aren't declaring any variables in the cases. Same with below.
mod_moder marked this conversation as resolved
@ -2492,3 +2548,2 @@
id_us_min(*src_socket_value);
*src_socket_value = nullptr;
convert.convert_to_uninitialized(src_type, dst_type, src_value, dst_value);
Member

I think convert_to_initialized might be correct here actually, since the destination is already a valid socket value, it will already be initialized. Not that it makes a difference right now...

I think `convert_to_initialized` might be correct here actually, since the destination is already a valid socket value, it will already be initialized. Not that it makes a difference right now...
Author
Member

Right now we no have a convert_to_initialized and i not sure if that make some difference now too. (This case really simple)

Right now we no have a `convert_to_initialized` and i not sure if that make some difference now too. (This case really simple)
Member

Oh, my bad, I searched and fount convert_to_initialized_n but missed the _n. Indeed it doesn't matter here currently.

Oh, my bad, I searched and fount `convert_to_initialized_n` but missed the `_n`. Indeed it doesn't matter here currently.
mod_moder marked this conversation as resolved
Iliya Katushenock added 1 commit 2023-05-01 15:42:48 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-05-01 15:43:00 +02:00
Hans Goudey approved these changes 2023-05-01 15:54:08 +02:00
Hans Goudey left a comment
Member

I'll still test this before committing it, but the code looks good.

I'll still test this before committing it, but the code looks good.
Author
Member

Yes, thank for reviews and testing Hans.

Yes, thank for reviews and testing Hans.
Hans Goudey requested changes 2023-05-01 22:23:26 +02:00
Hans Goudey left a comment
Member

This is really nice! A great usability improvement! A few things:

  • A noticed a problem with the "value" node coming from an integer socket (see video below)
  • Also in the video, it resets the size of the grid node to zero. Maybe it should reset to the default value from the node socket declaration instead.
This is really nice! A great usability improvement! A few things: - A noticed a problem with the "value" node coming from an integer socket (see video below) - Also in the video, it resets the size of the grid node to zero. Maybe it should reset to the default value from the node socket declaration instead.
@ -2429,0 +2455,4 @@
return nullptr;
}
void *socket_value_storage(bNodeSocket &socket)
Member
/home/hans/blender-git/blender/source/blender/blenkernel/intern/node.cc:2434:7: warning: no previous declaration for ‘void* blender::bke::node_static_value_storage_for(bNode&, const bNodeSocket&)’ [-Wmissing-declarations]
 2434 | void *node_static_value_storage_for(bNode &node, const bNodeSocket &socket)
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hans/blender-git/blender/source/blender/blenkernel/intern/node.cc:2458:7: warning: no previous declaration for ‘void* blender::bke::socket_value_storage(bNodeSocket&)’ [-Wmissing-declarations]
 2458 | void *socket_value_storage(bNodeSocket &socket)
      |       ^~~~~~~~~~~~~~~~~~~~
``` /home/hans/blender-git/blender/source/blender/blenkernel/intern/node.cc:2434:7: warning: no previous declaration for ‘void* blender::bke::node_static_value_storage_for(bNode&, const bNodeSocket&)’ [-Wmissing-declarations] 2434 | void *node_static_value_storage_for(bNode &node, const bNodeSocket &socket) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/hans/blender-git/blender/source/blender/blenkernel/intern/node.cc:2458:7: warning: no previous declaration for ‘void* blender::bke::socket_value_storage(bNodeSocket&)’ [-Wmissing-declarations] 2458 | void *socket_value_storage(bNodeSocket &socket) | ^~~~~~~~~~~~~~~~~~~~ ```
mod_moder marked this conversation as resolved
@ -2429,0 +2479,4 @@
case SOCK_MATERIAL:
return &socket.default_value_typed<bNodeSocketValueMaterial>()->value;
case SOCK_STRING:
break;
Member

Seems simpler to return null here as a way to not support strings, rather than checking again below:

    case SOCK_STRING:
      /* Strings are not supported here. */
      return nullptr;
Seems simpler to return null here as a way to not support strings, rather than checking again below: ``` case SOCK_STRING: /* Strings are not supported here. */ return nullptr; ```
mod_moder marked this conversation as resolved
Hans Goudey changed title from Geometry Nodes: Drag and drop value moving improvement to Geometry Nodes: Link drag search value moving improvement 2023-05-01 22:23:51 +02:00
Author
Member

A noticed a problem with the "value" node coming from an integer socket (see video below)

Yeah, i mention this little above. Right now a few nodes (in shader in many cases) implemented without node storage, but by storing value in socket itself.
I planning to offer comming soon some plans about refactoring this places for reduce legacy design moments.

> A noticed a problem with the "value" node coming from an integer socket (see video below) Yeah, i mention this little above. Right now a few nodes (in shader in many cases) implemented without node storage, but by storing value in socket itself. I planning to offer comming soon some plans about refactoring this places for reduce legacy design moments.
Member

Ah I see, makes sense now, thanks.

Ah I see, makes sense now, thanks.
Iliya Katushenock added 1 commit 2023-05-01 23:01:10 +02:00
Iliya Katushenock requested review from Hans Goudey 2023-05-01 23:03:36 +02:00
Hans Goudey approved these changes 2023-05-02 18:32:05 +02:00
Hans Goudey merged commit 71e4f48180 into main 2023-05-02 18:50:42 +02:00
Iliya Katushenock deleted branch tmp_add_other_value_option_to_dnd_moving 2023-05-02 19:00:23 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:42 +02:00
Sign in to join this conversation.
No reviewers
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
3 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#107470
No description provided.