* Fixes handling for Image, Material and Shape Assets' inspector fields so they properly work with non-object targeted inspectors, such as the PostFXEditor

* Updated PostFXEditor scripts to handle refreshing properly when certainl field types(assetId fields) are changed
* Adjusted display handling of slider values on guiGameSettingsCtrl to show 0.x decimal format instead of 0.xxxxx
* Fixed pad length of item names in guiTreeView for items that are marked to avoid console spam
* Fixed local offseting for popupMenus so scaled/offset window position doesn't cause the popup menu to offset from mouse click position(courtesy OTHG_Mars)
* Fix issue with terrain where, due to default value save validation, the global scope for the terrain collision list would be whiped when saving, causing players to fall through terrain. Moved to per-terrain convexLists
* Fixed issue with the core camera model mesh and updated references so camera bookmarks display properly
* Fixed console spam during asset browser initialization where it would try and expand the directory tree even though the dir tree isn't populated yet
* Fixed handling of Open File Location RMB menu action to properly deal with script and datablock types
* Removed unusuable "Create ___" asset type prompts from the RMB menus for the AB to avoid confusion
* Improved slider offset positioning for various popup sliders on editor toolbars
* Anchored the visibility popup menu to the button for more consistent formatting and better feel
* Shifted various visibility toggles from 'in place' on the menu buttons to functions, allowing it to also properly mark the menu entries as checked or not, improving usability
This commit is contained in:
Areloch 2022-08-26 15:25:17 -05:00
parent 6a0cd22e7a
commit ded99cd8cb
29 changed files with 276 additions and 127 deletions

View file

@ -470,9 +470,6 @@ void GuiInspectorTypeImageAssetPtr::consoleInit()
GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
{
if (mInspector->getInspectObject() == nullptr)
return nullptr;
// Create base filename edit controls
GuiControl* retCtrl = Parent::constructEditControl();
if (retCtrl == NULL)
@ -480,16 +477,28 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
retCtrl->getRenderTooltipDelegate().bind(this, &GuiInspectorTypeImageAssetPtr::renderTooltip);
// Change filespec
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
if (mInspector->getInspectObject() != nullptr)
{
// Change filespec
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
}
else
{
//if we don't have a target object, we'll be manipulating the desination value directly
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ImageAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mVariableName);
mBrowseButton->setField("Command", szBuffer);
}
// Create "Open in ShapeEditor" button
mImageEdButton = new GuiBitmapButtonCtrl();
mImageEdButton = NULL;
// Create "Open in ImageEditor" button
/*mImageEdButton = new GuiBitmapButtonCtrl();
char bitmapName[512] = "ToolsModule:GameTSCtrl_image";
mImageEdButton->setBitmap(StringTable->insert(bitmapName));
@ -498,10 +507,10 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl()
mImageEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mImageEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
mImageEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
mImageEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
mImageEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Image Editor");
mImageEdButton->registerObject();
addObject(mImageEdButton);
addObject(mImageEdButton);*/
return retCtrl;
}
@ -517,18 +526,21 @@ bool GuiInspectorTypeImageAssetPtr::updateRects()
mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y);
bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
if (mBrowseButton != NULL)
{
mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4);
resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent);
}
if (mImageEdButton != NULL)
{
RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4);
resized |= mImageEdButton->resize(shapeEdRect.point, shapeEdRect.extent);
}
if (mBrowseButton != NULL)
{
if(mImageEdButton != NULL)
mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4);
else
mBrowseRect.set(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4);
resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent);
}
return resized;
}

View file

@ -479,11 +479,22 @@ GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl()
// Change filespec
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
if (mInspector->getInspectObject() != nullptr)
{
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
}
else
{
//if we don't have a target object, we'll be manipulating the desination value directly
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mVariableName);
mBrowseButton->setField("Command", szBuffer);
}
// Create "Open in Editor" button
mEditButton = new GuiBitmapButtonCtrl();

View file

@ -749,11 +749,21 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl()
// Change filespec
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
if (mInspector->getInspectObject() != nullptr)
{
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mCaption);
mBrowseButton->setField("Command", szBuffer);
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString());
}
else
{
//if we don't have a target object, we'll be manipulating the desination value directly
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %s, %s);",
mInspector->getIdString(), mVariableName);
mBrowseButton->setField("Command", szBuffer);
}
// Create "Open in ShapeEditor" button
mShapeEdButton = new GuiBitmapButtonCtrl();

View file

@ -393,7 +393,7 @@ void GuiGameSettingsCtrl::onRenderSliderOption(Point2I currentOffset)
GFont* font = mProfile->mFont;
char stringVal[32];
dSprintf(stringVal, 32, "%f", mValue);
dSprintf(stringVal, 32, "%.1f", mValue);
S32 stringWidth = font->getStrWidth(stringVal);
Point2I textOffset(sliderRect.point.x + sliderRect.extent.x, 0);

View file

@ -1982,7 +1982,7 @@ bool GuiTreeViewCtrl::_hitTest(const Point2I & pnt, Item* & item, BitSet32 & fla
min += mProfile->mTextOffset.x;
FrameAllocatorMarker txtAlloc;
U32 bufLen = item->getDisplayTextLength() + 1;
U32 bufLen = item->getDisplayTextLength() + 2;
char *buf = (char*)txtAlloc.alloc(bufLen);
item->getDisplayText(bufLen, buf);

View file

@ -428,7 +428,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */)
Point2I pos = Point2I::Zero;
if (x == -1 && y == -1)
pos = owner->getCursorPos();
pos = owner->getCursorPosLocal();
else
pos = Point2I(x, y);

View file

@ -34,9 +34,6 @@ static const U32 MaxExtent = 256;
//----------------------------------------------------------------------------
Convex sTerrainConvexList;
// Number of vertices followed by point index
S32 sVertexList[5][5] = {
{ 3, 1,2,3 }, // 135 B
@ -350,7 +347,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
{
PROFILE_SCOPE( TerrainBlock_buildConvex );
sTerrainConvexList.collectGarbage();
mTerrainConvexList.collectGarbage();
// First check to see if the query misses the
// terrain elevation range.
@ -415,7 +412,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
// Create a new convex.
TerrainConvex* cp = new TerrainConvex;
sTerrainConvexList.registerObject(cp);
mTerrainConvexList.registerObject(cp);
convex->addToWorkingList(cp);
cp->halfA = true;
cp->square = 0;
@ -448,7 +445,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
cp->normal[1].normalize();
if (mDot(vp[3] - vp[1],cp->normal[0]) > 0) {
TerrainConvex* nc = new TerrainConvex(*cp);
sTerrainConvexList.registerObject(nc);
mTerrainConvexList.registerObject(nc);
convex->addToWorkingList(nc);
nc->halfA = false;
nc->square = cp;
@ -463,7 +460,7 @@ void TerrainBlock::buildConvex(const Box3F& box,Convex* convex)
cp->normal[1].normalize();
if (mDot(vp[2] - vp[0],cp->normal[0]) > 0) {
TerrainConvex* nc = new TerrainConvex(*cp);
sTerrainConvexList.registerObject(nc);
mTerrainConvexList.registerObject(nc);
convex->addToWorkingList(nc);
nc->halfA = false;
nc->square = cp;

View file

@ -220,13 +220,10 @@ TerrainBlock::TerrainBlock()
mTerrainAssetId = StringTable->EmptyString();
}
extern Convex sTerrainConvexList;
TerrainBlock::~TerrainBlock()
{
// Kill collision
sTerrainConvexList.nukeList();
mTerrainConvexList.nukeList();
SAFE_DELETE(mLightMap);
mLightMapTex = NULL;

View file

@ -55,7 +55,10 @@
#endif
#ifndef TERRAINASSET_H
#include "T3D/assets/TerrainAsset.h"
#endif
#endif
#ifndef _CONVEX_H_
#include "collision/convex.h"
#endif
class GBitmap;
class TerrainBlock;
@ -217,6 +220,9 @@ protected:
/// True if the zoning needs to be recalculated for the terrain.
bool mZoningDirty;
/// Holds the generated convex list stuff for this terrain
Convex mTerrainConvexList;
String _getBaseTexCacheFileName() const;
void _rebuildQuadtree();