Bläddra i källkod

Terrain painter integration for height based blending

Lukas Aldershaab 4 år sedan
förälder
incheckning
f55e7f7a22

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

@@ -210,7 +210,7 @@
       new GuiBitmapCtrl() {
          Enabled = "1";
          Profile = "ToolsGuiDefaultProfile";
-         position = "270 3";
+         position = "230 3";
          Extent = "2 26";
          MinExtent = "1 1";
          bitmap = "tools/gui/images/separator-h.png";
@@ -222,7 +222,7 @@
          Profile = "ToolsGuiDefaultProfile";
          HorizSizing = "right";
          VertSizing = "bottom";
-         Position = "262 5";
+         Position = "222 5";
          Extent = "256 50";
          MinExtent = "8 2";
          canSave = "1";
@@ -370,7 +370,7 @@
       new GuiBitmapCtrl() {
          Enabled = "1";
          Profile = "ToolsGuiDefaultProfile";
-         position = "525 3";
+         position = "445 3";
          Extent = "2 26";
          MinExtent = "1 1";
          bitmap = "tools/gui/images/separator-h.png";
@@ -382,7 +382,7 @@
          Profile = "ToolsGuiTransparentProfile";
          HorizSizing = "right";
          VertSizing = "bottom";
-         position = "540 5";
+         position = "480 5";
          Extent = "120 50";
          MinExtent = "8 2";
          canSave = "1";
@@ -454,6 +454,53 @@
             bitmap = "tools/gui/images/dropslider";
          }; 
       };
+
+      new GuiBitmapCtrl() {
+         Enabled = "1";
+         Profile = "ToolsGuiDefaultProfile";
+         position = "618 3";
+         Extent = "2 26";
+         MinExtent = "1 1";
+         bitmap = "tools/gui/images/separator-h.png";
+      };
+
+      new GuiControl(LerpBlendCheckButtonContainer,EditorGuiGroup) {
+         position = "628 5";
+         extent = "70 50";
+         minExtent = "8 2";
+         horizSizing = "right";
+         vertSizing = "bottom";
+         profile = "ToolsGuiTransparentProfile";
+         visible = "1";
+         active = "1";
+         tooltipProfile = "ToolsGuiToolTipProfile";
+         hovertime = "1000";
+         isContainer = "1";
+         canSave = "1";
+         canSaveDynamicFields = "0";
+
+         new GuiCheckBoxCtrl() {
+            text = " LerpBlend";
+            groupNum = "-1";
+            buttonType = "ToggleButton";
+            useMouseEvents = "0";
+            position = "0 2";
+            extent = "140 18";
+            minExtent = "8 2";
+            horizSizing = "right";
+            vertSizing = "bottom";
+            profile = "ToolsGuiCheckBoxProfile";
+            visible = "1";
+            active = "1";
+            command = "ETerrainEditor.toggleBlendType($ThisControl);";
+            tooltipProfile = "ToolsGuiToolTipProfile";
+            hovertime = "1000";
+            isContainer = "0";
+            internalName = "LerpBlendCheckBox";
+            canSave = "1";
+            canSaveDynamicFields = "0";
+         };
+      };
    };
 };
 //--- OBJECT WRITE END ---

+ 92 - 17
Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui

@@ -32,9 +32,9 @@
       anchorBottom = "0";
       anchorLeft = "0";
       anchorRight = "0";
-      position = "315 168";
-      extent = "394 494";
-      minExtent = "358 432";
+      position = "315 127";
+      extent = "394 514";
+      minExtent = "358 452";
       horizSizing = "center";
       vertSizing = "center";
       profile = "ToolsGuiWindowProfile";
@@ -149,7 +149,7 @@
          anchorLeft = "1";
          anchorRight = "0";
          position = "202 26";
-         extent = "185 425";
+         extent = "185 445";
          minExtent = "8 2";
          horizSizing = "left";
          vertSizing = "height";
@@ -511,7 +511,7 @@
             anchorLeft = "1";
             anchorRight = "0";
             position = "6 122";
-            extent = "185 50";
+            extent = "185 80";
             minExtent = "8 2";
             horizSizing = "width";
             vertSizing = "bottom";
@@ -712,12 +712,87 @@
                canSave = "1";
                canSaveDynamicFields = "0";
             };
+            new GuiSliderCtrl(TerrainMaterialDlgBlendDepthSlider) {
+               range = "-0.5 0.5";
+               ticks = "0";
+               snap = "0";
+               value = "0.5";
+               useFillBar = "0";
+               fillBarColor = "255 255 255 255";
+               renderTicks = "1";
+               position = "39 61";
+               extent = "70 14";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "ToolsGuiSliderProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "ToolsGuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               internalName = "blendDepthSliderCtrl";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiTextCtrl() {
+               text = "Blend Depth";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "1";
+               anchorBottom = "0";
+               anchorLeft = "1";
+               anchorRight = "0";
+               position = "115 61";
+               extent = "58 15";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "ToolsGuiTextProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "ToolsGuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "1";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
+            new GuiTextEditCtrl(TerrainMaterialDlgBlendDepthTextEdit) {
+               historySize = "0";
+               tabComplete = "0";
+               sinkAllKeyEvents = "0";
+               password = "0";
+               passwordMask = "*";
+               text = "0.3";
+               maxLength = "1024";
+               margin = "0 0 0 0";
+               padding = "0 0 0 0";
+               anchorTop = "0";
+               anchorBottom = "0";
+               anchorLeft = "0";
+               anchorRight = "0";
+               position = "1 59";
+               extent = "35 18";
+               minExtent = "8 2";
+               horizSizing = "right";
+               vertSizing = "bottom";
+               profile = "ToolsGuiTextEditProfile";
+               visible = "1";
+               active = "1";
+               tooltipProfile = "ToolsGuiToolTipProfile";
+               hovertime = "1000";
+               isContainer = "0";
+               internalName = "blendDepthTextEditCtrl";
+               canSave = "1";
+               canSaveDynamicFields = "0";
+            };
          };
          new GuiBitmapCtrl() {
             bitmap = "tools/gui/images/separator-v";
             color = "255 255 255 255";
             wrap = "0";
-            position = "6 177";
+            position = "6 202";
             extent = "175 2";
             minExtent = "8 2";
             horizSizing = "width";
@@ -738,7 +813,7 @@
             anchorBottom = "0";
             anchorLeft = "1";
             anchorRight = "0";
-            position = "6 184";
+            position = "6 209";
             extent = "185 64";
             minExtent = "8 2";
             horizSizing = "width";
@@ -781,7 +856,7 @@
                anchorLeft = "1";
                anchorRight = "0";
                position = "56 -3";
-               extent = "60 18";
+               extent = "64 18";
                minExtent = "8 2";
                horizSizing = "right";
                vertSizing = "bottom";
@@ -933,7 +1008,7 @@
             bitmap = "tools/gui/images/separator-v";
             color = "255 255 255 255";
             wrap = "0";
-            position = "6 254";
+            position = "6 279";
             extent = "175 2";
             minExtent = "8 2";
             horizSizing = "width";
@@ -954,7 +1029,7 @@
             anchorBottom = "0";
             anchorLeft = "1";
             anchorRight = "0";
-            position = "6 261";
+            position = "6 286";
             extent = "185 72";
             minExtent = "8 2";
             horizSizing = "width";
@@ -1438,7 +1513,7 @@
             bitmap = "tools/gui/images/separator-v";
             color = "255 255 255 255";
             wrap = "0";
-            position = "6 336";
+            position = "6 361";
             extent = "175 2";
             minExtent = "8 2";
             horizSizing = "width";
@@ -1459,7 +1534,7 @@
             anchorBottom = "0";
             anchorLeft = "1";
             anchorRight = "0";
-            position = "6 343";
+            position = "6 368";
             extent = "185 72";
             minExtent = "8 2";
             horizSizing = "width";
@@ -1766,7 +1841,7 @@
       };
       new GuiControl() {
          position = "6 42";
-         extent = "189 435";
+         extent = "189 455";
          minExtent = "8 2";
          horizSizing = "width";
          vertSizing = "height";
@@ -1831,7 +1906,7 @@
                canRenameObjects = "1";
                renameInternal = "0";
                position = "1 1";
-               extent = "8 2";
+               extent = "136 798";
                minExtent = "8 2";
                horizSizing = "right";
                vertSizing = "bottom";
@@ -1853,7 +1928,7 @@
          groupNum = "-1";
          buttonType = "PushButton";
          useMouseEvents = "0";
-         position = "202 456";
+         position = "202 476";
          extent = "98 22";
          minExtent = "8 2";
          horizSizing = "left";
@@ -1873,7 +1948,7 @@
          groupNum = "-1";
          buttonType = "PushButton";
          useMouseEvents = "0";
-         position = "307 456";
+         position = "307 476";
          extent = "80 22";
          minExtent = "8 2";
          horizSizing = "left";
@@ -1893,7 +1968,7 @@
          color = "255 255 255 255";
          wrap = "0";
          position = "199 23";
-         extent = "190 329";
+         extent = "190 349";
          minExtent = "8 2";
          horizSizing = "left";
          vertSizing = "height";

+ 8 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.cs

@@ -222,6 +222,8 @@ function EPainter::setup( %this, %matIndex )
    ETerrainEditor.setAction( ETerrainEditor.currentAction );
    EditorGuiStatusBar.setInfo(ETerrainEditor.currentActionDesc);
    ETerrainEditor.renderVertexSelection = true;
+   
+   EWTerrainPainterToolbar-->LerpBlendCheckBox.setValue($Terrain::LerpBlend);
 }
 
 function onNeedRelight()
@@ -257,6 +259,12 @@ function TerrainEditor::toggleBrushType( %this, %brush )
    %this.setBrushType( %brush.internalName );
 }
 
+function TerrainEditor::toggleBlendType( %this, %check )
+{
+   $Terrain::LerpBlend = %check.getValue();
+   %this.getActiveTerrain().getClientObject().setMaterialsDirty();
+}
+
 function TerrainEditor::offsetBrush(%this, %x, %y)
 {
    %curPos = %this.getBrushPos();

+ 24 - 1
Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs

@@ -443,6 +443,10 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
       %this-->detDistanceCtrl.setText( %mat.detailDistance );      
       %this-->sideProjectionCtrl.setValue( %mat.useSideProjection );
       %this-->parallaxScaleCtrl.setText( %mat.parallaxScale );
+      
+      %blendDepth = mFloor(%mat.blendDepth * 1000)/1000;
+      %this-->blendDepthTextEditCtrl.setText( %blendDepth );
+      %this-->blendDepthSliderCtrl.setValue( %mat.blendDepth );
 
       %this-->macroSizeCtrl.setText( %mat.macroSize );
       %this-->macroStrengthCtrl.setText( %mat.macroStrength );
@@ -504,6 +508,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
    %detailDistance = %this-->detDistanceCtrl.getText();   
    %useSideProjection = %this-->sideProjectionCtrl.getValue();   
    %parallaxScale = %this-->parallaxScaleCtrl.getText();
+   %blendDepth = %this-->blendDepthTextEditCtrl.getText();
 
    %macroSize = %this-->macroSizeCtrl.getText();      
    %macroStrength = %this-->macroStrengthCtrl.getText();
@@ -529,7 +534,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
          %mat.macroSize == %macroSize &&
          %mat.macroStrength == %macroStrength &&
          %mat.macroDistance == %macroDistance &&         
-         %mat.parallaxScale == %parallaxScale &&         
+         %mat.parallaxScale == %parallaxScale &&
+         %mat.blendDepth == %blendDepth &&         
          %mat.isSRGB == %isSRGB &&         
          %mat.invertRoughness == %invertRoughness)               
       return;
@@ -567,6 +573,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
    %mat.macroDistance = %macroDistance;    
    %mat.useSideProjection = %useSideProjection;
    %mat.parallaxScale = %parallaxScale;
+   %mat.blendDepth = %blendDepth;
    %mat.isSRGB = %isSRGB;
    %mat.invertRoughness = %invertRoughness;
    
@@ -619,6 +626,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
          macroDistance = %mat.macroDistance;
          useSideProjection = %mat.useSideProjection;
          parallaxScale = %mat.parallaxScale;
+         blendDepth = %mat.blendDepth;
          isSRGB = %mat.isSRGB;
          invertRoughness = %mat.invertRoughness;
       };
@@ -656,6 +664,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
       %mat.macroDistance = %obj.macroDistance;
       %mat.useSideProjection = %obj.useSideProjection;
       %mat.parallaxScale = %obj.parallaxScale;
+      %mat.blendDepth = %obj.blendDepth;
       %mat.isSRGB = %obj.isSRGB;
       %mat.invertRoughness = %obj.invertRoughness;
    }
@@ -693,3 +702,17 @@ function TerrainMaterialDlg::_selectTextureFileDialog( %this, %defaultFileName )
       
    return %file;
 }
+
+function TerrainMaterialDlgBlendDepthSlider::onMouseDragged(%this)
+{
+   %value = mFloor(%this.value * 1000)/1000;
+   TerrainMaterialDlgBlendDepthTextEdit.setText(%value);
+   TerrainMaterialDlg.activeMat.blendDepth = %this.value;
+
+}
+
+function TerrainMaterialDlgBlendDepthTextEdit::onValidate(%this)
+{
+   TerrainMaterialDlgBlendDepthSlider.setValue(%this.getText());
+   TerrainMaterialDlg.activeMat.blendDepth = %this.getText();
+}