利用者:Phonybone/Python Nodes/API changes
Changes in the bpy Python API by the pynodes branch
- Node identifiers have been changed. A node type now uses the same identifier string as the associated RNA type, instead of the upper-case enum identifiers. These strings are used when adding trees, nodes or sockets using bpy.data.node_groups.new, nodetree.nodes.new or node.inputs.new/node.outputs.new respectively.
- Examples:
Node Trees: | ||
bpy.data.node_groups.new('SHADER') | -> | bpy.data.node_groups.new('ShaderNodeTree') |
Nodes: | ||
nodetree.nodes.new(type='OUTPUT_MATERIAL') | -> | nodetree.nodes.new(type='ShaderNodeOutputMaterial') |
nodetree.nodes.new(type='BSDF_GLASS') | -> | nodetree.nodes.new(type='ShaderNodeBsdfGlass') |
nodetree.nodes.new(type='PIXELATE') | -> | nodetree.nodes.new(type='CompositorNodePixelate') |
WARNING!
The node.type property still returns the old enum identifiers. This is necessary for compatibility scripts, but using the 'type' property is generally discouraged. To get the actual identifier of a node type use node.bl_idname
|