WIP: Subtype for input function nodes #107010

Draft
Weikang-Qiu wants to merge 4 commits from Weikang-Qiu/blender:node-subtype into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

Problem

This patch is related to the issue #106505.

Solution

This is a rough patch where I only implement the subtype list for the function input vector node. Currently the subtype list includes all subtypes listed on https://docs.blender.org/api/current/bpy_types_enum_items/property_subtype_number_array_items.html#rna-enum-property-subtype-number-array-items. This is achieved by adding a subtype value in the node storage structure, and duplicating multiple properties associated with the same vector value.

demo-input-vector-subtype.mp4

Limitations

These properties will be all visible to python.
The subtypes have the same display name, for example, both COLOR and COLOR_GAMMA will display "Color". Also, some subtypes like AXISANGLE are 4d vector, but originally the node only supports 3d vector.

# Problem This patch is related to the issue [#106505](https://projects.blender.org/blender/blender/issues/106505). # Solution This is a rough patch where I only implement the subtype list for the function input vector node. Currently the subtype list includes all subtypes listed on https://docs.blender.org/api/current/bpy_types_enum_items/property_subtype_number_array_items.html#rna-enum-property-subtype-number-array-items. This is achieved by adding a `subtype` value in the node storage structure, and duplicating multiple properties associated with the same `vector` value. [demo-input-vector-subtype.mp4](/attachments/0f1f16ea-44ed-4eec-8c2c-7b7ad1af9204) # Limitations These properties will be all visible to python. The subtypes have the same display name, for example, both `COLOR` and `COLOR_GAMMA` will display "Color". Also, some subtypes like `AXISANGLE` are 4d vector, but originally the node only supports 3d vector.
Iliya Katushenock added this to the Nodes & Physics project 2023-04-16 18:38:33 +02:00
Weikang-Qiu force-pushed node-subtype from 28c1aa3446 to 393269266d 2023-04-16 21:24:40 +02:00 Compare
Weikang-Qiu added 1 commit 2023-04-19 01:02:29 +02:00
Author
Contributor

Solution changed

Instead of duplicating multiple properties associated with the same data:
Add a callback function to ntype.updatefunc. Add some utilities functions in RNA_access.h (not sure if these functions should be there or somewhere else, but since it is just a demo, I just put them there for now).

# Solution changed Instead of duplicating multiple properties associated with the same data: Add a callback function to `ntype.updatefunc`. Add some utilities functions in `RNA_access.h` (not sure if these functions should be there or somewhere else, but since it is just a demo, I just put them there for now).
Weikang-Qiu force-pushed node-subtype from 4e0e0e0662 to 384d734534 2023-04-19 01:20:35 +02:00 Compare
Iliya Katushenock reviewed 2023-04-19 20:17:04 +02:00
@ -5251,0 +5255,4 @@
{
PointerRNA ptr;
RNA_pointer_create(id, &RNA_Node, data, &ptr);

This is not very practical, because in fact, it cannot be applied to the properties of an object, for example? Is it possible to make property references without statically specifying the structure type? It seems one of the node_layout arguments might be useful. That is, it seems that the update function should do this itself and pass in RNA_property_subtype_set prop as argument?

This is not very practical, because in fact, it cannot be applied to the properties of an object, for example? Is it possible to make property references without statically specifying the structure type? It seems one of the `node_layout` arguments might be useful. That is, it seems that the update function should do this itself and pass in `RNA_property_subtype_set` `prop` as argument?
Weikang-Qiu added 1 commit 2023-04-22 00:52:00 +02:00
Author
Contributor

Update Summary

  1. move the RNA_pointer_create(id, &RNA_Node, data, &ptr); out of the RNA_property_subtype_set to make it more general.

  2. Add a rna_Node_update_individual function to only change the node (prevent from propagating).

# Update Summary 1. move the `RNA_pointer_create(id, &RNA_Node, data, &ptr);` out of the `RNA_property_subtype_set` to make it more general. 2. Add a `rna_Node_update_individual` function to only change the node (prevent from propagating).
This pull request has changes conflicting with the target branch.
  • source/blender/makesrna/RNA_access.h
  • source/blender/makesrna/intern/rna_nodetree.c
  • source/blender/nodes/function/CMakeLists.txt
  • source/blender/nodes/function/nodes/node_fn_input_vector.cc

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u node-subtype:Weikang-Qiu-node-subtype
git checkout Weikang-Qiu-node-subtype
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
2 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#107010
No description provided.