Pārlūkot izejas kodu

Rename all member variables to follow the style guidelines (prefixed with the 'm') - struct ImportOptions (ColladaUtils)

bank 11 gadi atpakaļ
vecāks
revīzija
733347fd61

+ 2 - 2
Engine/source/ts/collada/colladaAppMaterial.cpp

@@ -155,8 +155,8 @@ ColladaAppMaterial::ColladaAppMaterial(const domMaterial *pMat)
    normalMap = getSamplerImagePath(effect, effectExt->bumpSampler);
 
    // Set the material name
-   name = ColladaUtils::getOptions().matNamePrefix;
-   if ( ColladaUtils::getOptions().useDiffuseNames )
+   name = ColladaUtils::getOptions().mMatNamePrefix;
+   if ( ColladaUtils::getOptions().mUseDiffuseNames )
    {
       Torque::Path diffusePath( diffuseMap );
       name += diffusePath.getFileName();

+ 1 - 1
Engine/source/ts/collada/colladaAppMesh.cpp

@@ -1083,7 +1083,7 @@ void ColladaAppMesh::lookupSkinData()
       // stores default node transform and rotation. Compensate for this by
       // removing the scaling from the inverse bind transform as well
       MatrixF invBind = streams.mInvBindMatrices.getMatrixFValue(iJoint);
-      if (!ColladaUtils::getOptions().ignoreNodeScale)
+      if (!ColladaUtils::getOptions().mIgnoreNodeScale)
       {
          Point3F invScale = invBind.getScale();
          invScale.x = invScale.x ? (1.0f / invScale.x) : 0;

+ 2 - 2
Engine/source/ts/collada/colladaAppNode.cpp

@@ -221,7 +221,7 @@ MatrixF ColladaAppNode::getTransform(F32 time)
    else {
       // no parent (ie. root level) => scale by global shape <unit>
       lastTransform.identity();
-      lastTransform.scale(ColladaUtils::getOptions().unit);
+      lastTransform.scale(ColladaUtils::getOptions().mUnit);
       if (!isBounds())
          ColladaUtils::convertTransform(lastTransform);     // don't convert bounds node transform (or upAxis won't work!)
    }
@@ -242,7 +242,7 @@ MatrixF ColladaAppNode::getTransform(F32 time)
       }
 
       // Remove node scaling (but keep reflections) if desired
-      if (ColladaUtils::getOptions().ignoreNodeScale)
+      if (ColladaUtils::getOptions().mIgnoreNodeScale)
       {
          Point3F invScale = mat.getScale();
          invScale.x = invScale.x ? (1.0f / invScale.x) : 0;

+ 1 - 1
Engine/source/ts/collada/colladaExtensions.h

@@ -247,7 +247,7 @@ public:
 
       // OpenCOLLADA profile
       pTechnique = findExtraTechnique(node, "OpenCOLLADA");
-      if (!visibility.element)
+      if (!visibility.mElement)
          GET_EXTRA_PARAM(visibility, 1.0);
       GET_EXTRA_PARAM(user_properties, user_properties);
    }

+ 2 - 2
Engine/source/ts/collada/colladaLights.cpp

@@ -210,8 +210,8 @@ ConsoleFunction( loadColladaLights, bool, 2, 4,
          upAxis = root->getAsset()->getUp_axis()->getValue();
    }
 
-   ColladaUtils::getOptions().unit = unit;
-   ColladaUtils::getOptions().upAxis = upAxis;
+   ColladaUtils::getOptions().mUnit = unit;
+   ColladaUtils::getOptions().mUpAxis = upAxis;
 
    // First grab all of the top-level nodes
    Vector<ColladaAppNode*> sceneNodes;

+ 18 - 18
Engine/source/ts/collada/colladaShapeLoader.cpp

@@ -86,11 +86,11 @@ ColladaShapeLoader::ColladaShapeLoader(domCOLLADA* _root)
    }
 
    // Set import options (if they are not set to override)
-   if (ColladaUtils::getOptions().unit <= 0.0f)
-      ColladaUtils::getOptions().unit = unit;
+   if (ColladaUtils::getOptions().mUnit <= 0.0f)
+      ColladaUtils::getOptions().mUnit = unit;
 
-   if (ColladaUtils::getOptions().upAxis == UPAXISTYPE_COUNT)
-      ColladaUtils::getOptions().upAxis = upAxis;
+   if (ColladaUtils::getOptions().mUpAxis == UPAXISTYPE_COUNT)
+      ColladaUtils::getOptions().mUpAxis = upAxis;
 }
 
 ColladaShapeLoader::~ColladaShapeLoader()
@@ -267,7 +267,7 @@ void ColladaShapeLoader::enumerateScene()
 
    // Set LOD option
    bool singleDetail = true;
-   switch (ColladaUtils::getOptions().lodType)
+   switch (ColladaUtils::getOptions().mLodType)
    {
       case ColladaUtils::ImportOptions::DetectDTS:
          // Check for a baseXX->startXX hierarchy at the top-level, if we find
@@ -298,7 +298,7 @@ void ColladaShapeLoader::enumerateScene()
          break;
    }
 
-   ColladaAppMesh::fixDetailSize( singleDetail, ColladaUtils::getOptions().singleDetailSize );
+   ColladaAppMesh::fixDetailSize( singleDetail, ColladaUtils::getOptions().mSingleDetailSize );
 
    // Process the top level nodes
    for (S32 iNode = 0; iNode < sceneNodes.size(); iNode++) {
@@ -321,18 +321,18 @@ void ColladaShapeLoader::enumerateScene()
 
 bool ColladaShapeLoader::ignoreNode(const String& name)
 {
-   if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().alwaysImport, name, false))
+   if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mAlwaysImport, name, false))
       return false;
    else
-      return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().neverImport, name, false);
+      return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mNeverImport, name, false);
 }
 
 bool ColladaShapeLoader::ignoreMesh(const String& name)
 {
-   if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().alwaysImportMesh, name, false))
+   if (FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mAlwaysImportMesh, name, false))
       return false;
    else
-      return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().neverImportMesh, name, false);
+      return FindMatch::isMatchMultipleExprs(ColladaUtils::getOptions().mNeverImportMesh, name, false);
 }
 
 void ColladaShapeLoader::computeBounds(Box3F& bounds)
@@ -341,17 +341,17 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds)
 
    // Check if the model origin needs adjusting
    if ( bounds.isValidBox() &&
-       (ColladaUtils::getOptions().adjustCenter ||
-        ColladaUtils::getOptions().adjustFloor) )
+       (ColladaUtils::getOptions().mAdjustCenter ||
+        ColladaUtils::getOptions().mAdjustFloor) )
    {
       // Compute shape offset
       Point3F shapeOffset = Point3F::Zero;
-      if ( ColladaUtils::getOptions().adjustCenter )
+      if ( ColladaUtils::getOptions().mAdjustCenter )
       {
          bounds.getCenter( &shapeOffset );
          shapeOffset = -shapeOffset;
       }
-      if ( ColladaUtils::getOptions().adjustFloor )
+      if ( ColladaUtils::getOptions().mAdjustFloor )
          shapeOffset.z = -bounds.minExtents.z;
 
       // Adjust bounds
@@ -448,7 +448,7 @@ void copySketchupTexture(const Torque::Path &path, String &textureFilename)
 void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
 {
 #ifdef DAE2DTS_TOOL
-   if (!ColladaUtils::getOptions().forceUpdateMaterials)
+   if (!ColladaUtils::getOptions().mForceUpdateMaterials)
       return;
 #endif
 
@@ -467,7 +467,7 @@ void updateMaterialsScript(const Torque::Path &path, bool copyTextures = false)
          if ( Sim::findObject( MATMGR->getMapEntry( mat->getName() ), mappedMat ) )
          {
             // Only update existing materials if forced to
-            if ( ColladaUtils::getOptions().forceUpdateMaterials )
+            if ( ColladaUtils::getOptions().mForceUpdateMaterials )
                persistMgr.setDirty( mappedMat );
          }
          else
@@ -677,8 +677,8 @@ TSShape* loadColladaShape(const Torque::Path &path)
 
 #ifdef DAE2DTS_TOOL
       // Command line overrides certain options
-      ColladaUtils::getOptions().forceUpdateMaterials = cmdLineOptions.forceUpdateMaterials;
-      ColladaUtils::getOptions().useDiffuseNames = cmdLineOptions.useDiffuseNames;
+      ColladaUtils::getOptions().mForceUpdateMaterials = cmdLineOptions.mForceUpdateMaterials;
+      ColladaUtils::getOptions().mUseDiffuseNames = cmdLineOptions.mUseDiffuseNames;
 #endif
    }
 

+ 1 - 1
Engine/source/ts/collada/colladaUtils.cpp

@@ -49,7 +49,7 @@ void ColladaUtils::convertTransform(MatrixF& mat)
 {
    MatrixF rot(true);
 
-   switch (ColladaUtils::getOptions().upAxis)
+   switch (ColladaUtils::getOptions().mUpAxis)
    {
       case UPAXISTYPE_X_UP:
          // rotate 90 around Y-axis, then 90 around Z-axis

+ 28 - 28
Engine/source/ts/collada/colladaUtils.h

@@ -76,20 +76,20 @@ namespace ColladaUtils
          NumLodTypes
       };
 
-      domUpAxisType  upAxis;           // Override for the collada <up_axis> element
-      F32            unit;             // Override for the collada <unit> element
-      eLodType       lodType;          // LOD type option
-      S32            singleDetailSize; // Detail size for all meshes in the model
-      String         matNamePrefix;    // Prefix to apply to collada material names
-      String         alwaysImport;     // List of node names (with wildcards) to import, even if in the neverImport list
-      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
-      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           useDiffuseNames;  // Use diffuse texture as the material name
+      domUpAxisType  mUpAxis;             // Override for the collada <up_axis> element
+      F32            mUnit;               // Override for the collada <unit> element
+      eLodType       mLodType;            // LOD type option
+      S32            mSingleDetailSize;   // Detail size for all meshes in the model
+      String         mMatNamePrefix;      // Prefix to apply to collada material names
+      String         mAlwaysImport;       // List of node names (with wildcards) to import, even if in the neverImport list
+      String         mNeverImport;        // List of node names (with wildcards) to ignore on loading
+      String         mAlwaysImportMesh;   // List of mesh names (with wildcards) to import, even if in the neverImportMesh list
+      String         mNeverImportMesh;    // List of mesh names (with wildcards) to ignore on loading
+      bool           mIgnoreNodeScale;    // Ignore <scale> elements in <node>s
+      bool           mAdjustCenter;       // Translate model so origin is at the center
+      bool           mAdjustFloor;        // Translate model so origin is at the bottom
+      bool           mForceUpdateMaterials;  // Force update of materials.cs
+      bool           mUseDiffuseNames;    // Use diffuse texture as the material name
 
       ImportOptions()
       {
@@ -98,20 +98,20 @@ namespace ColladaUtils
 
       void reset()
       {
-         upAxis = UPAXISTYPE_COUNT;
-         unit = -1.0f;
-         lodType = DetectDTS;
-         singleDetailSize = 2;
-         matNamePrefix = "";
-         alwaysImport = "";
-         neverImport = "";
-         alwaysImportMesh = "";
-         neverImportMesh = "";
-         ignoreNodeScale = false;
-         adjustCenter = false;
-         adjustFloor = false;
-         forceUpdateMaterials = false;
-         useDiffuseNames = false;
+         mUpAxis = UPAXISTYPE_COUNT;
+         mUnit = -1.0f;
+         mLodType = DetectDTS;
+         mSingleDetailSize = 2;
+         mMatNamePrefix = "";
+         mAlwaysImport = "";
+         mNeverImport = "";
+         mAlwaysImportMesh = "";
+         mNeverImportMesh = "";
+         mIgnoreNodeScale = false;
+         mAdjustCenter = false;
+         mAdjustFloor = false;
+         mForceUpdateMaterials = false;
+         mUseDiffuseNames = false;
       }
    };
 

+ 13 - 13
Engine/source/ts/tsShapeConstruct.cpp

@@ -159,7 +159,7 @@ void TSShapeConstructor::initPersistFields()
    endGroup( "Media" );
 
    addGroup( "Collada" );
-   addField( "upAxis", TYPEID< domUpAxisType >(), Offset(mOptions.upAxis, TSShapeConstructor),
+   addField( "upAxis", TYPEID< domUpAxisType >(), Offset(mOptions.mUpAxis, TSShapeConstructor),
       "Override the <up_axis> element in the COLLADA (.dae) file. No effect for DTS files.\n"
       "Set to one of the following values:\n"
       "<dl><dt>X_AXIS</dt><dd>Positive X points up. Model will be rotated into Torque's coordinate system (Z up).</dd>"
@@ -167,7 +167,7 @@ void TSShapeConstructor::initPersistFields()
       "<dt>Z_AXIS</dt><dd>Positive Z points up. No rotation will be applied to the model.</dd>"
       "<dt>DEFAULT</dt><dd>The default value. Use the value in the .dae file (defaults to Z_AXIS if the <up_axis> element is not present).</dd></dl>" );
 
-   addField( "unit", TypeF32, Offset(mOptions.unit, TSShapeConstructor),
+   addField( "unit", TypeF32, Offset(mOptions.mUnit, TSShapeConstructor),
       "Override the <unit> element in the COLLADA (.dae) file. No effect for DTS files.\n"
       "COLLADA (.dae) files usually contain a <unit> element that indicates the "
       "'real world' units that the model is described in. It means you can work "
@@ -182,7 +182,7 @@ void TSShapeConstructor::initPersistFields()
       "Omit the field or set to -1 to use the value in the .dae file (1.0 if the "
       "<unit> element is not present)" );
 
-   addField( "lodType", TYPEID< ColladaUtils::ImportOptions::eLodType >(), Offset(mOptions.lodType, TSShapeConstructor),
+   addField( "lodType", TYPEID< ColladaUtils::ImportOptions::eLodType >(), Offset(mOptions.mLodType, TSShapeConstructor),
       "Control how the COLLADA (.dae) importer interprets LOD in the model. No effect for DTS files.\n"
       "Set to one of the following values:\n"
       "<dl><dt>DetectDTS</dt><dd>The default value. Instructs the importer to search for a 'baseXXX->startXXX' node hierarchy at the root level. If found, the importer acts as if ''TrailingNumber'' was set. Otherwise, all geometry is imported at a single detail size.</dd>"
@@ -190,16 +190,16 @@ void TSShapeConstructor::initPersistFields()
       "<dt>TrailingNumber</dt><dd>Numbers at the end of geometry node's name are interpreted as the detail size (similar to DTS exporting). Geometry instances with the same base name but different trailing number are grouped into the same object.</dd>"
       "<dt>DEFAULT</dt><dd>The default value. Use the value in the .dae file (defaults to Z_AXIS if the <up_axis> element is not present).</dd></dl>" );
 
-   addField( "singleDetailSize", TypeS32, Offset(mOptions.singleDetailSize, TSShapeConstructor),
+   addField( "singleDetailSize", TypeS32, Offset(mOptions.mSingleDetailSize, TSShapeConstructor),
       "Sets the detail size when lodType is set to SingleSize. No effect otherwise, and no effect for DTS files.\n"
       "@see lodType" );
 
-   addField( "matNamePrefix", TypeRealString, Offset(mOptions.matNamePrefix, TSShapeConstructor),
+   addField( "matNamePrefix", TypeRealString, Offset(mOptions.mMatNamePrefix, TSShapeConstructor),
       "Prefix to apply to all material map names in the COLLADA (.dae) file. No effect for DTS files.\n"
       "This field is useful to avoid material name clashes for exporters that generate generic material "
       "names like \"texture0\" or \"material1\"." );
 
-   addField( "alwaysImport", TypeRealString, Offset(mOptions.alwaysImport, TSShapeConstructor),
+   addField( "alwaysImport", TypeRealString, Offset(mOptions.mAlwaysImport, TSShapeConstructor),
       "TAB separated patterns of nodes to import even if in neverImport list. No effect for DTS files.\n"
       "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored "
       "during import. This field contains a TAB separated list of patterns to "
@@ -215,7 +215,7 @@ void TSShapeConstructor::initPersistFields()
       "}\n"
       "@endtsexample" );
 
-   addField( "neverImport", TypeRealString, Offset(mOptions.neverImport, TSShapeConstructor),
+   addField( "neverImport", TypeRealString, Offset(mOptions.mNeverImport, TSShapeConstructor),
       "TAB separated patterns of nodes to ignore on loading. No effect for DTS files.\n"
       "Torque allows unwanted nodes in COLLADA (.dae) files to to be ignored "
       "during import. This field contains a TAB separated list of patterns to "
@@ -223,7 +223,7 @@ void TSShapeConstructor::initPersistFields()
       "not be imported (unless it matches the alwaysImport list.\n"
       "@see alwaysImport" );
 
-   addField( "alwaysImportMesh", TypeRealString, Offset(mOptions.alwaysImportMesh, TSShapeConstructor),
+   addField( "alwaysImportMesh", TypeRealString, Offset(mOptions.mAlwaysImportMesh, TSShapeConstructor),
       "TAB separated patterns of meshes to import even if in neverImportMesh list. No effect for DTS files.\n"
       "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored "
       "during import. This field contains a TAB separated list of patterns to "
@@ -239,7 +239,7 @@ void TSShapeConstructor::initPersistFields()
       "}\n"
       "@endtsexample" );
 
-   addField( "neverImportMesh", TypeRealString, Offset(mOptions.neverImportMesh, TSShapeConstructor),
+   addField( "neverImportMesh", TypeRealString, Offset(mOptions.mNeverImportMesh, TSShapeConstructor),
       "TAB separated patterns of meshes to ignore on loading. No effect for DTS files.\n"
       "Torque allows unwanted meshes in COLLADA (.dae) files to to be ignored "
       "during import. This field contains a TAB separated list of patterns to "
@@ -247,21 +247,21 @@ void TSShapeConstructor::initPersistFields()
       "not be imported (unless it matches the alwaysImportMesh list.\n"
       "@see alwaysImportMesh" );
 
-   addField( "ignoreNodeScale", TypeBool, Offset(mOptions.ignoreNodeScale, TSShapeConstructor),
+   addField( "ignoreNodeScale", TypeBool, Offset(mOptions.mIgnoreNodeScale, 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 "
       "scaling, and is not usually required." );
 
-   addField( "adjustCenter", TypeBool, Offset(mOptions.adjustCenter, TSShapeConstructor),
+   addField( "adjustCenter", TypeBool, Offset(mOptions.mAdjustCenter, TSShapeConstructor),
       "Translate COLLADA model on import so the origin is at the center. No effect for DTS files." );
 
-   addField( "adjustFloor", TypeBool, Offset(mOptions.adjustFloor, TSShapeConstructor),
+   addField( "adjustFloor", TypeBool, Offset(mOptions.mAdjustFloor, TSShapeConstructor),
       "Translate COLLADA model on import so origin is at the (Z axis) bottom of the model. No effect for DTS files.\n"
       "This can be used along with adjustCenter to have the origin at the "
       "center of the bottom of the model.\n"
       "@see adjustCenter" );
 
-   addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.forceUpdateMaterials, TSShapeConstructor),
+   addField( "forceUpdateMaterials", TypeBool, Offset(mOptions.mForceUpdateMaterials, TSShapeConstructor),
       "Forces update of the materials.cs 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." );