Geometry Nodes: use texture socket in Attribute Sample Texture node
There is a new Texture data-block socket that we can use in Geometry Nodes now. This commit replaces the texture property of a node and gives it a texture input socket instead. That increases flexibility. The texture socket still has some limitations that will be lifted in the next couple of days (e.g. it's not supported by the switch node and cannot be exposed the a modifier yet). Differential Revision: https://developer.blender.org/D11222
This commit is contained in:
@@ -281,7 +281,7 @@ DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MIX, def_geo_attribute_mix, "ATTRIBUTE_
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_PROXIMITY, def_geo_attribute_proximity, "ATTRIBUTE_PROXIMITY", AttributeProximity, "Attribute Proximity", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_RANDOMIZE, def_geo_attribute_randomize, "ATTRIBUTE_RANDOMIZE", AttributeRandomize, "Attribute Randomize", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_REMOVE, 0, "ATTRIBUTE_REMOVE", AttributeRemove, "Attribute Remove", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE, def_geo_attribute_sample_texture, "ATTRIBUTE_SAMPLE_TEXTURE", AttributeSampleTexture, "Attribute Sample Texture", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE, 0, "ATTRIBUTE_SAMPLE_TEXTURE", AttributeSampleTexture, "Attribute Sample Texture", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_SEPARATE_XYZ, def_geo_attribute_separate_xyz, "ATTRIBUTE_SEPARATE_XYZ", AttributeSeparateXYZ, "Attribute Separate XYZ", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_TRANSFER, def_geo_attribute_transfer, "ATTRIBUTE_TRANSFER", AttributeTransfer, "Attribute Transfer", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_VECTOR_MATH, def_geo_attribute_vector_math, "ATTRIBUTE_VECTOR_MATH", AttributeVectorMath, "Attribute Vector Math", "")
|
||||
|
@@ -30,6 +30,7 @@
|
||||
|
||||
static bNodeSocketTemplate geo_node_attribute_sample_texture_in[] = {
|
||||
{SOCK_GEOMETRY, N_("Geometry")},
|
||||
{SOCK_TEXTURE, N_("Texture")},
|
||||
{SOCK_STRING, N_("Mapping")},
|
||||
{SOCK_STRING, N_("Result")},
|
||||
{-1, ""},
|
||||
@@ -40,13 +41,6 @@ static bNodeSocketTemplate geo_node_attribute_sample_texture_out[] = {
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
static void geo_node_attribute_sample_texture_layout(uiLayout *layout,
|
||||
bContext *C,
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
uiTemplateID(layout, C, ptr, "texture", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr);
|
||||
}
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
static AttributeDomain get_result_domain(const GeometryComponent &component,
|
||||
@@ -71,8 +65,7 @@ static AttributeDomain get_result_domain(const GeometryComponent &component,
|
||||
|
||||
static void execute_on_component(GeometryComponent &component, const GeoNodeExecParams ¶ms)
|
||||
{
|
||||
const bNode &node = params.node();
|
||||
Tex *texture = reinterpret_cast<Tex *>(node.id);
|
||||
Tex *texture = params.get_input<Tex *>("Texture");
|
||||
if (texture == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -144,6 +137,5 @@ void register_node_type_geo_sample_texture()
|
||||
node_type_socket_templates(
|
||||
&ntype, geo_node_attribute_sample_texture_in, geo_node_attribute_sample_texture_out);
|
||||
ntype.geometry_node_execute = blender::nodes::geo_node_attribute_sample_texture_exec;
|
||||
ntype.draw_buttons = geo_node_attribute_sample_texture_layout;
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
Reference in New Issue
Block a user