Subtype for input value nodes #106505

Open
opened 2023-04-03 18:37:52 +02:00 by Iliya Katushenock · 12 comments

image
The user may be at a loss when entering a rotation radians value into some built-in node, copies it into the input value node, and now these are degrees.
The explicit way of specifying the sub type must be an option for all value input nodes that it can have.
The type list option should be available in the N-Panel so as not to clutter up the node space.

![image](/attachments/8c927de7-3921-4a34-a8af-a732491bc18a) The user may be at a loss when entering a rotation radians value into some built-in node, copies it into the input value node, and now these are degrees. The explicit way of specifying the sub type must be an option for all value input nodes that it can have. The type list option should be available in the N-Panel so as not to clutter up the node space.
Iliya Katushenock added the
Type
Design
label 2023-04-03 18:37:52 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-04-03 18:37:53 +02:00
Iliya Katushenock added the
Meta
Good First Issue
label 2023-04-03 18:38:03 +02:00
Iliya Katushenock changed title from Subtype for input value node to Subtype for input value nodes 2023-04-03 18:40:42 +02:00
Contributor

Can I take this as my first issue?

Can I take this as my first issue?
Contributor

Hi, Can I ask that by subtype do you mean the enum PropertySubType? Like we should have an option to explicitly set it to something like PROP_ANGLE?

Hi, Can I ask that by subtype do you mean the enum `PropertySubType`? Like we should have an option to explicitly set it to something like `PROP_ANGLE`?
Author
Member

@Weikang-Qiu Hi, I'm glad you decided to give it a try. You understood correctly, these are the same subtypes. If you have any more questions, you can either ask them here or go to the https://blender.chat/channel/nodes-physics-module.

@Weikang-Qiu Hi, I'm glad you decided to give it a try. You understood correctly, these are the same subtypes. If you have any more questions, you can either ask them here or go to the https://blender.chat/channel/nodes-physics-module.

Also need "Length" subtype.

The type list option should be available in the N-Panel so as not to clutter up the node space.

Then it will be inconvenient to switch it, because you need to go to another place to switch it.

It is better to add the "Type" parameter to the nodes:
Value Subtypes.png

Also need "Length" subtype. > The type list option should be available in the N-Panel so as not to clutter up the node space. Then it will be inconvenient to switch it, because you need to go to another place to switch it. It is better to add the "Type" parameter to the nodes: ![Value Subtypes.png](/attachments/dc290c6b-ad00-4d30-b63f-ea1dd83e3d20)
Author
Member

This subtype is not part of the core workflow logic. You change it, either implicitly (when drag and drop a link, which would be nice to add in the future), or when copying values (now you just don't copy values between properties of different subtypes). Setting it manually is also convenient, but it is not primary and is not so often used.

This subtype is not part of the core workflow logic. You change it, either implicitly (when drag and drop a link, which would be nice to add in the future), or when copying values (now you just don't copy values between properties of different subtypes). Setting it manually is also convenient, but it is not primary and is not so often used.
Iliya Katushenock added the
Interest
User Interface
label 2023-04-07 11:50:34 +02:00

This subtype is not part of the core workflow logic.

This is true, when you use default settings.

But when you change the "Scene Unit" settings.
You can not use "Float Value" for set size, you always need use "Length".

Unit - Length.png

> This subtype is not part of the core workflow logic. This is true, when you use default settings. But when you change the "Scene Unit" settings. You can not use "Float Value" for set size, you always need use "Length". ![Unit - Length.png](/attachments/b643b61c-6ae8-4c29-9bb0-cbecf0924ab7)
Author
Member

There seems to be some misunderstanding. The type of quantity (distance, degrees, lumens, ...) is not the same as the dimension (micro, nano, mega, kilo, ...) or system of measures (meters, feet, elbows, ...). So it's not something we should be thinking about.

There seems to be some misunderstanding. The type of quantity (distance, degrees, lumens, ...) is not the same as the dimension (micro, nano, mega, kilo, ...) or system of measures (meters, feet, elbows, ...). So it's not something we should be thinking about.
Contributor

Hi @mod_moder, is it correct to create a node_buts_value_ex for the draw_buttons_ex function in draw_node.cc, and write some UI code for the subtype list in this function?

Hi @mod_moder, is it correct to create a `node_buts_value_ex` for the `draw_buttons_ex` function in `draw_node.cc`, and write some UI code for the subtype list in this function?
Author
Member

@Weikang-Qiu Hey, yeah, that correct. Just to be clear, functions have to be implemented in same files as node itself, but drawing happen in draw_node.cc.

@Weikang-Qiu Hey, yeah, that correct. Just to be clear, functions have to be implemented in same files as node itself, but drawing happen in `draw_node.cc`.
Contributor

Thanks for the confirmation.
Currently I create a new function draw_buts_value_ex and added some codes to UI

static void node_buts_value_ex(uiLayout *layout, bContext * C, PointerRNA *ptr)
{
/* some code */
uiLayoutSetContextPointer(layout, "interface_socket", &sockptr);
uiItemMenuEnumO(layout, C, "node.tree_socket_change_subtype", "socket_subtype", "None", ICON_NONE);
}

to mimic the subtype menu of the geometry nodes' group input, i.e.
Screenshot 2023-04-07 at 9.45.49 PM.png
, which is drawed by the script space_node.py. e369bf4a6d/scripts/startup/bl_ui/space_node.py (L902-L907)

However, it seems that using operators NODE_OT_tree_socket_change_subtype requires the socket of the value node to be a NodeSocketInterface according to
e369bf4a6d/source/blender/editors/space_node/node_edit.cc (L2422-L2423)
but actually the value node's socket is a NodeSocket. It seems that the function is only designed for socket interface?

Just wonder if I am on the right track.

Thanks for the confirmation. Currently I create a new function `draw_buts_value_ex` and added some codes to UI ```cpp static void node_buts_value_ex(uiLayout *layout, bContext * C, PointerRNA *ptr) { /* some code */ uiLayoutSetContextPointer(layout, "interface_socket", &sockptr); uiItemMenuEnumO(layout, C, "node.tree_socket_change_subtype", "socket_subtype", "None", ICON_NONE); } ``` to mimic the subtype menu of the geometry nodes' group input, i.e. ![Screenshot 2023-04-07 at 9.45.49 PM.png](/attachments/8cbc181e-f635-4175-af1e-b1338d84a440) , which is drawed by the script `space_node.py`. https://projects.blender.org/blender/blender/src/commit/e369bf4a6d38e755f77da3a6f99fa60f9fb8f3e0/scripts/startup/bl_ui/space_node.py#L902-L907 However, it seems that using operators `NODE_OT_tree_socket_change_subtype` requires the socket of the value node to be a `NodeSocketInterface` according to https://projects.blender.org/blender/blender/src/commit/e369bf4a6d38e755f77da3a6f99fa60f9fb8f3e0/source/blender/editors/space_node/node_edit.cc#L2422-L2423 but actually the value node's socket is a `NodeSocket`. It seems that the function is only designed for socket interface? Just wonder if I am on the right track.
Author
Member

@Weikang-Qiu I added a reply to you in the chat

@Weikang-Qiu I added a reply to you in the chat
Contributor

PR #107010

PR [#107010](https://projects.blender.org/blender/blender/pulls/107010)
Iliya Katushenock removed the
Meta
Good First Issue
label 2023-05-06 20:24:12 +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
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#106505
No description provided.