mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 00:24:40 +00:00
Merge pull request #1 from NordikLab/ueber-tlab-dev
TorqueLab v0.2 source code changes
This commit is contained in:
commit
956bcc3b6d
8 changed files with 53 additions and 11 deletions
|
|
@ -1479,3 +1479,9 @@ DefineConsoleMethod( GuiRiverEditorCtrl, regenerate, void, (), , "" )
|
||||||
if ( river )
|
if ( river )
|
||||||
river->regenerate();
|
river->regenerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TorqueLab Added to change node from script
|
||||||
|
DefineConsoleMethod(GuiRiverEditorCtrl, setSelectedNode, void, (S32 node), , "")
|
||||||
|
{
|
||||||
|
object->setSelectedNode(node);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1105,3 +1105,8 @@ DefineConsoleMethod( GuiRoadEditorCtrl, deleteRoad, void, (), , "" )
|
||||||
{
|
{
|
||||||
object->deleteSelectedRoad();
|
object->deleteSelectedRoad();
|
||||||
}
|
}
|
||||||
|
//TorqueLab Added to change node from script
|
||||||
|
DefineConsoleMethod(GuiRoadEditorCtrl, setSelectedNode, void, (S32 node), , "")
|
||||||
|
{
|
||||||
|
object->setSelectedNode(node);
|
||||||
|
}
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
#include "math/mRandomDeck.h"
|
#include "math/mRandomDeck.h"
|
||||||
#include "math/mRandomSet.h"
|
#include "math/mRandomSet.h"
|
||||||
|
|
||||||
|
F32 ForestBrushTool::smGlobalScale = 1.0f; //TorqueLab - Forest global scale Init
|
||||||
bool ForestBrushTool::protectedSetSize( void *object, const char *index, const char *data )
|
bool ForestBrushTool::protectedSetSize( void *object, const char *index, const char *data )
|
||||||
{
|
{
|
||||||
ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
|
ForestBrushTool *tool = static_cast<ForestBrushTool*>( object );
|
||||||
|
|
@ -122,7 +122,14 @@ void ForestBrushTool::initPersistFields()
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
//TorqueLab - Forest brush tool new console variables
|
||||||
|
void ForestBrushTool::consoleInit()
|
||||||
|
{
|
||||||
|
//TorqueLab - Forest global scale - Apply global scaling to painted elements
|
||||||
|
Con::addVariable("$Forest::GlobalScale", TypeF32, &ForestBrushTool::smGlobalScale, "For editor use.\n"
|
||||||
|
"@ingroup Editors\n");
|
||||||
|
Parent::consoleInit();
|
||||||
|
}
|
||||||
bool ForestBrushTool::onAdd()
|
bool ForestBrushTool::onAdd()
|
||||||
{
|
{
|
||||||
if ( !Parent::onAdd() )
|
if ( !Parent::onAdd() )
|
||||||
|
|
@ -380,6 +387,10 @@ void ForestBrushTool::_paint( const Point3F &point )
|
||||||
randElementSet.add( pElement, pElement->mProbability );
|
randElementSet.add( pElement, pElement->mProbability );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TorqueLab - Check forest global scale
|
||||||
|
if (smGlobalScale <= 0.01)
|
||||||
|
smGlobalScale = 0.01f;
|
||||||
|
|
||||||
// Pull elements from the random set until we would theoretically fill
|
// Pull elements from the random set until we would theoretically fill
|
||||||
// the desired area.
|
// the desired area.
|
||||||
|
|
||||||
|
|
@ -403,6 +414,8 @@ void ForestBrushTool::_paint( const Point3F &point )
|
||||||
|
|
||||||
areaLeft -= area * 5.0f; // fudge value
|
areaLeft -= area * 5.0f; // fudge value
|
||||||
|
|
||||||
|
scaleFactor *= smGlobalScale; //TorqueLab - Add forest global scale
|
||||||
|
|
||||||
// No room left we are done.
|
// No room left we are done.
|
||||||
//if ( areaLeft < 0.0f )
|
//if ( areaLeft < 0.0f )
|
||||||
// break;
|
// break;
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,12 @@ public:
|
||||||
|
|
||||||
// SimObject
|
// SimObject
|
||||||
DECLARE_CONOBJECT( ForestBrushTool );
|
DECLARE_CONOBJECT( ForestBrushTool );
|
||||||
|
static void consoleInit(); //TorqueLab - New console variables
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
virtual bool onAdd();
|
virtual bool onAdd();
|
||||||
virtual void onRemove();
|
virtual void onRemove();
|
||||||
|
|
||||||
|
static F32 smGlobalScale; //TorqueLab - Forest global scale
|
||||||
// ForestTool
|
// ForestTool
|
||||||
virtual void on3DMouseDown( const Gui3DMouseEvent &evt );
|
virtual void on3DMouseDown( const Gui3DMouseEvent &evt );
|
||||||
virtual void on3DMouseUp( const Gui3DMouseEvent &evt );
|
virtual void on3DMouseUp( const Gui3DMouseEvent &evt );
|
||||||
|
|
|
||||||
|
|
@ -66,14 +66,16 @@ GuiSwatchButtonCtrl::GuiSwatchButtonCtrl()
|
||||||
static StringTableEntry sProfile = StringTable->insert( "profile" );
|
static StringTableEntry sProfile = StringTable->insert( "profile" );
|
||||||
setDataField( sProfile, NULL, "GuiInspectorSwatchButtonProfile" );
|
setDataField( sProfile, NULL, "GuiInspectorSwatchButtonProfile" );
|
||||||
|
|
||||||
mGridBitmap = "tools/gui/images/transp_grid";
|
mGridBitmap = StringTable->insert("tools/gui/images/transp_grid"); //TorqueLab bad bitmap crash fix
|
||||||
|
//mGridBitmap = "tools/gui/images/transp_grid";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiSwatchButtonCtrl::initPersistFields()
|
void GuiSwatchButtonCtrl::initPersistFields()
|
||||||
{
|
{
|
||||||
addField( "color", TypeColorF, Offset( mSwatchColor, GuiSwatchButtonCtrl ), "The foreground color of GuiSwatchButtonCtrl" );
|
addField( "color", TypeColorF, Offset( mSwatchColor, GuiSwatchButtonCtrl ), "The foreground color of GuiSwatchButtonCtrl" );
|
||||||
|
|
||||||
addField( "gridBitmap", TypeString, Offset( mGridBitmap, GuiSwatchButtonCtrl ), "The bitmap used for the transparent grid" );
|
addField("gridBitmap", TypeFilename, Offset(mGridBitmap, GuiSwatchButtonCtrl), "The bitmap used for the transparent grid");//TorqueLab bad bitmap crash fix
|
||||||
|
//addField( "gridBitmap", TypeString, Offset( mGridBitmap, GuiSwatchButtonCtrl ), "The bitmap used for the transparent grid" );
|
||||||
|
|
||||||
Parent::initPersistFields();
|
Parent::initPersistFields();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ class GuiSwatchButtonCtrl : public GuiButtonBaseCtrl
|
||||||
ColorF mSwatchColor;
|
ColorF mSwatchColor;
|
||||||
|
|
||||||
/// Bitmap used for mGrid
|
/// Bitmap used for mGrid
|
||||||
String mGridBitmap;
|
StringTableEntry mGridBitmap; //TorqueLab bad bitmap crash fix
|
||||||
|
//String mGridBitmap;
|
||||||
|
|
||||||
/// Background texture that will show through with transparent colors.
|
/// Background texture that will show through with transparent colors.
|
||||||
GFXTexHandle mGrid;
|
GFXTexHandle mGrid;
|
||||||
|
|
|
||||||
|
|
@ -1000,12 +1000,15 @@ GuiMenuBar::MenuItem* GuiMenuBar::findSubmenuItem(MenuItem *menuItem, const char
|
||||||
// Add a menuitem to the given submenu
|
// Add a menuitem to the given submenu
|
||||||
void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, U32 id, const char *accelerator, S32 checkGroup)
|
void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, U32 id, const char *accelerator, S32 checkGroup)
|
||||||
{
|
{
|
||||||
// Check that the given menu item supports a submenu
|
// Check that the given menu item supports a submenu
|
||||||
if(submenu && !submenu->isSubmenu)
|
//TorqueLab isSubmenu check removed and simply validate the submenu object
|
||||||
{
|
//if(submenu && !submenu->isSubmenu)
|
||||||
Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text);
|
if (!submenu)
|
||||||
return;
|
{
|
||||||
}
|
Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu", text);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
submenu->isSubmenu = true;//TorqueLab => Force isSubmenu to true (hack)
|
||||||
|
|
||||||
// allocate the new menu item
|
// allocate the new menu item
|
||||||
MenuItem *newMenuItem = new MenuItem;
|
MenuItem *newMenuItem = new MenuItem;
|
||||||
|
|
@ -1029,6 +1032,13 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text,
|
||||||
// Point back to the submenu's menu
|
// Point back to the submenu's menu
|
||||||
newMenuItem->submenuParentMenu = menu;
|
newMenuItem->submenuParentMenu = menu;
|
||||||
|
|
||||||
|
//TorqueLab : Added to make sure there's a menu to add the item
|
||||||
|
if (!submenu->submenu){
|
||||||
|
Menu *newMenu = sCreateMenu(submenu->text, submenu->id);
|
||||||
|
submenu->submenu = newMenu;
|
||||||
|
}
|
||||||
|
//TorqueLab end
|
||||||
|
|
||||||
// link it into the menu's menu item list
|
// link it into the menu's menu item list
|
||||||
MenuItem **walk = &submenu->submenu->firstMenuItem;
|
MenuItem **walk = &submenu->submenu->firstMenuItem;
|
||||||
while(*walk)
|
while(*walk)
|
||||||
|
|
|
||||||
|
|
@ -2231,6 +2231,9 @@ void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
|
||||||
|
|
||||||
copySelection( mSelected );
|
copySelection( mSelected );
|
||||||
pasteSelection( false );
|
pasteSelection( false );
|
||||||
|
|
||||||
|
//TorqueLab -> Needed to know a dragCopy happen
|
||||||
|
Con::executef(this, "onDragCopy", mSelected->getIdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for grid snap toggle with ALT.
|
// Check for grid snap toggle with ALT.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue