Duplicate Objects Positions in Preview are wrong

So, I have searched for this for awhile now and I have yet to find a good answer…

Here’s the steps to re-creating my problem:

  1. Blevder v2.68

  2. Have a cube in the scene then duplicate (instance) it via alt+D

  3. Attempt to edit one of the instances location via the menu you can pull up with N (Result: does not move the preview, but the render of the scene renders the new position correctly)

  4. Attempt to edit the location of the instance with a python script:

import bpy


print()
print(bpy.context.scene.objects.active)
print(bpy.context.scene.objects.active.location)


location = bpy.context.scene.objects.active.location

location.x = 10
location.y = 15
location.z = 10

bpy.context.scene.objects.active.location = location


bpy.context.scene.update()


print(bpy.context.scene.objects.active.location)
print(bpy.context.scene.objects.active.matrix_basis)
print(bpy.context.scene.objects.active.matrix_local)
print(bpy.context.scene.objects.active.matrix_world)

Result: Preview still does not move, and rendering the scene does render it in the correct location. The printed matrices show that the basis is calculated correctly, but the world transform never updates properly even with an explicit call to update.

This is driving me nuts. Am I missing something about duplicates/instances that I should know about in blender?

Thanks for any help/time on this matter.

-Din

Well, not sure how active this forum is or when to expect some feedback, so just to make sure: If my question is too ambiguous or needs some clarification in some way, just let me know and I’ll add any additional information you may need to help me figure this out.

There is also the possibility it is a version or platform issue. So it would help if anyone would let me know if it works just fine on theirs and provide the OS of their computer and the version of blender they are using. It may be worth my time to downgrade my blender version to get this working as it is an integral part of my pipeline.

It’s strange, I’ve tried to reproduce your issue and everything worked perfectly.

Just one thing, when you type this :


location = bpy.context.scene.objects.active.location

location is not a copy of your active object, it’s a reference. So, when changing its values, you’re changing the location of your active object. If you comment this line :


bpy.context.scene.objects.active.location = location

The result will be the same.
If you want to copy the location data, you have to type :


location = bpy.context.scene.objects.active.location.copy()

Hope it helps !

Thanks for replying. Were you running the same version of blender that I was? I can’t remember if I was on 32 or 64 bit…might have something to do with it. I’m getting closer into the project when this will be a huge problem.

Let me know what version you’re running and I’ll try to install it and see if it fixes my issue. Currently it’s just wasting my little time, but later the issue will hurt more than that :S