• R/O
  • SSH
  • HTTPS

mmdx: Commit


Commit MetaInfo

Revision867 (tree)
Zeit2011-06-16 09:38:20
Autorwilfrem

Log Message

テクスチャファイルが無いときにFileNotFoundを投げるように修正

Ändern Zusammenfassung

Diff

--- branches/XNA4/SlimMMDX/Model/MMDModelFactory.cs (revision 866)
+++ branches/XNA4/SlimMMDX/Model/MMDModelFactory.cs (revision 867)
@@ -130,7 +130,10 @@
130130 if (!string.IsNullOrEmpty(material.TextureFileName))
131131 {
132132 //テクスチャを読み込んではめ込み
133- Texture tex = Texture.FromFile(SlimMMDXCore.Instance.Device, BuildPath(modelAbsPath, material.TextureFileName));
133+ string fulltexPath = BuildPath(modelAbsPath, material.TextureFileName);
134+ if (!File.Exists(fulltexPath))
135+ throw new FileNotFoundException("テクスチャファイルが見つかりません", fulltexPath);
136+ Texture tex = Texture.FromFile(SlimMMDXCore.Instance.Device, fulltexPath);
134137 effect.SetTexture("Texture", tex);
135138 shaderIndex = 2;//本来pmd以外のモデルを考慮すべきだが、('A`)マンドクセ
136139 }
@@ -163,6 +166,9 @@
163166 string toonPath = ToonTexManager.GetToonTexPath(material.ToonIndex, iomodel.ToonFileNames, modelAbsPath);
164167 if (!string.IsNullOrEmpty(toonPath))
165168 {
169+ string fulltexPath = BuildPath(modelAbsPath, toonPath);
170+ if (!File.Exists(fulltexPath))
171+ throw new FileNotFoundException("スフィアマップファイル:" + fulltexPath + "が見つかりません", fulltexPath);
166172 Texture tex = Texture.FromFile(SlimMMDXCore.Instance.Device, BuildPath(modelAbsPath, toonPath));
167173 effect.SetTexture("ToonTex", tex);
168174 effect.SetValue("UseToon", true);
Show on old repository browser