mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +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) \
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ bool TSStatic::_createShape()
|
|||
mObjBox = getShape()->mBounds;
|
||||
resetWorldBox();
|
||||
|
||||
mShapeInstance = new TSShapeInstance(getShape(), isClientObject());
|
||||
mShapeInstance = new TSShapeInstance(getShape(), true);
|
||||
mShapeInstance->resetMaterialList();
|
||||
mShapeInstance->cloneMaterialList();
|
||||
|
||||
|
|
@ -711,7 +711,7 @@ void TSStatic::_updateShouldTick()
|
|||
|
||||
void TSStatic::prepRenderImage(SceneRenderState* state)
|
||||
{
|
||||
if (!mShapeInstance)
|
||||
if (!mShapeAsset.isValid() || !mShapeInstance)
|
||||
return;
|
||||
|
||||
Point3F cameraOffset;
|
||||
|
|
@ -1326,27 +1326,25 @@ bool TSStatic::buildExportPolyList(ColladaUtils::ExportData* exportData, const B
|
|||
}
|
||||
|
||||
//Next, process the LOD levels and materials.
|
||||
if (isServerObject() && getClientObject())
|
||||
if (isServerObject())
|
||||
{
|
||||
TSStatic* clientShape = dynamic_cast<TSStatic*>(getClientObject());
|
||||
|
||||
exportData->meshData.increment();
|
||||
|
||||
//Prep a meshData for this shape in particular
|
||||
ColladaUtils::ExportData::meshLODData* meshData = &exportData->meshData.last();
|
||||
|
||||
//Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase
|
||||
meshData->shapeInst = clientShape->mShapeInstance;
|
||||
meshData->shapeInst = mShapeInstance;
|
||||
meshData->originatingObject = this;
|
||||
meshData->meshTransform = mObjToWorld;
|
||||
meshData->scale = mObjScale;
|
||||
|
||||
//Iterate over all our detail levels
|
||||
for (U32 i = 0; i < clientShape->mShapeInstance->getNumDetails(); i++)
|
||||
for (U32 i = 0; i < mShapeInstance->getNumDetails(); i++)
|
||||
{
|
||||
TSShape::Detail detail = clientShape->mShapeInstance->getShape()->details[i];
|
||||
TSShape::Detail detail = mShapeInstance->getShape()->details[i];
|
||||
|
||||
String detailName = String::ToLower(clientShape->mShapeInstance->getShape()->getName(detail.nameIndex));
|
||||
String detailName = String::ToLower(mShapeInstance->getShape()->getName(detail.nameIndex));
|
||||
|
||||
//Skip it if it's a collision or line of sight element
|
||||
if (detailName.startsWith("col") || detailName.startsWith("los"))
|
||||
|
|
|
|||
|
|
@ -123,7 +123,10 @@ public:
|
|||
StringTableEntry expandAssetFilePath(const char* pAssetFilePath) const;
|
||||
StringTableEntry collapseAssetFilePath(const char* pAssetFilePath) const;
|
||||
|
||||
virtual bool isAssetValid(void) const { return true; }
|
||||
virtual bool isAssetValid(void) const
|
||||
{
|
||||
return mpOwningAssetManager != nullptr && mAssetInitialized && (mLoadedState == AssetErrCode::Ok || mLoadedState == AssetErrCode::UsingFallback);
|
||||
}
|
||||
|
||||
void refreshAsset(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ public:
|
|||
/// Validity.
|
||||
bool isNull( void ) const override { return mpAsset.isNull(); }
|
||||
bool notNull( void ) const override { return !mpAsset.isNull(); }
|
||||
bool isValid(void) const { return notNull() && static_cast<AssetBase*>(mpAsset.getObject())->isAssetValid(); }
|
||||
};
|
||||
|
||||
#endif // _ASSET_PTR_H_
|
||||
|
|
|
|||
|
|
@ -498,7 +498,8 @@ public:
|
|||
FIELD_ComponentInspectors = BIT(1), ///< Custom fields used by components. They are likely to be non-standard size/configuration, so
|
||||
///< They are handled specially
|
||||
FIELD_CustomInspectors = BIT(2), ///< Display as a button in inspectors.
|
||||
FIELD_SpecialtyArrayField = BIT(3)
|
||||
FIELD_SpecialtyArrayField = BIT(3),
|
||||
FIELD_DontWriteToFile = BIT(4),
|
||||
};
|
||||
|
||||
struct Field
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
|
|||
const AbstractClassRep::Field* f = &list[i];
|
||||
|
||||
// Skip the special field types.
|
||||
if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors))
|
||||
if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) || f->flag.test(AbstractClassRep::FieldFlags::FIELD_DontWriteToFile))
|
||||
continue;
|
||||
|
||||
if (f->flag.test(AbstractClassRep::FIELD_SpecialtyArrayField))
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop)
|
|||
const AbstractClassRep::Field* f = &list[i];
|
||||
|
||||
// Skip the special field types.
|
||||
if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors))
|
||||
if ( f->type >= AbstractClassRep::ARCFirstCustomField || f->flag.test(AbstractClassRep::FieldFlags::FIELD_ComponentInspectors) || f->flag.test(AbstractClassRep::FieldFlags::FIELD_DontWriteToFile))
|
||||
continue;
|
||||
|
||||
for(U32 j = 0; S32(j) < f->elementCount; j++)
|
||||
|
|
|
|||
|
|
@ -126,7 +126,6 @@ void GuiIconButtonCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addField( "buttonMargin", TypePoint2I, Offset( mButtonMargin, GuiIconButtonCtrl ),"Margin area around the button.\n");
|
||||
|
||||
addProtectedField( "iconBitmap", TypeImageFilename, Offset( mBitmapAsset, GuiIconButtonCtrl ), &_setBitmapData, &defaultProtectedGetFn, "Bitmap file for the icon to display on the button.\n", AbstractClassRep::FIELD_HideInInspectors);
|
||||
INITPERSISTFIELD_IMAGEASSET(Bitmap, GuiIconButtonCtrl, "Bitmap file for the icon to display on the button.\n");
|
||||
|
||||
addField( "iconLocation", TYPEID< IconLocation >(), Offset( mIconLocation, GuiIconButtonCtrl ),"Where to place the icon on the control. Options are 0 (None), 1 (Left), 2 (Right), 3 (Center).\n");
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ bool GuiInspector::isGroupFiltered( const char *groupName ) const
|
|||
|
||||
// Is this group explicitly show? Does it immediately follow a + char.
|
||||
searchStr = String::ToString( "+%s", groupName );
|
||||
if ( mGroupFilters.find( searchStr ) != String::NPos )
|
||||
if ( mGroupFilters.find( searchStr, 0, String::NoCase | String::Left) != String::NPos )
|
||||
return false;
|
||||
|
||||
// Were there any other + characters, if so, we are implicitly hidden.
|
||||
|
|
@ -510,7 +510,7 @@ bool GuiInspector::isGroupFiltered( const char *groupName ) const
|
|||
|
||||
// Is this group explicitly hidden? Does it immediately follow a - char.
|
||||
searchStr = String::ToString( "-%s", groupName );
|
||||
if ( mGroupFilters.find( searchStr ) != String::NPos )
|
||||
if ( mGroupFilters.find( searchStr, 0, String::NoCase | String::Left) != String::NPos )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue