Răsfoiți Sursa

Merge pull request #860 from Areloch/MiscFixes20220825

Misc Fixes for 2022/08/25
Brian Roberts 3 ani în urmă
părinte
comite
63d8c5a699
29 a modificat fișierele cu 276 adăugiri și 127 ștergeri
  1. 31 19
      Engine/source/T3D/assets/ImageAsset.cpp
  2. 15 4
      Engine/source/T3D/assets/MaterialAsset.cpp
  3. 14 4
      Engine/source/T3D/assets/ShapeAsset.cpp
  4. 1 1
      Engine/source/gui/controls/guiGameSettingsCtrl.cpp
  5. 1 1
      Engine/source/gui/controls/guiTreeViewCtrl.cpp
  6. 1 1
      Engine/source/gui/editor/popupMenu.cpp
  7. 4 7
      Engine/source/terrain/terrCollision.cpp
  8. 1 4
      Engine/source/terrain/terrData.cpp
  9. 7 1
      Engine/source/terrain/terrData.h
  10. 1 1
      Templates/BaseGame/game/core/gameObjects/datablocks/defaultDatablocks.tscript
  11. 1 0
      Templates/BaseGame/game/core/gameObjects/shapes/CameraMat.asset.taml
  12. BIN
      Templates/BaseGame/game/core/gameObjects/shapes/camera.dts
  13. BIN
      Templates/BaseGame/game/core/gameObjects/shapes/camera.fbx
  14. 5 0
      Templates/BaseGame/game/core/gameObjects/shapes/camera_shape.asset.taml
  15. 11 0
      Templates/BaseGame/game/core/gameObjects/shapes/camera_shape.tscript
  16. 31 9
      Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript
  17. 31 4
      Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript
  18. 3 19
      Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript
  19. 6 6
      Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui
  20. 7 0
      Templates/BaseGame/game/tools/gui/postFxEditor.tscript
  21. 4 4
      Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui
  22. 4 4
      Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui
  23. 2 2
      Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui
  24. 8 8
      Templates/BaseGame/game/tools/worldEditor/gui/TerrainEditToolbar.ed.gui
  25. 12 12
      Templates/BaseGame/game/tools/worldEditor/gui/TerrainPainterToolbar.ed.gui
  26. 2 2
      Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui
  27. 4 2
      Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript
  28. 52 0
      Templates/BaseGame/game/tools/worldEditor/scripts/visibility/miscViz.tscript
  29. 17 12
      Templates/BaseGame/game/tools/worldEditor/scripts/visibility/visibilityLayer.ed.tscript

+ 31 - 19
Engine/source/T3D/assets/ImageAsset.cpp

@@ -470,9 +470,6 @@ void GuiInspectorTypeImageAssetPtr::consoleInit()
 
 GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
 {
-   if (mInspector->getInspectObject() == nullptr)
-      return nullptr;
-
    // Create base filename edit controls
    GuiControl* retCtrl = Parent::constructEditControl();
    if (retCtrl == NULL)
@@ -480,16 +477,28 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
 
    retCtrl->getRenderTooltipDelegate().bind(this, &GuiInspectorTypeImageAssetPtr::renderTooltip);
 
-   // Change filespec
-   char szBuffer[512];
-   dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
-      mInspector->getIdString(), mCaption);
-   mBrowseButton->setField("Command", szBuffer);
+   if (mInspector->getInspectObject() != nullptr)
+   {
+      // Change filespec
+         char szBuffer[512];
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mCaption);
+      mBrowseButton->setField("Command", szBuffer);
 
-   setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+      setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+   }
+   else
+   {
+      //if we don't have a target object, we'll be manipulating the desination value directly
+      char szBuffer[512];
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mVariableName);
+      mBrowseButton->setField("Command", szBuffer);
+   }
 
-   // Create "Open in ShapeEditor" button
-   mImageEdButton = new GuiBitmapButtonCtrl();
+   mImageEdButton = NULL;
+   // Create "Open in ImageEditor" button
+   /*mImageEdButton = new GuiBitmapButtonCtrl();
 
    char bitmapName[512] = "ToolsModule:GameTSCtrl_image";
    mImageEdButton->setBitmap(StringTable->insert(bitmapName));
@@ -498,10 +507,10 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
    mImageEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
    mImageEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
    mImageEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
-   mImageEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
+   mImageEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Image Editor");
 
    mImageEdButton->registerObject();
-   addObject(mImageEdButton);
+   addObject(mImageEdButton);*/
 
    return retCtrl;
 }
@@ -517,18 +526,21 @@ bool GuiInspectorTypeImageAssetPtr::updateRects()
    mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y);
 
    bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
-   if (mBrowseButton != NULL)
-   {
-      mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4);
-      resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent);
-   }
-
    if (mImageEdButton != NULL)
    {
       RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4);
       resized |= mImageEdButton->resize(shapeEdRect.point, shapeEdRect.extent);
    }
 
+   if (mBrowseButton != NULL)
+   {
+      if(mImageEdButton != NULL)
+         mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4);
+      else
+         mBrowseRect.set(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4);
+      resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent);
+   }
+
    return resized;
 }
 

+ 15 - 4
Engine/source/T3D/assets/MaterialAsset.cpp

@@ -479,11 +479,22 @@ GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl()
 
    // Change filespec
    char szBuffer[512];
-   dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
-      mInspector->getIdString(), mCaption);
-   mBrowseButton->setField("Command", szBuffer);
 
-   setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+   if (mInspector->getInspectObject() != nullptr)
+   {
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mCaption);
+      mBrowseButton->setField("Command", szBuffer);
+
+      setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+   }
+   else
+   {
+      //if we don't have a target object, we'll be manipulating the desination value directly
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mVariableName);
+      mBrowseButton->setField("Command", szBuffer);
+   }
 
    // Create "Open in Editor" button
    mEditButton = new GuiBitmapButtonCtrl();

+ 14 - 4
Engine/source/T3D/assets/ShapeAsset.cpp

@@ -749,11 +749,21 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
 
    // Change filespec
    char szBuffer[512];
-   dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
-      mInspector->getIdString(), mCaption);
-   mBrowseButton->setField("Command", szBuffer);
+   if (mInspector->getInspectObject() != nullptr)
+   {
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mCaption);
+      mBrowseButton->setField("Command", szBuffer);
 
-   setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+      setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
+   }
+   else
+   {
+      //if we don't have a target object, we'll be manipulating the desination value directly
+      dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
+         mInspector->getIdString(), mVariableName);
+      mBrowseButton->setField("Command", szBuffer);
+   }
 
    // Create "Open in ShapeEditor" button
    mShapeEdButton = new GuiBitmapButtonCtrl();

+ 1 - 1
Engine/source/gui/controls/guiGameSettingsCtrl.cpp

@@ -393,7 +393,7 @@ void GuiGameSettingsCtrl::onRenderSliderOption(Point2I currentOffset)
    GFont* font = mProfile->mFont;
 
    char stringVal[32];
-   dSprintf(stringVal, 32, "%f", mValue);
+   dSprintf(stringVal, 32, "%.1f", mValue);
 
    S32 stringWidth = font->getStrWidth(stringVal);
    Point2I textOffset(sliderRect.point.x + sliderRect.extent.x, 0);

+ 1 - 1
Engine/source/gui/controls/guiTreeViewCtrl.cpp

@@ -1982,7 +1982,7 @@ bool GuiTreeViewCtrl::_hitTest(const Point2I & pnt, Item* & item, BitSet32 & fla
    min += mProfile->mTextOffset.x;
 
    FrameAllocatorMarker txtAlloc;
-   U32 bufLen = item->getDisplayTextLength() + 1;
+   U32 bufLen = item->getDisplayTextLength() + 2;
    char *buf = (char*)txtAlloc.alloc(bufLen);
    item->getDisplayText(bufLen, buf);
 

+ 1 - 1
Engine/source/gui/editor/popupMenu.cpp

@@ -428,7 +428,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
    Point2I pos = Point2I::Zero;
 
    if (x == -1 && y == -1)
-      pos = owner->getCursorPos();
+      pos = owner->getCursorPosLocal();
    else
       pos = Point2I(x, y);
 

+ 4 - 7
Engine/source/terrain/terrCollision.cpp

@@ -34,9 +34,6 @@ static const U32 MaxExtent = 256;
 
 
 //----------------------------------------------------------------------------
-
-Convex sTerrainConvexList;
-
 // Number of vertices followed by point index
 S32 sVertexList[5][5] = {
    { 3, 1,2,3 },  // 135 B
@@ -350,7 +347,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
 {
    PROFILE_SCOPE( TerrainBlock_buildConvex );
    
-   sTerrainConvexList.collectGarbage();
+   mTerrainConvexList.collectGarbage();
 
    // First check to see if the query misses the 
    // terrain elevation range.
@@ -415,7 +412,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
 
          // Create a new convex.
          TerrainConvex* cp = new TerrainConvex;
-         sTerrainConvexList.registerObject(cp);
+         mTerrainConvexList.registerObject(cp);
          convex->addToWorkingList(cp);
          cp->halfA = true;
          cp->square = 0;
@@ -448,7 +445,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
             cp->normal[1].normalize();
             if (mDot(vp[3] - vp[1],cp->normal[0]) > 0) {
                TerrainConvex* nc = new TerrainConvex(*cp);
-               sTerrainConvexList.registerObject(nc);
+               mTerrainConvexList.registerObject(nc);
                convex->addToWorkingList(nc);
                nc->halfA = false;
                nc->square = cp;
@@ -463,7 +460,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
             cp->normal[1].normalize();
             if (mDot(vp[2] - vp[0],cp->normal[0]) > 0) {
                TerrainConvex* nc = new TerrainConvex(*cp);
-               sTerrainConvexList.registerObject(nc);
+               mTerrainConvexList.registerObject(nc);
                convex->addToWorkingList(nc);
                nc->halfA = false;
                nc->square = cp;

+ 1 - 4
Engine/source/terrain/terrData.cpp

@@ -220,13 +220,10 @@ TerrainBlock::TerrainBlock()
    mTerrainAssetId = StringTable->EmptyString();
 }
 
-
-extern Convex sTerrainConvexList;
-
 TerrainBlock::~TerrainBlock()
 {
    // Kill collision
-   sTerrainConvexList.nukeList();
+   mTerrainConvexList.nukeList();
 
    SAFE_DELETE(mLightMap);
    mLightMapTex = NULL;

+ 7 - 1
Engine/source/terrain/terrData.h

@@ -55,7 +55,10 @@
 #endif 
 #ifndef TERRAINASSET_H
 #include "T3D/assets/TerrainAsset.h"
-#endif 
+#endif
+#ifndef _CONVEX_H_
+#include "collision/convex.h"
+#endif
 
 class GBitmap;
 class TerrainBlock;
@@ -217,6 +220,9 @@ protected:
    /// True if the zoning needs to be recalculated for the terrain.
    bool mZoningDirty;
 
+   /// Holds the generated convex list stuff for this terrain
+   Convex mTerrainConvexList;
+
    String _getBaseTexCacheFileName() const;
 
    void _rebuildQuadtree();

+ 1 - 1
Templates/BaseGame/game/core/gameObjects/datablocks/defaultDatablocks.tscript

@@ -139,7 +139,7 @@ datablock MissionMarkerData(SpawnSphereMarker)
 datablock MissionMarkerData(CameraBookmarkMarker)
 {
    category = "Misc";
-   shapeAsset = "Core_GameObjects:Camera";
+   shapeAsset = "Core_GameObjects:camera_shape";
 };
 
 datablock CameraData(Observer)

+ 1 - 0
Templates/BaseGame/game/core/gameObjects/shapes/CameraMat.asset.taml

@@ -5,6 +5,7 @@
     materialDefinitionName="CameraMat"
     VersionId="1">
     <Material
+        mapTo="CameraMat"
         Name="CameraMat"
         doubleSided="1"
         translucent="1"

BIN
Templates/BaseGame/game/core/gameObjects/shapes/camera.dts


BIN
Templates/BaseGame/game/core/gameObjects/shapes/camera.fbx


+ 5 - 0
Templates/BaseGame/game/core/gameObjects/shapes/camera_shape.asset.taml

@@ -0,0 +1,5 @@
+<ShapeAsset
+    AssetName="camera_shape"
+    fileName="@assetFile=camera.fbx"
+    constuctorFileName="@assetFile=camera_shape.tscript"
+    materialSlot0="@asset=Core_GameObjects:CameraMat"/>

+ 11 - 0
Templates/BaseGame/game/core/gameObjects/shapes/camera_shape.tscript

@@ -0,0 +1,11 @@
+
+singleton TSShapeConstructor(cameradts2)
+{
+   baseShapeAsset = "Core_GameObjects:Camera_shape";
+   singleDetailSize = "0";
+   flipUVCoords = "0";
+   JoinIdenticalVerts = "0";
+   reverseWindingOrder = "0";
+   removeRedundantMats = "0";
+   animFPS = "2";
+};

+ 31 - 9
Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript

@@ -608,8 +608,11 @@ function AssetBrowser::doRefresh(%this)
       //Forces a clean collapse of the tree for any not-really-exposed items
       %dataItem = AssetBrowser-->filterTree.findItemByName("data");
 
-      AssetBrowser-->filterTree.expandItem(%dataItem, false);
-      AssetBrowser-->filterTree.expandItem(%dataItem);
+      if(%dataItem != 0)
+      {
+         AssetBrowser-->filterTree.expandItem(%dataItem, false);
+         AssetBrowser-->filterTree.expandItem(%dataItem);
+      }
       
       %this.dirty = false;
    }
@@ -985,14 +988,21 @@ function AssetBrowser::changeAsset(%this)
    %targetObject = %this.fieldTargetObject;
    %inspectorObject = "";
    
-   if(%this.fieldTargetObject.isInNamespaceHierarchy("GuiInspector"))
+   if(isObject(%this.fieldTargetObject) && %this.fieldTargetObject.isInNamespaceHierarchy("GuiInspector"))
    {
       %inspectorObject = %this.fieldTargetObject;
-      %targetObject = %inspectorObject.getInspectObject();
-      
-      %inspectorObject.setObjectField(%this.fieldTargetName, %this.selectedAsset);
+      if(%inspectorObject.getNumInspectObjects() != 0)
+      {
+         %targetObject = %inspectorObject.getInspectObject();
+         %inspectorObject.setObjectField(%this.fieldTargetName, %this.selectedAsset);
+      }
+      else if(startsWith(%this.fieldTargetName, "$"))
+      {
+         //we're targeting a variable directly, so deal with that then
+         %cmd = %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";";
+      }
    }
-   else
+   else if(isObject(%this.fieldTargetObject))
    {
       //alright, we've selectd an asset for a field, so time to set it!
       if(%this.fieldTargetName $= "")
@@ -1000,11 +1010,23 @@ function AssetBrowser::changeAsset(%this)
       else
          %cmd = %targetObject @ "." @ %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";";
       //echo("Changing asset via the " @ %cmd @ " command");
-      eval(%cmd);
    }
+   else if(startsWith(%this.fieldTargetName, "$"))
+   {
+      //we're targeting a variable directly, so deal with that then
+      %cmd = %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";";
+   }
+   
+   eval(%cmd);
    
    //Force update our object with the field change
-   %targetObject.inspectPostApply();
+   if(isObject(%targetObject))
+   {
+      if(%this.fieldTargetObject.isInNamespaceHierarchy("GuiInspector"))
+         %this.fieldTargetObject.refresh();
+      else
+         %targetObject.inspectPostApply();
+   }
    
    //Flag us as dirty for editing purposes
    EWorldEditor.setSceneAsDirty();

+ 31 - 4
Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript

@@ -499,7 +499,30 @@ function AssetBrowser::openFileLocation(%this)
    %filePath = "";
    if(EditAssetPopup.assetId !$= "")
    {
-      %filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
+      if(AssetDatabase.isDeclaredAsset(EditAssetPopup.assetId))
+      {
+         %filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
+      }
+      else
+      {
+         //probably a file path
+         %pathSplit = strpos(EditAssetPopup.assetId, ":");
+         if(%pathSplit != -1)
+         {
+            %path = getSubStr(EditAssetPopup.assetId, 0, %pathSplit);
+            %file = getSubStr(EditAssetPopup.assetId, %pathSplit + 1);
+            
+            //datablocks pack the originator file in the parent path as-is, so check that
+            if(fileExt(%path) !$= "")
+            {
+               %filePath = %path;  
+            }
+            else
+            {
+               %filePath = %path @ "/" @ %file;  
+            }
+         }
+      }
    }
    else if(EditLevelAssetPopup.assetId !$= "")
    {
@@ -510,16 +533,20 @@ function AssetBrowser::openFileLocation(%this)
       %filePath = AssetDatabase.getAssetPath(EditAssetPopup.assetId);
    }
    
-   if(%filePath !$= "")
+   if(isFile(%filePath) || isDirectory(%filePath))
    {
+      %fullPath = makeFullPath(%filePath);
+      if(fileExt(%fullPath) $= ".tscript")
+         %fullPath = filePath(%fullPath);
+         
       if($platform $= "windows")
       {
-         %cmd = "cd \"" @ makeFullPath(%filePath) @ "\" && start .";
+         %cmd = "cd \"" @ %fullPath @ "\" && start .";
          systemCommand(%cmd);
       }
       else
       {
-         %cmd = "open \"" @ makeFullPath(%filePath) @ "\"";
+         %cmd = "open \"" @ %fullPath @ "\"";
          systemCommand(%cmd);
       }
    }

+ 3 - 19
Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript

@@ -137,18 +137,9 @@ function AssetBrowser::buildPopupMenus(%this)
          item[ 3 ] = "-";
          item[ 4 ] = "Create Terrain Data" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"TerrainAsset\", AssetBrowser.selectedModule);";
          item[ 5 ] = "-";         
-         item[ 6 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);";
-         item[ 7 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);";
-         item[ 8 ] = "-";
-         item[ 9 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
-         item[ 10 ] = "-";
-         item[ 11 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
-         item[ 12 ] = "-";
-         item[ 13 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);";
-         item[ 14 ] = "-";
-         item[ 15 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);";
-         item[ 16 ] = "-";
-         item[ 17 ] = "Create Cubemap" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"CubemapAsset\", AssetBrowser.selectedModule);";
+         item[ 6 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);";
+         item[ 7 ] = "-";
+         item[ 8 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);";
       };
    }
    
@@ -232,13 +223,6 @@ function AssetBrowser::buildPopupMenus(%this)
       };
    }
    
-   //Some assets are not yet ready/implemented, so disable their creation here
-   AddNewArtAssetPopup.enableItem(6, false); //shape
-   AddNewArtAssetPopup.enableItem(7, false); //shape animation
-   AddNewArtAssetPopup.enableItem(13, false); //sound asset
-   AddNewArtAssetPopup.enableItem(15, false); //particle effect
-   AddNewArtAssetPopup.enableItem(17, false); //cubemap
-   
    if( !isObject( EditFolderPopup ) )
    {
       new PopupMenu( EditFolderPopup )

+ 6 - 6
Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui

@@ -362,8 +362,8 @@ new GuiMouseEventCtrl(ForestBrushSizeSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(ForestBrushSizeTextEditContainer.position) + firstWord(ForestEditToolbar.position)+11 SPC 
-         (getWord(ForestBrushSizeTextEditContainer, 1)) + 25;
+      position = ForestBrushSizeTextEditContainer.position.x + ForestEditToolbar.position.x + 50 SPC 
+         ForestBrushSizeTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -392,8 +392,8 @@ new GuiMouseEventCtrl(ForestBrushPressureSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(ForestBrushPressureTextEditContainer.position) + firstWord(ForestEditToolbar.position) SPC 
-         (getWord(ForestBrushPressureTextEditContainer, 1)) + 25;
+      position = ForestBrushPressureTextEditContainer.position.x + ForestEditToolbar.position.x + 50 SPC 
+         ForestBrushPressureTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -422,8 +422,8 @@ new GuiMouseEventCtrl(ForestBrushHardnessSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(ForestBrushHardnessTextEditContainer.position) + firstWord(ForestEditToolbar.position) SPC 
-         (getWord(TForestBrushHardnessTextEditContainer, 1)) + 25;
+      position = ForestBrushPressureTextEditContainer.position.x + ForestEditToolbar.position.x + 50 SPC 
+         ForestBrushPressureTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 7 - 0
Templates/BaseGame/game/tools/gui/postFxEditor.tscript

@@ -42,9 +42,14 @@ function PostFXEditor::editDefaultPostFXSettings( %this )
    PostFXEditorActionButton.command = "PostFXManager::savePresetHandler($PostFXManager::defaultPreset);";
 }
 
+function PostEffectEditorInspector::refresh(%this)
+{
+   PostFXEditor.refresh();
+}
 
 function PostFXEditor::refresh(%this)
 {
+   %selectedItem = PostEffectEditorList.getSelectedRow();
    PostEffectEditorList.clear();
 
    %count = PostFXManager.Count();
@@ -55,6 +60,8 @@ function PostFXEditor::refresh(%this)
       if(%postEffect.isEnabled())
          PostEffectEditorList.addRow( %i, %postEffect.getName() );
    }
+   
+   PostEffectEditorList.setSelectedRow(%selectedItem);
 }
 
 function PostFXEditor::apply(%this)

+ 4 - 4
Templates/BaseGame/game/tools/meshRoadEditor/meshRoadEditorToolbar.gui

@@ -302,8 +302,8 @@ new GuiMouseEventCtrl(MeshRoadDefaultWidthSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(MeshRoadDefaultWidthTextEditContainer.position) + firstWord(MeshRoadEditorToolbar.position) + 10 SPC 
-         (getWord(MeshRoadDefaultWidthTextEditContainer, 1)) + 25;
+      position = MeshRoadDefaultWidthTextEditContainer.position.x + MeshRoadEditorToolbar.position.x + 50 SPC 
+         MeshRoadDefaultWidthTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -331,8 +331,8 @@ new GuiMouseEventCtrl(MeshRoadDefaultDepthSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(MeshRoadDefaultDepthTextEditContainer.position) + firstWord(MeshRoadEditorToolbar.position) + 10 SPC 
-         (getWord(MeshRoadDefaultDepthTextEditContainer, 1)) + 25;
+      position = MeshRoadDefaultDepthTextEditContainer.position.x + MeshRoadEditorToolbar.position.x + 50 SPC 
+         MeshRoadDefaultDepthTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 4 - 4
Templates/BaseGame/game/tools/riverEditor/RiverEditorToolbar.gui

@@ -280,8 +280,8 @@ new GuiMouseEventCtrl(RiverDefaultWidthSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(RiverDefaultWidthTextEditContainer.position) + firstWord(RiverEditorToolbar.position) + 10 SPC 
-         (getWord(RiverDefaultWidthTextEditContainer, 1)) + 25;
+      position = RiverDefaultWidthTextEditContainer.position.x + RiverEditorToolbar.position.x + 50 SPC 
+         RiverDefaultWidthTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -309,8 +309,8 @@ new GuiMouseEventCtrl(RiverDefaultDepthSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(RiverDefaultDepthTextEditContainer.position) + firstWord(RiverEditorToolbar.position) + 10 SPC 
-         (getWord(RiverDefaultDepthTextEditContainer, 1)) + 25;
+      position = RiverDefaultDepthTextEditContainer.position.x + RiverEditorToolbar.position.x + 50 SPC 
+         RiverDefaultDepthTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 2 - 2
Templates/BaseGame/game/tools/roadEditor/RoadEditorToolbar.gui

@@ -259,8 +259,8 @@ new GuiMouseEventCtrl(RoadDefaultWidthSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(RoadDefaultWidthTextEditContainer.position) + firstWord(RoadEditorToolbar.position) + 10 SPC 
-         (getWord(RoadDefaultWidthTextEditContainer, 1)) + 25;
+      position = RoadDefaultWidthTextEditContainer.position.x + RoadEditorToolbar.position.x + 50 SPC 
+         RoadDefaultWidthTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 8 - 8
Templates/BaseGame/game/tools/worldEditor/gui/TerrainEditToolbar.ed.gui

@@ -510,8 +510,8 @@ new GuiMouseEventCtrl(TerrainBrushSizeSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(TerrainBrushSizeTextEditContainer.position) + firstWord(EWTerrainEditToolbar.position)+11 SPC 
-         (getWord(TerrainBrushSizeTextEditContainer, 1)) + 25;
+      position = TerrainBrushSizeTextEditContainer.position.x + EWTerrainEditToolbar.position.x + 50 SPC 
+         TerrainBrushSizeTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -540,8 +540,8 @@ new GuiMouseEventCtrl(TerrainBrushPressureSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(TerrainBrushPressureTextEditContainer.position) + firstWord(EWTerrainEditToolbar.position) SPC 
-         (getWord(TerrainBrushPressureTextEditContainer, 1)) + 25;
+      position = TerrainBrushPressureTextEditContainer.position.x + EWTerrainEditToolbar.position.x + 50 SPC 
+         TerrainBrushPressureTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -570,8 +570,8 @@ new GuiMouseEventCtrl(TerrainBrushSoftnessSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(TerrainBrushSoftnessTextEditContainer.position) + firstWord(EWTerrainEditToolbar.position) SPC 
-         (getWord(TerrainBrushSoftnessTextEditContainer, 1)) + 25;
+      position = TerrainBrushSoftnessTextEditContainer.position.x + EWTerrainEditToolbar.position.x + 50 SPC 
+         TerrainBrushSoftnessTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -600,8 +600,8 @@ new GuiMouseEventCtrl(TerrainSetHeightSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(TerrainSetHeightTextEditContainer.position) + firstWord(EWTerrainEditToolbar.position) SPC 
-         (getWord(TerrainSetHeightTextEditContainer, 1)) + 25;
+      position = TerrainSetHeightTextEditContainer.position.x + EWTerrainEditToolbar.position.x SPC 
+         TerrainSetHeightTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 12 - 12
Templates/BaseGame/game/tools/worldEditor/gui/TerrainPainterToolbar.ed.gui

@@ -222,7 +222,7 @@ $guiContent = new GuiControl(EWTerrainPainterToolbar,EditorGuiGroup) {
          Profile = "ToolsGuiDefaultProfile";
          HorizSizing = "right";
          VertSizing = "bottom";
-         Position = "222 5";
+         Position = "245 5";
          Extent = "256 50";
          MinExtent = "8 2";
          canSave = "1";
@@ -382,7 +382,7 @@ $guiContent = new GuiControl(EWTerrainPainterToolbar,EditorGuiGroup) {
          Profile = "ToolsGuiTransparentProfile";
          HorizSizing = "right";
          VertSizing = "bottom";
-         position = "480 5";
+         position = "490 5";
          Extent = "120 50";
          MinExtent = "8 2";
          canSave = "1";
@@ -524,8 +524,8 @@ new GuiMouseEventCtrl(PaintBrushSizeSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(PaintBrushSizeTextEditContainer.position) + firstWord(EWTerrainPainterToolbar.position)+11 SPC 
-         (getWord(PaintBrushSizeTextEditContainer, 1)) + 25;
+      position = PaintBrushSizeTextEditContainer.position.x + EWTerrainPainterToolbar.position.x + 50 SPC 
+         PaintBrushSizeTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -554,8 +554,8 @@ new GuiMouseEventCtrl(PaintBrushSlopeMinContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(PaintBrushSlopeControl.position) + firstWord(EWTerrainPainterToolbar.position)+firstWord(PaintBrushSlopeControl->SlopeMinAngle.position) - 40 SPC
-         (getWord(PaintBrushSlopeControl, 1)) + 25;
+      position = PaintBrushSlopeControl.position.x + EWTerrainPainterToolbar.position.x + PaintBrushSlopeControl->SlopeMinAngle.position.x - 40 SPC
+         PaintBrushSlopeControl.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -589,8 +589,8 @@ new GuiMouseEventCtrl(PaintBrushSlopeMaxContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(PaintBrushSlopeControl.position) + firstWord(EWTerrainPainterToolbar.position)+firstWord(PaintBrushSlopeControl->SlopeMaxAngle.position) - 40 SPC
-         (getWord(PaintBrushSlopeControl, 1)) + 25;
+      position = PaintBrushSlopeControl.position.x + EWTerrainPainterToolbar.position.x + PaintBrushSlopeControl->SlopeMaxAngle.position.x - 40 SPC
+         PaintBrushSlopeControl.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -629,8 +629,8 @@ new GuiMouseEventCtrl(PaintBrushPressureSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(PaintBrushPressureTextEditContainer.position) + firstWord(EWTerrainPainterToolbar.position) SPC 
-         (getWord(PaintBrushPressureTextEditContainer, 1)) + 25;
+      position = PaintBrushPressureTextEditContainer.position.x + EWTerrainPainterToolbar.position.x + 50 SPC 
+         PaintBrushPressureTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";
@@ -659,8 +659,8 @@ new GuiMouseEventCtrl(PaintBrushSoftnessSliderCtrlContainer,EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(PaintBrushSoftnessTextEditContainer.position) + firstWord(EWTerrainPainterToolbar.position) SPC 
-         (getWord(PaintBrushSoftnessTextEditContainer, 1)) + 25;
+      position = PaintBrushSoftnessTextEditContainer.position.x + EWTerrainPainterToolbar.position.x + 50 SPC 
+         PaintBrushSoftnessTextEditContainer.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/gui/WorldEditorToolbar.ed.gui

@@ -684,8 +684,8 @@ new GuiMouseEventCtrl(softSnapSizeSliderCtrlContainer, EditorGuiGroup) {
       Profile = "ToolsGuiSliderBoxProfile";
       HorizSizing = "right";
       VertSizing = "bottom";
-      position = firstWord(EWorldEditorToolbar-->softSnapSizeTextEdit.getGlobalPosition()) - 12 SPC 
-         (getWord(EWorldEditorToolbar-->softSnapSizeTextEdit.getGlobalPosition(), 1)) + 18;
+      position = EWorldEditorToolbar.position.x + EWorldEditorToolbar-->softSnapSizeTextEditContainer.position.x + 50 SPC 
+         EWorldEditorToolbar-->softSnapSizeTextEdit.position.y + 50;
       Extent = "112 20";
       MinExtent = "8 2";
       canSave = "1";

+ 4 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.tscript

@@ -734,7 +734,7 @@ function EditorGui::addCameraBookmarkByGui( %this )
    // look for a NewCamera name to grab
    for(%i = 0; ; %i++){
       %name = "NewCamera_" @ %i;
-      if( !CameraBookmarks.findObjectByInternalName(%name) ){
+      if( !isObject(CameraBookmarks) || !CameraBookmarks.findObjectByInternalName(%name) ){
          break;
       }
    }
@@ -1340,7 +1340,9 @@ function CameraTypesDropdownToggle()
 
 function VisibilityDropdownToggle()
 {
-   EditorVisibilityOptions.showPopup(Canvas);
+   %pos = visibilityToggleBtn.getGlobalPosition();
+   %pos.y += visibilityToggleBtn.extent.y;
+   EditorVisibilityOptions.showPopup(Canvas, %pos.x, %pos.y);
 }
 
 function CameraTypesDropdownDecoy::onMouseLeave()

+ 52 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/miscViz.tscript

@@ -436,3 +436,55 @@ function toggleVolumeViz(%vizName)
       EVisibilityVolumeOptions.checkItem(7, $SFXSpace::isRenderable);
    }
 }
+
+//
+//
+function togglePlayerCollisionViz()
+{
+   $Player::renderCollision = !$Player::renderCollision;
+   EVisibilityDebugRenderOptions.checkItem(0, $Player::renderCollision);
+}
+
+function toggleTerrainDebugViz()
+{
+   $TerrainBlock::debugRender = !$TerrainBlock::debugRender;
+   EVisibilityDebugRenderOptions.checkItem(1, $TerrainBlock::debugRender);
+}
+
+function toggleDecalsDebugViz()
+{
+   $Decals::debugRender = !$Decals::debugRender; 
+   EVisibilityDebugRenderOptions.checkItem(2, $Decals::debugRender); 
+}
+
+function toggleBoundingBoxesViz()
+{
+   $Scene::renderBoundingBoxes = !$Scene::renderBoundingBoxes;
+   EVisibilityDebugRenderOptions.checkItem(3, $Scene::renderBoundingBoxes); 
+}
+
+//
+//
+function toggleWireframeViz()
+{
+   $gfx::wireframe = !$gfx::wireframe;
+   EditorVisibilityOptions.checkItem(3, $gfx::wireframe); 
+}
+
+function toggleFrustumLockViz()
+{
+   $Scene::lockCull = !$Scene::lockCull;
+   EditorVisibilityOptions.checkItem(4, $Scene::lockCull); 
+}
+
+function toggleZoneCulling()
+{
+   $Scene::disableZoneCulling = !$Scene::disableZoneCulling; 
+   EditorVisibilityOptions.checkItem(7, $Scene::disableZoneCulling); 
+}
+
+function toggleTerrainCulling()
+{
+   $Scene::disableTerrainOcclusion = !$Scene::disableTerrainOcclusion; 
+   EditorVisibilityOptions.checkItem(8, $Scene::disableTerrainOcclusion);  
+}

+ 17 - 12
Templates/BaseGame/game/tools/worldEditor/scripts/visibility/visibilityLayer.ed.tscript

@@ -98,15 +98,17 @@ function setupEditorVisibilityMenu()
       superClass = "MenuBuilder";
       class = "EditorWorldMenu";
       
-      item[ 0 ] = "Show Player Collision" TAB "" TAB "$Player::renderCollision = !$Player::renderCollision;";
-      item[ 1 ] = "Show Terrain Debug" TAB "" TAB "$TerrainBlock::debugRender = !$TerrainBlock::debugRender;";
-      item[ 2 ] = "Show Decals Debug" TAB "" TAB "$Decals::debugRender = !$Decals::debugRender;";
-      item[ 3 ] = "Show Bounding Boxes" TAB "" TAB "$Scene::renderBoundingBoxes = !$Scene::renderBoundingBoxes;";
+      item[ 0 ] = "Show Player Collision" TAB "" TAB "togglePlayerCollisionViz();";
+      item[ 1 ] = "Show Terrain Debug" TAB "" TAB "toggleTerrainDebugViz();";
+      item[ 2 ] = "Show Decals Debug" TAB "" TAB "toggleDecalsDebugViz();";
+      item[ 3 ] = "Show Bounding Boxes" TAB "" TAB "toggleBoundingBoxesViz();";
       item[ 4 ] = "Show Physics World" TAB "" TAB "togglePhysicsDebugViz();";
       item[ 5 ] = "Show Texel Density" TAB "" TAB "toggleTexelDensityViz();";
    };
    
-   %debugRenderpopup.enableItem(4, false);
+   if(!physicsPluginPresent())
+      %debugRenderpopup.enableItem(4, false);
+      
    %debugRenderpopup.enableItem(5, false);
    
    //
@@ -231,12 +233,12 @@ function setupEditorVisibilityMenu()
       item[ 0 ] = "Volumes Visibility" TAB EVisibilityVolumeOptions;
       item[ 1 ] = "Debug Rendering" TAB EVisibilityDebugRenderOptions;
       item[ 2 ] = "-" TAB "" TAB "";
-      item[ 3 ] = "Wireframe" TAB "" TAB "$gfx::wireframe = !$gfx::wireframe;";
-      item[ 4 ] = "Frustum Lock" TAB "" TAB "$Scene::lockCull = !$Scene::lockCull;";
+      item[ 3 ] = "Wireframe" TAB "" TAB "toggleWireframeViz();";
+      item[ 4 ] = "Frustum Lock" TAB "" TAB "toggleFrustumLockViz();";
       item[ 5 ] = "Colorblindness" TAB EVisibilityColorblindnessOptions;
       item[ 6 ] = "-" TAB "" TAB "";
-      item[ 7 ] = "Disable Zone Culling" TAB "" TAB "$Scene::disableZoneCulling = !$Scene::disableZoneCulling;";
-      item[ 8 ] = "Disable Terrain Culling" TAB "" TAB "$Scene::disableTerrainOcclusion = !$Scene::disableTerrainOcclusion;";
+      item[ 7 ] = "Disable Zone Culling" TAB "" TAB "toggleZoneCulling();";
+      item[ 8 ] = "Disable Terrain Culling" TAB "" TAB "toggleTerrainCulling();";
       item[ 9 ] = "-" TAB "" TAB "";
       item[ 10 ] = "Lighting Modes" TAB EVisibilityLightingModesOptions;
       item[ 11 ] = "Lights" TAB EVisibilityLightsOptions;
@@ -383,14 +385,17 @@ function EVisibility::addClassOptions( %this )
    }
 }
 
-function togglePhysicsDebugViz( %enable )
+function togglePhysicsDebugViz( )
 {
-   $PhysicsWorld::render = %enable;
+   $PhysicsWorld::render = !$PhysicsWorld::render;
    
    if(physicsPluginPresent())
    {
-      physicsDebugDraw(%enable);
+      physicsDebugDraw($PhysicsWorld::render);
    }
+   
+   EVisibilityDebugRenderOptions.checkItem(4, $PhysicsWorld::render);
+   
 }
 
 function disableVisualizers()