Shader Nodes: Use layers from evaluated mesh
The list was populated from the base (unevaluated) object, but now that Geometry nodes can generate various layers this is impractical.. Differential Revision: https://developer.blender.org/D17093
This commit is contained in:
parent
ef39d85d7c
commit
a42f307915
|
@ -6,6 +6,8 @@
|
|||
#include "BKE_context.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
|
@ -26,7 +28,11 @@ static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRN
|
|||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
PointerRNA eval_obptr;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
DEG_get_evaluated_rna_pointer(depsgraph, &obptr, &eval_obptr);
|
||||
PointerRNA dataptr = RNA_pointer_get(&eval_obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
|
@ -29,7 +31,11 @@ static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *
|
|||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
PointerRNA eval_obptr;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
DEG_get_evaluated_rna_pointer(depsgraph, &obptr, &eval_obptr);
|
||||
PointerRNA dataptr = RNA_pointer_get(&eval_obptr, "data");
|
||||
uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
|
@ -25,7 +27,11 @@ static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *pt
|
|||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
PointerRNA eval_obptr;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
DEG_get_evaluated_rna_pointer(depsgraph, &obptr, &eval_obptr);
|
||||
PointerRNA dataptr = RNA_pointer_get(&eval_obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
|
@ -20,8 +22,11 @@ static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, Pointer
|
|||
{
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
PointerRNA eval_obptr;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
DEG_get_evaluated_rna_pointer(depsgraph, &obptr, &eval_obptr);
|
||||
PointerRNA dataptr = RNA_pointer_get(&eval_obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "layer_name", &dataptr, "color_attributes", "", ICON_GROUP_VCOL);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue