Merge branch 'GarageGames/development' into ueberengine-dev

This commit is contained in:
Duion 2015-08-06 20:05:32 +02:00
commit 683a11e384
273 changed files with 4702 additions and 3631 deletions

View file

@ -47,8 +47,6 @@ U32 GuiImageList::Insert( const char* texturePath, GFXTextureProfile *Type )
{
TextureEntry *t = new TextureEntry;
if ( ! t ) return -1;
t->TexturePath = StringTable->insert(texturePath);
if ( *t->TexturePath )
{

View file

@ -564,31 +564,25 @@ void GuiInspector::refresh()
ungroup = new GuiInspectorGroup( "Ungrouped", this );
ungroup->setHeaderHidden( true );
ungroup->setCanCollapse( false );
if( ungroup != NULL )
{
ungroup->registerObject();
mGroups.push_back( ungroup );
addObject( ungroup );
}
ungroup->registerObject();
mGroups.push_back( ungroup );
addObject( ungroup );
}
// Put the 'transform' group first
GuiInspectorGroup *transform = new GuiInspectorGroup( "Transform", this );
if( transform != NULL )
{
transform->registerObject();
mGroups.push_back( transform );
addObject( transform );
}
transform->registerObject();
mGroups.push_back(transform);
addObject(transform);
// Always create the 'general' group (for fields without a group)
GuiInspectorGroup *general = new GuiInspectorGroup( "General", this );
if( general != NULL )
{
general->registerObject();
mGroups.push_back( general );
addObject( general );
}
general->registerObject();
mGroups.push_back(general);
addObject(general);
// Create the inspector groups for static fields.
@ -606,25 +600,23 @@ void GuiInspector::refresh()
if( !group && !isGroupFiltered( itr->pGroupname ) )
{
GuiInspectorGroup *group = new GuiInspectorGroup( itr->pGroupname, this );
if( group != NULL )
group->registerObject();
if( !group->getNumFields() )
{
group->registerObject();
if( !group->getNumFields() )
{
#ifdef DEBUG_SPEW
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
group->getCaption().c_str() );
#endif
#ifdef DEBUG_SPEW
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
group->getCaption().c_str() );
#endif
// The group ended up having no fields. Remove it.
group->deleteObject();
}
else
{
mGroups.push_back( group );
addObject( group );
}
}
// The group ended up having no fields. Remove it.
group->deleteObject();
}
else
{
mGroups.push_back( group );
addObject( group );
}
}
}
}
@ -634,12 +626,10 @@ void GuiInspector::refresh()
if ( !isGroupFiltered( "Dynamic Fields" ) )
{
GuiInspectorGroup *dynGroup = new GuiInspectorDynamicGroup( "Dynamic Fields", this);
if( dynGroup != NULL )
{
dynGroup->registerObject();
mGroups.push_back( dynGroup );
addObject( dynGroup );
}
dynGroup->registerObject();
mGroups.push_back( dynGroup );
addObject( dynGroup );
}
if( mShowCustomFields && mTargets.size() == 1 )

View file

@ -57,10 +57,6 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl()
{
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
// Let's make it look pretty.
@ -218,25 +214,21 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
//return retCtrl;
mBrowseButton = new GuiBitmapButtonCtrl();
if ( mBrowseButton != NULL )
{
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
char szBuffer[512];
dSprintf( szBuffer, 512, command, getId());
mBrowseButton->setField( "Command", szBuffer );
dSprintf( szBuffer, 512, command, getId());
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
mBrowseButton->setBitmap( bitmapName );
//temporary static button name
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
}
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
return retCtrl;
}
@ -328,25 +320,21 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
//return retCtrl;
mBrowseButton = new GuiBitmapButtonCtrl();
if ( mBrowseButton != NULL )
{
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
char szBuffer[512];
dSprintf( szBuffer, 512, command, getId());
mBrowseButton->setField( "Command", szBuffer );
dSprintf( szBuffer, 512, command, getId());
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/layers-btn";
mBrowseButton->setBitmap( bitmapName );
//temporary static button name
char bitmapName[512] = "tools/gui/images/layers-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
}
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
return retCtrl;
}
@ -414,10 +402,6 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
{
GuiControl* retCtrl = new GuiCheckBoxCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
GuiCheckBoxCtrl *check = dynamic_cast<GuiCheckBoxCtrl*>(retCtrl);
// Let's make it look pretty.
@ -485,10 +469,6 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
{
GuiControl* retCtrl = new GuiTextEditCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditRightProfile" );
retCtrl->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
@ -504,20 +484,17 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
mBrowseButton = new GuiButtonCtrl();
if( mBrowseButton != NULL )
{
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
char szBuffer[512];
dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
mBrowseButton->setField( "Command", szBuffer );
mBrowseButton->setField( "text", "..." );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
}
dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
mBrowseButton->setField( "Command", szBuffer );
mBrowseButton->setField( "text", "..." );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
return retCtrl;
}
@ -769,23 +746,20 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
// Create "Open in ShapeEditor" button
mShapeEdButton = new GuiBitmapButtonCtrl();
if ( mShapeEdButton != NULL )
{
char szBuffer[512];
dSprintf( szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId() );
mShapeEdButton->setField( "Command", szBuffer );
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
mShapeEdButton->setBitmap( bitmapName );
dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId());
mShapeEdButton->setField("Command", szBuffer);
mShapeEdButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mShapeEdButton->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
mShapeEdButton->setDataField( StringTable->insert("hovertime"), NULL, "1000" );
mShapeEdButton->setDataField( StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor" );
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
mShapeEdButton->setBitmap(bitmapName);
mShapeEdButton->registerObject();
addObject( mShapeEdButton );
}
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
mShapeEdButton->registerObject();
addObject(mShapeEdButton);
return retCtrl;
}
@ -842,10 +816,6 @@ GuiControl* GuiInspectorTypeCommand::constructEditControl()
{
GuiButtonCtrl* retCtrl = new GuiButtonCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
@ -926,25 +896,21 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
//return retCtrl;
mBrowseButton = new GuiBitmapButtonCtrl();
if ( mBrowseButton != NULL )
{
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
char szBuffer[512];
dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
mBrowseButton->setField( "Command", szBuffer );
dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
mBrowseButton->setBitmap( bitmapName );
//temporary static button name
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
mBrowseButton->setBitmap( bitmapName );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
}
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
return retCtrl;
}
@ -1084,10 +1050,6 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
{
GuiControl* retCtrl = new GuiTextEditCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
// Let's make it look pretty.
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
@ -1101,46 +1063,42 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
mBrowseButton = new GuiSwatchButtonCtrl();
if ( mBrowseButton != NULL )
{
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
mBrowseButton->registerObject();
addObject( mBrowseButton );
char szColor[512];
if( _getColorConversionFunction() )
dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
else
dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
char szColor[2048];
if( _getColorConversionFunction() )
dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
else
dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
// If the inspector supports the alternate undo recording path,
// use this here.
// If the inspector supports the alternate undo recording path,
// use this here.
char szBuffer[2048];
GuiInspector* inspector = getInspector();
if( inspector->isMethod( "onInspectorPreFieldModification" ) )
{
dSprintf( szBuffer, sizeof( szBuffer ),
"%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
inspector->getId(), getRawFieldName(), getArrayIndex(),
mColorFunction, szColor, inspector->getId(), getId(),
getId(),
getId(),
inspector->getId()
);
}
else
dSprintf( szBuffer, sizeof( szBuffer ),
"%s(%s, \"%d.apply\", %d.getRoot());",
mColorFunction, szColor, getId(), getId() );
mBrowseButton->setConsoleCommand( szBuffer );
mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
GuiInspector* inspector = getInspector();
if( inspector->isMethod( "onInspectorPreFieldModification" ) )
{
dSprintf( szBuffer, sizeof( szBuffer ),
"%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
inspector->getId(), getRawFieldName(), getArrayIndex(),
mColorFunction, szColor, inspector->getId(), getId(),
getId(),
getId(),
inspector->getId()
);
}
else
dSprintf( szBuffer, sizeof( szBuffer ),
"%s(%s, \"%d.apply\", %d.getRoot());",
mColorFunction, szColor, getId(), getId() );
mBrowseButton->setConsoleCommand( szBuffer );
mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
// Position
mBrowseButton->resize( browseRect.point, browseRect.extent );
return retCtrl;
}
@ -1277,10 +1235,6 @@ GuiControl* GuiInspectorTypeS32::constructEditControl()
{
GuiControl* retCtrl = new GuiTextEditSliderCtrl();
// If we couldn't construct the control, bail!
if( retCtrl == NULL )
return retCtrl;
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
// Don't forget to register ourselves

View file

@ -1288,12 +1288,13 @@ void GuiMenuBar::onMouseUp(const GuiEvent &event)
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
{
RectI ctrlRect(offset, getExtent());
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
//if opaque, fill the update rect with the fill color
if (mProfile->mOpaque)
GFX->getDrawUtil()->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
drawUtil->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
//if there's a border, draw the border
if (mProfile->mBorder)
@ -1337,20 +1338,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
Point2I bitmapstart(start);
bitmapstart.y = walk->bounds.point.y + ( walk->bounds.extent.y - rect.extent.y ) / 2;
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
// Should we also draw the text?
if(!walk->drawBitmapOnly)
{
start.x += mBitmapMargin;
GFX->getDrawUtil()->setBitmapModulation( fontColor );
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
drawUtil->setBitmapModulation( fontColor );
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->setBitmapModulation( fontColor );
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
drawUtil->setBitmapModulation( fontColor );
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
}
}
@ -1633,7 +1634,7 @@ void GuiMenuBar::closeMenu()
}
// Called when a menu item is highlighted by the mouse
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize)
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
{
S32 selstore = selectionIndex;
@ -1787,7 +1788,7 @@ void GuiMenuBar::onAction()
//------------------------------------------------------------------------------
// Performs an action when a menu item that is a submenu is selected/highlighted
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize)
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
{
if(!mouseOverSubmenu)
return;

View file

@ -182,12 +182,12 @@ public:
static void addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem );
static void removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem);
static void clearSubmenuItems(MenuItem *menuitem);
void onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize);
void onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize);
void closeSubmenu();
void checkSubmenuMouseMove(const GuiEvent &event);
MenuItem *findHitMenuItem(Point2I mousePoint);
void highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
void highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
// display/mouse functions

View file

@ -287,33 +287,35 @@ void GuiRectHandles::onRender(Point2I offset, const RectI &updateRect)
Point2I size(extent.x*mHandleRect.extent.x, extent.y*mHandleRect.extent.y);
RectI box(offset+pos, size);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
// Draw border
GFX->getDrawUtil()->drawRect(box, handleColor);
drawUtil->drawRect(box, handleColor);
// Draw each handle
Point2I handleSize(mHandleSize, mHandleSize);
RectI handleRect(box.point, handleSize);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper left
drawUtil->drawRectFill(handleRect, handleColor); // Upper left
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper right
drawUtil->drawRectFill(handleRect, handleColor); // Upper right
handleRect.point = Point2I(box.point.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower left
drawUtil->drawRectFill(handleRect, handleColor); // Lower left
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower right
drawUtil->drawRectFill(handleRect, handleColor); // Lower right
Point2I halfSize = size / 2;
Point2I halfHandleSize = handleSize / 2;
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper middle
drawUtil->drawRectFill(handleRect, handleColor); // Upper middle
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+size.y-handleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower middle
drawUtil->drawRectFill(handleRect, handleColor); // Lower middle
handleRect.point = Point2I(box.point.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Left middle
drawUtil->drawRectFill(handleRect, handleColor); // Left middle
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Right middle
drawUtil->drawRectFill(handleRect, handleColor); // Right middle
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Middle
drawUtil->drawRectFill(handleRect, handleColor); // Middle
renderChildControls(offset, updateRect);
}

View file

@ -330,10 +330,11 @@ void GuiShapeEdPreview::setCurrentDetail(S32 dl)
{
if ( mModel )
{
S32 smallest = mModel->getShape()->mSmallestVisibleDL;
mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->details.size()-1;
TSShape* shape = mModel->getShape();
S32 smallest = shape->mSmallestVisibleDL;
shape->mSmallestVisibleDL = shape->details.size() - 1;
mModel->setCurrentDetail( dl );
mModel->getShape()->mSmallestVisibleDL = smallest;
shape->mSmallestVisibleDL = smallest;
// Match the camera distance to this detail if necessary
//@todo if ( !gui->mFixedDetail )
@ -359,19 +360,21 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
mModel = new TSShapeInstance( model, true );
AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName ));
TSShape* shape = mModel->getShape();
// Initialize camera values:
mOrbitPos = mModel->getShape()->center;
mOrbitPos = shape->center;
// Set camera move and zoom speed according to model size
mMoveSpeed = mModel->getShape()->radius / sMoveScaler;
mZoomSpeed = mModel->getShape()->radius / sZoomScaler;
mMoveSpeed = shape->radius / sMoveScaler;
mZoomSpeed = shape->radius / sZoomScaler;
// Reset node selection
mHoverNode = -1;
mSelectedNode = -1;
mSelectedObject = -1;
mSelectedObjDetail = 0;
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
mProjectedNodes.setSize( shape->nodes.size() );
// Reset detail stats
mCurrentDL = 0;
@ -511,8 +514,6 @@ bool GuiShapeEdPreview::mountShape(const char* modelName, const char* nodeName,
return false;
TSShapeInstance* tsi = new TSShapeInstance( model, true );
if ( !tsi )
return false;
if ( slot == -1 )
{
@ -683,9 +684,11 @@ void GuiShapeEdPreview::refreshShape()
mModel->initNodeTransforms();
mModel->initMeshObjects();
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
TSShape* shape = mModel->getShape();
if ( mSelectedObject >= mModel->getShape()->objects.size() )
mProjectedNodes.setSize( shape->nodes.size() );
if ( mSelectedObject >= shape->objects.size() )
{
mSelectedObject = -1;
mSelectedObjDetail = 0;
@ -694,22 +697,22 @@ void GuiShapeEdPreview::refreshShape()
// Re-compute the collision mesh stats
mColMeshes = 0;
mColPolys = 0;
for ( S32 i = 0; i < mModel->getShape()->details.size(); i++ )
for ( S32 i = 0; i < shape->details.size(); i++ )
{
const TSShape::Detail& det = mModel->getShape()->details[i];
const String& detName = mModel->getShape()->getName( det.nameIndex );
const TSShape::Detail& det = shape->details[i];
const String& detName = shape->getName( det.nameIndex );
if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) )
continue;
mColPolys += det.polyCount;
S32 od = det.objectDetailNum;
S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum];
S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum];
S32 start = shape->subShapeFirstObject[det.subShapeNum];
S32 end = start + shape->subShapeNumObjects[det.subShapeNum];
for ( S32 j = start; j < end; j++ )
{
const TSShape::Object &obj = mModel->getShape()->objects[j];
const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + od] : NULL;
const TSShape::Object &obj = shape->objects[j];
const TSMesh* mesh = ( od < obj.numMeshes ) ? shape->meshes[obj.startMeshIndex + od] : NULL;
if ( mesh )
mColMeshes++;
}
@ -1542,10 +1545,12 @@ void GuiShapeEdPreview::renderSunDirection() const
GFXStateBlockDesc desc;
desc.setZReadWrite( true, true );
GFX->getDrawUtil()->drawArrow( desc, start, end, color );
GFX->getDrawUtil()->drawArrow( desc, start + up, end + up, color );
GFX->getDrawUtil()->drawArrow( desc, start + right, end + right, color );
GFX->getDrawUtil()->drawArrow( desc, start + up + right, end + up + right, color );
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->drawArrow( desc, start, end, color );
drawUtil->drawArrow( desc, start + up, end + up, color );
drawUtil->drawArrow( desc, start + right, end + right, color );
drawUtil->drawArrow( desc, start + up + right, end + up + right, color );
}
}

View file

@ -167,12 +167,10 @@ GuiInspectorField* GuiInspectorGroup::constructField( S32 fieldType )
GuiInspectorDatablockField *dbFieldClass = new GuiInspectorDatablockField( typeClassName );
if( dbFieldClass != NULL )
{
// return our new datablock field with correct datablock type enumeration info
return dbFieldClass;
}
}
// return our new datablock field with correct datablock type enumeration info
return dbFieldClass;
}
// Nope, not a datablock. So maybe it has a valid inspector field override we can use?
if(!cbt->getInspectorFieldType())

View file

@ -52,13 +52,10 @@ void GuiVariableInspector::loadVars( String searchStr )
group->setCaption( "Global Variables" );
group->mSearchString = searchStr;
if( group != NULL )
{
group->registerObject();
mGroups.push_back( group );
addObject( group );
}
group->registerObject();
mGroups.push_back( group );
addObject( group );
//group->inspectGroup();
}