depsgraph object instance 'matrix_world' always returns identity matrix #60580

Closed
opened 2019-01-16 23:18:56 +01:00 by Jonathan Dent · 7 comments

Steps to reproduce:

Open a default scene
Open the Python console, type

for obj in C.depsgraph.object_instances:
    obj.matrix_world

You'll get back three identity matrices:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

This behavior is duplicated in rendering as well.

Steps to reproduce: Open a default scene Open the Python console, type ``` for obj in C.depsgraph.object_instances: obj.matrix_world ``` You'll get back three identity matrices: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 This behavior is duplicated in rendering as well.
Author

Added subscriber: @jdent02

Added subscriber: @jdent02
Member

Added subscribers: @mont29, @lichtwerk

Added subscribers: @mont29, @lichtwerk
Member

Isnt this meant for duplis / instances?
(checking is_instance on ob will tell you if this is the case)

Looking at the code seems to suggest this:

static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float *mat)
{
	BLI_Iterator *iterator = ptr->data;
	DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
	if (deg_iter->dupli_object_current != NULL) {
		copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat);
	}
	else {
		unit_m4((float(*)[4])mat);
	}
}

Not sure if I understand DepsgraphObjectInstance correct though, maybe @mont29 could share his wisdom?

Isnt this meant for duplis / instances? (checking `is_instance` on `ob` will tell you if this is the case) Looking at the code seems to suggest this: ``` static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float *mat) { BLI_Iterator *iterator = ptr->data; DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data; if (deg_iter->dupli_object_current != NULL) { copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat); } else { unit_m4((float(*)[4])mat); } } ``` Not sure if I understand `DepsgraphObjectInstance` correct though, maybe @mont29 could share his wisdom?

This issue was referenced by d86991ef37

This issue was referenced by d86991ef378cb9220dfb8e9e6cbbd734e81de052
Bastien Montagne self-assigned this 2019-01-17 12:32:38 +01:00

This is indeed not a bug, for non-instance items, people should typically only access the 'object' member.

But there is no good reasons (beside very strict consistency) to not fill matrix_world from that object in RNA... This is exact same data for both dupliinstances and objects here (and think it's the only one).

This is indeed not a bug, for non-instance items, people should typically only access the 'object' member. But there is no good reasons (beside very strict consistency) to not fill matrix_world from that object in RNA... This is exact same data for both dupliinstances and objects here (and think it's the only one).

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author

If that’s the case I would suggest you guys update the Python API docs for DepsgraphObjectInstance. As you can see below there’s no indication at all that it only applies to duplis.

matrix_world
Generated transform matrix in world space

Type: float multi-dimensional array of 4 * 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)), (readonly)

If that’s the case I would suggest you guys update the Python API docs for DepsgraphObjectInstance. As you can see below there’s no indication at all that it only applies to duplis. matrix_world Generated transform matrix in world space Type: float multi-dimensional array of 4 * 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0)), (readonly)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#60580
No description provided.