Fix re-baking meshes after prop data assing.

This commit is contained in:
Relintai 2021-08-10 17:10:05 +02:00
parent 498b289c36
commit 21379908e5
4 changed files with 21 additions and 6 deletions

View File

@ -33,7 +33,11 @@ void PropInstance::set_prop_data(const Ref<PropData> &data) {
_prop_data = data; _prop_data = data;
queue_build(); if (_building) {
queue_build();
} else {
call_deferred("build");
}
} }
Ref<Material> PropInstance::get_material() { Ref<Material> PropInstance::get_material() {
@ -58,11 +62,7 @@ void PropInstance::queue_build() {
} }
void PropInstance::build_finished() { void PropInstance::build_finished() {
_building = false; call("_build_finished");
if (_build_queued) {
call_deferred("build");
}
} }
void PropInstance::_build() { void PropInstance::_build() {
@ -89,6 +89,11 @@ void PropInstance::_build() {
} }
void PropInstance::_build_finished() { void PropInstance::_build_finished() {
_building = false;
if (_build_queued) {
call_deferred("build");
}
} }
void PropInstance::prop_preprocess(Transform transform, const Ref<PropData> &prop) { void PropInstance::prop_preprocess(Transform transform, const Ref<PropData> &prop) {

View File

@ -70,6 +70,10 @@ void PropInstanceJob::set_build_done(const bool val) {
void PropInstanceJob::finished() { void PropInstanceJob::finished() {
set_build_done(true); set_build_done(true);
if (_instance) {
_instance->build_finished();
}
} }
void PropInstanceJob::reset() { void PropInstanceJob::reset() {

View File

@ -462,6 +462,10 @@ Don't submit here, as it starts in physics process mode
void PropInstanceMerger::_build_finished() { void PropInstanceMerger::_build_finished() {
set_building(false); set_building(false);
if (_build_queued) {
call_deferred("build");
}
} }
void PropInstanceMerger::_prop_preprocess(Transform transform, const Ref<PropData> &prop) { void PropInstanceMerger::_prop_preprocess(Transform transform, const Ref<PropData> &prop) {

View File

@ -91,6 +91,7 @@ PropInstanceMerger *PropInstancePropJob::get_prop_instace() {
} }
void PropInstancePropJob::set_prop_instace(PropInstanceMerger *prop) { void PropInstancePropJob::set_prop_instace(PropInstanceMerger *prop) {
_prop_instace = prop; _prop_instace = prop;
_instance = prop;
} }
void PropInstancePropJob::set_prop_instace_bind(Node *prop) { void PropInstancePropJob::set_prop_instace_bind(Node *prop) {
set_prop_instace(Object::cast_to<PropInstanceMerger>(prop)); set_prop_instace(Object::cast_to<PropInstanceMerger>(prop));
@ -327,6 +328,7 @@ void PropInstancePropJob::_reset() {
_build_done = false; _build_done = false;
_phase = 0; _phase = 0;
_current_mesh = 0;
_current_job_step = 0; _current_job_step = 0;
reset_stages(); reset_stages();