'settings' argument for operators is undocumented in the API #77860
Labels
No Label
Meta
Good First Issue
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 & Devices
Module
Python API
Module
Rendering & Cycles
Module
Sculpt, Paint & Texture
Module
User Interface
Module
VFX & Video
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Information 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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-manual#77860
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 442.59
Blender Version
Broken: version: 2.90.0 Alpha, branch: master, commit date: 2020-06-12 13:44, hash:
blender/blender@326db1b7cd
Worked: n/a
Short description of error
There doesn't seem to be any API documentation (as far as I am aware) for the
settings
argument that some operators can be provided with.For example, the
node.add_node
operator lists its arguments (in the Python Console) astype=""
,use_transform=False
andsettings=- [ ]
however, it is never explained (either in Blender or online) how thesettings
argument works and what it expects.Through my own digging in the source code I was able to find that it expects a list dictionaries containing a
name
andvalue
keys e.g.:This adds the node and changes its operation to 'Square Root' when adding a math node (though again, I had to guess that the
SQRT
needed an extra set of quotes to get theeval
to work correctly).Added subscriber: @RayMairlot
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscribers: @Blendify, @rjg
The [Blender API docs ]] aren't ideal in this case. It merely states that it expects a
bpy_prop_collection
ofNodeSettings
and has a link that points to the node.py file. TheNodeSettings
should be documented, but currently aren't, to explain the key value format. The options cannot be documented foradd_node
directly, because they vary depending on thetype
argument. Therefore you need to look at the type of node you want to create, in order to find the name of the properties and the allowed values. For instance [ https:*docs.blender.org/api/current/bpy.types.ShaderNodeMath.html | bpy.types.ShaderNodeMath with"operation"
and"SQRT"
. This should also be explained in the description ofNodeSettings
.cc @Blendify
Edit: I was too slow ;)
Added subscriber: @ideasman42
Note that this operator is only meant to be used from the interface,
if you're adding nodes from Python, you're best off to use
tree.nodes.new
.Documentation for this operator should probably mention this.