mirror of
https://github.com/Relintai/props.git
synced 2024-11-12 10:15:25 +01:00
Processor for PropDataProp.
This commit is contained in:
parent
c76a6c7282
commit
59a874bd68
@ -22,6 +22,9 @@ SOFTWARE.
|
||||
|
||||
#include "prop_data_prop.h"
|
||||
|
||||
#include "../prop_instance.h"
|
||||
#include "prop_data.h"
|
||||
|
||||
Ref<PropData> PropDataProp::get_prop() const {
|
||||
return _prop;
|
||||
}
|
||||
@ -51,6 +54,33 @@ void PropDataProp::_add_textures_into(Ref<TexturePacker> texture_packer) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool PropDataProp::_processor_handles(Node *node) {
|
||||
PropInstance *i = Object::cast_to<PropInstance>(node);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void PropDataProp::_processor_process(Ref<PropData> prop_data, Node *node, const Transform &transform) {
|
||||
PropInstance *i = Object::cast_to<PropInstance>(node);
|
||||
|
||||
ERR_FAIL_COND(!i);
|
||||
|
||||
Ref<PropDataProp> 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);
|
||||
|
@ -49,6 +49,10 @@ public:
|
||||
void _add_textures_into(Ref<TexturePacker> texture_packer);
|
||||
#endif
|
||||
|
||||
bool _processor_handles(Node *node);
|
||||
void _processor_process(Ref<PropData> prop_data, Node *node, const Transform &transform);
|
||||
Node *_processor_get_node_for(const Transform &transform);
|
||||
|
||||
PropDataProp();
|
||||
~PropDataProp();
|
||||
|
||||
|
@ -68,6 +68,9 @@ void register_props_types() {
|
||||
Ref<PropDataLight> light_processor = Ref<PropDataLight>(memnew(PropDataLight));
|
||||
PropUtils::add_processor(light_processor);
|
||||
|
||||
Ref<PropDataProp> prop_processor = Ref<PropDataProp>(memnew(PropDataProp));
|
||||
PropUtils::add_processor(prop_processor);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorPlugins::add_by_type<PropEditorPlugin>();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user