mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 14:11:19 +07:00
fix scale bugs
This commit is contained in:
@@ -145,7 +145,7 @@ Camera:
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 3
|
||||
orthographic size: 512
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
@@ -166,7 +166,7 @@ Transform:
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1173114888}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -1000}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
|
||||
@@ -58,8 +58,11 @@ namespace FlashTools.Internal.SwfTools {
|
||||
? MainContex.Library.HasDefine<SwfLibrarySpriteDefine>(tag.CharacterId)
|
||||
: false;
|
||||
if ( tag.HasCharacter ) {
|
||||
SwfDisplayInstance old_inst = null;
|
||||
if ( tag.Move ) { // replace character
|
||||
dl.Instances.Remove(tag.Depth);
|
||||
if ( dl.Instances.TryGetValue(tag.Depth, out old_inst) ) {
|
||||
dl.Instances.Remove(tag.Depth);
|
||||
}
|
||||
}
|
||||
// new character
|
||||
SwfDisplayInstance new_inst = null;
|
||||
@@ -72,8 +75,8 @@ namespace FlashTools.Internal.SwfTools {
|
||||
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;
|
||||
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity );
|
||||
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity);
|
||||
dl.Instances.Add(new_inst.Depth, new_inst);
|
||||
}
|
||||
} else if ( tag.Move ) { // move character
|
||||
@@ -99,8 +102,11 @@ namespace FlashTools.Internal.SwfTools {
|
||||
? MainContex.Library.HasDefine<SwfLibrarySpriteDefine>(tag.CharacterId)
|
||||
: false;
|
||||
if ( tag.HasCharacter ) {
|
||||
SwfDisplayInstance old_inst = null;
|
||||
if ( tag.Move ) { // replace character
|
||||
dl.Instances.Remove(tag.Depth);
|
||||
if ( dl.Instances.TryGetValue(tag.Depth, out old_inst) ) {
|
||||
dl.Instances.Remove(tag.Depth);
|
||||
}
|
||||
}
|
||||
// new character
|
||||
SwfDisplayInstance new_inst = null;
|
||||
@@ -112,9 +118,9 @@ namespace FlashTools.Internal.SwfTools {
|
||||
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;
|
||||
new_inst.Visible = tag.HasVisible ? tag.Visible : (old_inst != null ? old_inst.Visible : true );
|
||||
new_inst.Matrix = tag.HasMatrix ? tag.Matrix : (old_inst != null ? old_inst.Matrix : SwfMatrix.identity );
|
||||
new_inst.ColorTransform = tag.HasColorTransform ? tag.ColorTransform : (old_inst != null ? old_inst.ColorTransform : SwfColorTransform.identity);
|
||||
dl.Instances.Add(new_inst.Depth, new_inst);
|
||||
}
|
||||
} else if ( tag.Move ) { // move character
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
|
||||
var has_scale = reader.ReadBit();
|
||||
if ( has_scale ) {
|
||||
var bits = (byte)reader.ReadUnsignedBits(5);
|
||||
matrix.ScaleX = reader.ReadFixedPoint16(bits) * (fill_style ? 1.0f / 20.0f : 1.0f);
|
||||
matrix.ScaleY = reader.ReadFixedPoint16(bits) * (fill_style ? 1.0f / 20.0f : 1.0f);
|
||||
matrix.ScaleX = reader.ReadFixedPoint16(bits);
|
||||
matrix.ScaleY = reader.ReadFixedPoint16(bits);
|
||||
} else {
|
||||
matrix.ScaleX =
|
||||
matrix.ScaleY = 1.0f;
|
||||
@@ -35,8 +35,8 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
|
||||
var has_rotate = reader.ReadBit();
|
||||
if ( has_rotate ) {
|
||||
var bits = (byte)reader.ReadUnsignedBits(5);
|
||||
matrix.RotateSkew0 = reader.ReadFixedPoint16(bits) / 20.0f;
|
||||
matrix.RotateSkew1 = reader.ReadFixedPoint16(bits) / 20.0f;
|
||||
matrix.RotateSkew0 = reader.ReadFixedPoint16(bits);
|
||||
matrix.RotateSkew1 = reader.ReadFixedPoint16(bits);
|
||||
} else {
|
||||
matrix.RotateSkew0 =
|
||||
matrix.RotateSkew1 = 0.0f;
|
||||
|
||||
@@ -37,27 +37,23 @@ namespace FlashTools.Internal.SwfTools.SwfTypes {
|
||||
switch ( style_type ) {
|
||||
case ShapeStyleType.Shape:
|
||||
shapes.FillStyles = ReadFillStyles(reader, false, false);
|
||||
//SkipLineStyles(reader, false, false, false);
|
||||
//SkipShapeRecords(reader, false, false, false);
|
||||
//reader.AlignToByte();
|
||||
SkipLineStyles(reader, false, false, false);
|
||||
SkipShapeRecords(reader, false, false, false);
|
||||
break;
|
||||
case ShapeStyleType.Shape2:
|
||||
shapes.FillStyles = ReadFillStyles(reader, true, false);
|
||||
//SkipLineStyles(reader, true, false, false);
|
||||
//SkipShapeRecords(reader, true, false, false);
|
||||
//reader.AlignToByte();
|
||||
SkipLineStyles(reader, true, false, false);
|
||||
SkipShapeRecords(reader, true, false, false);
|
||||
break;
|
||||
case ShapeStyleType.Shape3:
|
||||
shapes.FillStyles = ReadFillStyles(reader, true, true);
|
||||
//SkipLineStyles(reader, true, true, false);
|
||||
//SkipShapeRecords(reader, true, true, false);
|
||||
//reader.AlignToByte();
|
||||
SkipLineStyles(reader, true, true, false);
|
||||
SkipShapeRecords(reader, true, true, false);
|
||||
break;
|
||||
case ShapeStyleType.Shape4:
|
||||
shapes.FillStyles = ReadFillStyles(reader, true, true);
|
||||
//SkipLineStyles(reader, true, true, true);
|
||||
//SkipShapeRecords(reader, true, true, true);
|
||||
//reader.AlignToByte();
|
||||
SkipLineStyles(reader, true, true, true);
|
||||
SkipShapeRecords(reader, true, true, true);
|
||||
break;
|
||||
default:
|
||||
throw new UnityException(string.Format(
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace FlashTools {
|
||||
foreach ( var inst in frame.Instances ) {
|
||||
var bitmap = FindBitmap(inst.Bitmap);
|
||||
if ( bitmap != null ) {
|
||||
var width = bitmap.RealSize.x;
|
||||
var height = bitmap.RealSize.y;
|
||||
var width = bitmap.RealSize.x / 20.0f;
|
||||
var height = bitmap.RealSize.y / 20.0f;
|
||||
|
||||
var v0 = new Vector3( 0, 0, current_z);
|
||||
var v1 = new Vector3( width, 0, current_z);
|
||||
|
||||
Reference in New Issue
Block a user