From 2bc86c21ee0a5da4b017ac61a8e3e2332b865235 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 18 Sep 2011 22:02:29 +0200 Subject: [PATCH] Some scene editor enhancements. Added Shift+Mousewheel as faster alternative to E and R for tile selection (had to change the undocumented and probably unused Shift+R action to Alt+R). Allow applying element effects (numpad 0-9) to multiple selected tiles, and not only one. A new node does no longer have "NewPath" as default text when created, which always forces the user to hammer backspace 6 times before own text can be entered. --- Aquaria/Game.h | 1 + Aquaria/SceneEditor.cpp | 48 +++++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Aquaria/Game.h b/Aquaria/Game.h index 6958af3..b2c1885 100644 --- a/Aquaria/Game.h +++ b/Aquaria/Game.h @@ -516,6 +516,7 @@ protected: void changeShape(); int skinMinX, skinMinY, skinMaxX, skinMaxY; + void setGridPattern(int gi); void setGridPattern0(); void setGridPattern1(); void setGridPattern2(); diff --git a/Aquaria/SceneEditor.cpp b/Aquaria/SceneEditor.cpp index 599b98a..1eec2b1 100644 --- a/Aquaria/SceneEditor.cpp +++ b/Aquaria/SceneEditor.cpp @@ -972,35 +972,45 @@ void SceneEditor::toggleWarpAreaRender() //warpAreaRender->alpha.interpolateTo(1, 0.2); } + +void SceneEditor::setGridPattern(int gi) +{ + if (selectedElements.size()) + for (int i = 0; i < selectedElements.size(); ++i) + selectedElements[i]->setElementEffectByIndex(gi); + else if (editingElement) + editingElement->setElementEffectByIndex(gi); +} + void SceneEditor::setGridPattern0() -{ if (editingElement) editingElement->setElementEffectByIndex(-1); } +{ setGridPattern(-1); } void SceneEditor::setGridPattern1() -{ if (editingElement) editingElement->setElementEffectByIndex(0); } +{ setGridPattern(0); } void SceneEditor::setGridPattern2() -{ if (editingElement) editingElement->setElementEffectByIndex(1); } +{ setGridPattern(1); } void SceneEditor::setGridPattern3() -{ if (editingElement) editingElement->setElementEffectByIndex(2); } +{ setGridPattern(2); } void SceneEditor::setGridPattern4() -{ if (editingElement) editingElement->setElementEffectByIndex(3); } +{ setGridPattern(3); } void SceneEditor::setGridPattern5() -{ if (editingElement) editingElement->setElementEffectByIndex(4); } +{ setGridPattern(4); } void SceneEditor::setGridPattern6() -{ if (editingElement) editingElement->setElementEffectByIndex(5); } +{ setGridPattern(5); } void SceneEditor::setGridPattern7() -{ if (editingElement) editingElement->setElementEffectByIndex(6); } +{ setGridPattern(6); } void SceneEditor::setGridPattern8() -{ if (editingElement) editingElement->setElementEffectByIndex(7); } +{ setGridPattern(7); } void SceneEditor::setGridPattern9() -{ if (editingElement) editingElement->setElementEffectByIndex(8); } +{ setGridPattern(8); } void SceneEditor::moveToFront() { @@ -2860,7 +2870,7 @@ void SceneEditor::nextElement() return; } - if (core->getShiftState()) + if (core->getAltState()) { debugLog("rebuilding level!"); dsq->game->reconstructGrid(true); @@ -3126,7 +3136,7 @@ void SceneEditor::placeElement() { // new path Path *p = new Path; - p->name = "NewPath"; + p->name = ""; PathNode n; n.position = dsq->getGameCursorPosition(); p->nodes.push_back(n); @@ -3534,9 +3544,19 @@ void SceneEditor::update(float dt) else if (isActing(ACTION_ZOOMIN)) zoom *= (1 + spd*dt); else if (core->mouse.scrollWheelChange < 0) - zoom /= 1.05f; + { + if (core->getShiftState() && !core->getCtrlState()) // hackish: to prevent accidental recache() + nextElement(); + else + zoom /= 1.05f; + } else if (core->mouse.scrollWheelChange > 0) - zoom *= 1.05f; + { + if (core->getShiftState() && !core->getCtrlState()) // hackish: to prevent accidental entity selection + prevElement(); + else + zoom *= 1.05f; + } if (zoom.x < 0.04f) zoom.x = zoom.y = 0.04f; core->globalScale = zoom;