Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Commit

Permalink
when exporting the FBX file, no flip the picture
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfare committed Sep 20, 2016
1 parent 88d78e5 commit a831456
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Unity Studio/UnityStudioForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2528,8 +2528,8 @@ this will also make it easier to debug FBX files
//TODO check texture type and set path accordingly; eg. CubeMap, Texture3D
string texFilename = Path.GetDirectoryName(FBXfile) + "\\Texture2D\\" + TexturePD.Text;
StatusStripUpdate("Exporting Texture2D: " + Path.GetFileName(texFilename));
ExportTexture(TexturePD, texFilename, TexturePD.extension);

ExportTexture(TexturePD, texFilename, TexturePD.extension, false);
texFilename += ".png";//必须是png文件
ob.AppendFormat("\n\tTexture: 7{0}, \"Texture::{1}\", \"\" {{", TexturePD.uniqueID, TexturePD.Text);
ob.Append("\n\t\tType: \"TextureVideoClip\"");
ob.Append("\n\t\tVersion: 202");
Expand Down Expand Up @@ -3048,7 +3048,7 @@ private void ExportAssets_Click(object sender, EventArgs e)
switch (asset.Type2)
{
case 28:
if (ExportTexture(asset, exportpath + asset.Text, asset.extension))
if (ExportTexture(asset, exportpath + asset.Text, asset.extension, true))
{
exportedCount++;
}
Expand Down Expand Up @@ -3124,7 +3124,7 @@ private void ExportRawFile(AssetPreloadData asset, string exportFilepath)
File.WriteAllBytes(exportFilepath, bytes);
}

private bool ExportTexture(AssetPreloadData asset, string exportFilename, string exportFileextension)
private bool ExportTexture(AssetPreloadData asset, string exportFilename, string exportFileextension, bool flip)
{
ImageFormat format = null;
var oldextension = exportFileextension;
Expand Down Expand Up @@ -3154,7 +3154,8 @@ private bool ExportTexture(AssetPreloadData asset, string exportFilename, string
if ((bool)Properties.Settings.Default["convertTexture"])
{
var bitmap = DDSToBMP(imageBuffer);
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
if (flip)
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
bitmap.Save(exportFullname, format);
}
else
Expand All @@ -3173,7 +3174,8 @@ private bool ExportTexture(AssetPreloadData asset, string exportFilename, string
int len = Math.Abs(bmd.Stride) * bmd.Height;
DecompressPVR(pvrdata, bmd.Scan0, len);
bitmap.UnlockBits(bmd);
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
if (flip)
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
bitmap.Save(exportFullname, format);
}
else
Expand All @@ -3196,7 +3198,8 @@ private bool ExportTexture(AssetPreloadData asset, string exportFilename, string
File.Delete(tempastcfilepath);
File.Delete(temptgafilepath);
var bitmap = TGAToBMP(tempddsfile);
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
if (flip)
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
bitmap.Save(exportFullname, format);
}
}
Expand Down

1 comment on commit a831456

@duangsuse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.