[Bf-blender-cvs] [85f07486e28] temp-geometry-nodes-sample-texture: add texture pointer
Jacques Lucke
noreply at git.blender.org
Tue Dec 15 15:20:30 CET 2020
Commit: 85f07486e284a3be14facb55910e31be57055ede
Author: Jacques Lucke
Date: Tue Dec 15 13:53:53 2020 +0100
Branches: temp-geometry-nodes-sample-texture
https://developer.blender.org/rB85f07486e284a3be14facb55910e31be57055ede
add texture pointer
===================================================================
M source/blender/editors/space_node/drawnode.c
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/nodes/NOD_static_types.h
===================================================================
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index f8c71791054..dc36b2d3788 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3208,6 +3208,13 @@ static void node_geometry_buts_attribute_mix(uiLayout *layout,
uiItemR(col, ptr, "input_type_b", DEFAULT_FLAGS, IFACE_("B"), ICON_NONE);
}
+static void node_geometry_buts_sample_texture(uiLayout *layout,
+ bContext *UNUSED(C),
+ PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "texture", DEFAULT_FLAGS, "", ICON_NONE);
+}
+
static void node_geometry_set_butfunc(bNodeType *ntype)
{
switch (ntype->type) {
@@ -3235,6 +3242,9 @@ static void node_geometry_set_butfunc(bNodeType *ntype)
case GEO_NODE_ATTRIBUTE_MIX:
ntype->draw_buttons = node_geometry_buts_attribute_mix;
break;
+ case GEO_NODE_SAMPLE_TEXTURE:
+ ntype->draw_buttons = node_geometry_buts_sample_texture;
+ break;
}
}
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 153e2aebd22..2bb7b67cd92 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -8481,6 +8481,19 @@ static void def_geo_attribute_mix(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
+static void def_geo_sample_texture(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
+ RNA_def_property_ui_text(prop, "Texture", "Texture to sample values from");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
+}
+
/* -------------------------------------------------------------------------- */
static void rna_def_shader_node(BlenderRNA *brna)
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 346a93e4f56..45d60f071d7 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -279,7 +279,7 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MATH, def_geo_attribute_math, "ATTRIBUT
DefNode(GeometryNode, GEO_NODE_JOIN_GEOMETRY, 0, "JOIN_GEOMETRY", JoinGeometry, "Join Geometry", "")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_FILL, def_geo_attribute_fill, "ATTRIBUTE_FILL", AttributeFill, "Attribute Fill", "")
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MIX, def_geo_attribute_mix, "ATTRIBUTE_MIX", AttributeMix, "Attribute Mix", "")
-DefNode(GeometryNode, GEO_NODE_SAMPLE_TEXTURE, 0, "SAMPLE_TEXTURE", SampleTexture, "Sample Texture", "")
+DefNode(GeometryNode, GEO_NODE_SAMPLE_TEXTURE, def_geo_sample_texture, "SAMPLE_TEXTURE", SampleTexture, "Sample Texture", "")
/* undefine macros */
#undef DefNode
More information about the Bf-blender-cvs
mailing list