Parametrize script extension, default to 'tscript'

This commit is contained in:
Lukas Aldershaab 2020-12-12 16:54:16 +01:00
parent b8b62292bd
commit 099dd4f1f3
542 changed files with 774 additions and 783 deletions

View file

@ -150,7 +150,7 @@ void AssimpAppMaterial::initMaterial(const Torque::Path& path, Material* mat) co
else
{ // OPAQUE
translucent = false;
blendOp = Material::LerpAlpha; // Make default so it doesn't get written to materials.cs
blendOp = Material::LerpAlpha; // Make default so it doesn't get written to materials.tscript
}
}
}
@ -296,7 +296,7 @@ String AssimpAppMaterial::cleanTextureName(String& texName, String& shapeName, c
if (nameOnly)
cleanStr = foundPath.getFullFileName();
else
{ // Unless the file is in the same directory as the materials.cs (covered above)
{ // Unless the file is in the same directory as the materials.tscript (covered above)
// we need to set the full path from the root directory. If we use "subdirectory/file.ext",
// the material manager won't find the image file, but it will be found the next time the
// material is loaded from file. If we use "./subdirectory/file.ext", the image will be found

View file

@ -427,7 +427,7 @@ void AssimpShapeLoader::updateMaterialsScript(const Torque::Path &path)
{
Torque::Path scriptPath(path);
scriptPath.setFileName("materials");
scriptPath.setExtension("cs");
scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION);
// First see what materials we need to update
PersistenceManager persistMgr;

View file

@ -40,7 +40,7 @@ public:
ColladaExtension_effect* effectExt; ///< effect extension
String name; ///< Name of this material (cleaned)
// Settings extracted from the Collada file, and optionally saved to materials.cs
// Settings extracted from the Collada file, and optionally saved to materials.tscript
String diffuseMap;
String normalMap;

View file

@ -453,7 +453,7 @@ void copySketchupTexture(const Torque::Path &path, String &textureFilename)
}
//-----------------------------------------------------------------------------
/// Add collada materials to materials.cs
/// Add collada materials to materials.tscript
void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
{
#ifdef DAE2DTS_TOOL
@ -463,7 +463,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
Torque::Path scriptPath(path);
scriptPath.setFileName("materials");
scriptPath.setExtension("cs");
scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION);
// First see what materials we need to update
PersistenceManager persistMgr;
@ -731,7 +731,7 @@ TSShape* loadColladaShape(const Torque::Path &path)
#endif // DAE2DTS_TOOL
// Add collada materials to materials.cs
// Add collada materials to materials.tscript
updateMaterialsScript(path, isSketchup);
}
}

View file

@ -181,7 +181,7 @@ String ColladaUtils::resolveImagePath(const domImage* image)
// it is inside the Torque folder, otherwise force textures
// to be in the same folder as the shape.
// 2. If the URI string contains a relative path, append it
// to the shape path (since materials.cs cannot handle
// to the shape path (since materials.tscript cannot handle
// relative paths).
Torque::Path imagePath;

View file

@ -101,7 +101,7 @@ namespace ColladaUtils
bool ignoreNodeScale; // Ignore <scale> elements in <node>s
bool adjustCenter; // Translate model so origin is at the center
bool adjustFloor; // Translate model so origin is at the bottom
bool forceUpdateMaterials; // Force update of materials.cs
bool forceUpdateMaterials; // Force update of materials.tscript
bool useDiffuseNames; // Use diffuse texture as the material name
// Assimp specific preprocess import options

View file

@ -2112,14 +2112,14 @@ template<> void *Resource<TSShape>::create(const Torque::Path &path)
{
// Execute the shape script if it exists
Torque::Path scriptPath(path);
scriptPath.setExtension("cs");
scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION);
// Don't execute the script if we're already doing so!
StringTableEntry currentScript = Platform::stripBasePath(CodeBlock::getCurrentCodeBlockFullPath());
if (!scriptPath.getFullPath().equal(currentScript))
{
Torque::Path scriptPathDSO(scriptPath);
scriptPathDSO.setExtension("cs.dso");
scriptPathDSO.setExtension(TORQUE_SCRIPT_EXTENSION ".dso");
if (Torque::FS::IsFile(scriptPathDSO) || Torque::FS::IsFile(scriptPath))
{

View file

@ -313,9 +313,9 @@ void TSShapeConstructor::initPersistFields()
"@see adjustCenter" );
addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.forceUpdateMaterials, TSShapeConstructor),
"Forces update of the materials.cs file in the same folder as the COLLADA "
"Forces update of the materials." TORQUE_SCRIPT_EXTENSION " file in the same folder as the COLLADA "
"(.dae) file, even if Materials already exist. No effect for DTS files.\n"
"Normally only Materials that are not already defined are written to materials.cs." );
"Normally only Materials that are not already defined are written to materials." TORQUE_SCRIPT_EXTENSION "." );
// Fields added for assimp options
addField( "convertLeftHanded", TypeBool, Offset(mOptions.convertLeftHanded, TSShapeConstructor),
@ -710,11 +710,11 @@ DefineTSShapeConstructorMethod( saveShape, void, ( const char* filename ),,
DefineTSShapeConstructorMethod( writeChangeSet, void, (),,
(),,
"Write the current change set to a TSShapeConstructor script file. The "
"name of the script file is the same as the model, but with .cs extension. "
"eg. myShape.cs for myShape.dts or myShape.dae.\n" )
"name of the script file is the same as the model, but with ." TORQUE_SCRIPT_EXTENSION " extension. "
"eg. myShape." TORQUE_SCRIPT_EXTENSION " for myShape.dts or myShape.dae.\n" )
{
Torque::Path scriptPath( mShapePath );
scriptPath.setExtension( "cs" );
scriptPath.setExtension(TORQUE_SCRIPT_EXTENSION);
// Read current file contents
FileObject f;