35 const bool is_geometry =
b.tree_or_null() ?
b.tree_or_null()->type ==
NTREE_GEOMETRY :
true;
39 "Output the entire object as single instance. "
40 "This allows instancing non-geometry object types")
41 .available(is_geometry);
44 "Transformation matrix containing the location, rotation and scale of the object");
62 const bool transform_space_relative = (
storage.transform_space ==
68 if (
object ==
nullptr) {
78 bool show_transform_error =
false;
79 if (transform_space_relative) {
80 if (self_transform_evaluated && object_transform_evaluated) {
81 output_transform = self_object->world_to_object() *
object->object_to_world();
84 show_transform_error =
true;
88 if (object_transform_evaluated) {
89 output_transform =
object->object_to_world();
92 show_transform_error =
true;
95 if (show_transform_error) {
98 TIP_(
"Cannot access object's transforms because it's not evaluated yet. "
99 "This can happen when there is a dependency cycle"));
108 params.
set_output(
"Transform"_ustr, output_transform);
118 TIP_(
"Geometry cannot be retrieved from the edited object itself") :
119 TIP_(
"Geometry cannot be retrieved from the modifier object"));
125 if (!object_geometry_evaluated) {
128 TIP_(
"Cannot access object's geometry because it's not evaluated yet. "
129 "This can happen when there is a dependency cycle"));
134 std::optional<float4x4> geometry_transform;
135 if (transform_space_relative) {
136 if (!self_transform_evaluated || !object_transform_evaluated) {
139 TIP_(
"Cannot access object's transforms because it's not evaluated yet. "
140 "This can happen when there is a dependency cycle"));
144 geometry_transform = self_object->world_to_object() *
object->object_to_world();
149 auto instances = std::make_unique<bke::Instances>(1);
150 instances->reference_handles_for_write().first() = instances->add_reference(*
object);
151 if (transform_space_relative) {
152 instances->transforms_for_write().first() = *geometry_transform;
161 if (transform_space_relative) {
167 params.
set_output(
"Geometry"_ustr, geometry_set);
230 static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = {
235 "Output the geometry relative to the input object transform, and the location, rotation "
237 "scale relative to the world origin"},
242 "Bring the input object geometry, location, rotation and scale into the modified object, "
243 "maintaining the relative position between the two objects in the scene"},
244 {0,
nullptr, 0,
nullptr,
nullptr},
250 "The transformation of the vector and geometry outputs",
251 rna_node_geometry_object_info_transform_space_items,
264 static Set<UString> skip_socket_identifiers = {
"As Instance"_ustr,
"Geometry"_ustr};
#define NODE_STORAGE_FUNCS(StorageT)
#define GEO_NODE_OBJECT_INFO
Object is a sort of wrapper for general info.
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
NodeOperation(Context &context, const bNode &node)
Result & get_result(StringRef identifier)
void allocate_default_remaining_outputs()
Result & get_input(StringRef identifier) const
bool should_compute() const
void set_single_value(const T &value)
void allocate_single_value()
const T & get_single_value() const
const bNodeTree & node_tree() const
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
GeoNodesUserData * user_data() const
bool output_is_required(const UString identifier) const
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
const Object * self_object() const
NodeOperation(Context &context, const bNode &node)
#define storage(slot, qualifiers)
float3x3 scale(float3x3 mat, float2 scale)
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 NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_gather_link_searches(nodes::GatherLinkSearchOpParams ¶ms)
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static void node_rna(StructRNA *srna)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_geo_exec(GeoNodeExecParams params)
static void node_node_init(bNodeTree *, bNode *node)
void search_link_ops_for_basic_node(GatherLinkSearchOpParams ¶ms)
void search_filtered_link_ops_for_basic_node(GatherLinkSearchOpParams ¶ms, const Set< UString > &skip_socket_identifiers)
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)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool DEG_object_transform_is_evaluated(const Object &object)
BMesh const char void * data
void rna_Node_update_relations(Main *bmain, Scene *scne, PointerRNA *ptr)
@ GEO_NODE_TRANSFORM_SPACE_ORIGINAL
@ GEO_NODE_TRANSFORM_SPACE_RELATIVE
T * DEG_get_original(T *id)
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
bool DEG_object_geometry_is_evaluated(const Object &object)
void geo_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
static MatBase identity()
void set_name(std::string name)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
GeoNodesOperatorData * operator_data
const GeoNodesCallData * call_data
static GeometrySet from_instances(std::unique_ptr< Instances > instances)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)