Browse Source

added tracking of node flags to model viewer, also added try catch for reading objects in which can avoid crashes on some zones..

Emagi 2 years ago
parent
commit
635d1c42d8

+ 3 - 2
EQ2/devtools/EQ2ModelViewer/EQ2ModelViewer/Main.cs

@@ -37,7 +37,7 @@ namespace EQ2ModelViewer
         private bool AutoExportRegionOnLoad = false;
         private String AutoLoadFileName = "";
         private bool IsLoaded = false;
-        private bool WriteObjFile = true;
+        private bool WriteObjFile = false;
         public frmMain()
         {
             InitializeComponent();
@@ -99,7 +99,7 @@ namespace EQ2ModelViewer
             text.Initialize(Graphics.Device, Graphics.Context, pGraphics.ClientSize.Width, pGraphics.ClientSize.Height, baseViewMatrix);
 
             BitmapClass bmp = new BitmapClass();
-            bmp.Initialize(Graphics.Device, pGraphics.ClientSize.Width, pGraphics.ClientSize.Height, "Background.bmp", 145, 220, baseViewMatrix);
+            bmp.Initialize(Graphics.Device, pGraphics.ClientSize.Width, pGraphics.ClientSize.Height, "Background.bmp", 145, 260, baseViewMatrix);
             
             string[] args = Environment.GetCommandLineArgs();
             if (args.Length > 1)
@@ -550,6 +550,7 @@ namespace EQ2ModelViewer
                 model.Scale = scale;
                 model.WidgetID = widgetID;
                 model.GridID = GridID;
+                model.nodeFlags = ((VeNode)item).nodeFlags;
                 m_Models.Add(model);
             }
             else

+ 1 - 0
EQ2/devtools/EQ2ModelViewer/EQ2ModelViewer/Model.cs

@@ -27,6 +27,7 @@ namespace EQ2ModelViewer
         public UInt32 WidgetID = 0;
         public UInt32 GridID = 0;
         public String modelName = "";
+        public UInt32 nodeFlags = 0;
         List<MeshClass> m_meshes = new List<MeshClass>();
         LightShaderClass lightShader = new LightShaderClass();
 

+ 12 - 5
EQ2/devtools/EQ2ModelViewer/EQ2ModelViewer/TextClass.cs

@@ -50,6 +50,7 @@ namespace EQ2ModelViewer
         private SentenceType m_Sentence9;
         private SentenceType m_Sentence10;
         private SentenceType m_Sentence11;
+        private SentenceType m_Sentence12;
 
         public bool Initialize(Device device, DeviceContext context, int screenWidth, int screenHeight, Matrix baseViewMatrix)
         {
@@ -93,10 +94,13 @@ namespace EQ2ModelViewer
             UpdateSentence(ref m_Sentence9, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
 
             InitializeSentence(ref m_Sentence10, 32, device);
-            UpdateSentence(ref m_Sentence10, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
-
+            UpdateSentence(ref m_Sentence10, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
+
             InitializeSentence(ref m_Sentence11, 32, device);
-            UpdateSentence(ref m_Sentence11, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
+            UpdateSentence(ref m_Sentence11, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
+
+            InitializeSentence(ref m_Sentence12, 32, device);
+            UpdateSentence(ref m_Sentence12, "", 0, 0, 1.0f, 1.0f, 0.0f, context);
             return true;
         }
 
@@ -140,6 +144,7 @@ namespace EQ2ModelViewer
             RenderSentence(context, m_Sentence9, world, ortho);
             RenderSentence(context, m_Sentence10, world, ortho);
             RenderSentence(context, m_Sentence11, world, ortho);
+            RenderSentence(context, m_Sentence12, world, ortho);
 
             return true;
         }
@@ -278,7 +283,8 @@ namespace EQ2ModelViewer
                     && UpdateSentence(ref m_Sentence7, "Yaw: " + model.Rotation.X.ToString(), 20, 160, 1.0f, 0.0f, 0.0f, context)
                     && UpdateSentence(ref m_Sentence8, "Pitch: " + model.Rotation.Y.ToString(), 20, 180, 1.0f, 0.0f, 0.0f, context)
                     && UpdateSentence(ref m_Sentence9, "Roll: " + model.Rotation.Z.ToString(), 20, 200, 1.0f, 0.0f, 0.0f, context)
-                    && UpdateSentence(ref m_Sentence11, "Grid: " + model.GridID.ToString(), 20, 220, 1.0f, 0.0f, 0.0f, context);
+                    && UpdateSentence(ref m_Sentence11, "Grid: " + model.GridID.ToString(), 20, 220, 1.0f, 0.0f, 0.0f, context)
+                    && UpdateSentence(ref m_Sentence12, "NodeFlags: " + model.nodeFlags.ToString(), 20, 240, 1.0f, 0.0f, 0.0f, context);
             }
             else {
                 ret = UpdateSentence(ref m_Sentence2, "", 20, 60, 1.0f, 0.0f, 0.0f, context)
@@ -289,7 +295,8 @@ namespace EQ2ModelViewer
                     && UpdateSentence(ref m_Sentence7, "", 20, 160, 1.0f, 0.0f, 0.0f, context)
                     && UpdateSentence(ref m_Sentence8, "", 20, 180, 1.0f, 0.0f, 0.0f, context)
                     && UpdateSentence(ref m_Sentence9, "", 20, 200, 1.0f, 0.0f, 0.0f, context)
-                    && UpdateSentence(ref m_Sentence11, "", 20, 220, 1.0f, 0.0f, 0.0f, context);
+                    && UpdateSentence(ref m_Sentence11, "", 20, 220, 1.0f, 0.0f, 0.0f, context)
+                    && UpdateSentence(ref m_Sentence12, "", 20, 240, 1.0f, 0.0f, 0.0f, context);
             }
 
             return ret;

+ 13 - 7
EQ2/devtools/EQ2ModelViewer/EQ2ModelViewer/libeq2/Util/Eq2Reader.cs

@@ -102,13 +102,19 @@ namespace Everquest2.Util
                 //    filename != null ? "\n in file " + filename : "");
 
                 // Find deserializing constructor
-                constructor = classType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, 
-                                                       null, 
-                                                       new Type[] { typeof(Eq2Reader), typeof(StreamingContext) }, 
-                                                       null);
-                Debug.Assert(constructor != null, "Deserializing constructor not found on class " + classType.Name);
-
-                classCache[className] = constructor;
+                try
+                {
+                    constructor = classType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
+                                                           null,
+                                                           new Type[] { typeof(Eq2Reader), typeof(StreamingContext) },
+                                                           null);
+                    Debug.Assert(constructor != null, "Deserializing constructor not found on class " + classType.Name);
+
+                    classCache[className] = constructor;
+                }catch(Exception ex)
+                {
+                    return null;
+                }
             }
 
             // Create streaming context