Преглед на файлове

Change per frame software skinning check to is_visible

My mistake I missed this before the PR got merged:

is_visible_in_tree() should be avoided being called per frame unless absolutely necessary, because it is a recursive function that traverses the scene tree. It should be used when deciding on rare occasions whether to switch on or off skeleton processing, but it is better to use the cheaper is_visible() check on the per frame update.
lawnjelly преди 4 години
родител
ревизия
0abae185c8
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 4 0
      scene/3d/mesh_instance.cpp

+ 4 - 0
scene/3d/mesh_instance.cpp

@@ -370,7 +370,11 @@ void MeshInstance::_initialize_skinning(bool p_force_reset) {
 
 
 void MeshInstance::_update_skinning() {
 void MeshInstance::_update_skinning() {
 	ERR_FAIL_COND(!_is_software_skinning_enabled());
 	ERR_FAIL_COND(!_is_software_skinning_enabled());
+#if defined(TOOLS_ENABLED) && defined(DEBUG_ENABLED)
 	ERR_FAIL_COND(!is_visible_in_tree());
 	ERR_FAIL_COND(!is_visible_in_tree());
+#else
+	ERR_FAIL_COND(!is_visible());
+#endif
 
 
 	ERR_FAIL_COND(!software_skinning);
 	ERR_FAIL_COND(!software_skinning);
 	Ref<Mesh> software_skinning_mesh = software_skinning->mesh_instance;
 	Ref<Mesh> software_skinning_mesh = software_skinning->mesh_instance;