Assignments not working properly for Object.dimensions #31760
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#31760
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
%%%Working:
bpy.context.object.dimensions.z = 5
bpy.context.object.dimensions.xy = (2,2)
bpy.context.object.dimensions.xyz = (3,3,3)
bpy.context.object.dimensions.zxy = (3,5,4)
bpy.context.object.dimensions.zyx = (1,2,3)
bpy.context.object.dimensions.xzy = (7,6,5)
Not working:
bpy.context.object.dimensions.xz = (3,3) --> sets X to 3, Y to 0 and keeps previous Z
bpy.context.object.dimensions.yz = (2,2) --> sets X to 0, Y to 2 and keeps previous Z
bpy.context.object.dimensions.zx = (5,5) --> sets X to 5, Y to 0 and keeps previous Z
Auto-complete suggestion, that do not work: any combination of four like xyzw or duplicates like xzz --> Error not writeable
Furthermore, it's not possible to set dimensions individually (happened in modal func):
bpy.context.object.dimensions.x = 1
bpy.context.object.dimensions.y = 2
bpy.context.object.dimensions.z = 3
Example: run script from attached .blend, move mouse, then hit Esc --> Z will reset, X and Y will be kept%%%
Changed status to: 'Open'
%%%At first glance I would say that "Vector_swizzle_set()" in mathutils_Vector.c does undesired stuff with memcopy.
[the same thing happens not just for "dimensions" but for location as well]
I attached a patch that appears to solve the first part (assigning .xz .yz .zx) though this is just a suggestion
havent looked into assigning .x .y .z though...%%%
%%%separate assignments after each other seem to work if scene gets updates in-between:
but it shouldn't be required imo%%%
%%%First part of the bug is fixed in svn47754 (thanks Philipp for pointing the source of the problem).
The multi-assignement bug (which is specific to dimension) I’m not sure about, let’s see what campbell says (when he has some time free from Mango project ;) ). As a workaround, you can use .scale instead for now…%%%
%%%Hi there.
I also point out this: (ob references an Object)
i run:
ob.dimensions- [x]+=0.5
works
ob.dimensions- [x]+=0.5
ob.dimensions- [x]+=0.5
only last works
ob.dimensions- [x]+=0.5
ob.dimensions- [x]+=0.5
ob.dimensions- [x]+=0.5
only very last works.
the weird is that the problem manifests only from text editor. in python console it works all fine.
Thanks!!
%%%
%%%The problem is that the in order to modify the dimensions correctly, the object matrix needs to be recalculated, which in general needs a full update of the scene. In simple cases it might be possible to do without but with modifiers, dependencies, it's required and setting the dimensions might not even be exact.
The fact that you either need to update them all at once or need to do a scene update I would not consider a bug. The python console can do a scene update between commands but for scripts this would be much too slow. It's strange but remember this is a convenience function to indirectly edit data, it's more intended as a tool for users than scripters.%%%
Changed status from 'Open' to: 'Archived'