Made prop_preprocess overrideable.

This commit is contained in:
Relintai 2021-04-27 16:52:36 +02:00
parent cbb2028d64
commit 8667cc8eaf
4 changed files with 14 additions and 2 deletions

View File

@ -76,6 +76,10 @@ void PropInstance::_build_finished() {
}
void PropInstance::prop_preprocess(Transform transform, const Ref<PropData> &prop) {
call("_prop_preprocess", transform, prop);
}
void PropInstance::_prop_preprocess(Transform transform, const Ref<PropData> &prop) {
ERR_FAIL_COND(!prop.is_valid());
int count = prop->get_prop_count();
@ -185,6 +189,13 @@ void PropInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_prop_data", "value"), &PropInstance::set_prop_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "prop_data", PROPERTY_HINT_RESOURCE_TYPE, "PropData"), "set_prop_data", "get_prop_data");
BIND_VMETHOD(MethodInfo("_prop_preprocess",
PropertyInfo(Variant::TRANSFORM, "tarnsform"),
PropertyInfo(Variant::OBJECT, "prop_data", PROPERTY_HINT_RESOURCE_TYPE, "PropData")));
ClassDB::bind_method(D_METHOD("prop_preprocess", "tarnsform", "prop"), &PropInstance::prop_preprocess);
ClassDB::bind_method(D_METHOD("_prop_preprocess", "tarnsform", "prop"), &PropInstance::_prop_preprocess);
//---
BIND_VMETHOD(MethodInfo("_init_materials"));

View File

@ -55,6 +55,7 @@ public:
virtual void _build_finished();
void prop_preprocess(Transform tarnsform, const Ref<PropData> &prop);
virtual void _prop_preprocess(Transform tarnsform, const Ref<PropData> &prop);
PropInstance();
~PropInstance();

View File

@ -225,7 +225,7 @@ void PropInstanceMerger::_build() {
void PropInstanceMerger::_build_finished() {
}
void PropInstanceMerger::prop_preprocess(Transform transform, const Ref<PropData> &prop) {
void PropInstanceMerger::_prop_preprocess(Transform transform, const Ref<PropData> &prop) {
ERR_FAIL_COND(!prop.is_valid());
int count = prop->get_prop_count();

View File

@ -96,7 +96,7 @@ public:
virtual void _build();
virtual void _build_finished();
void prop_preprocess(Transform tarnsform, const Ref<PropData> &prop);
void _prop_preprocess(Transform tarnsform, const Ref<PropData> &prop);
PropInstanceMerger();
~PropInstanceMerger();