Browse Source

various fixes

STB probably shouldn't fail on failed info, just continue.
Assimp only add sequences if there are any.
Update kork chan asset.
marauder2k7 1 năm trước cách đây
mục cha
commit
6355da5df6

+ 2 - 4
Engine/source/gfx/bitmap/loaders/bitmapSTB.cpp

@@ -200,8 +200,7 @@ bool sReadSTB(const Torque::Path& path, GBitmap* bitmap)
       if (!stbErr)
          stbErr = "Unknown Error!";
 
-      Con::errorf("STB failed to get image info: %s", stbErr);
-      return false;
+      Con::errorf("STB get file info: %s", stbErr);
    }
 
    // do this to map 2 channels to 4, 2 channel not supported by gbitmap yet..
@@ -331,8 +330,7 @@ bool sReadStreamSTB(Stream& stream, GBitmap* bitmap, U32 len)
       if (!stbErr)
          stbErr = "Unknown Error!";
 
-      Con::errorf("STB failed to get image info: %s", stbErr);
-      Con::warnf("Going to attempt to load stream anyway.");
+      Con::errorf("STB get memory info: %s", stbErr);
    }
 
    S32 reqCom = comp;

+ 27 - 25
Engine/source/ts/assimp/assimpShapeLoader.cpp

@@ -261,38 +261,40 @@ void AssimpShapeLoader::processAnimations()
 
    Vector<aiNodeAnim*> ambientChannels;
    F32 duration = 0.0f;
-
-   for (U32 i = 0; i < mScene->mNumAnimations; ++i)
+   if (mScene->mNumAnimations > 0)
    {
-      aiAnimation* anim = mScene->mAnimations[i];
-      for (U32 j = 0; j < anim->mNumChannels; j++)
+      for (U32 i = 0; i < mScene->mNumAnimations; ++i)
       {
-         aiNodeAnim* nodeAnim = anim->mChannels[j];
-         // Determine the maximum keyframe time for this animation
-         F32 maxKeyTime = 0.0f;
-         for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
-            maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
-         }
-         for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
-            maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
-         }
-         for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
-            maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
-         }
+         aiAnimation* anim = mScene->mAnimations[i];
+         for (U32 j = 0; j < anim->mNumChannels; j++)
+         {
+            aiNodeAnim* nodeAnim = anim->mChannels[j];
+            // Determine the maximum keyframe time for this animation
+            F32 maxKeyTime = 0.0f;
+            for (U32 k = 0; k < nodeAnim->mNumPositionKeys; k++) {
+               maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mPositionKeys[k].mTime);
+            }
+            for (U32 k = 0; k < nodeAnim->mNumRotationKeys; k++) {
+               maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mRotationKeys[k].mTime);
+            }
+            for (U32 k = 0; k < nodeAnim->mNumScalingKeys; k++) {
+               maxKeyTime = getMax(maxKeyTime, (F32)nodeAnim->mScalingKeys[k].mTime);
+            }
 
-         ambientChannels.push_back(nodeAnim);
+            ambientChannels.push_back(nodeAnim);
 
-         duration = getMax(duration, maxKeyTime);
+            duration = getMax(duration, maxKeyTime);
+         }
       }
-   }
 
-   ambientSeq->mNumChannels = ambientChannels.size();
-   ambientSeq->mChannels = ambientChannels.address();
-   ambientSeq->mDuration = duration;
-   ambientSeq->mTicksPerSecond = 24.0;
+      ambientSeq->mNumChannels = ambientChannels.size();
+      ambientSeq->mChannels = ambientChannels.address();
+      ambientSeq->mDuration = duration;
+      ambientSeq->mTicksPerSecond = 24.0;
 
-   AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
-   appSequences.push_back(defaultAssimpSeq);
+      AssimpAppSequence* defaultAssimpSeq = new AssimpAppSequence(ambientSeq);
+      appSequences.push_back(defaultAssimpSeq);
+   }
 }
 
 void AssimpShapeLoader::computeBounds(Box3F& bounds)

+ 0 - 6
Templates/BaseGame/game/data/Prototyping/shapes/kork_chanShape.asset.taml

@@ -1,6 +0,0 @@
-<ShapeAsset
-    AssetName="kork_chanShape"
-    fileName="@assetFile=kork_chanShape.fbx"
-    constuctorFileName="@assetFile=kork_chanShape.tscript"
-    materialSlot0="@asset=Prototyping:kork_chan_mat"
-    originalFilePath="C:/dev/T3D/PRs/MiscFixes20220525/Templates/BaseGame/game/data/Prototyping/shapes/kork_chanShape.fbx"/>

+ 5 - 25
Templates/BaseGame/game/data/Prototyping/shapes/kork_chanShape.tscript

@@ -1,28 +1,8 @@
-//--- OBJECT WRITE BEGIN ---
-new TSShapeConstructor(kork_chanShape_fbx) {
-   baseShapeAsset = "Prototyping:kork_chanShape";
-   upAxis = "DEFAULT";
-   unit = "-1";
-   LODType = "TrailingNumber";
+
+singleton TSShapeConstructor(kork_chanShapefbx)
+{
+   baseShapeAsset = ":kork_chanShape_shape";
    singleDetailSize = "0";
-   IgnoreNodeScale = "0";
-   AdjustCenter = "0";
-   AdjustFloor = "0";
-   forceUpdateMaterials = "0";
-   convertLeftHanded = "0";
-   calcTangentSpace = "0";
-   genUVCoords = "0";
-   transformUVCoords = "0";
-   flipUVCoords = "1";
-   findInstances = "0";
-   limitBoneWeights = "0";
-   JoinIdenticalVerts = "1";
-   reverseWindingOrder = "1";
-   invertNormals = "0";
-   removeRedundantMats = "1";
-   animTiming = "Seconds";
+   neverImportMat = "DefaultMaterial	ColorEffect*";
    animFPS = "2";
-   canSave = "1";
-   canSaveDynamicFields = "1";
 };
-//--- OBJECT WRITE END ---

+ 5 - 0
Templates/BaseGame/game/data/Prototyping/shapes/kork_chanShape_shape.asset.taml

@@ -0,0 +1,5 @@
+<ShapeAsset
+    AssetName="kork_chanShape_shape"
+    fileName="@assetFile=kork_chanShape.fbx"
+    constuctorFileName="@assetFile=kork_chanShape.tscript"
+    materialSlot0="@asset=Prototyping:kork_chan_mat"/>

+ 1 - 2
Templates/BaseGame/game/data/Prototyping/shapes/kork_chan_image.asset.taml

@@ -1,4 +1,3 @@
 <ImageAsset
     AssetName="kork_chan_image"
-    imageFile="@assetFile=kork_chan.png"
-    originalFilePath="C:/dev/T3D/PRs/MiscFixes20220525/Templates/BaseGame/game/data/Prototyping/shapes/kork_chan.png"/>
+    imageFile="@assetFile=kork_chan.png"/>

+ 3 - 4
Templates/BaseGame/game/data/Prototyping/shapes/kork_chan_mat.asset.taml

@@ -5,12 +5,11 @@
     <Material
         Name="kork_chan_mat"
         mapTo="kork_chan"
-        alphaTest="true"
-        alphaRef="100">
+        doubleSided="true"
+        originalAssetName="kork_chan_mat">
         <Material.Stages>
             <Stages_beginarray
-                DiffuseMapAsset="Prototyping:kork_chan_image"
-                doubleSided="true"/>
+                DiffuseMapAsset="Prototyping:kork_chan_image"/>
         </Material.Stages>
     </Material>
 </MaterialAsset>