I am having a simple problem with Blender 2.76b using Python 3.4.2.
I'm trying to change the dimensions (not scale) of a mesh, and then put another object next to it, depending on the new size. However, after changing the dimensions (which works fine, the actual size in the animation changes) it still gives me the original dimensions when called.
add_cube = bpy.ops.mesh.primitive_cube_add add_cube(location=(0,0,0)) actor_name = bpy.context.scene.objects.active.name #randomized size to check if post resize call is working: sizex = random.randint(3,10) sizey = random.randint(3,10) sizez = random.randint(3,10) bpy.data.objects[actor_name].dimensions = (sizex, sizey, sizez) #end of random resize test objdim = bpy.data.objects[actor_name].dimensions print('Actor Dimensions: ', objdim)
A standard cube is (2,2,2) big. When the code runs it changes the object size, but then prints "Vector((2.0, 2.0, 2.0))" when it should be bigger. Putting in static values instead of random numbers produces the same problem.
Running this in the python command line in the scripts window works fine, running from script does not. Am I missing some refresh thing?
Anyone come across this? It's like it's not refreshing the actual dimensions when I call them.