From dbc9529f2131f568dc72a19697dc70883f69c5cb Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 27 Apr 2021 16:29:09 +0200 Subject: [PATCH] Added a virtual _build method to PropInstance. --- prop_instance.cpp | 28 +++++++++++++++++----------- prop_instance.h | 2 ++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/prop_instance.cpp b/prop_instance.cpp index d0a43df..6ca1e73 100644 --- a/prop_instance.cpp +++ b/prop_instance.cpp @@ -209,6 +209,21 @@ void PropInstance::_init_materials() { } void PropInstance::build() { + call("_build"); +} + +void PropInstance::queue_build() { +} + +void PropInstance::build_finished() { + _building = false; + + if (_build_queued) { + call_deferred("build"); + } +} + +void PropInstance::_build() { _building = true; _build_queued = false; @@ -237,17 +252,6 @@ void PropInstance::build() { prop_preprocess(Transform(), _prop_data); } -void PropInstance::queue_build() { -} - -void PropInstance::build_finished() { - _building = false; - - if (_build_queued) { - call_deferred("build"); - } -} - void PropInstance::_build_finished() { } @@ -442,7 +446,9 @@ void PropInstance::_bind_methods() { ClassDB::bind_method(D_METHOD("queue_build"), &PropInstance::queue_build); ClassDB::bind_method(D_METHOD("build_finished"), &PropInstance::build_finished); + BIND_VMETHOD(MethodInfo("_build")); BIND_VMETHOD(MethodInfo("_build_finished")); + ClassDB::bind_method(D_METHOD("_build"), &PropInstance::_build); ClassDB::bind_method(D_METHOD("_build_finished"), &PropInstance::_build_finished); } diff --git a/prop_instance.h b/prop_instance.h index fe273c0..5d778d8 100644 --- a/prop_instance.h +++ b/prop_instance.h @@ -98,6 +98,8 @@ public: void build(); void queue_build(); void build_finished(); + + virtual void _build(); virtual void _build_finished(); void prop_preprocess(Transform tarnsform, const Ref &prop);