mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-27 22:00:23 -04:00
support export MovieTexture
This commit is contained in:
parent
682ef4552e
commit
b2ecc65885
37
Unity Studio/Unity Classes/MovieTexture.cs
Normal file
37
Unity Studio/Unity Classes/MovieTexture.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Unity_Studio
|
||||
{
|
||||
class MovieTexture
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_MovieData;
|
||||
|
||||
public MovieTexture(AssetPreloadData preloadData, bool readSwitch)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var a_Stream = preloadData.sourceFile.a_Stream;
|
||||
a_Stream.Position = preloadData.Offset;
|
||||
|
||||
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||
if (readSwitch)
|
||||
{
|
||||
var m_Loop = a_Stream.ReadBoolean();
|
||||
a_Stream.AlignStream(4);
|
||||
//PPtr<AudioClip>
|
||||
sourceFile.ReadPPtr();
|
||||
var size = a_Stream.ReadInt32();
|
||||
m_MovieData = a_Stream.ReadBytes(size);
|
||||
var m_ColorSpace = a_Stream.ReadInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.extension = ".ogv";
|
||||
preloadData.Text = m_Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -295,6 +295,12 @@ namespace Unity_Studio
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case 152: //MovieTexture
|
||||
{
|
||||
var m_MovieTexture = new MovieTexture(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case 21: //Material
|
||||
case 74: //AnimationClip
|
||||
case 90: //Avatar
|
||||
@ -1826,6 +1832,16 @@ namespace Unity_Studio
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ExportMovieTexture(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_MovieTexture = new MovieTexture(asset, true);
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_MovieTexture.m_MovieData);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ExportRawFile(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
|
@ -142,6 +142,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Unity Classes\AssetBundle.cs" />
|
||||
<Compile Include="Unity Classes\MovieTexture.cs" />
|
||||
<Compile Include="Unity Classes\VideoClip.cs" />
|
||||
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
||||
<Compile Include="Unity Classes\AudioClip.cs" />
|
||||
|
@ -142,6 +142,7 @@
|
||||
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Unity Classes\AssetBundle.cs" />
|
||||
<Compile Include="Unity Classes\MovieTexture.cs" />
|
||||
<Compile Include="Unity Classes\VideoClip.cs" />
|
||||
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
||||
<Compile Include="Unity Classes\AudioClip.cs" />
|
||||
|
@ -1103,13 +1103,9 @@ namespace Unity_Studio
|
||||
#endregion
|
||||
#region VideoClip
|
||||
case 329:
|
||||
case 152: //MovieTexture
|
||||
{
|
||||
var str = asset.ViewStruct();
|
||||
if (str != null)
|
||||
{
|
||||
textPreviewBox.Text = str;
|
||||
textPreviewBox.Visible = true;
|
||||
}
|
||||
StatusStripUpdate("Only supported export.");
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
@ -1619,6 +1615,12 @@ namespace Unity_Studio
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
case 152: //MovieTexture
|
||||
if (ExportMovieTexture(asset, exportpath))
|
||||
{
|
||||
exportedCount++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (ExportRawFile(asset, exportpath))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user