Added a virtual _build method to PropInstance.

This commit is contained in:
Relintai 2021-04-27 16:29:09 +02:00
parent e6cc2625e4
commit dbc9529f21
2 changed files with 19 additions and 11 deletions

View File

@ -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);
}

View File

@ -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<PropData> &prop);