The list was populated from the base (unevaluated) object, but now that
Geometry nodes can generate various layers this is impractical..
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Don't know what's really better here, but I've seen CTX_data_active_object and DEG_get_evaluated_object a bit more in contexts like this. Sticking in RNA completely might be better though i suppose.
Also, could you update the diff title (commit message title) to follow the style guide? i.e. category prefix and no longer than 72 characters
| source/blender/nodes/shader/nodes/node_shader_uvmap.cc | ||
|---|---|---|
| 25 | This can stay at the same scope as before. | |
Hmm, thinking about this a bit more, it would probably best to change these nodes too, for consistency:
source/blender/nodes/shader/nodes/node_shader_normal_map.cc: 26: PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); source/blender/nodes/shader/nodes/node_shader_tangent.cc: 29: PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); source/blender/nodes/shader/nodes/node_shader_uvmap.cc: 25: PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); source/blender/nodes/shader/nodes/node_shader_vertex_color.cc: 21: PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
Looks good to me. Don't forget to update the title/description. Adding Brecht as a reviewer to make sure he sees this.
Added 3.5 tag, because it's something which makes the UV as attributes much more useful in geometry nodes.
I don't think the active object is guaranteed to get evaluated by the depsgraph? I think it should fall back to the original object in that case.
I tried to trace through DEG_get_evaluated_id() and as far as I can see it just returns the original id if the depsgraph doesn't return an evaluated id. Since PointerRNA dataptr is always of the OB_MESH type DEG_get_evaluated_rna_pointer() will always use that function (DEG_get_evaluated_id() ).
So I'd think it is not needed?
I'll check it again extra thoroughly tomorrow when a bit more awake. But if it indeed works as described above, do you agree a fallback isn't needed?
Looked it over once again, and the fallback to the original id is already present in blender::deg_get_evaluated_id(...) so I don't think it's needed here.