diff --git a/modules/props/doc_classes/PropMergeGroup.xml b/modules/props/doc_classes/PropMergeGroup.xml
index 4046741cd..d94367943 100644
--- a/modules/props/doc_classes/PropMergeGroup.xml
+++ b/modules/props/doc_classes/PropMergeGroup.xml
@@ -7,7 +7,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/props/prop_merge_group.cpp b/modules/props/prop_merge_group.cpp
index 4c89679ea..6fbb415c8 100644
--- a/modules/props/prop_merge_group.cpp
+++ b/modules/props/prop_merge_group.cpp
@@ -31,10 +31,72 @@
#include "prop_merge_group.h"
+#include "scene/resources/material/material.h"
+
+//Materials
+Ref PropMergeGroup::material_get(const int index) {
+ ERR_FAIL_INDEX_V(index, _materials.size(), Ref(NULL));
+
+ return _materials[index];
+}
+
+void PropMergeGroup::material_add(const Ref &value) {
+ ERR_FAIL_COND(!value.is_valid());
+
+ _materials.push_back(value);
+}
+
+int PropMergeGroup::material_get_num() const {
+ return _materials.size();
+}
+
+void PropMergeGroup::materials_clear() {
+ _materials.clear();
+}
+
+Vector PropMergeGroup::materials_get() {
+ Vector r;
+ for (int i = 0; i < _materials.size(); i++) {
+ r.push_back(_materials[i].get_ref_ptr());
+ }
+ return r;
+}
+
+void PropMergeGroup::materials_set(const Vector &materials) {
+ _materials.clear();
+
+ for (int i = 0; i < materials.size(); i++) {
+ Ref material = Ref(materials[i]);
+
+ _materials.push_back(material);
+ }
+}
+
+bool PropMergeGroup::get_is_merger() {
+ return _is_merger;
+}
+void PropMergeGroup::set_is_merger(bool value) {
+ _is_merger = value;
+}
+
PropMergeGroup::PropMergeGroup() {
+ _is_merger = false;
}
PropMergeGroup::~PropMergeGroup() {
}
void PropMergeGroup::_bind_methods() {
+ ///Materials
+ ClassDB::bind_method(D_METHOD("material_get", "index"), &PropMergeGroup::material_get);
+ ClassDB::bind_method(D_METHOD("material_add", "value"), &PropMergeGroup::material_add);
+ ClassDB::bind_method(D_METHOD("material_get_num"), &PropMergeGroup::material_get_num);
+ ClassDB::bind_method(D_METHOD("materials_clear"), &PropMergeGroup::materials_clear);
+
+ ClassDB::bind_method(D_METHOD("materials_get"), &PropMergeGroup::materials_get);
+ ClassDB::bind_method(D_METHOD("materials_set"), &PropMergeGroup::materials_set);
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "materials", PROPERTY_HINT_NONE, "23/20:Material", PROPERTY_USAGE_DEFAULT, "Material"), "materials_set", "materials_get");
+
+ ClassDB::bind_method(D_METHOD("get_is_merger"), &PropMergeGroup::get_is_merger);
+ ClassDB::bind_method(D_METHOD("set_is_merger", "value"), &PropMergeGroup::set_is_merger);
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_merger"), "set_is_merger", "get_is_merger");
}
diff --git a/modules/props/prop_merge_group.h b/modules/props/prop_merge_group.h
index 1e6be0c85..0d2b5c0da 100644
--- a/modules/props/prop_merge_group.h
+++ b/modules/props/prop_merge_group.h
@@ -39,15 +39,32 @@
#include "props/prop_data.h"
#include "scene/resources/packed_scene.h"
+class Material;
+
class PropMergeGroup : public Spatial {
GDCLASS(PropMergeGroup, Spatial);
public:
+ ///Materials
+ Ref material_get(const int index);
+ void material_add(const Ref &value);
+ int material_get_num() const;
+ void materials_clear();
+
+ Vector materials_get();
+ void materials_set(const Vector &materials);
+
+ bool get_is_merger();
+ void set_is_merger(bool value);
+
PropMergeGroup();
~PropMergeGroup();
protected:
static void _bind_methods();
+
+ bool _is_merger;
+ Vector[> _materials;
};
#endif
diff --git a/modules/props/props/prop_data_merge_group.cpp b/modules/props/props/prop_data_merge_group.cpp
index 2ac82f882..37a3f46fd 100644
--- a/modules/props/props/prop_data_merge_group.cpp
+++ b/modules/props/props/prop_data_merge_group.cpp
@@ -59,6 +59,9 @@ void PropDataMergeGroup::_processor_process(Ref prop_data, Node *node,
l.instance();
l->set_prop(d);
l->set_transform(transform * g->get_transform());
+ l->materials_set(g->materials_get());
+ l->set_is_merger(g->get_is_merger());
+
prop_data->add_prop(l);
}
}
diff --git a/modules/props/props/prop_data_merge_group.h b/modules/props/props/prop_data_merge_group.h
index 1bc39548a..6b2538e0d 100644
--- a/modules/props/props/prop_data_merge_group.h
+++ b/modules/props/props/prop_data_merge_group.h
@@ -50,7 +50,7 @@ public:
bool _processor_handles(Node *node);
void _processor_process(Ref prop_data, Node *node, const Transform &transform);
bool _processor_evaluate_children();
-
+
PropDataMergeGroup();
~PropDataMergeGroup();
]