35 "Output the entire object as single instance. "
36 "This allows instancing non-geometry object types");
39 "Transformation matrix containing the location, rotation and scale of the object");
60 if (
object ==
nullptr) {
61 params.set_default_remaining_outputs();
70 bool show_transform_error =
false;
71 if (transform_space_relative) {
72 if (self_transform_evaluated && object_transform_evaluated) {
73 output_transform = self_object->world_to_object() *
object->object_to_world();
76 show_transform_error =
true;
80 if (object_transform_evaluated) {
81 output_transform =
object->object_to_world();
84 show_transform_error =
true;
87 if (show_transform_error) {
89 NodeWarningType::Error,
90 TIP_(
"Can't access object's transforms because it's not evaluated yet. "
91 "This can happen when there is a dependency cycle"));
97 params.set_output(
"Location", location);
98 params.set_output(
"Rotation", rotation);
99 params.set_output(
"Scale", scale);
100 params.set_output(
"Transform", output_transform);
102 if (!
params.output_is_required(
"Geometry")) {
109 NodeWarningType::Error,
110 params.user_data()->call_data->operator_data ?
111 TIP_(
"Geometry cannot be retrieved from the edited object itself") :
112 TIP_(
"Geometry cannot be retrieved from the modifier object"));
113 params.set_default_remaining_outputs();
118 if (!object_geometry_evaluated) {
119 params.error_message_add(NodeWarningType::Error,
120 TIP_(
"Can't access object's geometry because it's not evaluated yet. "
121 "This can happen when there is a dependency cycle"));
122 params.set_default_remaining_outputs();
126 std::optional<float4x4> geometry_transform;
127 if (transform_space_relative) {
128 if (!self_transform_evaluated || !object_transform_evaluated) {
130 NodeWarningType::Error,
131 TIP_(
"Can't access object's transforms because it's not evaluated yet. "
132 "This can happen when there is a dependency cycle"));
133 params.set_default_remaining_outputs();
136 geometry_transform = self_object->world_to_object() *
object->object_to_world();
140 if (
params.get_input<
bool>(
"As Instance")) {
141 std::unique_ptr<bke::Instances> instances = std::make_unique<bke::Instances>();
142 const int handle = instances->add_reference(*
object);
143 if (transform_space_relative) {
144 instances->add_instance(handle, *geometry_transform);
153 if (transform_space_relative) {
158 geometry_set.
name =
object->id.name + 2;
159 params.set_output(
"Geometry", geometry_set);
166 node->storage =
data;
171 static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
176 "Output the geometry relative to the input object transform, and the location, rotation "
178 "scale relative to the world origin"},
183 "Bring the input object geometry, location, rotation and scale into the modified object, "
184 "maintaining the relative position between the two objects in the scene"},
185 {0,
nullptr, 0,
nullptr,
nullptr},
191 "The transformation of the vector and geometry outputs",
192 rna_node_geometry_object_info_transform_space_items,
#define NODE_STORAGE_FUNCS(StorageT)
bool DEG_object_transform_is_evaluated(const Object &object)
ID * DEG_get_original_id(ID *id)
bool DEG_object_geometry_is_evaluated(const Object &object)
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
Object is a sort of wrapper for general info.
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void rna_Node_update_relations(Main *bmain, Scene *scne, PointerRNA *ptr)
#define NOD_storage_enum_accessors(member)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
local_group_size(16, 16) .push_constant(Type b
GeometrySet object_get_evaluated_geometry_set(const Object &object)
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
std::optional< TransformGeometryErrors > transform_geometry(bke::GeometrySet &geometry, const float4x4 &transform)
void to_loc_rot_scale_safe(const MatBase< T, 4, 4 > &mat, VecBase< T, 3 > &r_location, RotationT &r_rotation, VecBase< T, 3 > &r_scale)
static void node_register()
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_rna(StructRNA *srna)
static void node_geo_exec(GeoNodeExecParams params)
static void node_node_init(bNodeTree *, bNode *node)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
static MatBase identity()
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare