mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-01-06 08:26:52 +07:00
visible and rasterization fix
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -82,7 +82,7 @@ namespace FlashTools.Internal {
|
||||
Matrix4x4 parent_matrix, SwfAnimationColorTransform parent_color_transform,
|
||||
SwfAnimationFrameData frame)
|
||||
{
|
||||
foreach ( var inst in dl.Instances.Values ) {
|
||||
foreach ( var inst in dl.Instances.Values.Where(p => p.Visible) ) {
|
||||
switch ( inst.Type ) {
|
||||
case SwfDisplayInstanceType.Shape:
|
||||
var shape_def = ctx.Library.FindDefine<SwfLibraryShapeDefine>(inst.Id);
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace FlashTools.Internal.SwfTools {
|
||||
|
||||
public ushort Id;
|
||||
public ushort Depth;
|
||||
public bool Visible;
|
||||
public SwfMatrix Matrix;
|
||||
public SwfColorTransform ColorTransform;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace FlashTools.Internal.SwfTools {
|
||||
if ( new_inst != null ) {
|
||||
new_inst.Id = tag.CharacterId;
|
||||
new_inst.Depth = tag.Depth;
|
||||
new_inst.Visible = true;
|
||||
new_inst.Matrix = tag.Matrix;
|
||||
new_inst.ColorTransform = tag.ColorTransform;
|
||||
dl.Instances.Add(new_inst.Depth, new_inst);
|
||||
@@ -70,6 +71,7 @@ namespace FlashTools.Internal.SwfTools {
|
||||
if ( new_inst != null ) {
|
||||
new_inst.Id = tag.CharacterId;
|
||||
new_inst.Depth = tag.Depth;
|
||||
new_inst.Visible = true;
|
||||
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : SwfMatrix.identity;
|
||||
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : SwfColorTransform.identity;
|
||||
dl.Instances.Add(new_inst.Depth, new_inst);
|
||||
@@ -90,6 +92,45 @@ namespace FlashTools.Internal.SwfTools {
|
||||
|
||||
public SwfDisplayList Visit(PlaceObject3Tag tag, SwfDisplayList dl) {
|
||||
Debug.Log(tag);
|
||||
var is_shape = tag.HasCharacter
|
||||
? MainContex.Library.HasDefine<SwfLibraryShapeDefine >(tag.CharacterId)
|
||||
: false;
|
||||
var is_sprite = tag.HasCharacter
|
||||
? MainContex.Library.HasDefine<SwfLibrarySpriteDefine>(tag.CharacterId)
|
||||
: false;
|
||||
if ( tag.HasCharacter ) {
|
||||
if ( tag.Move ) { // replace character
|
||||
dl.Instances.Remove(tag.Depth);
|
||||
}
|
||||
// new character
|
||||
SwfDisplayInstance new_inst = null;
|
||||
if ( is_shape ) {
|
||||
new_inst = new SwfDisplayShapeInstance();
|
||||
} else if ( is_sprite ) {
|
||||
new_inst = new SwfDisplaySpriteInstance();
|
||||
}
|
||||
if ( new_inst != null ) {
|
||||
new_inst.Id = tag.CharacterId;
|
||||
new_inst.Depth = tag.Depth;
|
||||
new_inst.Visible = tag.HasVisible ? tag.Visible : true;
|
||||
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : SwfMatrix.identity;
|
||||
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : SwfColorTransform.identity;
|
||||
dl.Instances.Add(new_inst.Depth, new_inst);
|
||||
}
|
||||
} else if ( tag.Move ) { // move character
|
||||
SwfDisplayInstance inst;
|
||||
if ( dl.Instances.TryGetValue(tag.Depth, out inst) ) {
|
||||
if ( tag.HasVisible ) {
|
||||
inst.Visible = tag.Visible;
|
||||
}
|
||||
if ( tag.HasMatrix ) {
|
||||
inst.Matrix = tag.Matrix;
|
||||
}
|
||||
if ( tag.HasColorTransform ) {
|
||||
inst.ColorTransform = tag.ColorTransform;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dl;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace FlashTools.Internal.SwfTools.SwfTags {
|
||||
public ushort ClipDepth;
|
||||
public SwfSurfaceFilters SurfaceFilters;
|
||||
public SwfBlendMode BlendMode;
|
||||
public byte BitmapCache;
|
||||
public byte Visible;
|
||||
public bool BitmapCache;
|
||||
public bool Visible;
|
||||
public SwfColor BackgroundColor;
|
||||
public SwfClipActions ClipActions;
|
||||
|
||||
@@ -126,12 +126,12 @@ namespace FlashTools.Internal.SwfTools.SwfTags {
|
||||
: SwfBlendMode.identity;
|
||||
|
||||
tag.BitmapCache = tag.HasCacheAsBitmap
|
||||
? reader.ReadByte()
|
||||
: (byte)0;
|
||||
? (0 != reader.ReadByte())
|
||||
: false;
|
||||
|
||||
tag.Visible = tag.HasVisible
|
||||
? reader.ReadByte()
|
||||
: (byte)1;
|
||||
? (0 != reader.ReadByte())
|
||||
: true;
|
||||
|
||||
tag.BackgroundColor = tag.HasVisible && !reader.IsEOF
|
||||
? SwfColor.Read(reader, true)
|
||||
|
||||
Reference in New Issue
Block a user