mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 12:25:30 +00:00
Adds load status to MaterialAsset for if the Script file itself has been loaded, but the material itself hasn't yet been processed.
Fixed String -> StringTableEntry conversion in prefab file to correct corruption when setting the filename Cleaned up message spam from the MaterialSlot fields on TSStatics Added getter/setters for terrain file and assets Removed unneeded exec of tools profiles for MainMenuGUI Add logic to remove creators section of AB if in select mode Fixed misc. messageBox invokes that were erroneously converted to 'toolsMessageBox' Fix classname for NotesObject in AB Creator Entry Fix issue where ConvexShapeEditor toolbar would hide after being seen once Changed keybind for quick AB access from 'space' to 'shift space' to avoid input issues when typing in fields in some cases Fixed default image assignments for River objects on foam/ripple/depth Added handling for Material, Sound and Shape asset fields in Object Builder, and updated various objectBuilder class entries to utilize them now. Updated various fields' defaults for ObjectBuilder to utilize correct assetId's Fixed editor SceneTree tooltips for TSShape and GroundCovert to correctly reference assets as needed Added logic to properly check terrain asset validity when prompting to save changes, which would break saving actions before Added menubar items in the Object category to take control and release control of control objects quickly for testing
This commit is contained in:
parent
4176482373
commit
adec6e7c74
21 changed files with 436 additions and 78 deletions
|
|
@ -169,7 +169,13 @@ void MaterialAsset::initializeAsset()
|
|||
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||
|
||||
if (Torque::FS::IsScriptFile(mScriptPath))
|
||||
Con::executeFile(mScriptPath, false, false);
|
||||
{
|
||||
if (!Sim::findObject(mMatDefinitionName))
|
||||
if (Con::executeFile(mScriptPath, false, false))
|
||||
mLoadedState = ScriptLoaded;
|
||||
else
|
||||
mLoadedState = Failed;
|
||||
}
|
||||
|
||||
loadMaterial();
|
||||
}
|
||||
|
|
@ -179,7 +185,22 @@ void MaterialAsset::onAssetRefresh()
|
|||
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
|
||||
|
||||
if (Torque::FS::IsScriptFile(mScriptPath))
|
||||
Con::executeFile(mScriptPath, false, false);
|
||||
{
|
||||
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
|
||||
//But that definition, whatever it is, is the 'correct' one, so we enable the Replace Existing behavior
|
||||
//when the engine encounters a named object conflict.
|
||||
String redefineBehaviorPrev = Con::getVariable("$Con::redefineBehavior");
|
||||
Con::setVariable("$Con::redefineBehavior", "replaceExisting");
|
||||
|
||||
if (Con::executeFile(mScriptPath, false, false))
|
||||
mLoadedState = ScriptLoaded;
|
||||
else
|
||||
mLoadedState = Failed;
|
||||
|
||||
//And now that we've executed, switch back to the prior behavior
|
||||
Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str());
|
||||
|
||||
}
|
||||
|
||||
loadMaterial();
|
||||
}
|
||||
|
|
@ -206,7 +227,7 @@ void MaterialAsset::loadMaterial()
|
|||
if (mMaterialDefinition)
|
||||
SAFE_DELETE(mMaterialDefinition);
|
||||
|
||||
if (mMatDefinitionName != StringTable->EmptyString())
|
||||
if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString())
|
||||
{
|
||||
Material* matDef;
|
||||
if (!Sim::findObject(mMatDefinitionName, matDef))
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ class MaterialAsset : public AssetBase
|
|||
public:
|
||||
static StringTableEntry smNoMaterialAssetFallback;
|
||||
|
||||
enum MaterialAssetErrCode
|
||||
{
|
||||
ScriptLoaded = AssetErrCode::Extended,
|
||||
Extended
|
||||
};
|
||||
|
||||
public:
|
||||
MaterialAsset();
|
||||
virtual ~MaterialAsset();
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ bool Prefab::protectedSetFile( void *object, const char *index, const char *data
|
|||
return false;
|
||||
}
|
||||
|
||||
void Prefab::setFile( String file )
|
||||
void Prefab::setFile( StringTableEntry file )
|
||||
{
|
||||
AssertFatal( isServerObject(), "Prefab-bad" );
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ void Prefab::setFile( String file )
|
|||
// be called for the client-side prefab but maybe the user did so accidentally.
|
||||
if ( isClientObject() )
|
||||
{
|
||||
Con::errorf( "Prefab::setFile( %s ) - Should not be called on a client-side Prefab.", file.c_str() );
|
||||
Con::errorf( "Prefab::setFile( %s ) - Should not be called on a client-side Prefab.", file );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public:
|
|||
void render( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat );
|
||||
|
||||
///
|
||||
void setFile( String file );
|
||||
void setFile(StringTableEntry file );
|
||||
|
||||
/// Removes all children from this Prefab and puts them into a SimGroup
|
||||
/// which is added to the Scene and returned to the caller.
|
||||
|
|
|
|||
|
|
@ -1675,10 +1675,6 @@ void TSStatic::onInspect(GuiInspector* inspector)
|
|||
{
|
||||
dSprintf(matFieldName, 128, "MaterialSlot%d", i);
|
||||
|
||||
//addComponentField(matFieldName, "A material used in the shape file", "Material", matAsset->getAssetId(), "");
|
||||
//Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName);
|
||||
Con::printf("Added material field for MaterialSlot %d", i);
|
||||
|
||||
GuiInspectorField* fieldGui = materialGroup->constructField(TypeMaterialAssetPtr);
|
||||
fieldGui->init(inspector, materialGroup);
|
||||
|
||||
|
|
|
|||
|
|
@ -1613,3 +1613,15 @@ void TerrainBlock::deleteZodiacPrimitiveBuffer()
|
|||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod(TerrainBlock, getTerrain, String, (), , "Returns the terrain file used for this terrain block, either via the asset or the filename assigned, which ever is valid")
|
||||
{
|
||||
return object->getTerrain();
|
||||
}
|
||||
DefineEngineMethod(TerrainBlock, getTerrainAsset, String, (), , "Returns the assetId used for this terrain block")
|
||||
{
|
||||
return object->getTerrainAssetId();
|
||||
}
|
||||
DefineEngineMethod(TerrainBlock, setTerrain, bool, (const char* terrain), , "Terrain assignment.first tries asset then flat file.")
|
||||
{
|
||||
return object->_setTerrain(StringTable->insert(terrain));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -488,6 +488,39 @@ public:
|
|||
void inspectPostApply();
|
||||
|
||||
virtual void getUtilizedAssets(Vector<StringTableEntry>* usedAssetsList);
|
||||
|
||||
const StringTableEntry getTerrain() const
|
||||
{
|
||||
if (mTerrainAsset && (mTerrainAsset->getTerrainFilePath() != StringTable->EmptyString()))
|
||||
return mTerrainAsset->getTerrainFilePath();
|
||||
else if (mTerrainAssetId != StringTable->EmptyString())
|
||||
return mTerrainAssetId;
|
||||
else if (mTerrFileName != StringTable->EmptyString())
|
||||
return mTerrFileName;
|
||||
else
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
const StringTableEntry getTerrainAssetId() const
|
||||
{
|
||||
if (mTerrainAssetId != StringTable->EmptyString())
|
||||
return mTerrainAssetId;
|
||||
else
|
||||
return StringTable->EmptyString();
|
||||
}
|
||||
|
||||
bool _setTerrain(StringTableEntry terrain)
|
||||
{
|
||||
if (terrain == StringTable->EmptyString())
|
||||
return false;
|
||||
|
||||
if (AssetDatabase.isDeclaredAsset(terrain))
|
||||
setTerrainAsset(terrain);
|
||||
else
|
||||
mTerrFileName = terrain;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool mUpdateBasetex;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue