I am using a Python startup script to add repetitious details to
a scene. Arranging the nodes of the network for a new Cycles material
is cleaner if I know the size of each node as it is created. The height
and width
attributes are not correct, but the dimensions
attribute
is accurate — once it is set up.
What I am looking for is a way to get the dimensions
attribute
updated right after the node is created. (My current workaround
uses a table of node sizes.)
If I run the equivalent of
import bpy mats = bpy.data.materials mat = mats['GlossyGreenMaterial'] nods = mat.node_tree.nodes newNode = nods.new('ShaderNodeBsdfGlossy') newNode.name = 'Glossy BSDF added'
to set up the node and then immediately execute
print('newNode.dimensions: ', newNode.dimensions)
it will display
newNode.dimensions: <Vector(0.0000, 0.0000)>
If I bring up the Node Editor so the node is drawn and then execute the print statement again it provides the expected
newNode.dimensions: <Vector(150.0000, 142.0000)>
Is there some update routine I could call as each node is
added that would cause the dimensions
attribute to be set?
Thanks,
Roy Earle