Page MenuHome

Object.dimensions doesn't support shortshands (e.g. *=)
Closed, ArchivedPublic

Description

--- Blender version with error, and version that worked ---
r60402


--- Steps for others to reproduce the error (preferably based on attached .blend file) ---

bpy.context.object.dimensions = bpy.context.object.dimensions * 3 # works
bpy.context.object.dimensions *= 3 # does nothing

Details

Type
Bug

Event Timeline

Guess that one is for Campbell too… ;)

Whats happening is 'dimensions' works in quite a strange way.

Dimensions reads from the object matrix, but sets the object scale.
So writing if the vector is set, then immediately read, the read value will remain unchanged.

This causes a problem for in-place multiplication since the vector is written to once for the in place multiplication, but read again for the attribute assignment.

Attached a workaround when skips the assignment if an RNA variable is assigned to its self, however I don't think its acceptable.

IMHO dimensions shouldn't even be an RNA attribute, it was only added for the interface and has problems with the order values are set in too - perhaps this could be redone in C and the rna attribute removed.

This is weak design on blenders part, but not going to change, I would say fix is to remove dimensions but probably this would annoy script authors too.

closing (wontfix)