Fixed getAssetBy... functions so the lookup loop is more stable and doesn't fail if null results return

Added sanity check to reflectionProbe preview shape so if the material didn't load right, it doesn't crash
Added logic to better control if module groups as a whole should fail if a module dependency in that group fails, defaulted to off
Added sanity check if a shape's material failed to load so it doesn't crash when checking accumulation rules
Added search bar to SimView control for easier use
This commit is contained in:
Areloch 2023-05-08 21:18:23 -05:00
parent 3538da30d0
commit 667a0db760
9 changed files with 130 additions and 235 deletions

View file

@ -362,16 +362,16 @@ StringTableEntry MaterialAsset::getAssetIdByMaterialName(StringTableEntry matNam
U32 foundCount = AssetDatabase.findAssetType(&query, "MaterialAsset"); U32 foundCount = AssetDatabase.findAssetType(&query, "MaterialAsset");
if (foundCount != 0) if (foundCount != 0)
{ {
for (U32 i = 0; i < foundCount; i++) for (U32 i = 0; i < foundCount && materialAssetId == MaterialAsset::smNoMaterialAssetFallback; i++)
{ {
MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(query.mAssetList[i]); MaterialAsset* matAsset = AssetDatabase.acquireAsset<MaterialAsset>(query.mAssetList[i]);
if (matAsset && matAsset->getMaterialDefinitionName() == matName) if (matAsset)
{ {
materialAssetId = matAsset->getAssetId(); if (matAsset->getMaterialDefinitionName() == matName)
materialAssetId = matAsset->getAssetId();
AssetDatabase.releaseAsset(query.mAssetList[i]); AssetDatabase.releaseAsset(query.mAssetList[i]);
break;
} }
AssetDatabase.releaseAsset(query.mAssetList[i]);
} }
} }

View file

@ -274,16 +274,16 @@ StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName)
U32 foundCount = AssetDatabase.findAssetType(&query, "SoundAsset"); U32 foundCount = AssetDatabase.findAssetType(&query, "SoundAsset");
if (foundCount != 0) if (foundCount != 0)
{ {
for (U32 i = 0; i < foundCount; i++) for (U32 i = 0; i < foundCount && soundAssetId == StringTable->EmptyString(); i++)
{ {
SoundAsset* soundAsset = AssetDatabase.acquireAsset<SoundAsset>(query.mAssetList[i]); SoundAsset* soundAsset = AssetDatabase.acquireAsset<SoundAsset>(query.mAssetList[i]);
if (soundAsset && soundAsset->getSoundPath() == fileName) if (soundAsset)
{ {
soundAssetId = soundAsset->getAssetId(); if (soundAsset->getSoundPath() == fileName)
soundAssetId = soundAsset->getAssetId();
AssetDatabase.releaseAsset(query.mAssetList[i]); AssetDatabase.releaseAsset(query.mAssetList[i]);
break;
} }
AssetDatabase.releaseAsset(query.mAssetList[i]);
} }
} }

View file

@ -378,16 +378,16 @@ StringTableEntry TerrainMaterialAsset::getAssetIdByMaterialName(StringTableEntry
U32 foundCount = AssetDatabase.findAssetType(&query, "TerrainMaterialAsset"); U32 foundCount = AssetDatabase.findAssetType(&query, "TerrainMaterialAsset");
if (foundCount != 0) if (foundCount != 0)
{ {
for (U32 i = 0; i < foundCount; i++) for (U32 i = 0; i < foundCount && materialAssetId == StringTable->EmptyString(); i++)
{ {
TerrainMaterialAsset* matAsset = AssetDatabase.acquireAsset<TerrainMaterialAsset>(query.mAssetList[i]); TerrainMaterialAsset* matAsset = AssetDatabase.acquireAsset<TerrainMaterialAsset>(query.mAssetList[i]);
if (matAsset && matAsset->getMaterialDefinitionName() == matName) if (matAsset)
{ {
materialAssetId = matAsset->getAssetId(); if (matAsset->getMaterialDefinitionName() == matName)
materialAssetId = matAsset->getAssetId();
AssetDatabase.releaseAsset(query.mAssetList[i]); AssetDatabase.releaseAsset(query.mAssetList[i]);
break;
} }
AssetDatabase.releaseAsset(query.mAssetList[i]);
} }
} }

View file

@ -883,6 +883,9 @@ void ReflectionProbe::prepRenderImage(SceneRenderState *state)
BaseMatInstance* probePrevMat = mEditorShapeInst->getMaterialList()->getMaterialInst(0); BaseMatInstance* probePrevMat = mEditorShapeInst->getMaterialList()->getMaterialInst(0);
if (probePrevMat == nullptr)
return;
setPreviewMatParameters(state, probePrevMat); setPreviewMatParameters(state, probePrevMat);
// GFXTransformSaver is a handy helper class that restores // GFXTransformSaver is a handy helper class that restores

View file

@ -104,6 +104,7 @@ S32 ModuleManager::moduleDependencySort(ModuleDefinition* const* a, ModuleDefini
ModuleManager::ModuleManager() : ModuleManager::ModuleManager() :
mEnforceDependencies(true), mEnforceDependencies(true),
mEchoInfo(false), mEchoInfo(false),
mFailGroupIfModuleFail(false),
mDatabaseLocks( 0 ), mDatabaseLocks( 0 ),
mIgnoreLoadedGroups(false) mIgnoreLoadedGroups(false)
{ {
@ -148,6 +149,7 @@ void ModuleManager::initPersistFields()
addField( "EnforceDependencies", TypeBool, Offset(mEnforceDependencies, ModuleManager), "Whether the module manager enforces any dependencies on module definitions it discovers or not." ); addField( "EnforceDependencies", TypeBool, Offset(mEnforceDependencies, ModuleManager), "Whether the module manager enforces any dependencies on module definitions it discovers or not." );
addField( "EchoInfo", TypeBool, Offset(mEchoInfo, ModuleManager), "Whether the module manager echos extra information to the console or not." ); addField( "EchoInfo", TypeBool, Offset(mEchoInfo, ModuleManager), "Whether the module manager echos extra information to the console or not." );
addField( "FailGroupIfModuleFail", TypeBool, Offset(mFailGroupIfModuleFail, ModuleManager), "Whether the module manager will fail to load an entire module group if a single module fails to load.");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -292,8 +294,8 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup )
StringTableEntry moduleId = *moduleIdItr; StringTableEntry moduleId = *moduleIdItr;
// Finish if we could not resolve the dependencies for module Id (of any version Id). // Finish if we could not resolve the dependencies for module Id (of any version Id).
if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) ) if (!resolveModuleDependencies(moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue) && mFailGroupIfModuleFail)
return false; return false;
} }
// Check the modules we want to load to ensure that we do not have incompatible modules loaded already. // Check the modules we want to load to ensure that we do not have incompatible modules loaded already.
@ -524,8 +526,8 @@ bool ModuleManager::unloadModuleGroup( const char* pModuleGroup )
StringTableEntry moduleId = *moduleIdItr; StringTableEntry moduleId = *moduleIdItr;
// Finish if we could not resolve the dependencies for module Id (of any version Id). // Finish if we could not resolve the dependencies for module Id (of any version Id).
if ( !resolveModuleDependencies( moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue ) ) if (!resolveModuleDependencies(moduleId, 0, moduleGroup, false, moduleResolvingQueue, moduleReadyQueue) && mFailGroupIfModuleFail)
return false; return false;
} }
// Check the modules we want to load to ensure that we do not have incompatible modules loaded already. // Check the modules we want to load to ensure that we do not have incompatible modules loaded already.

View file

@ -117,6 +117,7 @@ private:
/// Miscellaneous. /// Miscellaneous.
bool mEnforceDependencies; bool mEnforceDependencies;
bool mEchoInfo; bool mEchoInfo;
bool mFailGroupIfModuleFail;
S32 mDatabaseLocks; S32 mDatabaseLocks;
char mModuleExtension[256]; char mModuleExtension[256];
Taml mTaml; Taml mTaml;

View file

@ -891,7 +891,7 @@ bool TSShapeInstance::hasAccumulation()
for ( U32 i = 0; i < mMaterialList->size(); ++i ) for ( U32 i = 0; i < mMaterialList->size(); ++i )
{ {
BaseMatInstance* mat = mMaterialList->getMaterialInst(i); BaseMatInstance* mat = mMaterialList->getMaterialInst(i);
if ( mat->hasAccumulation() ) if (mat != nullptr && mat->hasAccumulation() )
result = true; result = true;
} }
return result; return result;

View file

@ -1,7 +1,7 @@
<GUIAsset <GUIAsset
canSave="true" canSave="true"
canSaveDynamicFields="true" canSaveDynamicFields="true"
AssetName="simViewDlg, EditorGuiGroup" AssetName="simViewDlg"
scriptFile="@assetFile=simViewDlg.ed.gui" scriptFile="@assetFile=simViewDlg.ed.gui"
GUIFile="@assetFile=simViewDlg.ed.gui" GUIFile="@assetFile=simViewDlg.ed.gui"
VersionId="1" /> VersionId="1" />

View file

@ -1,262 +1,142 @@
//--- OBJECT WRITE BEGIN --- //--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(simViewDlg, EditorGuiGroup) { $guiContent = new GuiControl(simViewDlg,EditorGuiGroup) {
canSaveDynamicFields = "0"; extent = "1024 768";
Profile = "ToolsGuiDefaultProfile"; minExtent = "8 8";
HorizSizing = "right"; profile = "ToolsGuiDefaultProfile";
VertSizing = "bottom"; tooltipProfile = "GuiToolTipProfile";
position = "0 0"; isContainer = "1";
Extent = "800 600"; canSaveDynamicFields = "1";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
new GuiWindowCtrl() { new GuiWindowCtrl() {
canSaveDynamicFields = "0";
Profile = "ToolsGuiWindowProfile";
HorizSizing = "center";
VertSizing = "center";
position = "70 43";
Extent = "685 489";
MinExtent = "602 440";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Torque SimView"; text = "Torque SimView";
maxLength = "1024";
resizeWidth = "1";
resizeHeight = "1";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "1";
minSize = "50 50";
closeCommand = "Canvas.popDialog(simViewDlg);"; closeCommand = "Canvas.popDialog(simViewDlg);";
position = "169 139";
extent = "685 489";
minExtent = "602 440";
horizSizing = "center";
vertSizing = "center";
profile = "ToolsGuiWindowProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiScrollCtrl() { new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Profile = "ToolsGuiScrollProfile";
HorizSizing = "width";
VertSizing = "height";
position = "10 28";
Extent = "255 448";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
willFirstRespond = "1";
hScrollBar = "dynamic"; hScrollBar = "dynamic";
vScrollBar = "alwaysOn"; position = "10 51";
lockHorizScroll = "false"; extent = "255 425";
lockVertScroll = "false"; minExtent = "8 8";
constantThumbHeight = "0"; horizSizing = "width";
childMargin = "0 0"; vertSizing = "height";
profile = "ToolsGuiScrollProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiTreeViewCtrl(InspectTreeView) { new GuiTreeViewCtrl(InspectTreeView) {
canSaveDynamicFields = "0";
Profile = "ToolsGuiTreeViewProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "2 2";
Extent = "212 21";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
tabSize = "16";
textOffset = "2";
fullRowSelect = "0";
itemHeight = "21"; itemHeight = "21";
destroyTreeOnSleep = "1"; position = "2 25";
MouseDragging = "1"; extent = "212 21";
MultipleSelections = "1"; minExtent = "8 8";
DeleteObjectAllowed = "1"; profile = "ToolsGuiTreeViewProfile";
DragToItemAllowed = "1"; tooltipProfile = "GuiToolTipProfile";
}; };
}; };
new GuiScrollCtrl() { new GuiScrollCtrl() {
canSaveDynamicFields = "0";
Profile = "ToolsGuiScrollProfile";
HorizSizing = "left";
VertSizing = "height";
position = "272 96";
Extent = "404 380";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
willFirstRespond = "1";
hScrollBar = "alwaysOff"; hScrollBar = "alwaysOff";
vScrollBar = "alwaysOn"; lockHorizScroll = "1";
lockHorizScroll = "true"; position = "272 96";
lockVertScroll = "false"; extent = "404 380";
constantThumbHeight = "0"; minExtent = "8 8";
childMargin = "0 0"; horizSizing = "left";
vertSizing = "height";
profile = "ToolsGuiScrollProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiInspector(InspectFields) { new GuiInspector(InspectFields) {
StackingType = "Vertical"; position = "1 1";
HorizStacking = "Left to Right"; extent = "389 8";
VertStacking = "Top to Bottom"; minExtent = "8 8";
Padding = "1"; horizSizing = "width";
canSaveDynamicFields = "0"; profile = "ToolsGuiTransparentProfile";
Profile = "ToolsGuiTransparentProfile"; tooltipProfile = "GuiToolTipProfile";
HorizSizing = "width";
VertSizing = "bottom";
position = "2 2";
Extent = "382 8";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
}; };
}; };
new GuiTextEditCtrl(SimViewTreeFilter) {
position = "11 27";
extent = "255 18";
profile = "ToolsGuiTextEditProfile";
tooltipProfile = "GuiToolTipProfile";
placeholderText = "Filter...";
};
new GuiControl() { new GuiControl() {
canSaveDynamicFields = "0";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "left";
VertSizing = "bottom";
position = "272 28"; position = "272 28";
Extent = "403 61"; extent = "403 61";
MinExtent = "8 2"; horizSizing = "left";
canSave = "1"; profile = "ToolsGuiButtonProfile";
Visible = "1"; tooltipProfile = "GuiToolTipProfile";
hovertime = "1000"; isContainer = "1";
new GuiTextEditCtrl(InspectObjectName) { new GuiTextEditCtrl(InspectObjectName) {
canSaveDynamicFields = "0";
Profile = "ToolsGuiTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "121 8"; position = "121 8";
Extent = "195 18"; extent = "195 18";
MinExtent = "8 8"; minExtent = "8 8";
canSave = "1"; profile = "ToolsGuiTextEditProfile";
Visible = "1"; tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
maxLength = "1024";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
}; };
new GuiTextCtrl() { new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorTextHLRight";
HorizSizing = "right";
VertSizing = "bottom";
position = "217 35";
Extent = "44 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Sim ID:"; text = "Sim ID:";
maxLength = "1024"; position = "217 35";
extent = "44 18";
minExtent = "8 8";
profile = "GuiTextProfile";
tooltipProfile = "GuiToolTipProfile";
}; };
new GuiTextCtrl() { new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorTextHLRight";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 35";
Extent = "106 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Internal Name:"; text = "Internal Name:";
maxLength = "1024"; position = "10 35";
extent = "106 18";
minExtent = "8 8";
profile = "GuiTextProfile";
tooltipProfile = "GuiToolTipProfile";
}; };
new GuiTextEditCtrl(InspectObjectInternalName) { new GuiTextEditCtrl(InspectObjectInternalName) {
canSaveDynamicFields = "0";
Profile = "ToolsGuiTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "121 35"; position = "121 35";
Extent = "93 18"; extent = "93 18";
MinExtent = "8 8"; minExtent = "8 8";
canSave = "1"; profile = "ToolsGuiTextEditProfile";
Visible = "1"; tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
maxLength = "1024";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
}; };
new GuiTextCtrl() { new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorTextHLBoldRight";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 8";
Extent = "106 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "Selected Object:"; text = "Selected Object:";
maxLength = "1024"; position = "10 8";
extent = "106 18";
minExtent = "8 8";
profile = "GuiTextProfile";
tooltipProfile = "GuiToolTipProfile";
}; };
new GuiIconButtonCtrl() { new GuiIconButtonCtrl() {
canSaveDynamicFields = "0"; BitmapAsset = "ToolsModule:iconRefresh_image";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "321 33";
Extent = "76 22";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "InspectApply();";
hovertime = "1000";
text = "Refresh";
groupNum = "-1";
buttonType = "PushButton";
bitmapAsset = "ToolsModule:iconRefresh_image";
sizeIconToButton = "0";
textLocation = "Right"; textLocation = "Right";
textMargin = "4"; text = "Refresh";
buttonMargin = "4 4"; position = "321 33";
extent = "76 22";
profile = "ToolsGuiButtonProfile";
command = "InspectApply();";
tooltipProfile = "GuiToolTipProfile";
}; };
new GuiTextCtrl(InspectObjectSimID) { new GuiTextCtrl(InspectObjectSimID) {
canSaveDynamicFields = "0";
Profile = "EditorTextHLBoldCenter";
HorizSizing = "right";
VertSizing = "bottom";
position = "265 35";
Extent = "51 18";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
text = "0"; text = "0";
maxLength = "1024"; position = "265 35";
extent = "51 18";
minExtent = "8 8";
profile = "GuiTextProfile";
tooltipProfile = "GuiToolTipProfile";
}; };
new GuiIconButtonCtrl() { new GuiIconButtonCtrl() {
canSaveDynamicFields = "0"; BitmapAsset = "ToolsModule:iconDelete_image";
Profile = "ToolsGuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "321 6";
Extent = "76 22";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Command = "InspectDelete();";
hovertime = "1000";
text = "Delete";
groupNum = "-1";
buttonType = "PushButton";
bitmapAsset = "ToolsModule:iconDelete_image";
sizeIconToButton = "0";
textLocation = "Right"; textLocation = "Right";
textMargin = "4"; text = "Delete";
buttonMargin = "4 4"; position = "321 6";
extent = "76 22";
profile = "ToolsGuiButtonProfile";
command = "InspectDelete();";
tooltipProfile = "GuiToolTipProfile";
}; };
}; };
}; };
@ -346,3 +226,12 @@ function GuiInspector::setAllGroupStateScript(%this, %obj, %groupState)
%this.setAllGroupState(%groupState); %this.setAllGroupState(%groupState);
%this.inspect(%obj); %this.inspect(%obj);
} }
function SimViewTreeFilter::onReturn(%this)
{
%text = %this.getText();
if( %text $= "" )
%this.reset();
else
InspectTreeView.setFilterText( %text );
}