Game Development Community

[BUG] Min/Max Slope painting feature in Terrain Texture Painter (with fix) - RESOLVED

by Michael Hall · in Torque 3D Professional · 07/25/2010 (6:37 pm) · 12 replies

EDIT: the feature does work if using the slider controls to set the min/max slope. The text entry however is non-functional

The Min/Max Slope painting feature in the Terrain Texture Painter -- what happened to it?

I remember it being added in one of the pre-release betas last year (Beta 2 or 3) and was a nifty feature that allowed one to paint on a defined slope range instead of the full circumference of the brush. However it doesn't seem to be working now and checking back over the more recent Beta and 1.0 Release it wasn't working in them either - yet the options are still there...

Trying to set the maxSlope results in this error message:
Object ETerrainEditor(6879) ETerrainEditor -> TerrainEditor -> EditTSCtrl -> GuiTSCtrl -> GuiContainer -> GuiControl -> SimGroup -> SimSet -> SimObject
tools/worldEditor/gui/TerrainPainterToolbar.ed.gui (467): Unknown command setSlopeLimitSlopeMaxAngle


Trying to set the minSlope results in this error message:
<input> (0): Unable to find function setMinSlope

Masking through import of a heightmap and opacity masks does work great but still would like the ease of hand tweaking that this feature enabled.


EDIT: the feature does work if using the slider controls to set the min/max slope. The text entry however is non-functional

EDIT: Edited thread title and body of post to indicate an actual bug -- fix has been posted below.

About the author

Been dabbling with game-programming since the age of 10 when I got my first computer, a Commodore. Got serious about game-development after modding Tribes for several years. Doesn't sleep much. Drinks rum. Teaches guitar. Plays cello.


#1
07/25/2010 (10:02 pm)
I am using 1.0.1 and it works for me, with one caveat. you cant type in a number in the min/max boxes you have to use the sliders to set your numbers or it wont take

its that way with 1.1b1 too
#2
07/25/2010 (10:27 pm)
Yeah, finally figured that out... I detest the sliders though ;)
#3
07/26/2010 (4:38 pm)
Quick/Simple (although not final) fix for setMinSlope

tools/worldEditor/gui/TerrainPainterToolbar.ed.gui
At line# 268 where it says:
Command = "setMinSlope( $ThisControl.getText() );";
make it say:
Command = "setTerrainEditorMinSlope( $ThisControl.getText() );";
#4
07/26/2010 (4:39 pm)
Quick/Simple (although not final) fix for setMinSlope

tools/worldEditor/gui/TerrainPainterToolbar.ed.gui
At line# 467 where it says:
%val = ETerrainEditor.setSlopeLimitSlopeMaxAngle( %value );
make it say:
%val = ETerrainEditor.setSlopeLimitMaxAngle( %value );
#5
07/26/2010 (4:43 pm)
I'll check this against 1.1 Beta 2 to make sure it isn't still a bug.
#6
07/26/2010 (4:45 pm)
Hehe, it still is -- I noticed the problem while using the current repo ;)
#7
07/26/2010 (5:15 pm)
Yeah, I was just checking it and saw it was. Writing a ticket for it now.

Logged as THREED-978.
#8
07/30/2010 (3:47 am)
@Michael: I couldn't get your fix working on my machine, still got wonky results when trying to set the values by hand. I implemented and checked in a new fix that both gives expected results from text entry and regulates the slider behavior. I'm running very late to take a test right now, so I'll post the actual changes first thing in the morning when I get to my desk.
#9
07/30/2010 (5:02 am)
At the point in time I had posted this I was getting weirdness with the text entry aspect myself - a proper fix would be to add a validateSlopeAngle method to the Terrain Painter plugin. Seems this feature in the editor was missing them when compared to other editor functionality.
#10
07/30/2010 (9:02 pm)
Okay, sorry about that. I've got it all fixed up and working properly now. Damn school for making me run off at odd times :P Anyway, for all those interested here's the fix:

First off revert any changes you may have implemented earlier.

Now, in your worldEditor/gui/TerrainPainterToolbar.ed.gui file, make the following changes.

Starting with line #256:
new GuiTextEditCtrl() {
            internalName = "SlopeMinAngle";
            canSaveDynamicFields = "0";
            isContainer = "0";
            Profile = "GuiNumericDropSliderTextProfile";
            HorizSizing = "right";
            VertSizing = "bottom";
            Position = "104 2";
            Extent = "51 18";
            MinExtent = "8 2";
            canSave = "1";
            Visible = "1";
            validate = "TerrainPainterPlugin.validateSlopeMinAngle();";//add this line
            Command = "ETerrainEditor.setSlopeLimitMinAngle( $ThisControl.getText() );";//change this line

Line #317:
new GuiTextEditCtrl() {
            internalName = "SlopeMaxAngle";
            canSaveDynamicFields = "0";
            isContainer = "0";
            Profile = "GuiNumericDropSliderTextProfile";
            HorizSizing = "right";
            VertSizing = "bottom";
            Position = "190 2";
            Extent = "51 18";
            MinExtent = "8 2";
            canSave = "1";
            Visible = "1";
            validate = "TerrainPainterPlugin.validateSlopeMaxAngle();";//add this line
            Command = "ETerrainEditor.setSlopeLimitMaxAngle( $ThisControl.getText() );";//change this line

Line#513
new GuiSliderCtrl() {
      canSaveDynamicFields = "0";
      internalName = "slider";
      isContainer = "0";
      Profile = "GuiSliderBoxProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = firstWord(PaintBrushSlopeControl.position) + firstWord(EWTerrainPainterToolbar.position)+firstWord(PaintBrushSlopeControl->SlopeMinAngle.position) - 40 SPC
         (getWord(PaintBrushSlopeControl, 1)) + 25;
      Extent = "112 20";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      AltCommand = "PaintBrushSlopeControl-->SlopeMinAngle.setValue(mFloatLength( ($ThisControl.getValue()), 1 )); ETerrainEditor.setSlopeLimitMinAngle(mFloatLength( ($ThisControl.getValue()), 1 ));TerrainPainterPlugin.validateSlopeMinAngle();";//change this line


new GuiSliderCtrl() {
      canSaveDynamicFields = "0";
      internalName = "slider";
      isContainer = "0";
      Profile = "GuiSliderBoxProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = firstWord(PaintBrushSlopeControl.position) + firstWord(EWTerrainPainterToolbar.position)+firstWord(PaintBrushSlopeControl->SlopeMaxAngle.position) - 40 SPC
         (getWord(PaintBrushSlopeControl, 1)) + 25;
      Extent = "112 20";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      AltCommand = "PaintBrushSlopeControl-->SlopeMaxAngle.setValue(mFloatLength( ($ThisControl.getValue()), 1 )); ETerrainEditor.setSlopeLimitMaxAngle(mFloatLength( ($ThisControl.getValue()), 1 ));TerrainPainterPlugin.validateSlopeMaxAngle();";//change this line


Now in tools/worldEditor/scripts/Editor.Gui.ed.cs:
Line #1203 add the following functions.
function TerrainPainterPlugin::validateBrushSize( %this )
{
   %val = $ThisControl.getText();
   if(%val < 1)
      $ThisControl.setValue(1);
   else if(%val > 40)
      $ThisControl.setValue(40);
}



//BEGIN ADDING NEW CODE
function TerrainPainterPlugin::validateSlopeMaxAngle( %this )
{
   %maxval = ETerrainEditor.getSlopeLimitMaxAngle();
   PaintBrushSlopeControl-->SlopeMaxAngle.setText(%maxval); 
}

function TerrainPainterPlugin::validateSlopeMinAngle( %this )
{
   %minval = ETerrainEditor.getSlopeLimitMinAngle();
   PaintBrushSlopeControl-->SlopeMinAngle.setText(%minval);  
}
//END ADDING NEW CODE

Those changes should get the slider and text fields correctly working when using the terrain painter tool. Let me know if there any any problems or something I may have left out and I'll look into it right away.
#11
08/01/2010 (10:51 am)
Yeah, that's the fix I should've taken the time to do. Good to see it was pretty much as I expected to get the text-entry fully working.
#12
08/02/2010 (4:35 pm)
Confirmed as Fixed in 1.1 Beta2