1

I'm Creating some nodes through python script. The problem is that all the nodes are overlapping each over. I just wanna programatically re position those nodes. How to do this?

 imgtx1 = nodes.new('ShaderNodeTexImage')
 imgtx2 = nodes.new('ShaderNodeTexImage')

Just consider these 2 nodes as of now. Thanks in advance!

youhsia
  • 35
  • 4

1 Answers1

5

Every node has it's own size/location properties that are accessible in the node itself.

import bpy
from mathutils import Vector

imgtx1 = nodes.new('ShaderNodeTexImage')
imgtx2 = nodes.new('ShaderNodeTexImage')

#location
imgtx1.location = Vector((200.0, 400.0))

#or
imgtx2.location.x = 100
imgtx2.location.y = 200

#size
# only width changes are allowed within the values of 
# node.bl_width_min and node.bl_width_max
imgtx2.width = 200
imgtx2.width_hidden = 100
Secrop
  • 3,576
  • 19
  • 20