mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Merge branch 'development' of https://github.com/GarageGames/Torque3D into andOrMaybe
Conflicts: Engine/source/T3D/staticShape.cpp
This commit is contained in:
commit
dd071484da
517 changed files with 87707 additions and 178465 deletions
|
|
@ -511,7 +511,6 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
U32 origStyle = GFX->getCurrentRenderStyle();
|
||||
|
||||
// Set up the appropriate render style
|
||||
U32 prevRenderStyle = GFX->getCurrentRenderStyle();
|
||||
Point2I renderSize = getExtent();
|
||||
Frustum frustum;
|
||||
|
||||
|
|
@ -795,7 +794,6 @@ void GuiTSCtrl::renderDisplayPreview(const RectI &updateRect, GFXTexHandle &prev
|
|||
F32 screenBottom = rectHeight;
|
||||
|
||||
const F32 fillConv = 0.0f;
|
||||
const F32 frustumDepthAdjusted = 0.0f;
|
||||
verts[0].point.set(screenLeft - fillConv, screenTop - fillConv, 0.f);
|
||||
verts[1].point.set(screenRight - fillConv, screenTop - fillConv, 0.f);
|
||||
verts[2].point.set(screenLeft - fillConv, screenBottom - fillConv, 0.f);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,6 @@ void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
{
|
||||
bool highlight = mMouseOver;
|
||||
|
||||
ColorI backColor = mSwatchColor;
|
||||
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
||||
|
||||
RectI renderRect( offset, getExtent() );
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ bool GuiContainer::anchorControl( GuiControl *control, const Point2I &deltaParen
|
|||
|
||||
Point2I minExtent = control->getMinExtent();
|
||||
// Only resize if our minExtent is satisfied with it.
|
||||
if( !( newRect.extent.x >= control->getMinExtent().x && newRect.extent.y >= control->getMinExtent().y ) )
|
||||
if( !( newRect.extent.x >= minExtent.x && newRect.extent.y >= minExtent.y ) )
|
||||
return false;
|
||||
|
||||
if( newRect.point == oldRect.point && newRect.extent == oldRect.extent )
|
||||
|
|
|
|||
|
|
@ -384,8 +384,6 @@ void GuiFormCtrl::onMouseUp(const GuiEvent &event)
|
|||
mouseUnlock();
|
||||
setUpdate();
|
||||
|
||||
Point2I localClick = globalToLocalCoord(event.mousePoint);
|
||||
|
||||
// If we're clicking in the header then resize
|
||||
//if(localClick.y < mThumbSize.y && mDepressed)
|
||||
// setCollapsed(!mCollapsed);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ void GuiRolloutCtrl::removeObject( SimObject *obj )
|
|||
|
||||
void GuiRolloutCtrl::onMouseDown( const GuiEvent &event )
|
||||
{
|
||||
Point2I localPoint = globalToLocalCoord( event.mousePoint );
|
||||
mouseLock();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ ConsoleDocClass( GuiBitmapCtrl,
|
|||
GuiBitmapCtrl::GuiBitmapCtrl(void)
|
||||
: mBitmapName(),
|
||||
mStartPoint( 0, 0 ),
|
||||
mWrap( false ),
|
||||
mColor(ColorI::WHITE)
|
||||
mColor(ColorI::WHITE),
|
||||
mWrap( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ void GuiGradientSwatchCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
{
|
||||
bool highlight = mMouseOver;
|
||||
|
||||
ColorI backColor = mSwatchColor;
|
||||
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
|
||||
RectI renderRect( offset, getExtent() );
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ class GuiTextListCtrl : public GuiArrayCtrl
|
|||
UP = 0,
|
||||
DOWN = 1
|
||||
};
|
||||
enum {
|
||||
enum : U32
|
||||
{
|
||||
InvalidId = 0xFFFFFFFF
|
||||
};
|
||||
Vector<S32> mColumnOffsets;
|
||||
|
|
|
|||
|
|
@ -4113,10 +4113,20 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool )
|
|||
{
|
||||
if ( pGroup != NULL)
|
||||
{
|
||||
if (item->isExpanded())
|
||||
item->mIcon = SimGroup1;
|
||||
//Check if we're a SceneObject, and pick the default icon as appropriate
|
||||
|
||||
if (pObject->getClassName() != String("SimGroup"))
|
||||
{
|
||||
item->mIcon = Icon31;
|
||||
}
|
||||
else
|
||||
item->mIcon = SimGroup2;
|
||||
{
|
||||
//If we're purely a SimGroup, pick our icon.
|
||||
if (item->isExpanded())
|
||||
item->mIcon = SimGroup1;
|
||||
else
|
||||
item->mIcon = SimGroup2;
|
||||
}
|
||||
}
|
||||
else
|
||||
item->mIcon = SimGroup2;
|
||||
|
|
|
|||
|
|
@ -198,22 +198,22 @@ EndImplementEnumType;
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
GuiControl::GuiControl() : mAddGroup( NULL ),
|
||||
mLayer(0),
|
||||
mBounds(0,0,64,64),
|
||||
mMinExtent(8,2),
|
||||
mProfile(NULL),
|
||||
mLangTable(NULL),
|
||||
mFirstResponder(NULL),
|
||||
mTooltipProfile(NULL),
|
||||
mTipHoverTime(1000),
|
||||
mVisible(true),
|
||||
mActive(true),
|
||||
mAwake(false),
|
||||
mHorizSizing(horizResizeRight),
|
||||
mVertSizing(vertResizeBottom),
|
||||
mTooltipProfile(NULL),
|
||||
mTipHoverTime(1000),
|
||||
mIsContainer(false),
|
||||
mCanResize(true),
|
||||
mCanHit( true )
|
||||
mCanResize(true),
|
||||
mCanHit( true ),
|
||||
mLayer(0),
|
||||
mMinExtent(8,2),
|
||||
mLangTable(NULL),
|
||||
mFirstResponder(NULL),
|
||||
mHorizSizing(horizResizeRight),
|
||||
mVertSizing(vertResizeBottom)
|
||||
{
|
||||
mConsoleVariable = StringTable->EmptyString();
|
||||
mAcceleratorKey = StringTable->EmptyString();
|
||||
|
|
|
|||
|
|
@ -921,15 +921,15 @@ DefineEngineMethod( GuiInspector, setObjectField, void, (const char* fieldname,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* object), ,
|
||||
DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), ,
|
||||
"Returns the id of an awake inspector that is inspecting the passed object if one exists\n"
|
||||
"@param object Object to find away inspector for."
|
||||
"@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
|
||||
{
|
||||
if ( !object )
|
||||
if ( !obj)
|
||||
return NULL;
|
||||
|
||||
SimObject *inspector = GuiInspector::findByObject( object );
|
||||
SimObject *inspector = GuiInspector::findByObject(obj);
|
||||
|
||||
if ( !inspector )
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -400,6 +400,32 @@ ConsoleDocClass( GuiInspectorTypeCheckBox,
|
|||
|
||||
GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
|
||||
{
|
||||
if ( mField->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) )
|
||||
{
|
||||
// This checkbox (bool field) is meant to be treated as a button.
|
||||
GuiControl* retCtrl = new GuiButtonCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
GuiButtonCtrl *button = dynamic_cast<GuiButtonCtrl*>(retCtrl);
|
||||
|
||||
// Let's make it look pretty.
|
||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "InspectorTypeButtonProfile" );
|
||||
retCtrl->setField( "text", "Click Here" );
|
||||
|
||||
retCtrl->setScriptValue( getData() );
|
||||
|
||||
_registerEditControl( retCtrl );
|
||||
|
||||
// Configure it to update our value when the popup is closed
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, 512, "%d.apply(%d.getValue());",getId(), button->getId() );
|
||||
button->setField("Command", szBuffer );
|
||||
|
||||
return retCtrl;
|
||||
} else {
|
||||
GuiControl* retCtrl = new GuiCheckBoxCtrl();
|
||||
|
||||
GuiCheckBoxCtrl *check = dynamic_cast<GuiCheckBoxCtrl*>(retCtrl);
|
||||
|
|
@ -420,6 +446,7 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
|
|||
check->setField("Command", szBuffer );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1263,9 +1290,9 @@ void GuiInspectorTypeS32::setValue( StringTableEntry newValue )
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
GuiInspectorTypeBitMask32::GuiInspectorTypeBitMask32()
|
||||
: mRollout( NULL ),
|
||||
mArrayCtrl( NULL ),
|
||||
mHelper( NULL )
|
||||
: mHelper( NULL ),
|
||||
mRollout( NULL ),
|
||||
mArrayCtrl( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1953,7 +1953,6 @@ void GuiMenuBar::closeSubmenu()
|
|||
// Find if the mouse pointer is within a menu item
|
||||
GuiMenuBar::MenuItem *GuiMenuBar::findHitMenuItem(Point2I mousePoint)
|
||||
{
|
||||
Point2I pos = globalToLocalCoord(mousePoint);
|
||||
|
||||
// for(Menu *walk = menuList; walk; walk = walk->nextMenu)
|
||||
// if(walk->visible && walk->bounds.pointInRect(pos))
|
||||
|
|
|
|||
|
|
@ -748,7 +748,6 @@ void GuiParticleGraphCtrl::onMouseDown(const GuiEvent &event)
|
|||
if(event.mouseClickCount == 2)
|
||||
{
|
||||
Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y);
|
||||
Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint);
|
||||
S32 point = removePlotPoint(hitNut.x, hitNut.y);
|
||||
|
||||
// Argument Buffer.
|
||||
|
|
@ -885,8 +884,6 @@ void GuiParticleGraphCtrl::onRightMouseDown(const GuiEvent &event)
|
|||
if( hitNut != Point2I(-1,-1) )
|
||||
{
|
||||
Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y);
|
||||
|
||||
Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint);
|
||||
S32 point = removePlotPoint(hitNut.x, hitNut.y);
|
||||
|
||||
// Argument Buffer.
|
||||
|
|
@ -913,8 +910,6 @@ void GuiParticleGraphCtrl::onRightMouseDragged(const GuiEvent &event)
|
|||
if( hitNut != Point2I(-1,-1) )
|
||||
{
|
||||
Point2F plotPoint = getPlotPoint(hitNut.x, hitNut.y);
|
||||
|
||||
Point2F mousePos = convertToGraphCoord(mSelectedPlot, event.mousePoint);
|
||||
S32 point = removePlotPoint(hitNut.x, hitNut.y);
|
||||
|
||||
// Argument Buffer.
|
||||
|
|
|
|||
|
|
@ -145,8 +145,8 @@ S32 CreatorTree::Node::getSelected()
|
|||
//------------------------------------------------------------------------------
|
||||
CreatorTree::CreatorTree() :
|
||||
mCurId(0),
|
||||
mTxtOffset(5),
|
||||
mRoot(0)
|
||||
mRoot(0),
|
||||
mTxtOffset(5)
|
||||
{
|
||||
VECTOR_SET_ASSOCIATION(mNodeList);
|
||||
clear();
|
||||
|
|
|
|||
|
|
@ -811,8 +811,6 @@ void Gizmo::on3DMouseDown( const Gui3DMouseEvent & event )
|
|||
camPos = event.pos;
|
||||
else
|
||||
camPos = mCameraPos;
|
||||
|
||||
Point3F end = camPos + event.vec * smProjectDistance;
|
||||
|
||||
if ( 0 <= mSelectionIdx && mSelectionIdx <= 2 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -494,8 +494,6 @@ void GuiDecalEditorCtrl::renderScene(const RectI & updateRect)
|
|||
PROFILE_SCOPE( GuiDecalEditorCtrl_renderScene );
|
||||
|
||||
GFXTransformSaver saver;
|
||||
|
||||
RectI bounds = getBounds();
|
||||
|
||||
ColorI hlColor(0,255,0,255);
|
||||
ColorI regColor(255,0,0,255);
|
||||
|
|
|
|||
|
|
@ -282,7 +282,6 @@ void RaiseHeightAction::process( Selection *sel, const Gui3DMouseEvent &evt, boo
|
|||
return;
|
||||
|
||||
Point2I brushPos = brush->getPosition();
|
||||
Point2I brushSize = brush->getSize();
|
||||
GridPoint brushGridPoint = brush->getGridPoint();
|
||||
|
||||
Vector<GridInfo> cur; // the height at the brush position
|
||||
|
|
@ -327,7 +326,6 @@ void LowerHeightAction::process(Selection * sel, const Gui3DMouseEvent &, bool s
|
|||
return;
|
||||
|
||||
Point2I brushPos = brush->getPosition();
|
||||
Point2I brushSize = brush->getSize();
|
||||
GridPoint brushGridPoint = brush->getGridPoint();
|
||||
|
||||
Vector<GridInfo> cur; // the height at the brush position
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include "platform/typetraits.h"
|
||||
#include "T3D/prefab.h"
|
||||
#include "math/mEase.h"
|
||||
|
||||
#include "T3D/tsStatic.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT( WorldEditor );
|
||||
|
|
@ -3631,7 +3631,18 @@ void WorldEditor::makeSelectionPrefab( const char *filename )
|
|||
{
|
||||
for ( S32 i = 0; i < grp->size(); i++ )
|
||||
stack.push_back( grp->at(i) );
|
||||
cleanup.push_back( grp );
|
||||
|
||||
SceneObject* scn = dynamic_cast< SceneObject* >(grp);
|
||||
if (scn)
|
||||
{
|
||||
if (Prefab::isValidChild(obj, true))
|
||||
found.push_back(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Only push the cleanup of the group if it's ONLY a SimGroup.
|
||||
cleanup.push_back(grp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3742,6 +3753,158 @@ void WorldEditor::explodeSelectedPrefab()
|
|||
setDirty();
|
||||
}
|
||||
|
||||
void WorldEditor::makeSelectionAMesh(const char *filename)
|
||||
{
|
||||
if (mSelected->size() == 0)
|
||||
{
|
||||
Con::errorf("WorldEditor::makeSelectionAMesh - Nothing selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
SimGroup *missionGroup;
|
||||
if (!Sim::findObject("MissionGroup", missionGroup))
|
||||
{
|
||||
Con::errorf("WorldEditor::makeSelectionAMesh - Could not find MissionGroup.");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector< SimObject* > stack;
|
||||
Vector< SimObject* > found;
|
||||
|
||||
for (S32 i = 0; i < mSelected->size(); i++)
|
||||
{
|
||||
SimObject *obj = (*mSelected)[i];
|
||||
stack.push_back(obj);
|
||||
}
|
||||
|
||||
Vector< SimGroup* > cleanup;
|
||||
|
||||
while (!stack.empty())
|
||||
{
|
||||
SimObject *obj = stack.last();
|
||||
SimGroup *grp = dynamic_cast< SimGroup* >(obj);
|
||||
|
||||
stack.pop_back();
|
||||
|
||||
if (grp)
|
||||
{
|
||||
for (S32 i = 0; i < grp->size(); i++)
|
||||
stack.push_back(grp->at(i));
|
||||
|
||||
SceneObject* scn = dynamic_cast< SceneObject* >(grp);
|
||||
if (scn)
|
||||
{
|
||||
if (Prefab::isValidChild(obj, true))
|
||||
found.push_back(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Only push the cleanup of the group if it's ONLY a SimGroup.
|
||||
cleanup.push_back(grp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Prefab::isValidChild(obj, true))
|
||||
found.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
if (found.empty())
|
||||
{
|
||||
Con::warnf("WorldEditor::makeSelectionPrefab - No valid objects selected.");
|
||||
return;
|
||||
}
|
||||
|
||||
// SimGroup we collect prefab objects into.
|
||||
SimGroup *group = new SimGroup();
|
||||
group->registerObject();
|
||||
|
||||
// Transform from World to Prefab space.
|
||||
MatrixF fabMat(true);
|
||||
fabMat.setPosition(mSelected->getCentroid());
|
||||
fabMat.inverse();
|
||||
|
||||
MatrixF objMat;
|
||||
SimObject *obj = NULL;
|
||||
SceneObject *sObj = NULL;
|
||||
|
||||
Vector< SceneObject* > objectList;
|
||||
|
||||
for ( S32 i = 0; i < mSelected->size(); i++ )
|
||||
{
|
||||
SceneObject *pObj = dynamic_cast< SceneObject* >( ( *mSelected )[i] );
|
||||
if ( pObj )
|
||||
objectList.push_back( pObj );
|
||||
}
|
||||
|
||||
if ( objectList.empty() )
|
||||
return;
|
||||
|
||||
//
|
||||
Point3F centroid;
|
||||
MatrixF orientation;
|
||||
|
||||
if (objectList.size() == 1)
|
||||
{
|
||||
orientation = objectList[0]->getTransform();
|
||||
centroid = objectList[0]->getPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
orientation.identity();
|
||||
centroid.zero();
|
||||
|
||||
S32 count = 0;
|
||||
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
{
|
||||
SceneObject *pObj = objectList[i];
|
||||
if (pObj->isGlobalBounds())
|
||||
continue;
|
||||
|
||||
centroid += pObj->getPosition();
|
||||
count++;
|
||||
}
|
||||
|
||||
centroid /= count;
|
||||
}
|
||||
|
||||
orientation.setPosition(centroid);
|
||||
orientation.inverse();
|
||||
|
||||
OptimizedPolyList polyList;
|
||||
polyList.setBaseTransform(orientation);
|
||||
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
{
|
||||
SceneObject *pObj = objectList[i];
|
||||
if (!pObj->buildPolyList(PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
|
||||
}
|
||||
|
||||
// Use a ColladaUtils function to do the actual export to a Collada file
|
||||
ColladaUtils::exportToCollada(filename, polyList);
|
||||
//
|
||||
|
||||
// Allocate TSStatic object and add to level.
|
||||
TSStatic *ts = new TSStatic();
|
||||
ts->setShapeFileName(StringTable->insert(filename));
|
||||
fabMat.inverse();
|
||||
ts->setTransform(fabMat);
|
||||
ts->registerObject();
|
||||
missionGroup->addObject(ts);
|
||||
|
||||
// Select it, mark level as dirty.
|
||||
clearSelection();
|
||||
selectObject(ts);
|
||||
setDirty();
|
||||
|
||||
// Delete original objects and temporary SimGroup.
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
objectList[i]->deleteObject();
|
||||
}
|
||||
|
||||
DefineEngineMethod( WorldEditor, makeSelectionPrefab, void, ( const char* filename ),,
|
||||
"Save selected objects to a .prefab file and replace them in the level with a Prefab object."
|
||||
"@param filename Prefab file to save the selected objects to.")
|
||||
|
|
@ -3755,6 +3918,13 @@ DefineEngineMethod( WorldEditor, explodeSelectedPrefab, void, (),,
|
|||
object->explodeSelectedPrefab();
|
||||
}
|
||||
|
||||
DefineEngineMethod(WorldEditor, makeSelectionAMesh, void, (const char* filename), ,
|
||||
"Save selected objects to a .dae collada file and replace them in the level with a TSStatic object."
|
||||
"@param filename collada file to save the selected objects to.")
|
||||
{
|
||||
object->makeSelectionAMesh(filename);
|
||||
}
|
||||
|
||||
DefineEngineMethod( WorldEditor, mountRelative, void, ( SceneObject *objA, SceneObject *objB ),,
|
||||
"Mount object B relatively to object A."
|
||||
"@param objA Object to mount to."
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ class WorldEditor : public EditTSCtrl
|
|||
void makeSelectionPrefab( const char *filename );
|
||||
void explodeSelectedPrefab();
|
||||
|
||||
void makeSelectionAMesh(const char *filename);
|
||||
|
||||
//
|
||||
static SceneObject* getClientObj(SceneObject *);
|
||||
static void markAsSelected( SimObject* object, bool state );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue