mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Merge pull request #1541 from Areloch/MiscFixes_20250825
Misc small fixes, improvements and QoL tweaks
This commit is contained in:
commit
e73efc13c4
37 changed files with 728 additions and 346 deletions
|
|
@ -599,20 +599,42 @@ void GuiInspectorTypeMaterialAssetPtr::updateValue()
|
|||
|
||||
void GuiInspectorTypeMaterialAssetPtr::updatePreviewImage()
|
||||
{
|
||||
const char* previewImage;
|
||||
const char* matAssetId;
|
||||
if (mInspector->getInspectObject() != nullptr)
|
||||
previewImage = mInspector->getInspectObject()->getDataField(mCaption, NULL);
|
||||
matAssetId = mInspector->getInspectObject()->getDataField(mCaption, NULL);
|
||||
else
|
||||
previewImage = Con::getVariable(mVariableName);
|
||||
matAssetId = Con::getVariable(mVariableName);
|
||||
|
||||
//if what we're working with isn't even a valid asset, don't present like we found a good one
|
||||
if (!AssetDatabase.isDeclaredAsset(previewImage))
|
||||
if (!AssetDatabase.isDeclaredAsset(matAssetId))
|
||||
{
|
||||
mPreviewImage->_setBitmap(StringTable->EmptyString());
|
||||
mPreviewImage->_setBitmap(StringTable->insert("Core_Rendering:NoMaterial"));
|
||||
return;
|
||||
}
|
||||
|
||||
String matPreviewAssetId = String(previewImage) + "_PreviewImage";
|
||||
AssetPtr<MaterialAsset> matAssetDef = matAssetId;
|
||||
if (matAssetDef.isNull() || matAssetDef->getStatus() != AssetBase::AssetErrCode::Ok ||
|
||||
matAssetDef->getMaterialDefinitionName() == StringTable->EmptyString())
|
||||
{
|
||||
mPreviewImage->_setBitmap(StringTable->insert("Core_Rendering:WarningMaterial"));
|
||||
return;
|
||||
}
|
||||
|
||||
Material* matDef;
|
||||
if (!Sim::findObject(matAssetDef->getMaterialDefinitionName(), matDef))
|
||||
{
|
||||
mPreviewImage->_setBitmap(StringTable->insert("Core_Rendering:WarningMaterial"));
|
||||
return;
|
||||
}
|
||||
|
||||
AssetPtr<ImageAsset> difMapAsset = matDef->getDiffuseMapAsset(0);
|
||||
if (difMapAsset.isNull() || difMapAsset->getStatus() != AssetBase::AssetErrCode::Ok)
|
||||
{
|
||||
mPreviewImage->_setBitmap(StringTable->insert("Core_Rendering:WarningMaterial"));
|
||||
return;
|
||||
}
|
||||
|
||||
String matPreviewAssetId = String(difMapAsset->getAssetName()) + "_PreviewImage";
|
||||
matPreviewAssetId.replace(":", "_");
|
||||
matPreviewAssetId = "ToolsModule:" + matPreviewAssetId;
|
||||
if (AssetDatabase.isDeclaredAsset(matPreviewAssetId.c_str()))
|
||||
|
|
@ -621,18 +643,14 @@ void GuiInspectorTypeMaterialAssetPtr::updatePreviewImage()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (AssetDatabase.isDeclaredAsset(previewImage))
|
||||
if (AssetDatabase.isDeclaredAsset(difMapAsset->getAssetId()))
|
||||
{
|
||||
MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(previewImage);
|
||||
if (matAsset && matAsset->getMaterialDefinition())
|
||||
{
|
||||
mPreviewImage->_setBitmap(matAsset->getMaterialDefinition()->_getDiffuseMap(0));
|
||||
}
|
||||
mPreviewImage->setBitmap(difMapAsset->getAssetId());
|
||||
}
|
||||
}
|
||||
|
||||
if (mPreviewImage->getBitmapAsset().isNull())
|
||||
mPreviewImage->_setBitmap(StringTable->insert("ToolsModule:genericAssetIcon_image"));
|
||||
mPreviewImage->setBitmap(StringTable->insert("ToolsModule:genericAssetIcon_image"));
|
||||
}
|
||||
|
||||
void GuiInspectorTypeMaterialAssetPtr::setPreviewImage(StringTableEntry assetId)
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ public:
|
|||
|
||||
#define INITPERSISTFIELD_SHAPEASSET_REFACTOR(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeShapeAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.)); \
|
||||
addProtectedField(assetText(name, File), TypeFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, file docs.));
|
||||
addProtectedField(assetText(name, File), TypeFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, file docs.), AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
||||
|
||||
#define DECLARE_SHAPEASSET_ARRAY_REFACTOR(className, name, max) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue