I recently stumbled upon the following problem of the data/context object API layer. If one changes object values which are accessed by the scripting with

D.objects["MyObject"].location[0] = -3

This works mighty fine. The object moves to -3. If one has a big, heavy object, the transformation is - understandably - delayed. However, if I want to perform another operation which is dependent on the new location, i don't get any access to a return value.

I tried with the bpy.ops.transform API layer but that does only work when the cursor is in the right window. I tried overriding the Execution Context, as in https://blender.stackexchange.com/a/6105/107059

The bpy.ops' return value {'FINISHED'} is something that comes in very handy. I need a functionality similar to this with the objects.location attributes (NOT calling any bpy.ops stuff...)

Is there any way to check if a direct transformation is finished or is this impossible? I tried something along the lines of:

old_loc = D.objects["MyObject"].location[0]
D.objects["MyObject"].location[0] = -3
while old_loc == D.objects["MyObject"].location[0]:

But that will result in an endless loop. Also updating the view before performing the new transformation did not do anything. I basically need a thread-lock for the function.

Thanks for any hint or help in advance


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.