Browse Source

avoid update icons when debug icons not visible

MonkeyFirst 10 years ago
parent
commit
10c117c1bb
1 changed files with 19 additions and 18 deletions
  1. 19 18
      bin/Data/Scripts/Editor/EditorViewDebugIcons.as

+ 19 - 18
bin/Data/Scripts/Editor/EditorViewDebugIcons.as

@@ -21,6 +21,7 @@ int timeToNextDebugIconsUpdateSplinePath = 0;
 
 
 const int splinePathResolution = 16;
 const int splinePathResolution = 16;
 bool debugIconsShow = true;
 bool debugIconsShow = true;
+bool supressDebugIconsShow = false;
 Vector2 debugIconsSize = Vector2(0.025, 0.025);
 Vector2 debugIconsSize = Vector2(0.025, 0.025);
 Vector2 debugIconsSizeSmall = debugIconsSize / 2.0;
 Vector2 debugIconsSizeSmall = debugIconsSize / 2.0;
 
 
@@ -98,12 +99,13 @@ void CreateDebugIcons()
 
 
 void UpdateViewDebugIcons() 
 void UpdateViewDebugIcons() 
 {
 {
-    if (timeToNextDebugIconsUpdate > time.systemTime) return; 
-    
     if (editorScene is null) return;
     if (editorScene is null) return;
     
     
+    if (timeToNextDebugIconsUpdate > time.systemTime) return; 
+    
     debugIconsNode = editorScene.GetChild("DebugIconsContainer", true);
     debugIconsNode = editorScene.GetChild("DebugIconsContainer", true);
     
     
+    
     if (debugIconsNode is null) 
     if (debugIconsNode is null) 
     {
     {
         debugIconsNode = editorScene.CreateChild("DebugIconsContainer", LOCAL);
         debugIconsNode = editorScene.CreateChild("DebugIconsContainer", LOCAL);
@@ -118,15 +120,26 @@ void UpdateViewDebugIcons()
     {
     {
         CreateDebugIcons();
         CreateDebugIcons();
     }
     }
-    
-    Vector3 camPos = cameraNode.worldPosition;
         
         
     if (debugIconsSetPointLights !is null) 
     if (debugIconsSetPointLights !is null) 
     {
     {
         debugIconsSetDirectionalLights.enabled = debugIconsShow;
         debugIconsSetDirectionalLights.enabled = debugIconsShow;
         debugIconsSetSpotLights.enabled = debugIconsShow;
         debugIconsSetSpotLights.enabled = debugIconsShow;
         debugIconsSetPointLights.enabled = debugIconsShow;
         debugIconsSetPointLights.enabled = debugIconsShow;
+        debugIconsSetCameras.enabled = debugIconsShow;
+        debugIconsSetSoundSources.enabled = debugIconsShow;
+        debugIconsSetSoundSources3D.enabled = debugIconsShow;
+        debugIconsSetSoundListeners.enabled = debugIconsShow;
+        debugIconsSetZones.enabled = debugIconsShow;
+        debugIconsSetSplinesPoints.enabled = debugIconsShow;
+    }
+    
+    if (debugIconsShow == false) return; 
+    
+    Vector3 camPos = activeViewport.cameraNode.worldPosition;
         
         
+    if (debugIconsSetPointLights !is null) 
+    {
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Light", true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Light", true);
         
         
         if (nodes.length > 0) 
         if (nodes.length > 0) 
@@ -139,7 +152,6 @@ void UpdateViewDebugIcons()
             debugIconsSetSpotLights.Commit();
             debugIconsSetSpotLights.Commit();
             debugIconsSetDirectionalLights.Commit();
             debugIconsSetDirectionalLights.Commit();
             
             
-            
             debugIconsSetDirectionalLights.numBillboards = nodes.length;
             debugIconsSetDirectionalLights.numBillboards = nodes.length;
             debugIconsSetSpotLights.numBillboards = nodes.length;
             debugIconsSetSpotLights.numBillboards = nodes.length;
             debugIconsSetPointLights.numBillboards = nodes.length;
             debugIconsSetPointLights.numBillboards = nodes.length;
@@ -187,7 +199,6 @@ void UpdateViewDebugIcons()
     
     
     if (debugIconsSetCameras !is null) 
     if (debugIconsSetCameras !is null) 
     {
     {
-        debugIconsSetCameras.enabled = debugIconsShow;
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Camera", true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Camera", true);
 
 
         if (nodes.length > 0) 
         if (nodes.length > 0) 
@@ -211,9 +222,7 @@ void UpdateViewDebugIcons()
     }
     }
     
     
     if (debugIconsSetSoundSources !is null) 
     if (debugIconsSetSoundSources !is null) 
-    {
-        debugIconsSetSoundSources.enabled = debugIconsShow;
-        
+    {   
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundSource", true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundSource", true);
 
 
         if (nodes.length > 0) 
         if (nodes.length > 0) 
@@ -234,9 +243,7 @@ void UpdateViewDebugIcons()
     }
     }
     
     
     if (debugIconsSetSoundSources3D !is null) 
     if (debugIconsSetSoundSources3D !is null) 
-    {
-        debugIconsSetSoundSources3D.enabled = debugIconsShow;
-        
+    {   
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundSource3D", true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundSource3D", true);
 
 
         if (nodes.length > 0) 
         if (nodes.length > 0) 
@@ -258,7 +265,6 @@ void UpdateViewDebugIcons()
     
     
     if (debugIconsSetSoundListeners !is null) 
     if (debugIconsSetSoundListeners !is null) 
     {
     {
-        debugIconsSetSoundListeners.enabled = debugIconsShow;
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundListener" , true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("SoundListener" , true);
 
 
         if (nodes.length > 0) 
         if (nodes.length > 0) 
@@ -280,8 +286,6 @@ void UpdateViewDebugIcons()
     
     
     if (debugIconsSetZones !is null) 
     if (debugIconsSetZones !is null) 
     {
     {
-        debugIconsSetZones.enabled = debugIconsShow;
-
         // Collect all scene's Zones and add it
         // Collect all scene's Zones and add it
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Zone", true);
         Array<Node@> nodes = editorScene.GetChildrenWithComponent("Zone", true);
         
         
@@ -320,8 +324,6 @@ void UpdateViewDebugIcons()
     {
     {
         if (debugIconsSetSplinesPoints !is null) 
         if (debugIconsSetSplinesPoints !is null) 
         {
         {
-            debugIconsSetSplinesPoints.enabled = debugIconsShow;
-
             // Collect all scene's SplinePath and add it
             // Collect all scene's SplinePath and add it
             Array<Node@> nodes = editorScene.GetChildrenWithComponent("SplinePath", true);
             Array<Node@> nodes = editorScene.GetChildrenWithComponent("SplinePath", true);
             
             
@@ -376,6 +378,5 @@ void UpdateViewDebugIcons()
         timeToNextDebugIconsUpdateSplinePath = time.systemTime + stepDebugIconsUpdateSplinePath;
         timeToNextDebugIconsUpdateSplinePath = time.systemTime + stepDebugIconsUpdateSplinePath;
     }
     }
     
     
-      
     timeToNextDebugIconsUpdate = time.systemTime + stepDebugIconsUpdate;
     timeToNextDebugIconsUpdate = time.systemTime + stepDebugIconsUpdate;
 }
 }