mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 14:11:19 +07:00
Compare commits
7 Commits
versions/1
...
versions/1
| Author | SHA1 | Date | |
|---|---|---|---|
| ad0e6251e8 | |||
| 6f4f11cc9d | |||
| 7e4bd5b159 | |||
| 2d8bd13384 | |||
| fa8a636d2e | |||
| 27bb4ef58d | |||
| ece15d9ada |
@@ -2,6 +2,9 @@ glob:obj/*
|
||||
glob:Temp/*
|
||||
glob:Library/*
|
||||
|
||||
glob:AssetStoreTools/*
|
||||
glob:AssetStoreTools.meta
|
||||
|
||||
glob:.DS_Store
|
||||
glob:unityflash.sln
|
||||
glob:unityflash.userprefs
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
-------------------
|
||||
-- Version 1.3.2 --
|
||||
-------------------
|
||||
|
||||
Fix bug custom scale export with small items optimization
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.1 --
|
||||
-------------------
|
||||
|
||||
Fix some Unity 5.5 deprecated functions
|
||||
|
||||
-------------------
|
||||
-- Version 1.3.0 --
|
||||
-------------------
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
};
|
||||
|
||||
ft.type_assert_if_defined = function (item, type) {
|
||||
if (item !== undefined) {
|
||||
if (item && item !== undefined) {
|
||||
ft.type_assert(item, type);
|
||||
}
|
||||
};
|
||||
@@ -228,12 +228,48 @@
|
||||
ftdoc.get_temp = function (doc) {
|
||||
if (!ftdoc.hasOwnProperty("temp")) {
|
||||
ftdoc["temp"] = {
|
||||
x_scales : {},
|
||||
y_scales : {}
|
||||
x_max_scales : {},
|
||||
y_max_scales : {}
|
||||
}
|
||||
}
|
||||
return ftdoc["temp"];
|
||||
};
|
||||
|
||||
ftdoc.calculate_item_final_scale = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ft.graphics_scale;
|
||||
if (optional_item && ft.optimize_small_items) {
|
||||
var item_name = optional_item.name;
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
if (x_max_scales.hasOwnProperty(item_name) && y_max_scales.hasOwnProperty(item_name)) {
|
||||
var max_x_scale = x_max_scales[item_name];
|
||||
var max_y_scale = y_max_scales[item_name];
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
final_scale *= max_c_scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
return final_scale;
|
||||
};
|
||||
|
||||
ftdoc.convert_selection_to_bitmap = function (doc, optional_item) {
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert_if_defined(optional_item, LibraryItem);
|
||||
var final_scale = ftdoc.calculate_item_final_scale(doc, optional_item);
|
||||
if (ft.approximately(final_scale, 1.0, 0.01)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "center");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item.timeline, final_scale);
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
doc.convertSelectionToBitmap();
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
}
|
||||
};
|
||||
|
||||
ftdoc.prepare_folders = function (doc) {
|
||||
ft.type_assert(doc, Document);
|
||||
@@ -383,8 +419,8 @@
|
||||
ft.type_assert(doc, Document);
|
||||
ft.type_assert(library, Library);
|
||||
|
||||
var x_scales = ftdoc.get_temp(doc).x_scales;
|
||||
var y_scales = ftdoc.get_temp(doc).y_scales;
|
||||
var x_max_scales = ftdoc.get_temp(doc).x_max_scales;
|
||||
var y_max_scales = ftdoc.get_temp(doc).y_max_scales;
|
||||
|
||||
var walk_by_timeline = function(timeline, func, acc) {
|
||||
ft.type_assert(timeline, Timeline);
|
||||
@@ -412,8 +448,8 @@
|
||||
var x_func = function(elem, acc) {
|
||||
var elem_sx = elem.scaleX * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
x_scales[item_name] = Math.max(
|
||||
x_scales.hasOwnProperty(item_name) ? x_scales[item_name] : elem_sx,
|
||||
x_max_scales[item_name] = Math.max(
|
||||
x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : elem_sx,
|
||||
elem_sx);
|
||||
return elem_sx;
|
||||
};
|
||||
@@ -421,8 +457,8 @@
|
||||
var y_func = function(elem, acc) {
|
||||
var elem_sy = elem.scaleY * acc;
|
||||
var item_name = elem.libraryItem.name;
|
||||
y_scales[item_name] = Math.max(
|
||||
y_scales.hasOwnProperty(item_name) ? y_scales[item_name] : elem_sy,
|
||||
y_max_scales[item_name] = Math.max(
|
||||
y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : elem_sy,
|
||||
elem_sy);
|
||||
return elem_sy;
|
||||
};
|
||||
@@ -434,13 +470,13 @@
|
||||
walk_by_timeline(doc.getTimeline(), y_func, 1.0);
|
||||
|
||||
if (ft.verbose_mode) {
|
||||
for (var item_name in x_scales) {
|
||||
var max_x_scale = x_scales.hasOwnProperty(item_name) ? x_scales[item_name] : 1.0;
|
||||
var max_y_scale = y_scales.hasOwnProperty(item_name) ? y_scales[item_name] : 1.0;
|
||||
for (var item_name in x_max_scales) {
|
||||
var max_x_scale = x_max_scales.hasOwnProperty(item_name) ? x_max_scales[item_name] : 1.0;
|
||||
var max_y_scale = y_max_scales.hasOwnProperty(item_name) ? y_max_scales[item_name] : 1.0;
|
||||
var max_c_scale = Math.max(max_x_scale, max_y_scale);
|
||||
if (max_c_scale < 1.0) {
|
||||
ft.trace_fmt("Small item for optimize: {0} - {1}", item_name, max_c_scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -517,27 +553,7 @@
|
||||
new_item_elem.setTransformationPoint({x: 0, y: 0});
|
||||
new_item_elem.transformX = 0;
|
||||
new_item_elem.transformY = 0;
|
||||
|
||||
var x_scales = ftdoc.get_temp(doc).x_scales;
|
||||
var y_scales = ftdoc.get_temp(doc).y_scales;
|
||||
|
||||
var final_scale = ft.graphics_scale;
|
||||
if (x_scales.hasOwnProperty(item.name) && y_scales.hasOwnProperty(item.name)) {
|
||||
var max_scale_x = x_scales[item.name];
|
||||
var max_scale_y = y_scales[item.name];
|
||||
final_scale = Math.min(final_scale, Math.max(max_scale_x, max_scale_y));
|
||||
}
|
||||
|
||||
if (ft.approximately(final_scale, 1.0, 0.01)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "center");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item.timeline, final_scale);
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
doc.convertSelectionToBitmap();
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
}
|
||||
ftdoc.convert_selection_to_bitmap(doc, item);
|
||||
return true;
|
||||
} else {
|
||||
doc.exitEditMode();
|
||||
@@ -775,28 +791,7 @@
|
||||
doc.selectNone();
|
||||
doc.selection = ft.array_filter(frame.elements, fttim.is_shape_instance);
|
||||
if (doc.selection.length > 0) {
|
||||
|
||||
var x_scales = ftdoc.get_temp(doc).x_scales;
|
||||
var y_scales = ftdoc.get_temp(doc).y_scales;
|
||||
|
||||
var item = timeline.libraryItem;
|
||||
var final_scale = ft.graphics_scale;
|
||||
if (item && x_scales.hasOwnProperty(item.name) && y_scales.hasOwnProperty(item.name)) {
|
||||
var max_scale_x = x_scales[item.name];
|
||||
var max_scale_y = y_scales[item.name];
|
||||
final_scale = Math.min(final_scale, Math.max(max_scale_x, max_scale_y));
|
||||
}
|
||||
|
||||
if (ft.approximately(final_scale, 1.0, 0.01)) {
|
||||
doc.convertSelectionToBitmap();
|
||||
} else {
|
||||
var wrapper_item_name = ft.gen_unique_name();
|
||||
var wrapper_item = doc.convertToSymbol("graphic", wrapper_item_name , "center");
|
||||
fttim.recursive_scale_filters(doc, wrapper_item.timeline, final_scale);
|
||||
doc.scaleSelection(final_scale, final_scale);
|
||||
doc.convertSelectionToBitmap();
|
||||
doc.scaleSelection(1.0 / final_scale, 1.0 / final_scale);
|
||||
}
|
||||
ftdoc.convert_selection_to_bitmap(doc, timeline.libraryItem);
|
||||
doc.arrange("back");
|
||||
any_rasterize = true;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,11 @@ namespace FTEditor.Postprocessors {
|
||||
atlas_importer.spritePixelsPerUnit = asset.Settings.PixelsPerUnit;
|
||||
atlas_importer.mipmapEnabled = asset.Settings.GenerateMipMaps;
|
||||
atlas_importer.filterMode = SwfAtlasFilterToImporterFilter(asset.Settings.AtlasTextureFilter);
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
atlas_importer.textureCompression = SwfAtlasFormatToImporterCompression(asset.Settings.AtlasTextureFormat);
|
||||
#else
|
||||
atlas_importer.textureFormat = SwfAtlasFormatToImporterFormat(asset.Settings.AtlasTextureFormat);
|
||||
#endif
|
||||
AssetDatabase.WriteImportSettingsIfDirty(atlas_path);
|
||||
}
|
||||
|
||||
@@ -248,24 +252,37 @@ namespace FTEditor.Postprocessors {
|
||||
}
|
||||
}
|
||||
|
||||
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
static TextureImporterCompression SwfAtlasFormatToImporterCompression(
|
||||
SwfSettingsData.AtlasFormat format)
|
||||
{
|
||||
switch ( format ) {
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
|
||||
return TextureImporterFormat.AutomaticCompressed;
|
||||
case SwfSettingsData.AtlasFormat.Automatic16bit:
|
||||
return TextureImporterFormat.Automatic16bit;
|
||||
return TextureImporterCompression.Compressed;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
|
||||
return TextureImporterFormat.AutomaticTruecolor;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCrunched:
|
||||
return TextureImporterFormat.AutomaticCrunched;
|
||||
return TextureImporterCompression.Uncompressed;
|
||||
default:
|
||||
throw new UnityException(string.Format(
|
||||
"incorrect swf atlas format ({0})",
|
||||
format));
|
||||
}
|
||||
}
|
||||
#else
|
||||
static TextureImporterFormat SwfAtlasFormatToImporterFormat(
|
||||
SwfSettingsData.AtlasFormat format)
|
||||
{
|
||||
switch ( format ) {
|
||||
case SwfSettingsData.AtlasFormat.AutomaticCompressed:
|
||||
return TextureImporterFormat.AutomaticCompressed;
|
||||
case SwfSettingsData.AtlasFormat.AutomaticTruecolor:
|
||||
return TextureImporterFormat.AutomaticTruecolor;
|
||||
default:
|
||||
throw new UnityException(string.Format(
|
||||
"incorrect swf atlas format ({0})",
|
||||
format));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
|
||||
@@ -11,10 +11,8 @@ namespace FTRuntime {
|
||||
}
|
||||
|
||||
public enum AtlasFormat {
|
||||
AutomaticCompressed,
|
||||
Automatic16bit,
|
||||
AutomaticTruecolor,
|
||||
AutomaticCrunched
|
||||
AutomaticCompressed = 0,
|
||||
AutomaticTruecolor = 2
|
||||
}
|
||||
|
||||
[SwfPowerOfTwoIfAttribute(5, 13, "AtlasPowerOfTwo")]
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
<DefineConstants>FT_VERSION_FULL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTEditor\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib">
|
||||
<HintPath>..\DLLs\mscorlib.dll</HintPath>
|
||||
@@ -66,6 +62,9 @@
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="FTEditor\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\Editor\FTEditor\Editors.meta">
|
||||
<Link>FTEditor\Editors.meta</Link>
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTRuntime\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -49,9 +48,6 @@
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAsset.cs.meta">
|
||||
<Link>FTRuntime\SwfAsset.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAttributes.cs.meta">
|
||||
<Link>FTRuntime\SwfAttributes.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfClip.cs.meta">
|
||||
<Link>FTRuntime\SwfClip.cs.meta</Link>
|
||||
</None>
|
||||
@@ -67,23 +63,35 @@
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfSettings.cs.meta">
|
||||
<Link>FTRuntime\SwfSettings.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields.meta">
|
||||
<Link>FTRuntime\Yields.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAssocList.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfAssocList.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAttributes.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfAttributes.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfList.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfList.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfUtils.cs.meta">
|
||||
<Link>FTRuntime\Internal\SwfUtils.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitPlayStopped.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitPlayStopped.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitRewindPlaying.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitRewindPlaying.cs.meta</Link>
|
||||
</None>
|
||||
<None Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopPlaying.cs.meta">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopPlaying.cs.meta</Link>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAsset.cs">
|
||||
<Link>FTRuntime\SwfAsset.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfAttributes.cs">
|
||||
<Link>FTRuntime\SwfAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\SwfClip.cs">
|
||||
<Link>FTRuntime\SwfClip.cs</Link>
|
||||
</Compile>
|
||||
@@ -102,11 +110,23 @@
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAssocList.cs">
|
||||
<Link>FTRuntime\Internal\SwfAssocList.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfAttributes.cs">
|
||||
<Link>FTRuntime\Internal\SwfAttributes.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfList.cs">
|
||||
<Link>FTRuntime\Internal\SwfList.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Internal\SwfUtils.cs">
|
||||
<Link>FTRuntime\Internal\SwfUtils.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitPlayStopped.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitPlayStopped.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitRewindPlaying.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitRewindPlaying.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\Assets\FlashTools\Scripts\FTRuntime\Yields\SwfWaitStopPlaying.cs">
|
||||
<Link>FTRuntime\Yields\SwfWaitStopPlaying.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Sources\" />
|
||||
<Folder Include="FTSwfTools\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -22,7 +22,7 @@ GraphicsSettings:
|
||||
- {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_PreloadedShaders: []
|
||||
m_ShaderSettings:
|
||||
useScreenSpaceShadows: 1
|
||||
useScreenSpaceShadows: 0
|
||||
m_BuildTargetShaderSettings: []
|
||||
m_LightmapStripping: 0
|
||||
m_FogStripping: 0
|
||||
|
||||
Reference in New Issue
Block a user