mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-03-22 12:55:32 +07:00
tests for features
This commit is contained in:
9
Assets/FlashTools/Examples/Animations/Tests.meta
Normal file
9
Assets/FlashTools/Examples/Animations/Tests.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fab275383abb42759b0d204d3c0a1bd
|
||||
folderAsset: yes
|
||||
timeCreated: 1456856160
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Tests/0_keyframes.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Tests/0_keyframes.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6d16b21e25284375a23eb3459645da6
|
||||
timeCreated: 1456856160
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -1,15 +1,20 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace FlashTools {
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
|
||||
public class FlashAnim : MonoBehaviour {
|
||||
public FlashAnimAsset Asset = null;
|
||||
|
||||
int _current_frame = 0;
|
||||
float _frame_timer = 0.0f;
|
||||
float _current_z = 0.0f;
|
||||
int _current_frame = 0;
|
||||
int _current_symbol = -1;
|
||||
float _frame_timer = 0.0f;
|
||||
float _current_z = 0.0f;
|
||||
|
||||
List<Vector2> _uvs = new List<Vector2>();
|
||||
List<Vector3> _vertices = new List<Vector3>();
|
||||
@@ -27,6 +32,20 @@ namespace FlashTools {
|
||||
public void GoToFrame(int frame) {
|
||||
}
|
||||
|
||||
public int currentFrame {
|
||||
get { return _current_frame; }
|
||||
set {
|
||||
_current_frame = Mathf.Clamp(value, 0, frameCount - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public int currentSymbol {
|
||||
get { return _current_symbol; }
|
||||
set {
|
||||
_current_symbol = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int frameCount {
|
||||
get {
|
||||
int frames = 0;
|
||||
@@ -42,8 +61,11 @@ namespace FlashTools {
|
||||
}
|
||||
|
||||
FlashAnimSymbolData GetCurrentSymbol() {
|
||||
//return Asset.Data.Library.Symbols[0];
|
||||
return Asset.Data.Stage;
|
||||
if ( currentSymbol >= 0 && currentSymbol < Asset.Data.Library.Symbols.Count ) {
|
||||
return Asset.Data.Library.Symbols[currentSymbol];
|
||||
} else {
|
||||
return Asset.Data.Stage;
|
||||
}
|
||||
}
|
||||
|
||||
int GetNumFrameByNum(FlashAnimLayerData layer, int num) {
|
||||
@@ -120,14 +142,19 @@ namespace FlashTools {
|
||||
void RenderSymbol(FlashAnimSymbolData symbol, int frame_num, Matrix4x4 matix) {
|
||||
for ( var i = 0; i < symbol.Layers.Count; ++i ) {
|
||||
var layer = symbol.Layers[i];
|
||||
if ( layer.LayerType != FlashAnimLayerType.Mask ) {
|
||||
if ( layer.LayerType != FlashAnimLayerType.Guide &&
|
||||
layer.LayerType != FlashAnimLayerType.Mask &&
|
||||
layer.LayerType != FlashAnimLayerType.Folder )
|
||||
{
|
||||
var frame = GetFrameByNum(layer, frame_num);
|
||||
if ( frame != null ) {
|
||||
for ( var j = 0; j < frame.Elems.Count; ++j ) {
|
||||
var elem = frame.Elems[j];
|
||||
if ( elem.Instance != null ) {
|
||||
RenderInstance(
|
||||
elem.Instance, frame_num, matix * elem.Matrix);
|
||||
elem.Instance,
|
||||
elem.Instance.FirstFrame,
|
||||
matix * elem.Matrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,6 +162,12 @@ namespace FlashTools {
|
||||
}
|
||||
}
|
||||
|
||||
void MartDirtySelf() {
|
||||
#if UNITY_EDITOR
|
||||
EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
// Messages
|
||||
|
||||
@@ -19,6 +19,12 @@ namespace FlashTools {
|
||||
Erase
|
||||
}
|
||||
|
||||
public enum FlashAnimLoopingMode {
|
||||
Loop,
|
||||
PlayOnce,
|
||||
SingleFrame
|
||||
}
|
||||
|
||||
public enum FlashAnimLayerType {
|
||||
Normal,
|
||||
Guide,
|
||||
@@ -28,22 +34,11 @@ namespace FlashTools {
|
||||
Folder
|
||||
}
|
||||
|
||||
public enum FlashAnimLoopingType {
|
||||
Loop,
|
||||
PlayOnce,
|
||||
SingleFrame
|
||||
}
|
||||
|
||||
public enum FlashAnimInstType {
|
||||
Bitmap,
|
||||
Symbol
|
||||
}
|
||||
|
||||
public enum FlashAnimInstSymbolType {
|
||||
Graphic,
|
||||
MovieClip
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class FlashAnimBitmapData {
|
||||
public string Id = string.Empty;
|
||||
@@ -59,13 +54,12 @@ namespace FlashTools {
|
||||
|
||||
[System.Serializable]
|
||||
public class FlashAnimInstData {
|
||||
public FlashAnimInstType Type = FlashAnimInstType.Bitmap;
|
||||
public FlashAnimInstSymbolType SymbolType = FlashAnimInstSymbolType.Graphic;
|
||||
public FlashAnimBlendMode BlendMode = FlashAnimBlendMode.Normal;
|
||||
public string Asset = string.Empty;
|
||||
public bool Visible = true;
|
||||
public FlashAnimLoopingType LoopingType = FlashAnimLoopingType.SingleFrame;
|
||||
public int LoopingFirstFrame = 0;
|
||||
public FlashAnimInstType Type = FlashAnimInstType.Bitmap;
|
||||
public FlashAnimBlendMode BlendMode = FlashAnimBlendMode.Normal;
|
||||
public string Asset = string.Empty;
|
||||
public bool Visible = true;
|
||||
public int FirstFrame = 0;
|
||||
public FlashAnimLoopingMode LoopingMode = FlashAnimLoopingMode.SingleFrame;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
@@ -108,7 +102,7 @@ namespace FlashTools {
|
||||
}
|
||||
|
||||
public class FlashAnimAsset : ScriptableObject {
|
||||
//[HideInInspector]
|
||||
[HideInInspector]
|
||||
public FlashAnimData Data = new FlashAnimData();
|
||||
public Texture2D Atlas = null;
|
||||
public int MaxAtlasSize = 1024;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
namespace FlashTools.Internal {
|
||||
[CustomEditor(typeof(FlashAnim))]
|
||||
public class FlashAnimEditor : Editor {
|
||||
//FlashAnim _anim = null;
|
||||
FlashAnim _anim = null;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
@@ -13,11 +14,27 @@ namespace FlashTools.Internal {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
void OnEnable() {
|
||||
//_anim = target as FlashAnim;
|
||||
_anim = target as FlashAnim;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI() {
|
||||
DrawDefaultInspector();
|
||||
if ( _anim.Asset ) {
|
||||
var new_current_frame = EditorGUILayout.IntSlider(
|
||||
"Frame",
|
||||
_anim.currentFrame, 0, _anim.frameCount - 1);
|
||||
if ( new_current_frame != _anim.currentFrame ) {
|
||||
_anim.currentFrame = new_current_frame;
|
||||
}
|
||||
|
||||
var symbols = _anim.Asset.Data.Library.Symbols.Select(p => p.Id).ToArray();
|
||||
var new_current_symbol = EditorGUILayout.Popup(
|
||||
"Symbol",
|
||||
_anim.currentSymbol, symbols);
|
||||
if ( new_current_symbol != _anim.currentSymbol ) {
|
||||
_anim.currentSymbol = new_current_symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,18 +116,14 @@ namespace FlashTools.Internal {
|
||||
}
|
||||
|
||||
static void LoadFlashAnimInstFromFtaElemElem(XElement elem_elem, FlashAnimElemData data) {
|
||||
var inst_elem = elem_elem.Element("instance");
|
||||
var instance = new FlashAnimInstData();
|
||||
instance.Type = SafeLoadEnumFromElemAttr(inst_elem, "type" , instance.Type);
|
||||
instance.SymbolType = SafeLoadEnumFromElemAttr(inst_elem, "symbol_type", instance.SymbolType);
|
||||
instance.BlendMode = SafeLoadEnumFromElemAttr(inst_elem, "blend_mode" , instance.BlendMode);
|
||||
instance.Asset = SafeLoadStrFromElemAttr (inst_elem, "asset" , instance.Asset);
|
||||
instance.Visible = SafeLoadBoolFromElemAttr(inst_elem, "visible" , instance.Visible);
|
||||
var looping_elem = inst_elem.Element("looping");
|
||||
if ( looping_elem != null ) {
|
||||
instance.LoopingType = SafeLoadEnumFromElemAttr(looping_elem, "type" , instance.LoopingType);
|
||||
instance.LoopingFirstFrame = SafeLoadIntFromElemAttr (looping_elem, "first_frame", instance.LoopingFirstFrame);
|
||||
}
|
||||
var inst_elem = elem_elem.Element("instance");
|
||||
var instance = new FlashAnimInstData();
|
||||
instance.Type = SafeLoadEnumFromElemAttr(inst_elem, "type" , instance.Type);
|
||||
instance.BlendMode = SafeLoadEnumFromElemAttr(inst_elem, "blend_mode" , instance.BlendMode);
|
||||
instance.Asset = SafeLoadStrFromElemAttr (inst_elem, "asset" , instance.Asset);
|
||||
instance.Visible = SafeLoadBoolFromElemAttr(inst_elem, "visible" , instance.Visible);
|
||||
instance.FirstFrame = SafeLoadIntFromElemAttr (inst_elem, "first_frame" , instance.FirstFrame);
|
||||
instance.LoopingMode = SafeLoadEnumFromElemAttr(inst_elem, "looping_mode", instance.LoopingMode);
|
||||
data.Instance = instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
|
||||
var g_export_path = "";
|
||||
var g_library_path = "";
|
||||
var g_current_doc = null;
|
||||
fl.showIdleMessage(false);
|
||||
Main();
|
||||
|
||||
function Main()
|
||||
{
|
||||
var documents = fl.documents;
|
||||
if ( documents && documents.length )
|
||||
{
|
||||
fl.saveAll();
|
||||
fl.outputPanel.clear();
|
||||
|
||||
for ( var i = 0; i < documents.length; ++i )
|
||||
{
|
||||
g_current_doc = documents[i];
|
||||
ExportDocument();
|
||||
fl.closeDocument(g_current_doc, false);
|
||||
};
|
||||
|
||||
alert("-= Process Complete =-");
|
||||
}
|
||||
}
|
||||
|
||||
function ExportDocument()
|
||||
{
|
||||
var document_path = g_current_doc.path;
|
||||
var last_slash = document_path.lastIndexOf("/");
|
||||
var last_dot = document_path.lastIndexOf(".");
|
||||
|
||||
// g_export_path
|
||||
var export_folder = document_path.substr(0, last_slash) + "/../" + document_path.substr(last_slash, last_dot-last_slash) + "_export/";
|
||||
g_export_path = FLfile.platformPathToURI(export_folder);
|
||||
|
||||
// g_library_path
|
||||
var library_folder = document_path.substr(0, last_slash) + "/LIBRARY/";
|
||||
g_library_path = FLfile.platformPathToURI(library_folder);
|
||||
|
||||
// create export folder
|
||||
FLfile.remove(g_export_path);
|
||||
FLfile.createFolder(g_export_path);
|
||||
|
||||
// run
|
||||
ExportLibrary(g_export_path + "Library.xml");
|
||||
}
|
||||
|
||||
function PrintNormal( text )
|
||||
{
|
||||
fl.outputPanel.trace(text);
|
||||
}
|
||||
|
||||
function PrintWarning( text )
|
||||
{
|
||||
fl.outputPanel.trace("-= PROCESS WARNING =-\n -- " + text);
|
||||
}
|
||||
|
||||
function ToRad( deg )
|
||||
{
|
||||
return deg * Math.PI / 180;
|
||||
}
|
||||
|
||||
function ExitEditMode()
|
||||
{
|
||||
for ( var i = 0; i < 100; ++i )
|
||||
g_current_doc.exitEditMode();
|
||||
}
|
||||
|
||||
function ExportLibrary( file )
|
||||
{
|
||||
ExitEditMode();
|
||||
|
||||
var doc = g_current_doc;
|
||||
var library = doc.library;
|
||||
var temp_layer = doc.getTimeline().addNewLayer("bme_temp_export_layer");
|
||||
var file_str = "<Library>\n"
|
||||
|
||||
for ( var i = 0; i < library.items.length; ++i )
|
||||
{
|
||||
var item = library.items[i];
|
||||
|
||||
if ( item.itemType == "folder" )
|
||||
{
|
||||
// create folder
|
||||
var path = g_export_path + item.name;
|
||||
FLfile.createFolder(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( item.itemType == "bitmap" )
|
||||
{
|
||||
file_str +=
|
||||
"\t<Asset" +
|
||||
" name='" + item.name + "'" +
|
||||
" type='" + item.itemType + "'" +
|
||||
" filename='" + item.name + "'" +
|
||||
" smoothing='" + item.allowSmoothing + "'/>\n";
|
||||
|
||||
// copy bitmap to export
|
||||
FLfile.copy(g_library_path + item.name, g_export_path + item.name);
|
||||
}
|
||||
else if ( item.itemType == "movie clip" || item.itemType == "graphic" || item.itemType == "component" )
|
||||
{
|
||||
file_str +=
|
||||
"\t<Asset" +
|
||||
" name='" + item.name + "'" +
|
||||
" type='" + item.itemType + "'" +
|
||||
" filename='" + item.name + ".xml" + "'";
|
||||
|
||||
// create and get default component parameters
|
||||
|
||||
var is_parameters = false;
|
||||
if ( library.addItemToDocument({x:20, y:20}, item.name) &&
|
||||
doc.selection && doc.selection.length > 0 )
|
||||
{
|
||||
var sel = doc.selection[0];
|
||||
if ( sel.parameters && sel.parameters.length > 0 )
|
||||
{
|
||||
is_parameters = true;
|
||||
file_str += ">\n";
|
||||
file_str = ExportParameters(sel.parameters, file_str, "\t\t");
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_parameters )
|
||||
file_str += "\t</Asset>\n";
|
||||
else
|
||||
file_str += "/>\n";
|
||||
|
||||
// export item timeline
|
||||
|
||||
library.editItem(item.name);
|
||||
ExportTimeline(g_export_path + item.name + ".xml")
|
||||
ExitEditMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintWarning("Unsupported library type(" + item.itemType + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FLfile.write(file, file_str + "</Library>", "append");
|
||||
doc.getTimeline().deleteLayer();
|
||||
}
|
||||
|
||||
function ExportTimeline( file )
|
||||
{
|
||||
var doc_timeline = g_current_doc.getTimeline();
|
||||
|
||||
// [2:-] for disable dublicate single frame
|
||||
if ( doc_timeline.frameCount > 1 )
|
||||
{
|
||||
doc_timeline.selectAllFrames();
|
||||
doc_timeline.convertToKeyframes();
|
||||
}
|
||||
|
||||
var doc_frames = doc_timeline.frameCount;
|
||||
var doc_framerate = g_current_doc.frameRate;
|
||||
|
||||
var file_str = "<Timeline";
|
||||
file_str += " frames='" + doc_frames + "'";
|
||||
file_str += " speed='" + doc_framerate + "'";
|
||||
file_str += ">\n";
|
||||
|
||||
for ( var i = doc_timeline.layerCount-1; i >= 0; --i )
|
||||
{
|
||||
var doc_layer = doc_timeline.layers[i];
|
||||
if ( !doc_layer || !doc_layer.visible )
|
||||
continue;
|
||||
|
||||
file_str = ExportLayer(doc_layer, i, file_str, "\t")
|
||||
}
|
||||
|
||||
FLfile.write(file, file_str + "</Timeline>", "append" );
|
||||
}
|
||||
|
||||
function ExportLayer( layer, index, file_str, prefix )
|
||||
{
|
||||
file_str += prefix + "<Layer name='" + layer.name + "'>\n";
|
||||
|
||||
for ( var i = 0; i < layer.frameCount; ++i )
|
||||
{
|
||||
var frame = layer.frames[i];
|
||||
if ( !frame || i != frame.startFrame )
|
||||
continue;
|
||||
|
||||
file_str = ExportFrame(frame, i, file_str, prefix + "\t");
|
||||
}
|
||||
|
||||
return file_str + prefix + "</Layer>\n";
|
||||
}
|
||||
|
||||
function ExportFrame( frame, index, file_str, prefix )
|
||||
{
|
||||
file_str += prefix + "<Frame";
|
||||
file_str += " name='" + frame.name + "'";
|
||||
file_str += " index='" + index + "'";
|
||||
file_str += " duration='" + frame.duration + "'";
|
||||
file_str += ">\n";
|
||||
|
||||
for ( var i = 0; i < frame.elements.length; ++i )
|
||||
{
|
||||
var element = frame.elements[i];
|
||||
if ( element.instanceType == "symbol" || element.instanceType == "bitmap" )
|
||||
{
|
||||
file_str = ExportElement(element, i, file_str, prefix + "\t");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintWarning("Unsupported element type(" + element.instanceType + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return file_str + prefix + "</Frame>\n";
|
||||
}
|
||||
|
||||
function ExportElement( element, index, file_str, prefix )
|
||||
{
|
||||
file_str += prefix + "<Element";
|
||||
file_str += " name='" + element.name + "'";
|
||||
file_str += " type='" + element.libraryItem.itemType + "'";
|
||||
file_str += " asset='" + element.libraryItem.name + "'";
|
||||
|
||||
if ( element.libraryItem.linkageExportForAS )
|
||||
{
|
||||
file_str += " base_class='" + element.libraryItem.linkageBaseClass + "'";
|
||||
file_str += " class='" + element.libraryItem.linkageClassName + "'";
|
||||
}
|
||||
|
||||
if ( element.libraryItem.linkageExportForRS )
|
||||
{
|
||||
file_str += " url='" + element.libraryItem.linkageURL + "'";
|
||||
}
|
||||
|
||||
file_str += ">\n";
|
||||
|
||||
file_str = ExportInstance(element, file_str, prefix + "\t");
|
||||
|
||||
return file_str + prefix + "</Element>\n";
|
||||
}
|
||||
|
||||
function ExportInstance( instance, file_str, prefix )
|
||||
{
|
||||
// --------------------------------
|
||||
// parameters
|
||||
// --------------------------------
|
||||
|
||||
if ( instance.parameters && instance.parameters.length > 0 )
|
||||
{
|
||||
file_str = ExportParameters(instance.parameters, file_str, prefix);
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// transform
|
||||
// --------------------------------
|
||||
|
||||
file_str += prefix + "<Transform";
|
||||
|
||||
var position = "'" + instance.x + ";" + instance.y + "'";
|
||||
var scale = "'" + instance.scaleX + ";" + instance.scaleY + "'";
|
||||
|
||||
file_str += " position=" + position;
|
||||
file_str += " scale=" + scale;
|
||||
|
||||
if ( isNaN(instance.rotation) )
|
||||
{
|
||||
if ( Math.abs(Math.abs(instance.skewX) - Math.abs(instance.skewY)) > 0.01 )
|
||||
PrintWarning("Skew transformation unsupported! Element type(" + instance.libraryItem.name + ")");
|
||||
|
||||
var rotation = "'" + ToRad(instance.skewX) + "'";
|
||||
file_str += " rotation=" + rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
var rotation = "'" + ToRad(instance.rotation) + "'";
|
||||
file_str += " rotation=" + rotation;
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// color
|
||||
// --------------------------------
|
||||
|
||||
if ( instance.colorAlphaPercent )
|
||||
{
|
||||
var alpha = "'" + instance.colorAlphaPercent / 100 + "'";
|
||||
file_str += " alpha=" + alpha;
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// blend
|
||||
// --------------------------------
|
||||
|
||||
if ( instance.blendMode )
|
||||
{
|
||||
var blend = "'ALPHA'";
|
||||
if ( instance.blendMode == "normal" ) blend = "'ALPHA'";
|
||||
else if ( instance.blendMode == "add" ) blend = "'ADD'";
|
||||
else if ( instance.blendMode == "multiply" ) blend = "'MULTIPLY'";
|
||||
else PrintWarning("Unsupported blend mode(" + instance.blendMode + ")");
|
||||
|
||||
file_str += " blend=" + blend;
|
||||
}
|
||||
|
||||
return file_str + "/>\n";
|
||||
}
|
||||
|
||||
function ExportParameters( params, file_str, prefix )
|
||||
{
|
||||
file_str += prefix + "<Parameters count='" + params.length + "'>\n";
|
||||
|
||||
for ( var i = 0; i < params.length; ++i )
|
||||
{
|
||||
var param = params[i];
|
||||
|
||||
if ( param.valueType == "Number" || param.valueType == "Boolean" || param.valueType == "String" )
|
||||
{
|
||||
var name = "'" + param.name + "'";
|
||||
var value = "'" + param.value + "'";
|
||||
var type = "'" + param.valueType + "'";
|
||||
|
||||
if ( param.valueType == "Number" )
|
||||
value = value.replace(",", ".");
|
||||
|
||||
file_str += prefix + "\t<Parameter";
|
||||
file_str += " name=" + name;
|
||||
file_str += " value=" + value;
|
||||
file_str += " type=" + type;
|
||||
file_str += "/>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintWarning("Unsupported parameter type(" + param.valueType + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return file_str + prefix + "</Parameters>\n";
|
||||
}
|
||||
@@ -828,33 +828,21 @@ if (typeof Object.create != 'function') {
|
||||
|
||||
SymbolInst.prototype = Object.create(ElementInst.prototype);
|
||||
|
||||
SymbolInst.prototype.get_symbol_type = function () {
|
||||
var symbol_type = this.inst.symbolType;
|
||||
if ( symbol_type == "movie clip" ) {
|
||||
return "movieclip";
|
||||
} else if ( symbol_type == "graphic" ) {
|
||||
return "graphic";
|
||||
} else {
|
||||
throw "Unsupported symbol type ({0})!"
|
||||
.format(symbol_type);
|
||||
}
|
||||
};
|
||||
|
||||
SymbolInst.prototype.get_looping_type = function () {
|
||||
SymbolInst.prototype.get_looping_mode = function () {
|
||||
var looping_type = this.inst.loop !== undefined ? this.inst.loop : "single frame";
|
||||
if ( looping_type == "loop" ) {
|
||||
return "loop";
|
||||
} else if ( looping_type == "play once" ) {
|
||||
return "playonce";
|
||||
} else if ( looping_type == "single frame" ) {
|
||||
return "single frame";
|
||||
return "singleframe";
|
||||
} else {
|
||||
throw "Unsupported looping type ({0})!"
|
||||
.format(looping_type);
|
||||
}
|
||||
};
|
||||
|
||||
SymbolInst.prototype.get_looping_first_frame = function () {
|
||||
SymbolInst.prototype.get_first_frame = function () {
|
||||
return this.inst.firstFrame !== undefined ? this.inst.firstFrame : 0;
|
||||
};
|
||||
|
||||
@@ -862,14 +850,12 @@ if (typeof Object.create != 'function') {
|
||||
ft.type_assert(xml_node, XmlNode);
|
||||
var instance_node = ElementInst.prototype.export_description.call(this, xml_node)
|
||||
.child("instance")
|
||||
.attr("type" , "symbol")
|
||||
.attr("symbol_type", this.get_symbol_type())
|
||||
.attr("asset" , this.uniqueIds.get_string_id(this.inst.libraryItem.name))
|
||||
.attr("visible" , this.inst.visible)
|
||||
.attr("blend_mode" , this.inst.blendMode);
|
||||
instance_node.child("looping")
|
||||
.attr("type" , this.get_looping_type())
|
||||
.attr("first_frame", this.get_looping_first_frame());
|
||||
.attr("type" , "symbol")
|
||||
.attr("asset" , this.uniqueIds.get_string_id(this.inst.libraryItem.name))
|
||||
.attr("visible" , this.inst.visible)
|
||||
.attr("blend_mode" , this.inst.blendMode)
|
||||
.attr("first_frame" , this.get_first_frame())
|
||||
.attr("looping_mode", this.get_looping_mode());
|
||||
|
||||
/* \TODO export color mode
|
||||
if (this.inst.colorMode !== "none") {
|
||||
|
||||
Reference in New Issue
Block a user