//--- OBJECT WRITE BEGIN --- new TerrainEditor(tEditor) { profile = ""; horizSizing = "width"; vertSizing = "height"; position = "0 0"; extent = "420 420"; minExtent = "8 8"; visible = "1"; setFirstResponder = "0"; modal = "1"; }; //--- OBJECT WRITE END --- //------------------------------------------------------------------------------ // Functions //------------------------------------------------------------------------------ function TerrainEditor::getPrefs(%this) { // persist these... %this.softSelecting = 1; %this.currentAction = "raiseHeight"; %this.currentMode = "select"; } function TerrainEditor::setPrefs(%this) { } function TerrainEditor::init(%this) { %this.getPrefs(); tEditor.attachTerrain(); } function TerrainEditor::onGuiUpdate(%this, %text) { TerrainEditorStatusBarDlg.update(%text); TerrainEditorFrameSetDlg.update(); } function TerrainEditor::offsetBrush(%this, %x, %y) { %curPos = %this.getBrushPos(); %this.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y); } function TerrainEditor::swapInLoneMaterial(%this, %name) { // swapped? if(%this.baseMaterialsSwapped $= "true") { %this.baseMaterialsSwapped = "false"; tEditor.popBaseMaterialInfo(); } else { %this.baseMaterialsSwapped = "true"; %this.pushBaseMaterialInfo(); %this.setLoneBaseMaterial(%name); } // flushTextureCache(); } //------------------------------------------------------------------------------ // keys new ActionMap(TerrainEditorMap); TerrainEditorMap.bindCmd(keyboard, "ctrl z", "tEditor.undo();", ""); TerrainEditorMap.bindCmd(keyboard, "ctrl y", "tEditor.redo();", ""); TerrainEditorMap.bindCmd(keyboard, "left", "tEditor.offsetBrush(-1, 0);", ""); TerrainEditorMap.bindCmd(keyboard, "right", "tEditor.offsetBrush(1, 0);", ""); TerrainEditorMap.bindCmd(keyboard, "up", "tEditor.offsetBrush(0, 1);", ""); TerrainEditorMap.bindCmd(keyboard, "down", "tEditor.offsetBrush(0, -1);", ""); TerrainEditorMap.bindCmd(keyboard, "1", "TERaiseHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "2", "TELowerHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "3", "TESetHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "4", "TESetEmptyActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "5", "TEClearEmptyActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "6", "TEFlattenHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "7", "TESmoothHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "8", "TESetMaterialActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "9", "TEAdjustHeightActionRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "shift 1", "tEditor.processUsesBrush = true;TERaiseHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 2", "tEditor.processUsesBrush = true;TELowerHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 3", "tEditor.processUsesBrush = true;TESetHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 4", "tEditor.processUsesBrush = true;TESetEmptyActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 5", "tEditor.processUsesBrush = true;TEClearEmptyActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 6", "tEditor.processUsesBrush = true;TEFlattenHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 7", "tEditor.processUsesBrush = true;TESmoothHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 8", "tEditor.processUsesBrush = true;TESetMaterialActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "shift 9", "tEditor.processUsesBrush = true;TEAdjustHeightActionRadio.setValue(1);tEditor.processUsesBrush = false;", ""); TerrainEditorMap.bindCmd(keyboard, "h", "TESelectModeRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "j", "TEPaintModeRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "k", "TEAdjustModeRadio.setValue(1);", ""); TerrainEditorMap.bindCmd(keyboard, "o", "Canvas.pushDialog(TerrainEditorValuesSettingsGui, 99);", ""); TerrainEditorMap.bindCmd(keyboard, "m", "Canvas.pushDialog(TerrainEditorTextureSelectGui, 99);", ""); TerrainEditorMap.bindCmd(keyboard, "backspace", "tEditor.clearSelection();", "");