diff --git a/props/prop_data_prop.cpp b/props/prop_data_prop.cpp index abdeb5c..92e477b 100644 --- a/props/prop_data_prop.cpp +++ b/props/prop_data_prop.cpp @@ -22,6 +22,9 @@ SOFTWARE. #include "prop_data_prop.h" +#include "../prop_instance.h" +#include "prop_data.h" + Ref PropDataProp::get_prop() const { return _prop; } @@ -51,6 +54,33 @@ void PropDataProp::_add_textures_into(Ref texture_packer) { } #endif +bool PropDataProp::_processor_handles(Node *node) { + PropInstance *i = Object::cast_to(node); + + return i; +} + +void PropDataProp::_processor_process(Ref prop_data, Node *node, const Transform &transform) { + PropInstance *i = Object::cast_to(node); + + ERR_FAIL_COND(!i); + + Ref l; + l.instance(); + l->set_prop(i->get_prop_data()); + l->set_transform(transform * i->get_transform()); + prop_data->add_prop(l); +} + +Node *PropDataProp::_processor_get_node_for(const Transform &transform) { + PropInstance *i = memnew(PropInstance); + + i->set_prop_data(get_prop()); + i->set_transform(get_transform()); + + return i; +} + PropDataProp::PropDataProp() { _snap_to_mesh = false; _snap_axis = Vector3(0, 1, 0); diff --git a/props/prop_data_prop.h b/props/prop_data_prop.h index 97b33ee..3128913 100644 --- a/props/prop_data_prop.h +++ b/props/prop_data_prop.h @@ -49,6 +49,10 @@ public: void _add_textures_into(Ref texture_packer); #endif + bool _processor_handles(Node *node); + void _processor_process(Ref prop_data, Node *node, const Transform &transform); + Node *_processor_get_node_for(const Transform &transform); + PropDataProp(); ~PropDataProp(); diff --git a/register_types.cpp b/register_types.cpp index 7bbcd3c..5502e82 100644 --- a/register_types.cpp +++ b/register_types.cpp @@ -68,6 +68,9 @@ void register_props_types() { Ref light_processor = Ref(memnew(PropDataLight)); PropUtils::add_processor(light_processor); + Ref prop_processor = Ref(memnew(PropDataProp)); + PropUtils::add_processor(prop_processor); + #ifdef TOOLS_ENABLED EditorPlugins::add_by_type(); #endif