Game Development Community

Torque 3D Beta 3 Bug: terrain painter - plugin ID comparision bug+fix

by Fyodor -bank- Osokin · in Torque 3D Professional · 06/24/2009 (4:13 pm) · 2 replies

I've noticed this inside TerrainEditor::onActiveTerrainChange function:
function TerrainEditor::onActiveTerrainChange(%this, %newTerrain)
{
   // Need to refresh the terrain painter.
   if ( EditorGui.currentEditor == TerrainPainterPlugin.getId() )
      EPainter.setup(ETerrainEditor.paintIndex);
}
The EditorGui.currentEditor equals to the name of plugin, not it's id: "TerrainPainterPlugin", "TerrainPainterPlugin" and so on.
So, here we comparing string with U32, so it always returns false.
The fix is easy:
function TerrainEditor::onActiveTerrainChange(%this, %newTerrain)
{
   // Need to refresh the terrain painter.
   if ( EditorGui.currentEditor.getId() == TerrainPainterPlugin.getId() )
      EPainter.setup(ETerrainEditor.paintIndex);
}
Same bug is inside:
function TerrainEditor::onBrushChanged( %this )
So, by adding .getId() to the currentEditor we fix this.
Gosh, weird behaviour and easy fix.

#1
06/26/2009 (2:47 pm)
Logged as THREED-524
#2
07/18/2009 (6:28 am)
Fixed in B4.
Tagged original post as resolved.