Merge remote-tracking branch 'devhead/Preview4_0' into tsneo

# Conflicts:
#	Templates/BaseGame/game/data/ui/guis/loadingGui.gui
#	Templates/BaseGame/game/data/ui/guis/mainMenu.gui
#	Templates/BaseGame/game/tools/MainEditor/guis/MainEditorWindow.gui
#	Templates/BaseGame/game/tools/assetBrowser/guis/assetPreviewButtonsTemplate.gui
#	Templates/BaseGame/game/tools/forestEditor/brushes.tscript
This commit is contained in:
Jeff Hutchinson 2021-08-13 20:14:39 -04:00
commit 717c7acca9
2266 changed files with 48780 additions and 26034 deletions

View file

@ -161,7 +161,9 @@ public:
void setObjectField( const char *fieldName, const char *data );
static GuiInspector* findByObject( SimObject *obj );
static GuiInspector* findByObject( SimObject *obj );
void refresh();
protected:
@ -181,8 +183,6 @@ protected:
SimObjectPtr<GuiInspectorField> mHLField;
String mGroupFilters;
bool mShowCustomFields;
void refresh();
};
#endif

View file

@ -220,8 +220,8 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
mBrowseButton->setBitmap( bitmapName );
char bitmapName[512] = "ToolsModule:change_material_btn_n_image";
mBrowseButton->setBitmap( StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -326,8 +326,8 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/layers-btn";
mBrowseButton->setBitmap( bitmapName );
char bitmapName[512] = "ToolsModule:tools/gui/images/layers_btn_n_image";
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -804,8 +804,8 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
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);
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
@ -956,8 +956,8 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
mBrowseButton->setBitmap( bitmapName );
char bitmapName[512] = "ToolsModule:uv_editor_btn_n_image";
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
mBrowseButton->registerObject();
@ -1544,7 +1544,7 @@ GuiControl* GuiInspectorTypeBitMask32Helper::constructEditControl()
mButton->setField( "Command", szBuffer );
mButton->setField( "buttonType", "ToggleButton" );
mButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mButton->setBitmap( "tools/gui/images/arrowBtn" );
mButton->setBitmap(StringTable->insert("ToolsModule:arrowBtn_image") );
mButton->setStateOn( true );
mButton->setExtent( 16, 16 );
mButton->registerObject();

View file

@ -1347,7 +1347,7 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
bitmapstart.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - rect.extent.y) / 2;
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mProfile->mTextureObject, offset + bitmapstart, rect);
drawUtil->drawBitmapSR(mProfile->getBitmapResource(), offset + bitmapstart, rect);
// Should we also draw the text?
if (!mMenuList[i].drawBitmapOnly)

View file

@ -142,7 +142,7 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s
Point2I bitPos = Point2I(offset.x + mCellSize.y / 2, offset.y + mCellSize.y / 2);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, bitPos + off, rect);
GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), bitPos + off, rect);
}
}

View file

@ -35,6 +35,9 @@
#include "gfx/gfxDrawUtil.h"
#include "collision/concretePolyList.h"
#include "T3D/assets/ShapeAsset.h"
#include "T3D/assets/ShapeAnimationAsset.h"
#ifdef TORQUE_COLLADA
#include "collision/optimizedPolyList.h"
#include "ts/collada/colladaUtils.h"
@ -65,6 +68,7 @@ GuiShapeEdPreview::GuiShapeEdPreview()
mZoomSpeed ( 1.0f ),
mGridDimension( 30, 30 ),
mModel( NULL ),
mModelName(StringTable->EmptyString()),
mRenderGhost( false ),
mRenderNodes( false ),
mRenderBounds( false ),
@ -349,6 +353,8 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
mThreads.clear();
mActiveThread = -1;
ResourceManager::get().getChangedSignal().remove(this, &GuiShapeEdPreview::_onResourceChanged);
if (modelName && modelName[0])
{
Resource<TSShape> model = ResourceManager::get().load( modelName );
@ -382,11 +388,57 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
// the first time recording
mLastRenderTime = Platform::getVirtualMilliseconds();
mModelName = StringTable->insert(modelName);
//Now to reflect changes when the model file is changed.
ResourceManager::get().getChangedSignal().notify(this, &GuiShapeEdPreview::_onResourceChanged);
}
else
{
mModelName = StringTable->EmptyString();
}
return true;
}
bool GuiShapeEdPreview::setObjectShapeAsset(const char* assetId)
{
SAFE_DELETE(mModel);
unmountAll();
mThreads.clear();
mActiveThread = -1;
StringTableEntry modelName = StringTable->EmptyString();
if (AssetDatabase.isDeclaredAsset(assetId))
{
StringTableEntry id = StringTable->insert(assetId);
StringTableEntry assetType = AssetDatabase.getAssetType(id);
if (assetType == StringTable->insert("ShapeAsset"))
{
ShapeAsset* asset = AssetDatabase.acquireAsset<ShapeAsset>(id);
modelName = asset->getShapeFilePath();
AssetDatabase.releaseAsset(id);
}
else if (assetType == StringTable->insert("ShapeAnimationAsset"))
{
ShapeAnimationAsset* asset = AssetDatabase.acquireAsset<ShapeAnimationAsset>(id);
modelName = asset->getAnimationPath();
AssetDatabase.releaseAsset(id);
}
}
return setObjectModel(modelName);
}
void GuiShapeEdPreview::_onResourceChanged(const Torque::Path& path)
{
if (path != Torque::Path(mModelName))
return;
setObjectModel(path.getFullPath());
}
void GuiShapeEdPreview::addThread()
{
if ( mModel )
@ -1697,6 +1749,14 @@ DefineEngineMethod( GuiShapeEdPreview, setModel, bool, ( const char* shapePath )
return object->setObjectModel( shapePath );
}
DefineEngineMethod(GuiShapeEdPreview, setShapeAsset, bool, (const char* shapeAsset), ,
"Sets the model to be displayed in this control\n\n"
"@param shapeName Name of the model to display.\n"
"@return True if the model was loaded successfully, false otherwise.\n")
{
return object->setObjectShapeAsset(shapeAsset);
}
DefineEngineMethod( GuiShapeEdPreview, fitToShape, void, (),,
"Adjust the camera position and zoom to fit the shape within the view.\n\n" )
{

View file

@ -114,6 +114,7 @@ protected:
bool mRenderColMeshes;
bool mRenderMounts;
TSShapeInstance* mModel;
StringTableEntry mModelName;
LightInfo* mFakeSun;
EulerF mSunRot;
@ -198,6 +199,9 @@ public:
void setCurrentDetail(S32 dl);
bool setObjectModel(const char * modelName);
bool setObjectShapeAsset(const char* assetId);
void _onResourceChanged(const Torque::Path& path);
/// @name Threads
///@{

View file

@ -257,7 +257,7 @@ bool GuiInspectorDynamicField::onAdd()
mParent->getId() );
// FIXME Hardcoded image
mDeleteButton->setField( "Bitmap", "tools/gui/images/iconDelete" );
mDeleteButton->setField( "Bitmap", "ToolsModule:iconDelete_image" );
mDeleteButton->setField( "Text", "X" );
mDeleteButton->setField( "Command", szBuffer );
mDeleteButton->setSizing( horizResizeLeft, vertResizeCenter );

View file

@ -60,7 +60,7 @@ bool GuiInspectorDynamicGroup::createContent()
addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) );
// FIXME Hardcoded image
addFieldBtn->setBitmap("tools/gui/images/iconAdd.png");
addFieldBtn->setBitmap(StringTable->insert("ToolsModule:iconAdd_image"));
char commandBuf[64];
dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId());

View file

@ -22,6 +22,9 @@
#include "gui/editor/inspector/variableInspector.h"
#include "console/engineAPI.h"
#include "T3D/assets/ShapeAsset.h"
#include "T3D/assets/ImageAsset.h"
#include "T3D/assets/MaterialAsset.h"
GuiVariableInspector::GuiVariableInspector() : mAutoUpdate(true)
{
@ -180,12 +183,12 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c
fieldTypeMask = TypePoint3F;
else if (newField.mFieldTypeName == StringTable->insert("vector2"))
fieldTypeMask = TypePoint2F;
//else if (fieldType == StringTable->insert("material"))
// fieldTypeMask = TypeMaterialName;
else if (newField.mFieldTypeName == StringTable->insert("material"))
fieldTypeMask = TypeMaterialAssetId;
else if (newField.mFieldTypeName == StringTable->insert("image"))
fieldTypeMask = TypeImageFilename;
fieldTypeMask = TypeImageAssetId;
else if (newField.mFieldTypeName == StringTable->insert("shape"))
fieldTypeMask = TypeShapeFilename;
fieldTypeMask = TypeShapeAssetId;
else if (newField.mFieldTypeName == StringTable->insert("bool"))
fieldTypeMask = TypeBool;
else if (newField.mFieldTypeName == StringTable->insert("object"))