mirror of
https://github.com/Relintai/mesh_data_resource.git
synced 2024-11-12 10:15:21 +01:00
Updated the 2d PropDataEntry. Also registered it to the Prop2D singleton.
This commit is contained in:
parent
4d73bb78ea
commit
befd0071b6
@ -69,31 +69,38 @@ bool Prop2DDataMeshData::_processor_handles(Node *node) {
|
||||
return i;
|
||||
}
|
||||
|
||||
void Prop2DDataMeshData::_processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform) {
|
||||
void Prop2DDataMeshData::_processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform, Ref<Prop2DDataEntry> entry) {
|
||||
MeshDataInstance *i = Object::cast_to<MeshDataInstance>(node);
|
||||
|
||||
ERR_FAIL_COND(!i);
|
||||
|
||||
Ref<Prop2DDataMeshData> m;
|
||||
m.instance();
|
||||
|
||||
if (entry.is_valid()) {
|
||||
m = entry;
|
||||
} else {
|
||||
m.instance();
|
||||
}
|
||||
|
||||
m->set_mesh(i->get_mesh_data());
|
||||
m->set_texture(i->get_texture());
|
||||
//m->set_transform(transform * i->get_transform());
|
||||
prop_data->add_prop(m);
|
||||
|
||||
Prop2DDataEntry::_processor_process(prop_data, node, transform, m);
|
||||
}
|
||||
|
||||
Node *Prop2DDataMeshData::_processor_get_node_for(const Transform2D &transform) {
|
||||
MeshDataInstance *i = memnew(MeshDataInstance);
|
||||
Node *Prop2DDataMeshData::_processor_get_node_for(const Transform2D &transform, Node *node) {
|
||||
MeshDataInstance *i = nullptr;
|
||||
|
||||
Ref<SpatialMaterial> m;
|
||||
m.instance();
|
||||
if (!node) {
|
||||
i = memnew(MeshDataInstance);
|
||||
} else {
|
||||
i = Object::cast_to<MeshDataInstance>(node);
|
||||
}
|
||||
|
||||
i->set_material(m);
|
||||
i->set_texture(get_texture());
|
||||
i->set_mesh_data(get_mesh());
|
||||
//i->set_transform(get_transform());
|
||||
|
||||
return i;
|
||||
return Prop2DDataEntry::_processor_get_node_for(transform, i);
|
||||
}
|
||||
|
||||
Prop2DDataMeshData::Prop2DDataMeshData() {
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
#endif
|
||||
|
||||
bool _processor_handles(Node *node);
|
||||
void _processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform);
|
||||
Node *_processor_get_node_for(const Transform2D &transform);
|
||||
void _processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform2D &transform, Ref<Prop2DDataEntry> entry = Ref<Prop2DDataEntry>());
|
||||
Node *_processor_get_node_for(const Transform2D &transform, Node *node = nullptr);
|
||||
|
||||
Prop2DDataMeshData();
|
||||
~Prop2DDataMeshData();
|
||||
|
@ -39,6 +39,11 @@ SOFTWARE.
|
||||
#include "props/prop_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
#if PROPS_2D_PRESENT
|
||||
#include "../props_2d/singleton/prop_2d_utils.h"
|
||||
#include "props_2d/prop_2d_data_mesh_data.h"
|
||||
#endif
|
||||
|
||||
void register_mesh_data_resource_types() {
|
||||
ClassDB::register_class<MeshDataResource>();
|
||||
ClassDB::register_class<MeshDataResourceCollection>();
|
||||
@ -51,6 +56,12 @@ void register_mesh_data_resource_types() {
|
||||
PropUtils::add_processor(processor);
|
||||
#endif
|
||||
|
||||
#if PROPS_2D_PRESENT
|
||||
ClassDB::register_class<Prop2DDataMeshData>();
|
||||
Ref<Prop2DDataMeshData> prop_2d_processor = Ref<Prop2DDataMeshData>(memnew(Prop2DDataMeshData));
|
||||
Prop2DUtils::add_processor(prop_2d_processor);
|
||||
#endif
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorPlugins::add_by_type<EditorPluginColladaMdr>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user