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) {
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 params.user_data()->call_data->operator_data ?
110 TIP_(
"Geometry cannot be retrieved from the edited object itself") :
111 TIP_(
"Geometry cannot be retrieved from the modifier object"));
112 params.set_default_remaining_outputs();
117 if (!object_geometry_evaluated) {
119 TIP_(
"Can't access object's geometry because it's not evaluated yet. "
120 "This can happen when there is a dependency cycle"));
121 params.set_default_remaining_outputs();
125 std::optional<float4x4> geometry_transform;
126 if (transform_space_relative) {
127 if (!self_transform_evaluated || !object_transform_evaluated) {
130 TIP_(
"Can't access object's transforms because it's not evaluated yet. "
131 "This can happen when there is a dependency cycle"));
132 params.set_default_remaining_outputs();
135 geometry_transform = self_object->world_to_object() *
object->object_to_world();
139 if (
params.extract_input<
bool>(
"As Instance")) {
140 std::unique_ptr<bke::Instances> instances = std::make_unique<bke::Instances>();
141 const int handle = instances->add_reference(*
object);
142 if (transform_space_relative) {
143 instances->add_instance(handle, *geometry_transform);
152 if (transform_space_relative) {
157 geometry_set.
name =
object->id.name + 2;
158 params.set_output(
"Geometry", geometry_set);
170 static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
175 "Output the geometry relative to the input object transform, and the location, rotation "
177 "scale relative to the world origin"},
182 "Bring the input object geometry, location, rotation and scale into the modified object, "
183 "maintaining the relative position between the two objects in the scene"},
184 {0,
nullptr, 0,
nullptr,
nullptr},
190 "The transformation of the vector and geometry outputs",
191 rna_node_geometry_object_info_transform_space_items,
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_OBJECT_INFO
bool DEG_object_transform_is_evaluated(const Object &object)
bool DEG_object_geometry_is_evaluated(const Object &object)
T * DEG_get_original(T *id)
@ 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)
BMesh const char void * data
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
GeometrySet object_get_evaluated_geometry_set(const Object &object, bool apply_subdiv=true)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
std::optional< TransformGeometryErrors > transform_geometry(bke::GeometrySet &geometry, const float4x4 &transform)
QuaternionBase< float > Quaternion
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)
MatBase< float, 4, 4 > float4x4
VecBase< float, 3 > float3
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
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()
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
static GeometrySet from_instances(Instances *instances, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)