I was trying to scale a bunch of objects with a script and I tried this line on the console :
thing.scale= Vector((1, 1, 1))
It works fine and set the scale of the object to 1 but then I tried to use the same code in a loop on the text editor and I got an error saying that Vector
is not defined :
Python: Traceback (most recent call last):
File "E:\w3D-mqbaka\Mobiverse\looop__\f_cking_modif\08.blend\scale_the_big_ones.py", line 6, in <module>
NameError: name 'Vector' is not defined
This is the code I tried to run :
import bpy;
visible_objects=[ob for ob in bpy.context.view_layer.objects if (ob.visible_get() and ob.type== 'MESH')];
for stuff in visible_objects:
stuff.scale= Vector((1, 1, 1));#reset scale
if (stuff.dimensions.z >= 0.3):
stuff.scale= Vector((1/stuff.dimension.z, 1/stuff.dimension.z, 1/stuff.dimension.z));
stuf.scale= Vector((1/3, 1/3, 1/3));
My question is not how to makie the code working since I know that I can just remplace Vector((1, 1, 1))
by (1, 1, 1)
and the code will run with the expected outcome.
My question is why is Vector
running on the console and not on the text editor?