Check whether the cache has materials instead of whether it's initialized or not in PropInstanceMerger::_build.

This commit is contained in:
Relintai 2021-08-25 23:42:23 +02:00
parent 5f915d4dd2
commit 6fe7427b03

View File

@ -542,13 +542,13 @@ void PropInstanceMerger::_build() {
Ref<PropMaterialCache> cache = PropCache::get_singleton()->material_cache_get(_prop_data);
if (!cache->get_initialized()) {
if (cache->material_get_num() == 0) {
//lock it!
cache->mutex_lock();
//check again, this thread might have gotten here after an another one already did the initialization!
//this check might not be needed here
if (!cache->get_initialized()) {
if (cache->material_get_num() == 0) {
//this will set up materials, and settings
//needs to be called from the main thread!
cache->initial_setup_default();