Merge pull request #2328 from Areloch/neverImportMat

Adds a filter for materials to never import when importing a shape
This commit is contained in:
Areloch 2019-05-04 11:51:21 -05:00 committed by GitHub
commit 4e9b9b4724
3 changed files with 81 additions and 16 deletions

View file

@ -90,6 +90,7 @@ namespace ColladaUtils
String neverImport; // List of node names (with wildcards) to ignore on loading
String alwaysImportMesh; // List of mesh names (with wildcards) to import, even if in the neverImportMesh list
String neverImportMesh; // List of mesh names (with wildcards) to ignore on loading
String neverImportMat; // List of material names (with wildcards) to ignore on loading
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
@ -109,9 +110,10 @@ namespace ColladaUtils
singleDetailSize = 2;
matNamePrefix = "";
alwaysImport = "";
neverImport = "";
neverImport = String(Con::getVariable("$TSShapeConstructor::neverImport"));
alwaysImportMesh = "";
neverImportMesh = "";
neverImportMesh = String(Con::getVariable("$TSShapeConstructor::neverImportMesh"));
neverImportMat = String(Con::getVariable("$TSShapeConstructor::neverImportMat"));
ignoreNodeScale = false;
adjustCenter = false;
adjustFloor = false;
@ -632,7 +634,7 @@ public:
/// Most primitives can use these common implementations
const char* getElementName() { return primitive->getElementName(); }
const char* getMaterial() { return primitive->getMaterial(); }
const char* getMaterial() { return (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().neverImportMat, primitive->getMaterial(), false)) ? NULL : primitive->getMaterial(); }
const domInputLocalOffset_Array& getInputs() { return primitive->getInput_array(); }
S32 getStride() const { return stride; }

View file

@ -144,6 +144,7 @@ TSShapeConstructor::TSShapeConstructor()
mOptions.neverImport = String(Con::getVariable("$TSShapeConstructor::neverImport"));
mOptions.alwaysImportMesh = "";
mOptions.neverImportMesh = String(Con::getVariable("$TSShapeConstructor::neverImportMesh"));
mOptions.neverImportMat = String(Con::getVariable("$TSShapeConstructor::neverImportMat"));
mOptions.ignoreNodeScale = false;
mOptions.adjustCenter = false;
mOptions.adjustFloor = false;
@ -266,6 +267,13 @@ void TSShapeConstructor::initPersistFields()
"not be imported (unless it matches the alwaysImportMesh list.\n"
"@see alwaysImportMesh" );
addField("neverImportMat", TypeRealString, Offset(mOptions.neverImportMat, TSShapeConstructor),
"TAB separated patterns of materials to ignore on loading. No effect for DTS files.\n"
"Torque allows unwanted materials in COLLADA (.dae) files to to be ignored "
"during import. This field contains a TAB separated list of patterns to "
"match material names. Any material that matches one of the patterns in the list will "
"not be imported");
addField( "ignoreNodeScale", TypeBool, Offset(mOptions.ignoreNodeScale, TSShapeConstructor),
"Ignore <scale> elements inside COLLADA <node>s. No effect for DTS files.\n"
"This field is a workaround for certain exporters that generate bad node "