diff --git a/source/blender/makesdna/DNA_node_tree_interface_types.h b/source/blender/makesdna/DNA_node_tree_interface_types.h index 3d9793f7062..7b74396adc4 100644 --- a/source/blender/makesdna/DNA_node_tree_interface_types.h +++ b/source/blender/makesdna/DNA_node_tree_interface_types.h @@ -135,6 +135,7 @@ typedef enum GeometryNodeDefaultInputType { GEO_NODE_DEFAULT_FIELD_INPUT_NORMAL_FIELD = 3, GEO_NODE_DEFAULT_FIELD_INPUT_POSITION_FIELD = 4, GEO_NODE_DEFAULT_FIELD_INPUT_INSTANCE_TRANSFORM_FIELD = 5, + GEO_NODE_DEFAULT_FIELD_INPUT_ROTATION_FIELD = 6, } GeometryNodeDefaultInputType; typedef struct bNodeTreeInterfacePanel { diff --git a/source/blender/makesrna/intern/rna_node_tree_interface.cc b/source/blender/makesrna/intern/rna_node_tree_interface.cc index 394cb29bc23..799f9c00452 100644 --- a/source/blender/makesrna/intern/rna_node_tree_interface.cc +++ b/source/blender/makesrna/intern/rna_node_tree_interface.cc @@ -456,6 +456,14 @@ static const EnumPropertyItem *rna_NodeTreeInterfaceSocket_default_input_itemf( N_("Transformation of each instance from the geometry context")}; RNA_enum_item_add(&items, &items_count, &instance_transform); } + else if (type->type == SOCK_ROTATION) { + const EnumPropertyItem rotation{GEO_NODE_DEFAULT_FIELD_INPUT_ROTATION_FIELD, + "ROTATION", + 0, + N_("Rotation"), + N_("The rotation from the context")}; + RNA_enum_item_add(&items, &items_count, &rotation); + } } RNA_enum_item_end(&items, &items_count); diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh index 178b698e9ef..c8bf7db83d5 100644 --- a/source/blender/nodes/NOD_node_declaration.hh +++ b/source/blender/nodes/NOD_node_declaration.hh @@ -602,6 +602,7 @@ void normal(const bNode &node, void *r_value); void index(const bNode &node, void *r_value); void id_or_index(const bNode &node, void *r_value); void instance_transform(const bNode &node, void *r_value); +void rotation(const bNode &node, void *r_value); } // namespace implicit_field_inputs void build_node_declaration(const bke::bNodeType &typeinfo, diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index 5d157cf82c3..54c3fccce1e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -31,7 +31,9 @@ static void node_declare(NodeDeclarationBuilder &b) .description( "Index of the instance used for each point. This is only used when Pick Instances " "is on. By default the point index is used"); - b.add_input("Rotation").field_on({0}).description("Rotation of the instances"); + b.add_input("Rotation") + .implicit_field_on(implicit_field_inputs::rotation, {0}) + .description("Rotation of the instances"); b.add_input("Scale") .default_value({1.0f, 1.0f, 1.0f}) .subtype(PROP_XYZ) @@ -200,7 +202,8 @@ static void node_geo_exec(GeoNodeExecParams params) const Array types{GeometryComponent::Type::Mesh, GeometryComponent::Type::PointCloud, - GeometryComponent::Type::Curve}; + GeometryComponent::Type::Curve, + GeometryComponent::Type::Physics}; Map attributes_to_propagate; geometry_set.gather_attributes_for_propagation(types, diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index 66175ec2a11..ce865f2646f 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -457,6 +457,11 @@ static void set_default_input_field(const bNodeTreeInterfaceSocket &input, Socke implicit_field_inputs::instance_transform); decl.hide_value = true; } + else if (decl.socket_type == SOCK_ROTATION) { + decl.implicit_input_fn = std::make_unique( + implicit_field_inputs::rotation); + decl.hide_value = true; + } } void node_group_declare(NodeDeclarationBuilder &b) diff --git a/source/blender/nodes/intern/node_declaration.cc b/source/blender/nodes/intern/node_declaration.cc index df2c2c874b2..a2a8bd275d5 100644 --- a/source/blender/nodes/intern/node_declaration.cc +++ b/source/blender/nodes/intern/node_declaration.cc @@ -6,6 +6,7 @@ #include "NOD_socket_declarations.hh" #include "NOD_socket_declarations_geometry.hh" +#include "BLI_math_quaternion_types.hh" #include "BLI_stack.hh" #include "BLI_utildefines.h" @@ -870,6 +871,12 @@ void instance_transform(const bNode & /*node*/, void *r_value) bke::SocketValueVariant(bke::AttributeFieldInput::Create("instance_transform")); } +void rotation(const bNode & /*node*/, void *r_value) +{ + new (r_value) + bke::SocketValueVariant(bke::AttributeFieldInput::Create("rotation")); +} + } // namespace implicit_field_inputs } // namespace blender::nodes