{\r
string column_name = lvMaterials.Columns[i].Text;\r
string text = item.SubItems[i].Text;\r
-\r
+#if false\r
if (text == "")\r
error_message = string.Format("マテリアル名 {0} の {1} を設定する必要があります。", material_name, column_name);\r
else if (!File.Exists(text))\r
error_message = string.Format("マテリアル名 {0} の {1} は存在しません。", material_name, column_name);\r
-\r
+#endif\r
if (error_message != null)\r
{\r
MessageBox.Show(error_message);\r
string file = GetTexturePath(tex);
byte[] data = tex.data;
+ //TODO: .bmpのはずが.psdになってるものがある
using (FileStream fs = File.OpenWrite(file))
{
bw.Write((byte)0); // depth
break;
- case ".BMP":
+ default:
bw.Write((byte)'B');
bw.Write((byte)'M');
bw.Write((int)(54 + data.Length));
foreach (TSOMaterial mat in file.materials)
{
- if (mat.ColorTex != null)
+ TSOTex tex = null;
+ if (file.texturemap.TryGetValue(mat.ColorTex, out tex))
{
- TSOTex tex = file.texturemap[mat.ColorTex];
tw.WriteLine(
"\t\"{0}\" col(1.000 1.000 1.000 1.000) dif(0.800) amb(0.600) emi(0.000) spc(0.000) power(5.00) tex(\"{1}\")",
mat.name, GetTextureFileName(tex));
meshes[i].sub_meshes[j].numbones = r.ReadInt32();
meshes[i].sub_meshes[j].bones = new int[meshes[i].sub_meshes[j].numbones];
- meshes[i].sub_meshes[j].ink = materials[meshes[i].sub_meshes[j].spec].technique.ToUpper().IndexOf("INKOFF") < 0;
- //meshes[i].sub[j].shadow = specs[meshes[i].sub[j].spec].technique.ToUpper().IndexOf(Shadow
-
for (int k = 0; k < meshes[i].sub_meshes[j].numbones; ++k)
meshes[i].sub_meshes[j].bones[k] = r.ReadInt32();
internal int numvertices;
internal Vertex[] vertices;
internal TSOMesh owner;
- //internal bool shadow;
- internal bool ink;
[Category("Detail")]
public int Spec { get { return spec; } set { spec = value; } }
public float Weight;
}
*/
-}
\ No newline at end of file
+}
\r
foreach (MaterialInfo i in materials.Values)\r
{\r
- string name = Path.GetFileNameWithoutExtension(i.ColorTexture);\r
+ string color_tex_name = Path.GetFileNameWithoutExtension(i.ColorTexture);\r
\r
- if (!textures.ContainsKey(name))\r
- textures.Add(name, new TextureInfo(name, i.ColorTexture));\r
+ if (color_tex_name != null && !textures.ContainsKey(color_tex_name))\r
+ textures.Add(color_tex_name, new TextureInfo(color_tex_name, i.ColorTexture));\r
\r
- name = Path.GetFileNameWithoutExtension(i.ShadeTexture);\r
+ string shade_tex_name = Path.GetFileNameWithoutExtension(i.ShadeTexture);\r
\r
- if (!textures.ContainsKey(name))\r
- textures.Add(name, new TextureInfo(name, i.ShadeTexture));\r
+ if (shade_tex_name != null && !textures.ContainsKey(shade_tex_name))\r
+ textures.Add(shade_tex_name, new TextureInfo(shade_tex_name, i.ShadeTexture));\r
}\r
\r
return true;\r
{\r
get\r
{\r
- return File.Exists(shader)\r
- && File.Exists(color_tex)\r
- && File.Exists(shade_tex);\r
+ return File.Exists(shader);\r
}\r
}\r
\r
public string[] GetCode()\r
{\r
TSOMaterialCode code = TSOMaterialCode.GenerateFromFile(shader);\r
- List<string> line = new List<string>();\r
-\r
- code.SetValue("ColorTex", Path.GetFileNameWithoutExtension(color_tex));\r
- code.SetValue("ShadeTex", Path.GetFileNameWithoutExtension(shade_tex));\r
+ if (color_tex != null)\r
+ code.SetValue("ColorTex", Path.GetFileNameWithoutExtension(color_tex));\r
+ if (shade_tex != null)\r
+ code.SetValue("ShadeTex", Path.GetFileNameWithoutExtension(shade_tex));\r
\r
+ List<string> line = new List<string>();\r
foreach (KeyValuePair<string, TSOParameter> i in code)\r
line.Add(i.Value.ToString());\r
\r