I'm trying to write a function for my script that will distribute the standard 5 nodes along the x axis, without overlapping.
My current setup looks like this:
for index, node in enumerate((texCoord, mapping, texture, diffuse, output)):
node.location.x = 200.0 * index
This works well, and will separate the nodes equally at 200 px apart, which is fine normally but the mapping node is a little over-sized, and it covers my image texture.
edit: I have tried an if statement, that looked like:
for index, node in enumerate((texCoord, mapping, texture, diffuse, output)):
if node == mapping:
node.location.x = 400.0 * index
else:
node.location.x = 200.0 * index
I also tried adjusting the values, like so:
for index, node in enumerate((texCoord, mapping, texture, diffuse, output)):
if node == mapping:
node.location.x = 100.0 * index
else:
node.location.x = 250.0 * index
But that ends up not moving the texture coordinate enough:
I also tried using a while loop, but that crashes blender.
I feel like there is probably a better way to adjust for this size, but I can't think of anything.