mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Merge branch 'method_Unmangle' into PBR_PR
This commit is contained in:
commit
1eed979a9c
632 changed files with 3935 additions and 3450 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)
|
||||
|
|
|
|||
|
|
@ -702,12 +702,12 @@ void EditTSCtrl::calcOrthoCamOffset(F32 mousex, F32 mousey, U8 modifier)
|
|||
break;
|
||||
|
||||
case DisplayTypeFront:
|
||||
mOrthoCamTrans.x += mousex * mOrthoFOV * camScale;
|
||||
mOrthoCamTrans.x -= mousex * mOrthoFOV * camScale;
|
||||
mOrthoCamTrans.z += mousey * mOrthoFOV * camScale;
|
||||
break;
|
||||
|
||||
case DisplayTypeBack:
|
||||
mOrthoCamTrans.x -= mousex * mOrthoFOV * camScale;
|
||||
mOrthoCamTrans.x += mousex * mOrthoFOV * camScale;
|
||||
mOrthoCamTrans.z += mousey * mOrthoFOV * camScale;
|
||||
break;
|
||||
|
||||
|
|
@ -1125,17 +1125,17 @@ bool EditTSCtrl::processCameraQuery(CameraQuery * query)
|
|||
break;
|
||||
|
||||
case DisplayTypeFront:
|
||||
camRot.setColumn(0, Point3F(-1.0, 0.0, 0.0));
|
||||
camRot.setColumn(1, Point3F( 0.0, -1.0, 0.0));
|
||||
camRot.setColumn(2, Point3F( 0.0, 0.0, 1.0));
|
||||
camPos.y = getMax(camPos.y + smMinSceneBounds.y, sceneBounds.maxExtents.y + camBuffer);
|
||||
camRot.setColumn(0, Point3F(1.0, 0.0, 0.0));
|
||||
camRot.setColumn(1, Point3F(0.0, 1.0, 0.0));
|
||||
camRot.setColumn(2, Point3F(0.0, 0.0, 1.0));
|
||||
camPos.y = getMin(camPos.y - smMinSceneBounds.y, sceneBounds.minExtents.y - camBuffer);
|
||||
break;
|
||||
|
||||
case DisplayTypeBack:
|
||||
camRot.setColumn(0, Point3F(1.0, 0.0, 0.0));
|
||||
camRot.setColumn(1, Point3F(0.0, 1.0, 0.0));
|
||||
camRot.setColumn(2, Point3F(0.0, 0.0, 1.0));
|
||||
camPos.y = getMin(camPos.y - smMinSceneBounds.y, sceneBounds.minExtents.y - camBuffer);
|
||||
camRot.setColumn(0, Point3F(-1.0, 0.0, 0.0));
|
||||
camRot.setColumn(1, Point3F(0.0, -1.0, 0.0));
|
||||
camRot.setColumn(2, Point3F(0.0, 0.0, 1.0));
|
||||
camPos.y = getMax(camPos.y + smMinSceneBounds.y, sceneBounds.maxExtents.y + camBuffer);
|
||||
break;
|
||||
|
||||
case DisplayTypeLeft:
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@
|
|||
#include "core/volume.h"
|
||||
#include "gui/worldEditor/worldEditor.h"
|
||||
#include "T3D/prefab.h"
|
||||
#include "T3D/trigger.h"
|
||||
#include "T3D/zone.h"
|
||||
#include "T3D/portal.h"
|
||||
#include "math/mPolyhedron.impl.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT( GuiConvexEditorCtrl );
|
||||
|
||||
|
|
@ -161,6 +165,35 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
mGizmoProfile->flags = mSavedGizmoFlags;
|
||||
mSavedGizmoFlags = -1;
|
||||
}
|
||||
|
||||
SimGroup* misGroup;
|
||||
if (Sim::findObject("MissionGroup", misGroup))
|
||||
{
|
||||
//Make our proxy objects "real" again
|
||||
for (U32 i = 0; i < mProxyObjects.size(); ++i)
|
||||
{
|
||||
if (!mProxyObjects[i].shapeProxy || !mProxyObjects[i].targetObject)
|
||||
continue;
|
||||
|
||||
AbstractClassRep* classRep = AbstractClassRep::findClassRep(mProxyObjects[i].targetObjectClass);
|
||||
if (!classRep)
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - No such class: %s", mProxyObjects[i].targetObjectClass);
|
||||
continue;
|
||||
}
|
||||
|
||||
SceneObject* polyObj = createPolyhedralObject(mProxyObjects[i].targetObjectClass.c_str(), mProxyObjects[i].shapeProxy);
|
||||
|
||||
misGroup->addObject(polyObj);
|
||||
|
||||
//Now, remove the convex proxy
|
||||
mProxyObjects[i].shapeProxy->deleteObject();
|
||||
mProxyObjects[i].targetObject->deleteObject();
|
||||
mProxyObjects.erase(i);
|
||||
--i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -188,6 +221,60 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
}
|
||||
updateGizmoPos();
|
||||
mSavedGizmoFlags = mGizmoProfile->flags;
|
||||
|
||||
SimGroup* misGroup;
|
||||
if (Sim::findObject("MissionGroup", misGroup))
|
||||
{
|
||||
for (U32 c = 0; c < misGroup->size(); ++c)
|
||||
{
|
||||
bool isTrigger = (misGroup->at(c)->getClassName() == StringTable->insert("Trigger"));
|
||||
bool isZone = (misGroup->at(c)->getClassName() == StringTable->insert("Zone"));
|
||||
bool isPortal = (misGroup->at(c)->getClassName() == StringTable->insert("Portal"));
|
||||
bool isOccluder = (misGroup->at(c)->getClassName() == StringTable->insert("OcclusionVolume"));
|
||||
|
||||
if (isZone || isPortal || isOccluder)
|
||||
{
|
||||
SceneObject* sceneObj = static_cast<SceneObject*>(misGroup->at(c));
|
||||
if (!sceneObj)
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Invalid object");
|
||||
continue;
|
||||
}
|
||||
|
||||
ConvexShape* proxyShape = createConvexShapeFrom(sceneObj);
|
||||
|
||||
//Set the texture to a representatory one so we know what's what
|
||||
if (isTrigger)
|
||||
proxyShape->mMaterialName = "TriggerProxyMaterial";
|
||||
else if (isPortal)
|
||||
proxyShape->mMaterialName = "PortalProxyMaterial";
|
||||
else if (isZone)
|
||||
proxyShape->mMaterialName = "ZoneProxyMaterial";
|
||||
else if (isOccluder)
|
||||
proxyShape->mMaterialName = "OccluderProxyMaterial";
|
||||
|
||||
proxyShape->_updateMaterial();
|
||||
|
||||
sceneObj->setHidden(true);
|
||||
|
||||
//set up the proxy object
|
||||
ConvexShapeProxy newProxy;
|
||||
newProxy.shapeProxy = proxyShape;
|
||||
newProxy.targetObject = sceneObj;
|
||||
|
||||
if (isTrigger)
|
||||
newProxy.targetObjectClass = "Trigger";
|
||||
else if (isPortal)
|
||||
newProxy.targetObjectClass = "Portal";
|
||||
else if (isZone)
|
||||
newProxy.targetObjectClass = "Zone";
|
||||
else
|
||||
newProxy.targetObjectClass = "OcclusionVolume";
|
||||
|
||||
mProxyObjects.push_back(newProxy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -438,6 +525,8 @@ void GuiConvexEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event)
|
|||
|
||||
setupShape( newShape );
|
||||
|
||||
newShape->setField("material", mConvexSEL->getMaterialName());
|
||||
|
||||
submitUndo( CreateShape, newShape );
|
||||
|
||||
setSelection( newShape, -1 );
|
||||
|
|
@ -2033,7 +2122,8 @@ ConvexShape* ConvexEditorCreateTool::extrudeShapeFromFace( ConvexShape *inShape,
|
|||
surf.mulL( worldToShape );
|
||||
}
|
||||
|
||||
newShape->setField( "material", Parent::mEditor->mMaterialName );
|
||||
//newShape->setField( "material", Parent::mEditor->mMaterialName );
|
||||
newShape->setField("material", inShape->getMaterialName());
|
||||
|
||||
newShape->registerObject();
|
||||
mEditor->updateShape( newShape );
|
||||
|
|
@ -2179,43 +2269,248 @@ void GuiConvexEditorCtrl::splitSelectedFace()
|
|||
updateGizmoPos();
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" )
|
||||
SceneObject* GuiConvexEditorCtrl::createPolyhedralObject(const char* className, SceneObject* geometryProvider)
|
||||
{
|
||||
if (!geometryProvider)
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - Invalid geometry provider!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!className || !className[0])
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - Invalid class name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AbstractClassRep* classRep = AbstractClassRep::findClassRep(className);
|
||||
if (!classRep)
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - No such class: %s", className);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// We don't want the extracted poly list to be affected by the object's
|
||||
// current transform and scale so temporarily reset them.
|
||||
|
||||
MatrixF savedTransform = geometryProvider->getTransform();
|
||||
Point3F savedScale = geometryProvider->getScale();
|
||||
|
||||
geometryProvider->setTransform(MatrixF::Identity);
|
||||
geometryProvider->setScale(Point3F(1.f, 1.f, 1.f));
|
||||
|
||||
// Extract the geometry. Use the object-space bounding volumes
|
||||
// as we have moved the object to the origin for the moment.
|
||||
|
||||
OptimizedPolyList polyList;
|
||||
if (!geometryProvider->buildPolyList(PLC_Export, &polyList, geometryProvider->getObjBox(), geometryProvider->getObjBox().getBoundingSphere()))
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - Failed to extract geometry!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Restore the object's original transform.
|
||||
|
||||
geometryProvider->setTransform(savedTransform);
|
||||
geometryProvider->setScale(savedScale);
|
||||
|
||||
// Create the object.
|
||||
|
||||
SceneObject* object = dynamic_cast< SceneObject* >(classRep->create());
|
||||
if (!Object)
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - Could not create SceneObject with class '%s'", className);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Convert the polylist to a polyhedron.
|
||||
|
||||
Polyhedron polyhedron = polyList.toPolyhedron();
|
||||
|
||||
// Add the vertex data.
|
||||
|
||||
const U32 numPoints = polyhedron.getNumPoints();
|
||||
const Point3F* points = polyhedron.getPoints();
|
||||
|
||||
for (U32 i = 0; i < numPoints; ++i)
|
||||
{
|
||||
static StringTableEntry sPoint = StringTable->insert("point");
|
||||
object->setDataField(sPoint, NULL, EngineMarshallData(points[i]));
|
||||
}
|
||||
|
||||
// Add the plane data.
|
||||
|
||||
const U32 numPlanes = polyhedron.getNumPlanes();
|
||||
const PlaneF* planes = polyhedron.getPlanes();
|
||||
|
||||
for (U32 i = 0; i < numPlanes; ++i)
|
||||
{
|
||||
static StringTableEntry sPlane = StringTable->insert("plane");
|
||||
const PlaneF& plane = planes[i];
|
||||
|
||||
char buffer[1024];
|
||||
dSprintf(buffer, sizeof(buffer), "%g %g %g %g", plane.x, plane.y, plane.z, plane.d);
|
||||
|
||||
object->setDataField(sPlane, NULL, buffer);
|
||||
}
|
||||
|
||||
// Add the edge data.
|
||||
|
||||
const U32 numEdges = polyhedron.getNumEdges();
|
||||
const Polyhedron::Edge* edges = polyhedron.getEdges();
|
||||
|
||||
for (U32 i = 0; i < numEdges; ++i)
|
||||
{
|
||||
static StringTableEntry sEdge = StringTable->insert("edge");
|
||||
const Polyhedron::Edge& edge = edges[i];
|
||||
|
||||
char buffer[1024];
|
||||
dSprintf(buffer, sizeof(buffer), "%i %i %i %i ",
|
||||
edge.face[0], edge.face[1],
|
||||
edge.vertex[0], edge.vertex[1]
|
||||
);
|
||||
|
||||
object->setDataField(sEdge, NULL, buffer);
|
||||
}
|
||||
|
||||
// Set the transform.
|
||||
|
||||
object->setTransform(savedTransform);
|
||||
object->setScale(savedScale);
|
||||
|
||||
// Register and return the object.
|
||||
|
||||
if (!object->registerObject())
|
||||
{
|
||||
Con::errorf("WorldEditor::createPolyhedralObject - Failed to register object!");
|
||||
delete object;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
ConvexShape* GuiConvexEditorCtrl::createConvexShapeFrom(SceneObject* polyObject)
|
||||
{
|
||||
if (!polyObject)
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Invalid object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IScenePolyhedralObject* iPoly = dynamic_cast< IScenePolyhedralObject* >(polyObject);
|
||||
if (!iPoly)
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Not a polyhedral object!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get polyhedron.
|
||||
|
||||
AnyPolyhedron polyhedron = iPoly->ToAnyPolyhedron();
|
||||
const U32 numPlanes = polyhedron.getNumPlanes();
|
||||
if (!numPlanes)
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Object returned no valid polyhedron");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create a ConvexShape.
|
||||
|
||||
ConvexShape* shape = new ConvexShape();
|
||||
|
||||
// Add all planes.
|
||||
|
||||
for (U32 i = 0; i < numPlanes; ++i)
|
||||
{
|
||||
const PlaneF& plane = polyhedron.getPlanes()[i];
|
||||
|
||||
// Polyhedron planes are facing inwards so we need to
|
||||
// invert the normal here.
|
||||
|
||||
Point3F normal = plane.getNormal();
|
||||
normal.neg();
|
||||
|
||||
// Turn the orientation of the plane into a quaternion.
|
||||
// The normal is our up vector (that's what's expected
|
||||
// by ConvexShape for the surface orientation).
|
||||
|
||||
MatrixF orientation(true);
|
||||
MathUtils::getMatrixFromUpVector(normal, &orientation);
|
||||
const QuatF quat(orientation);
|
||||
|
||||
// Get the plane position.
|
||||
|
||||
const Point3F position = plane.getPosition();
|
||||
|
||||
// Turn everything into a "surface" property for the ConvexShape.
|
||||
|
||||
char buffer[1024];
|
||||
dSprintf(buffer, sizeof(buffer), "%g %g %g %g %g %g %g",
|
||||
quat.x, quat.y, quat.z, quat.w,
|
||||
position.x, position.y, position.z
|
||||
);
|
||||
|
||||
// Add the surface.
|
||||
|
||||
static StringTableEntry sSurface = StringTable->insert("surface");
|
||||
shape->setDataField(sSurface, NULL, buffer);
|
||||
}
|
||||
|
||||
// Copy the transform.
|
||||
|
||||
shape->setTransform(polyObject->getTransform());
|
||||
shape->setScale(polyObject->getScale());
|
||||
|
||||
// Register the shape.
|
||||
|
||||
if (!shape->registerObject())
|
||||
{
|
||||
Con::errorf("WorldEditor::createConvexShapeFrom - Could not register ConvexShape!");
|
||||
delete shape;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
@ -114,6 +114,8 @@ public:
|
|||
void dropSelectionAtScreenCenter();
|
||||
void splitSelectedFace();
|
||||
|
||||
SceneObject* createPolyhedralObject(const char* className, SceneObject* geometryProvider);
|
||||
ConvexShape* createConvexShapeFrom(SceneObject* polyObject);
|
||||
/// Interface with Tools.
|
||||
/// @{
|
||||
|
||||
|
|
@ -192,6 +194,16 @@ protected:
|
|||
UndoAction *mLastUndo;
|
||||
UndoManager *mUndoManager;
|
||||
|
||||
struct ConvexShapeProxy
|
||||
{
|
||||
ConvexShape* shapeProxy;
|
||||
SceneObject* targetObject;
|
||||
String targetObjectClass;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
Vector<ConvexShapeProxy> mProxyObjects;
|
||||
|
||||
ConvexEditorTool *mActiveTool;
|
||||
ConvexEditorCreateTool *mCreateTool;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -2502,23 +2502,23 @@ DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (
|
|||
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 )
|
||||
|
|
@ -2716,7 +2716,7 @@ DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets th
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -3225,7 +3225,7 @@ void WorldEditor::setEditorTool(EditorTool* newTool)
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
||||
DefineEngineStringlyVariadicMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)")
|
||||
{
|
||||
object->ignoreObjClass(argc, argv);
|
||||
}
|
||||
|
|
@ -3252,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.")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -657,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;
|
||||
}
|
||||
|
||||
|
|
@ -719,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