mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Merge branch 'development' into ConvexProxies
This commit is contained in:
commit
bb30de04f7
2803 changed files with 195958 additions and 224299 deletions
|
|
@ -219,7 +219,7 @@ void CreatorTree::sort()
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)")
|
||||
DefineEngineMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)")
|
||||
{
|
||||
CreatorTree::Node * grp = object->findNode(group);
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name,
|
|||
return(node ? node->getId() : -1);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)")
|
||||
DefineEngineMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)")
|
||||
{
|
||||
CreatorTree::Node * grp = object->findNode(group);
|
||||
|
||||
|
|
@ -249,7 +249,7 @@ DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, c
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)")
|
||||
DefineEngineMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)")
|
||||
{
|
||||
// argv[2] - world short
|
||||
// argv[3] - type short
|
||||
|
|
@ -269,12 +269,12 @@ DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, cons
|
|||
return(!dStrnicmp(filename+1, type, typeLen));
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.")
|
||||
DefineEngineMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.")
|
||||
{
|
||||
return(object->getSelected());
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)")
|
||||
DefineEngineMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(group));
|
||||
if(node && node->isGroup())
|
||||
|
|
@ -282,24 +282,24 @@ DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group
|
|||
return(false);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)")
|
||||
DefineEngineMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(dAtoi(item));
|
||||
return(node ? node->mName : 0);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)")
|
||||
DefineEngineMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(nodeValue);
|
||||
return(node ? node->mValue : 0);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, clear, void, (), , "Clear the tree.")
|
||||
DefineEngineMethod( CreatorTree, clear, void, (), , "Clear the tree.")
|
||||
{
|
||||
object->clear();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)")
|
||||
DefineEngineMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)")
|
||||
{
|
||||
CreatorTree::Node * node = object->findNode(nodeValue);
|
||||
if(node && node->mParent)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ static GameBase * getControlObj()
|
|||
return(control);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)")
|
||||
DefineEngineMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)")
|
||||
{
|
||||
if(val < 0 || val > 9)
|
||||
return;
|
||||
|
|
@ -138,7 +138,7 @@ DefineConsoleMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)")
|
|||
object->mBookmarks[val] = control->getTransform();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)")
|
||||
DefineEngineMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)")
|
||||
{
|
||||
if(val < 0 || val > 9)
|
||||
return;
|
||||
|
|
@ -148,17 +148,17 @@ DefineConsoleMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)")
|
|||
control->setTransform(object->mBookmarks[val]);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( EditManager, editorEnabled, void, (), , "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" )
|
||||
DefineEngineMethod( EditManager, editorEnabled, void, (), , "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" )
|
||||
{
|
||||
object->editorEnabled();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( EditManager, editorDisabled, void, (), , "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" )
|
||||
DefineEngineMethod( EditManager, editorDisabled, void, (), , "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" )
|
||||
{
|
||||
object->editorDisabled();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( EditManager, isEditorEnabled, bool, (), , "Return the value of gEditingMission." )
|
||||
DefineEngineMethod( EditManager, isEditorEnabled, bool, (), , "Return the value of gEditingMission." )
|
||||
{
|
||||
return gEditingMission;
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include "platform/platform.h"
|
||||
#include "gui/worldEditor/editorIconRegistry.h"
|
||||
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/simBase.h"
|
||||
|
||||
|
||||
|
|
@ -36,6 +36,8 @@ ConsoleDoc(
|
|||
"@internal"
|
||||
);
|
||||
|
||||
IMPLEMENT_STATIC_CLASS(EditorIconRegistry,, "");
|
||||
|
||||
EditorIconRegistry::EditorIconRegistry()
|
||||
{
|
||||
}
|
||||
|
|
@ -168,51 +170,42 @@ void EditorIconRegistry::clear()
|
|||
mDefaultIcon.free();
|
||||
}
|
||||
|
||||
ConsoleStaticMethod( EditorIconRegistry, add, void, 3, 4, "( String className, String imageFile [, bool overwrite = true] )"
|
||||
DefineEngineStaticMethod( EditorIconRegistry, add, void, (String className, String imageFile, bool overwrite), (true),
|
||||
"@internal")
|
||||
{
|
||||
bool overwrite = true;
|
||||
if ( argc > 3 )
|
||||
overwrite = dAtob( argv[3] );
|
||||
|
||||
gEditorIcons.add( argv[1], argv[2], overwrite );
|
||||
gEditorIcons.add( className, imageFile, overwrite );
|
||||
}
|
||||
|
||||
ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String imagePath [, bool overwrite = true] )"
|
||||
DefineEngineStaticMethod( EditorIconRegistry, loadFromPath, void, (String imagePath, bool overwrite), (true),
|
||||
"@internal")
|
||||
{
|
||||
bool overwrite = true;
|
||||
if ( argc > 2 )
|
||||
overwrite = dAtob( argv[2] );
|
||||
|
||||
gEditorIcons.loadFromPath( argv[1], overwrite );
|
||||
gEditorIcons.loadFromPath( imagePath, overwrite );
|
||||
}
|
||||
|
||||
ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, ""
|
||||
DefineEngineStaticMethod( EditorIconRegistry, clear, void, (),,
|
||||
"@internal")
|
||||
{
|
||||
gEditorIcons.clear();
|
||||
}
|
||||
|
||||
ConsoleStaticMethod( EditorIconRegistry, findIconByClassName, const char*, 2, 2, "( String className )\n"
|
||||
"Returns the file path to the icon file if found."
|
||||
DefineEngineStaticMethod( EditorIconRegistry, findIconByClassName, const char*, (String className),,
|
||||
"@brief Returns the file path to the icon file if found."
|
||||
"@internal")
|
||||
{
|
||||
GFXTexHandle icon = gEditorIcons.findIcon( argv[1] );
|
||||
GFXTexHandle icon = gEditorIcons.findIcon( className );
|
||||
if ( icon.isNull() )
|
||||
return NULL;
|
||||
|
||||
return icon->mPath;
|
||||
}
|
||||
|
||||
ConsoleStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, 2, 2, "( SimObject )\n"
|
||||
DefineEngineStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, (SimObject* obj),,
|
||||
"Returns the file path to the icon file if found."
|
||||
"@internal")
|
||||
{
|
||||
SimObject *obj = NULL;
|
||||
if ( !Sim::findObject( argv[1], obj ) )
|
||||
if ( !obj )
|
||||
{
|
||||
Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", (const char*)argv[1] );
|
||||
Con::warnf( "EditorIconRegistry::findIcon, parameter was not a SimObject!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
#include "core/util/tDictionary.h"
|
||||
#endif
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
class SimObject;
|
||||
class AbstractClassRep;
|
||||
|
||||
|
|
@ -40,6 +42,7 @@ class AbstractClassRep;
|
|||
class EditorIconRegistry
|
||||
{
|
||||
public:
|
||||
DECLARE_STATIC_CLASS(EditorIconRegistry);
|
||||
|
||||
EditorIconRegistry();
|
||||
~EditorIconRegistry();
|
||||
|
|
|
|||
|
|
@ -612,12 +612,12 @@ bool Gizmo::collideAxisGizmo( const Gui3DMouseEvent & event )
|
|||
Point3F(mOrigin + (p1 + p2) * scale)
|
||||
};
|
||||
|
||||
Point3F end = camPos + event.vec * smProjectDistance;
|
||||
F32 t = plane.intersect(camPos, end);
|
||||
Point3F endProj = camPos + event.vec * smProjectDistance;
|
||||
F32 t = plane.intersect(camPos, endProj);
|
||||
if ( t >= 0 && t <= 1 )
|
||||
{
|
||||
Point3F pos;
|
||||
pos.interpolate(camPos, end, t);
|
||||
pos.interpolate(camPos, endProj, t);
|
||||
|
||||
// check if inside our 'poly' of this axisIdx vector...
|
||||
bool inside = true;
|
||||
|
|
|
|||
|
|
@ -2474,43 +2474,43 @@ ConvexShape* GuiConvexEditorCtrl::createConvexShapeFrom(SceneObject* polyObject)
|
|||
return shape;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" )
|
||||
{
|
||||
object->hollowSelection();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, recenterSelection, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, recenterSelection, void, (), , "" )
|
||||
{
|
||||
object->recenterSelection();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, hasSelection, S32, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, hasSelection, S32, (), , "" )
|
||||
{
|
||||
return object->hasSelection();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, handleDelete, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, handleDelete, void, (), , "" )
|
||||
{
|
||||
object->handleDelete();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, handleDeselect, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, handleDeselect, void, (), , "" )
|
||||
{
|
||||
object->handleDeselect();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, (), , "" )
|
||||
{
|
||||
object->dropSelectionAtScreenCenter();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, selectConvex, void, (ConvexShape *convex), , "( ConvexShape )" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, selectConvex, void, (ConvexShape *convex), , "( ConvexShape )" )
|
||||
{
|
||||
if (convex)
|
||||
object->setSelection( convex, -1 );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, splitSelectedFace, void, (), , "" )
|
||||
DefineEngineMethod( GuiConvexEditorCtrl, splitSelectedFace, void, (), , "" )
|
||||
{
|
||||
object->splitSelectedFace();
|
||||
}
|
||||
|
|
@ -784,12 +784,12 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
|||
Con::executef( this, "paletteSync", mMode );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" )
|
||||
{
|
||||
object->deleteSelectedDecal();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" )
|
||||
{
|
||||
String lookupName( datablock );
|
||||
if( lookupName == String::EmptyString )
|
||||
|
|
@ -798,22 +798,22 @@ DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const cha
|
|||
object->deleteDecalDatablock( lookupName );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" )
|
||||
{
|
||||
object->setMode( newMode );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" )
|
||||
{
|
||||
return object->mMode;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" )
|
||||
{
|
||||
return gDecalManager->mDecalInstanceVec.size();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
|
||||
|
|
@ -835,7 +835,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 i
|
|||
return returnBuffer;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 id ), , "getDecalLookupName( S32 )()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 id ), , "getDecalLookupName( S32 )()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
if( decalInstance == NULL )
|
||||
|
|
@ -844,7 +844,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32
|
|||
return decalInstance->mDataBlock->lookupName;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selectDecal( S32 )()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selectDecal( S32 )()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
if( decalInstance == NULL )
|
||||
|
|
@ -853,7 +853,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selec
|
|||
object->selectDecal( decalInstance );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" )
|
||||
{
|
||||
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
|
||||
if( decalInstance == NULL )
|
||||
|
|
@ -872,14 +872,14 @@ DefineConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point
|
|||
gDecalManager->notifyDecalModified( decalInstance );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" )
|
||||
{
|
||||
if ( object->mSELDecal != NULL )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" )
|
||||
DefineEngineMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" )
|
||||
{
|
||||
if( dStrcmp( dbFrom, "" ) != 0 && dStrcmp( dbTo, "" ) != 0 )
|
||||
object->retargetDecalDatablock( dbFrom, dbTo );
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void GuiMissionAreaEditorCtrl::setSelectedMissionArea( MissionArea *missionArea
|
|||
Con::executef( this, "onMissionAreaSelected" );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" )
|
||||
DefineEngineMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" )
|
||||
{
|
||||
if ( dStrcmp( missionAreaName, "" )==0 )
|
||||
object->setSelectedMissionArea(NULL);
|
||||
|
|
@ -107,7 +107,7 @@ DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (co
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, (), , "" )
|
||||
DefineEngineMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, (), , "" )
|
||||
{
|
||||
MissionArea *missionArea = object->getSelectedMissionArea();
|
||||
if ( !missionArea )
|
||||
|
|
|
|||
|
|
@ -88,35 +88,35 @@ void GuiTerrPreviewCtrl::initPersistFields()
|
|||
}
|
||||
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.")
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.")
|
||||
{
|
||||
object->reset();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.")
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.")
|
||||
{
|
||||
object->setRoot();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.")
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.")
|
||||
{
|
||||
return object->getRoot();
|
||||
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)"
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)"
|
||||
"Set the origin of the view.")
|
||||
{
|
||||
object->setOrigin( pos );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.")
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.")
|
||||
{
|
||||
return object->getOrigin();
|
||||
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y")
|
||||
{
|
||||
Point2F r = object->getRoot();
|
||||
Point2F o = object->getOrigin();
|
||||
|
|
@ -126,7 +126,7 @@ DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a
|
|||
return valuebuf;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n"
|
||||
DefineEngineMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n"
|
||||
"@see GuiTerrPreviewCtrl::getValue()")
|
||||
{
|
||||
Point2F r,o;
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ void TerrainSmoothAction::smooth( TerrainBlock *terrain, F32 factor, U32 steps )
|
|||
redo();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainSmoothAction, smooth, void, ( TerrainBlock *terrain, F32 factor, U32 steps ), , "( TerrainBlock obj, F32 factor, U32 steps )")
|
||||
DefineEngineMethod( TerrainSmoothAction, smooth, void, ( TerrainBlock *terrain, F32 factor, U32 steps ), , "( TerrainBlock obj, F32 factor, U32 steps )")
|
||||
{
|
||||
if (terrain)
|
||||
object->smooth( terrain, factor, mClamp( steps, 1, 13 ) );
|
||||
|
|
|
|||
|
|
@ -2403,7 +2403,7 @@ void TerrainEditor::reorderMaterial( S32 index, S32 orderPos )
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)")
|
||||
DefineEngineMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)")
|
||||
{
|
||||
SimSet * missionGroup = dynamic_cast<SimSet*>(Sim::findObject("MissionGroup"));
|
||||
if (!missionGroup)
|
||||
|
|
@ -2459,12 +2459,12 @@ DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain),
|
|||
}
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()")
|
||||
DefineEngineMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()")
|
||||
{
|
||||
return object->getTerrainBlockCount();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)")
|
||||
DefineEngineMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)")
|
||||
{
|
||||
TerrainBlock* tb = object->getTerrainBlock(index);
|
||||
if(!tb)
|
||||
|
|
@ -2473,7 +2473,7 @@ DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 i
|
|||
return tb->getId();
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.")
|
||||
DefineEngineMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.")
|
||||
{
|
||||
Vector<StringTableEntry> list;
|
||||
object->getTerrainBlocksMaterialList(list);
|
||||
|
|
@ -2495,30 +2495,30 @@ DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (
|
|||
ret[0] = 0;
|
||||
for(U32 i = 0; i < list.size(); ++i)
|
||||
{
|
||||
dStrcat( ret, list[i] );
|
||||
dStrcat( ret, "\n" );
|
||||
dStrcat( ret, list[i], size );
|
||||
dStrcat( ret, "\n", size );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)"
|
||||
DefineEngineMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)"
|
||||
"One of box, ellipse, selection.")
|
||||
{
|
||||
object->setBrushType(type);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getBrushType, const char*, (), , "()")
|
||||
DefineEngineMethod( TerrainEditor, getBrushType, const char*, (), , "()")
|
||||
{
|
||||
return object->getBrushType();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])")
|
||||
DefineEngineMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])")
|
||||
{
|
||||
object->setBrushSize( w, h==0?w:h );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
|
||||
DefineEngineMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
|
||||
{
|
||||
Point2I size = object->getBrushSize();
|
||||
|
||||
|
|
@ -2528,74 +2528,74 @@ DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()")
|
|||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)")
|
||||
DefineEngineMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)")
|
||||
{
|
||||
object->setBrushPressure( pressure );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getBrushPressure, F32, (), , "()")
|
||||
DefineEngineMethod( TerrainEditor, getBrushPressure, F32, (), , "()")
|
||||
{
|
||||
return object->getBrushPressure();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)")
|
||||
DefineEngineMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)")
|
||||
{
|
||||
object->setBrushSoftness( softness );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getBrushSoftness, F32, (), , "()")
|
||||
DefineEngineMethod( TerrainEditor, getBrushSoftness, F32, (), , "()")
|
||||
{
|
||||
|
||||
return object->getBrushSoftness();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.")
|
||||
DefineEngineMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.")
|
||||
{
|
||||
return object->getBrushPos();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location")
|
||||
DefineEngineMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location")
|
||||
{
|
||||
|
||||
object->setBrushPos(pos);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)")
|
||||
DefineEngineMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)")
|
||||
{
|
||||
object->setAction(action_name);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)")
|
||||
DefineEngineMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)")
|
||||
{
|
||||
return (object->getActionName(index));
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getNumActions, S32, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getNumActions, S32, (), , "")
|
||||
{
|
||||
return(object->getNumActions());
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getCurrentAction, const char*, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getCurrentAction, const char*, (), , "")
|
||||
{
|
||||
return object->getCurrentAction();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)")
|
||||
DefineEngineMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)")
|
||||
{
|
||||
object->resetSelWeights(clear);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, clearSelection, void, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, clearSelection, void, (), , "")
|
||||
{
|
||||
object->clearSelection();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)")
|
||||
DefineEngineMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)")
|
||||
{
|
||||
object->processAction(action);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getActiveTerrain, S32, (), , "")
|
||||
{
|
||||
S32 ret = 0;
|
||||
|
||||
|
|
@ -2607,27 +2607,27 @@ DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "")
|
|||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getNumTextures, S32, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getNumTextures, S32, (), , "")
|
||||
{
|
||||
return object->getNumTextures();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, markEmptySquares, void, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, markEmptySquares, void, (), , "")
|
||||
{
|
||||
object->markEmptySquares();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "")
|
||||
DefineEngineMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "")
|
||||
{
|
||||
object->mirrorTerrain(mirrorIndex);
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
|
||||
DefineEngineMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.")
|
||||
{
|
||||
// XA: This one needs to be implemented :)
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), ,
|
||||
DefineEngineMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), ,
|
||||
"( int index, string matName )\n"
|
||||
"Changes the material name at the index." )
|
||||
{
|
||||
|
|
@ -2645,7 +2645,7 @@ DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String mat
|
|||
return true;
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), ,
|
||||
DefineEngineMethod(TerrainEditor, addMaterial, S32, ( String matName ), ,
|
||||
"( string matName )\n"
|
||||
"Adds a new material." )
|
||||
{
|
||||
|
|
@ -2660,7 +2660,7 @@ DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), ,
|
|||
return true;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." )
|
||||
DefineEngineMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
|
|
@ -2689,7 +2689,7 @@ DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( in
|
|||
object->setGridUpdateMinMax();
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), ,
|
||||
DefineEngineMethod(TerrainEditor, getMaterialCount, S32, (), ,
|
||||
"Returns the current material count." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
|
|
@ -2699,7 +2699,7 @@ DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), ,
|
|||
return 0;
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.")
|
||||
DefineEngineMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.")
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
|
|
@ -2709,14 +2709,14 @@ DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets th
|
|||
ret[0] = 0;
|
||||
for(U32 i = 0; i < terr->getMaterialCount(); i++)
|
||||
{
|
||||
dStrcat( ret, terr->getMaterialName(i) );
|
||||
dStrcat( ret, "\n" );
|
||||
dStrcat( ret, terr->getMaterialName(i), 4096 );
|
||||
dStrcat( ret, "\n", 4096 );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." )
|
||||
DefineEngineMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
|
|
@ -2732,7 +2732,7 @@ DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), ,
|
|||
return Con::getReturnBuffer( name );
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." )
|
||||
DefineEngineMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." )
|
||||
{
|
||||
TerrainBlock *terr = object->getClientTerrain();
|
||||
if ( !terr )
|
||||
|
|
@ -2747,13 +2747,13 @@ DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "(
|
|||
return -1;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) "
|
||||
DefineEngineMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) "
|
||||
"- Reorder material at the given index to the new position, changing the order in which it is rendered / blended." )
|
||||
{
|
||||
object->reorderMaterial( index, orderPos );
|
||||
}
|
||||
|
||||
DefineConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""),
|
||||
DefineEngineMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""),
|
||||
"(x/y/z) Gets the terrain block that is located under the given world point.\n"
|
||||
"@param x/y/z The world coordinates (floating point values) you wish to query at. "
|
||||
"These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n"
|
||||
|
|
@ -2822,12 +2822,12 @@ void TerrainEditor::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "")
|
||||
{
|
||||
return object->mSlopeMinAngle;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "")
|
||||
DefineEngineMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "")
|
||||
{
|
||||
if ( angle < 0.0f )
|
||||
angle = 0.0f;
|
||||
|
|
@ -2838,12 +2838,12 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "
|
|||
return angle;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "")
|
||||
DefineEngineMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "")
|
||||
{
|
||||
return object->mSlopeMaxAngle;
|
||||
}
|
||||
|
||||
DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "")
|
||||
DefineEngineMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "")
|
||||
{
|
||||
if ( angle > 90.0f )
|
||||
angle = 90.0f;
|
||||
|
|
@ -2857,14 +2857,21 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "
|
|||
//------------------------------------------------------------------------------
|
||||
void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage )
|
||||
{
|
||||
if (!mActiveTerrain)
|
||||
|
||||
#define AUTOPAINT_UNDO
|
||||
|
||||
if (!mActiveTerrain)
|
||||
return;
|
||||
|
||||
S32 mat = getPaintMaterialIndex();
|
||||
if (mat == -1)
|
||||
return;
|
||||
|
||||
mUndoSel = new Selection;
|
||||
|
||||
|
||||
#ifndef AUTOPAINT_UNDO
|
||||
mUndoSel = new Selection;
|
||||
#endif
|
||||
|
||||
|
||||
U32 terrBlocks = mActiveTerrain->getBlockSize();
|
||||
for (U32 y = 0; y < terrBlocks; y++)
|
||||
|
|
@ -2906,19 +2913,23 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS
|
|||
if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope)))
|
||||
continue;
|
||||
|
||||
gi.mMaterialChanged = true;
|
||||
mUndoSel->add(gi);
|
||||
gi.mMaterialChanged = true;
|
||||
#ifndef AUTOPAINT_UNDO
|
||||
mUndoSel->add(gi);
|
||||
#endif
|
||||
gi.mMaterial = mat;
|
||||
setGridInfo(gi);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef AUTOPAINT_UNDO
|
||||
if(mUndoSel->size())
|
||||
submitUndo( mUndoSel );
|
||||
else
|
||||
delete mUndoSel;
|
||||
|
||||
mUndoSel = 0;
|
||||
#endif
|
||||
|
||||
|
||||
scheduleMaterialUpdate();
|
||||
}
|
||||
|
|
|
|||
136
Engine/source/gui/worldEditor/tools/editorTool.cpp
Normal file
136
Engine/source/gui/worldEditor/tools/editorTool.cpp
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#include "editorTool.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(EditorTool);
|
||||
|
||||
EditorTool::EditorTool()
|
||||
{
|
||||
mWorldEditor = NULL;
|
||||
|
||||
mUseMouseDown = true;
|
||||
mUseMouseUp = true;
|
||||
mUseMouseMove = true;
|
||||
|
||||
mUseRightMouseDown = false;
|
||||
mUseRightMouseUp = false;
|
||||
mUseRightMouseMove = false;
|
||||
|
||||
mUseMiddleMouseDown = true;
|
||||
mUseMiddleMouseUp = true;
|
||||
mUseMiddleMouseMove = true;
|
||||
|
||||
mUseKeyInput = true;
|
||||
}
|
||||
|
||||
bool EditorTool::onAdd()
|
||||
{
|
||||
return Parent::onAdd();
|
||||
}
|
||||
|
||||
void EditorTool::onRemove()
|
||||
{
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
||||
//Called when the tool is activated on the World Editor
|
||||
void EditorTool::onActivated(WorldEditor* editor)
|
||||
{
|
||||
mWorldEditor = editor;
|
||||
Con::executef(this, "onActivated");
|
||||
}
|
||||
|
||||
//Called when the tool is deactivated on the World Editor
|
||||
void EditorTool::onDeactivated()
|
||||
{
|
||||
mWorldEditor = NULL;
|
||||
Con::executef(this, "onDeactivated");
|
||||
}
|
||||
|
||||
//
|
||||
bool EditorTool::onMouseMove(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onMouseMove", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onMouseDown(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onMouseDown", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onMouseDragged(const Gui3DMouseEvent &e)
|
||||
{
|
||||
Con::executef(this, "onMouseDragged", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onMouseUp(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onMouseUp", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
bool EditorTool::onRightMouseDown(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseRightMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onRightMouseDown", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onRightMouseDragged(const Gui3DMouseEvent &e)
|
||||
{
|
||||
Con::executef(this, "onRightMouseDragged", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onRightMouseUp(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseRightMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onRightMouseUp", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
bool EditorTool::onMiddleMouseDown(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseMiddleMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onMiddleMouseDown", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onMiddleMouseDragged(const Gui3DMouseEvent &e)
|
||||
{
|
||||
Con::executef(this, "onMiddleMouseDragged", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
bool EditorTool::onMiddleMouseUp(const Gui3DMouseEvent &e)
|
||||
{
|
||||
if (!mUseMiddleMouseDown)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onMiddleMouseUp", e.mousePoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
bool EditorTool::onInputEvent(const InputEventInfo &e)
|
||||
{
|
||||
if (!mUseKeyInput)
|
||||
return false;
|
||||
|
||||
Con::executef(this, "onKeyPress", e.ascii, e.modifier);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
void render(SceneRenderState *);
|
||||
88
Engine/source/gui/worldEditor/tools/editorTool.h
Normal file
88
Engine/source/gui/worldEditor/tools/editorTool.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _EDITOR_TOOL_
|
||||
#define _EDITOR_TOOL_
|
||||
|
||||
#ifndef _WORLDEDITOR_H_
|
||||
#include "gui/worldEditor/worldEditor.h"
|
||||
#endif
|
||||
|
||||
class EditorTool : public SimObject
|
||||
{
|
||||
typedef SimObject Parent;
|
||||
|
||||
protected:
|
||||
WorldEditor* mWorldEditor;
|
||||
bool mUseMouseDown;
|
||||
bool mUseMouseUp;
|
||||
bool mUseMouseMove;
|
||||
|
||||
bool mUseRightMouseDown;
|
||||
bool mUseRightMouseUp;
|
||||
bool mUseRightMouseMove;
|
||||
|
||||
bool mUseMiddleMouseDown;
|
||||
bool mUseMiddleMouseUp;
|
||||
bool mUseMiddleMouseMove;
|
||||
|
||||
bool mUseKeyInput;
|
||||
|
||||
public:
|
||||
EditorTool();
|
||||
~EditorTool(){}
|
||||
|
||||
DECLARE_CONOBJECT(EditorTool);
|
||||
|
||||
bool onAdd();
|
||||
void onRemove();
|
||||
|
||||
//Called when the tool is activated on the World Editor
|
||||
virtual void onActivated(WorldEditor*);
|
||||
|
||||
//Called when the tool is deactivated on the World Editor
|
||||
virtual void onDeactivated();
|
||||
|
||||
//
|
||||
virtual bool onMouseMove(const Gui3DMouseEvent &);
|
||||
virtual bool onMouseDown(const Gui3DMouseEvent &);
|
||||
virtual bool onMouseDragged(const Gui3DMouseEvent &);
|
||||
virtual bool onMouseUp(const Gui3DMouseEvent &);
|
||||
|
||||
//
|
||||
virtual bool onRightMouseDown(const Gui3DMouseEvent &);
|
||||
virtual bool onRightMouseDragged(const Gui3DMouseEvent &);
|
||||
virtual bool onRightMouseUp(const Gui3DMouseEvent &);
|
||||
|
||||
//
|
||||
virtual bool onMiddleMouseDown(const Gui3DMouseEvent &);
|
||||
virtual bool onMiddleMouseDragged(const Gui3DMouseEvent &);
|
||||
virtual bool onMiddleMouseUp(const Gui3DMouseEvent &);
|
||||
|
||||
//
|
||||
virtual bool onInputEvent(const InputEventInfo &);
|
||||
|
||||
//
|
||||
virtual void render(){}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -49,6 +49,7 @@
|
|||
#include "math/mEase.h"
|
||||
#include "T3D/tsStatic.h"
|
||||
|
||||
#include "tools/editorTool.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( WorldEditor );
|
||||
|
||||
|
|
@ -1453,16 +1454,16 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
|
|||
|
||||
}
|
||||
|
||||
CameraSpline::Knot::Path path;
|
||||
CameraSpline::Knot::Path tPath;
|
||||
switch (pathmarker->mSmoothingType)
|
||||
{
|
||||
case Marker::SmoothingTypeLinear: path = CameraSpline::Knot::LINEAR; break;
|
||||
case Marker::SmoothingTypeLinear: tPath = CameraSpline::Knot::LINEAR; break;
|
||||
case Marker::SmoothingTypeSpline:
|
||||
default: path = CameraSpline::Knot::SPLINE; break;
|
||||
default: tPath = CameraSpline::Knot::SPLINE; break;
|
||||
|
||||
}
|
||||
|
||||
spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, path));
|
||||
spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, tPath));
|
||||
}
|
||||
|
||||
F32 t = 0.0f;
|
||||
|
|
@ -1558,8 +1559,8 @@ void WorldEditor::renderSplinePath(SimPath::Path *path)
|
|||
|
||||
// Reset for next pass...
|
||||
vIdx = 0;
|
||||
void *lockPtr = vb.lock();
|
||||
if(!lockPtr) return;
|
||||
void *nextlockPtr = vb.lock();
|
||||
if(!nextlockPtr) return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1823,6 +1824,8 @@ WorldEditor::WorldEditor()
|
|||
mUseGroupCenter = true;
|
||||
mFadeIcons = true;
|
||||
mFadeIconsDist = 8.f;
|
||||
|
||||
mActiveEditorTool = nullptr;
|
||||
}
|
||||
|
||||
WorldEditor::~WorldEditor()
|
||||
|
|
@ -1915,6 +1918,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
|
|||
setCursor(PlatformCursorController::curArrow);
|
||||
mHitObject = NULL;
|
||||
|
||||
//If we have an active tool and it's intercepted our input, bail out
|
||||
if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseMove(event))
|
||||
return;
|
||||
|
||||
//
|
||||
mUsingAxisGizmo = false;
|
||||
|
||||
|
|
@ -1943,6 +1950,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event)
|
|||
|
||||
void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
|
||||
{
|
||||
//If we have an active tool and it's intercepted our input, bail out
|
||||
if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDown(event))
|
||||
return;
|
||||
|
||||
mMouseDown = true;
|
||||
mMouseDragged = false;
|
||||
mPerformedDragCopy = false;
|
||||
|
|
@ -2010,6 +2021,10 @@ void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event)
|
|||
|
||||
void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event )
|
||||
{
|
||||
//If we have an active tool and it's intercepted our input, bail out
|
||||
if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseUp(event))
|
||||
return;
|
||||
|
||||
const bool wasUsingAxisGizmo = mUsingAxisGizmo;
|
||||
|
||||
mMouseDown = false;
|
||||
|
|
@ -2165,6 +2180,10 @@ void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event )
|
|||
|
||||
void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event)
|
||||
{
|
||||
//If we have an active tool and it's intercepted our input, bail out
|
||||
if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDragged(event))
|
||||
return;
|
||||
|
||||
if ( !mMouseDown )
|
||||
return;
|
||||
|
||||
|
|
@ -2400,6 +2419,9 @@ void WorldEditor::renderScene( const RectI &updateRect )
|
|||
GFXDEBUGEVENT_SCOPE( Editor_renderScene, ColorI::RED );
|
||||
|
||||
smRenderSceneSignal.trigger(this);
|
||||
|
||||
if (mActiveEditorTool != nullptr)
|
||||
mActiveEditorTool->render();
|
||||
|
||||
// Grab this before anything here changes it.
|
||||
Frustum frustum;
|
||||
|
|
@ -3014,25 +3036,25 @@ bool WorldEditor::alignByAxis( S32 axis )
|
|||
if(mSelected->size() < 2)
|
||||
return true;
|
||||
|
||||
SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] );
|
||||
if( !object )
|
||||
SceneObject* primaryObj = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] );
|
||||
if( !primaryObj)
|
||||
return false;
|
||||
|
||||
submitUndo( mSelected, "Align By Axis" );
|
||||
|
||||
// All objects will be repositioned to line up with the
|
||||
// first selected object
|
||||
Point3F pos = object->getPosition();
|
||||
Point3F pos = primaryObj->getPosition();
|
||||
|
||||
for(S32 i=0; i<mSelected->size(); ++i)
|
||||
{
|
||||
SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] );
|
||||
if( !object )
|
||||
SceneObject* additionalObj = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] );
|
||||
if( !additionalObj)
|
||||
continue;
|
||||
|
||||
Point3F objPos = object->getPosition();
|
||||
Point3F objPos = additionalObj->getPosition();
|
||||
objPos[axis] = pos[axis];
|
||||
object->setPosition(objPos);
|
||||
additionalObj->setPosition(objPos);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -3190,7 +3212,20 @@ void WorldEditor::resetSelectedScale()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
||||
void WorldEditor::setEditorTool(EditorTool* newTool)
|
||||
{
|
||||
if (mActiveEditorTool)
|
||||
mActiveEditorTool->onDeactivated();
|
||||
|
||||
mActiveEditorTool = newTool;
|
||||
|
||||
if (mActiveEditorTool)
|
||||
mActiveEditorTool->onActivated(this);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
DefineEngineStringlyVariadicMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
||||
{
|
||||
object->ignoreObjClass(argc, argv);
|
||||
}
|
||||
|
|
@ -3217,7 +3252,7 @@ DefineEngineMethod( WorldEditor, getActiveSelection, S32, (),,
|
|||
return object->getActiveSelectionSet()->getId();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), ,
|
||||
DefineEngineMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), ,
|
||||
"Set the currently active WorldEditorSelection object.\n"
|
||||
"@param selection A WorldEditorSelectionSet object to use for the selection container.")
|
||||
{
|
||||
|
|
@ -3892,15 +3927,38 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
|
|||
OptimizedPolyList polyList;
|
||||
polyList.setBaseTransform(orientation);
|
||||
|
||||
ColladaUtils::ExportData exportData;
|
||||
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
{
|
||||
SceneObject *pObj = objectList[i];
|
||||
if (!pObj->buildPolyList(PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
|
||||
}
|
||||
|
||||
//Now that we have all of our mesh data, process it so we can correctly collapse everything.
|
||||
exportData.processData();
|
||||
|
||||
//recenter generated visual mesh results
|
||||
for (U32 dl = 0; dl < exportData.colMeshes.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.colMeshes[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.colMeshes[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
//recenter generated collision mesh results
|
||||
for (U32 dl = 0; dl < exportData.detailLevels.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.detailLevels[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.detailLevels[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
// Use a ColladaUtils function to do the actual export to a Collada file
|
||||
ColladaUtils::exportToCollada(filename, polyList);
|
||||
ColladaUtils::exportToCollada(filename, exportData);
|
||||
//
|
||||
|
||||
// Allocate TSStatic object and add to level.
|
||||
|
|
@ -4015,8 +4073,8 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c
|
|||
|
||||
// Create the object.
|
||||
|
||||
SceneObject* object = dynamic_cast< SceneObject* >( classRep->create() );
|
||||
if( !Object )
|
||||
SceneObject* polyObj = dynamic_cast< SceneObject* >( classRep->create() );
|
||||
if( !polyObj)
|
||||
{
|
||||
Con::errorf( "WorldEditor::createPolyhedralObject - Could not create SceneObject with class '%s'", className );
|
||||
return NULL;
|
||||
|
|
@ -4034,7 +4092,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c
|
|||
for( U32 i = 0; i < numPoints; ++ i )
|
||||
{
|
||||
static StringTableEntry sPoint = StringTable->insert( "point" );
|
||||
object->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) );
|
||||
polyObj->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) );
|
||||
}
|
||||
|
||||
// Add the plane data.
|
||||
|
|
@ -4050,7 +4108,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c
|
|||
char buffer[ 1024 ];
|
||||
dSprintf( buffer, sizeof( buffer ), "%g %g %g %g", plane.x, plane.y, plane.z, plane.d );
|
||||
|
||||
object->setDataField( sPlane, NULL, buffer );
|
||||
polyObj->setDataField( sPlane, NULL, buffer );
|
||||
}
|
||||
|
||||
// Add the edge data.
|
||||
|
|
@ -4069,24 +4127,24 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c
|
|||
edge.vertex[ 0 ], edge.vertex[ 1 ]
|
||||
);
|
||||
|
||||
object->setDataField( sEdge, NULL, buffer );
|
||||
polyObj->setDataField( sEdge, NULL, buffer );
|
||||
}
|
||||
|
||||
// Set the transform.
|
||||
|
||||
object->setTransform( savedTransform );
|
||||
object->setScale( savedScale );
|
||||
polyObj->setTransform( savedTransform );
|
||||
polyObj->setScale( savedScale );
|
||||
|
||||
// Register and return the object.
|
||||
|
||||
if( !object->registerObject() )
|
||||
if( !polyObj->registerObject() )
|
||||
{
|
||||
Con::errorf( "WorldEditor::createPolyhedralObject - Failed to register object!" );
|
||||
delete object;
|
||||
delete polyObj;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return object;
|
||||
return polyObj;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -4175,3 +4233,15 @@ DefineEngineMethod( WorldEditor, createConvexShapeFrom, ConvexShape*, ( SceneObj
|
|||
|
||||
return shape;
|
||||
}
|
||||
|
||||
DefineEngineMethod(WorldEditor, setEditorTool, void, (EditorTool* newEditorTool), (nullAsType<EditorTool*>()),
|
||||
"Sets the active Editor Tool for the world editor.")
|
||||
{
|
||||
object->setEditorTool(newEditorTool);
|
||||
}
|
||||
|
||||
DefineEngineMethod(WorldEditor, getActiveEditorTool, EditorTool*, (),,
|
||||
"Gets the active Editor Tool for the world editor.")
|
||||
{
|
||||
return object->getActiveEditorTool();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
class SceneObject;
|
||||
class WorldEditorSelection;
|
||||
|
||||
class EditorTool;
|
||||
|
||||
///
|
||||
class WorldEditor : public EditTSCtrl
|
||||
|
|
@ -285,6 +285,9 @@ class WorldEditor : public EditTSCtrl
|
|||
ClassInfo::Entry * getClassEntry(const SimObject * obj);
|
||||
bool addClassEntry(ClassInfo::Entry * entry);
|
||||
|
||||
|
||||
EditorTool* mActiveEditorTool;
|
||||
|
||||
// persist field data
|
||||
public:
|
||||
|
||||
|
|
@ -411,6 +414,9 @@ class WorldEditor : public EditTSCtrl
|
|||
DECLARE_CONOBJECT(WorldEditor);
|
||||
|
||||
static Signal<void(WorldEditor*)> smRenderSceneSignal;
|
||||
|
||||
void setEditorTool(EditorTool*);
|
||||
EditorTool* getActiveEditorTool() { return mActiveEditorTool; }
|
||||
};
|
||||
|
||||
typedef WorldEditor::DropType WorldEditorDropType;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "gui/worldEditor/worldEditorSelection.h"
|
||||
#include "gui/worldEditor/worldEditor.h"
|
||||
#include "scene/sceneObject.h"
|
||||
|
||||
#include "T3D/entity.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( WorldEditorSelection );
|
||||
|
||||
|
|
@ -410,26 +410,34 @@ void WorldEditorSelection::rotate(const EulerF & rot, const Point3F & center)
|
|||
// single selections will rotate around own axis, multiple about world
|
||||
if(size() == 1)
|
||||
{
|
||||
SceneObject* object = dynamic_cast< SceneObject* >( at( 0 ) );
|
||||
if( object )
|
||||
Entity* eO = dynamic_cast< Entity* >(at(0));
|
||||
if (eO)
|
||||
{
|
||||
MatrixF mat = object->getTransform();
|
||||
eO->setTransform(eO->getPosition(), eO->getRotation() + RotationF(rot));
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObject* object = dynamic_cast<SceneObject*>(at(0));
|
||||
if (object)
|
||||
{
|
||||
MatrixF mat = object->getTransform();
|
||||
|
||||
Point3F pos;
|
||||
mat.getColumn(3, &pos);
|
||||
Point3F pos;
|
||||
mat.getColumn(3, &pos);
|
||||
|
||||
// get offset in obj space
|
||||
Point3F offset = pos - center;
|
||||
MatrixF wMat = object->getWorldTransform();
|
||||
wMat.mulV(offset);
|
||||
// get offset in obj space
|
||||
Point3F offset = pos - center;
|
||||
MatrixF wMat = object->getWorldTransform();
|
||||
wMat.mulV(offset);
|
||||
|
||||
//
|
||||
MatrixF transform(EulerF(0,0,0), -offset);
|
||||
transform.mul(MatrixF(rot));
|
||||
transform.mul(MatrixF(EulerF(0,0,0), offset));
|
||||
mat.mul(transform);
|
||||
//
|
||||
MatrixF transform(EulerF(0, 0, 0), -offset);
|
||||
transform.mul(MatrixF(rot));
|
||||
transform.mul(MatrixF(EulerF(0, 0, 0), offset));
|
||||
mat.mul(transform);
|
||||
|
||||
object->setTransform(mat);
|
||||
object->setTransform(mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -649,58 +657,42 @@ void WorldEditorSelection::setSize(const VectorF & newsize)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, containsGlobalBounds, bool, 2, 2, "() - True if an object with global bounds is contained in the selection." )
|
||||
DefineEngineMethod( WorldEditorSelection, containsGlobalBounds, bool, (),, "True if an object with global bounds is contained in the selection." )
|
||||
{
|
||||
return object->containsGlobalBounds();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Return the median of all object positions in the selection." )
|
||||
DefineEngineMethod( WorldEditorSelection, getCentroid, Point3F, (),, "Return the median of all object positions in the selection." )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* buffer = Con::getReturnBuffer( bufSize );
|
||||
const Point3F& centroid = object->getCentroid();
|
||||
|
||||
dSprintf( buffer, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z );
|
||||
return buffer;
|
||||
return centroid;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, getBoxCentroid, const char*, 2, 2, "() - Return the center of the bounding box around the selection." )
|
||||
DefineEngineMethod( WorldEditorSelection, getBoxCentroid, Point3F, (),, "Return the center of the bounding box around the selection." )
|
||||
{
|
||||
static const U32 bufSize = 256;
|
||||
char* buffer = Con::getReturnBuffer( bufSize );
|
||||
const Point3F& boxCentroid = object->getBoxCentroid();
|
||||
|
||||
dSprintf( buffer, bufSize, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z );
|
||||
return buffer;
|
||||
return boxCentroid;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, offset, void, 3, 4, "( vector delta, float gridSnap=0 ) - Move all objects in the selection by the given delta." )
|
||||
{
|
||||
F32 x, y, z;
|
||||
dSscanf( argv[ 3 ], "%g %g %g", &x, &y, &z );
|
||||
|
||||
F32 gridSnap = 0.f;
|
||||
if( argc > 3 )
|
||||
gridSnap = dAtof( argv[ 3 ] );
|
||||
|
||||
object->offset( Point3F( x, y, z ), gridSnap );
|
||||
DefineEngineMethod(WorldEditorSelection, offset, void, (Point3F delta, F32 gridSnap), (0.0f), "Move all objects in the selection by the given delta.")
|
||||
{
|
||||
object->offset( delta, gridSnap );
|
||||
WorldEditor::updateClientTransforms( object );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add all objects in the given set to this selection." )
|
||||
DefineEngineMethod( WorldEditorSelection, union, void, (SimSet* selection),, "Add all objects in the given set to this selection." )
|
||||
{
|
||||
SimSet* selection;
|
||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||
if( !selection)
|
||||
{
|
||||
Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", (const char*)argv[ 2 ] );
|
||||
Con::errorf( "WorldEditorSelection::union - no SimSet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -711,12 +703,11 @@ ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add al
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditorSelection, subtract, void, 3, 3, "( SimSet ) - Remove all objects in the given set from this selection." )
|
||||
DefineEngineMethod( WorldEditorSelection, subtract, void, (SimSet* selection),, "Remove all objects in the given set from this selection." )
|
||||
{
|
||||
SimSet* selection;
|
||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||
if( !selection )
|
||||
{
|
||||
Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", (const char*)argv[ 2 ] );
|
||||
Con::errorf( "WorldEditorSelection::subtract - no SimSet" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue