mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 22:19:31 +07:00
access to frame labels
This commit is contained in:
@@ -436,6 +436,7 @@ namespace FTEditor.Postprocessors {
|
||||
MulColors = baked_mulcolors.ToArray()};
|
||||
|
||||
return new SwfClipAsset.Frame(
|
||||
frame.Labels.ToArray(),
|
||||
mesh_data,
|
||||
baked_materials.ToArray());
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Gets the current animation sequence frame count
|
||||
/// </summary>
|
||||
/// <value>The frame count.</value>
|
||||
/// <value>The frame count</value>
|
||||
public int frameCount {
|
||||
get {
|
||||
return _curSequence != null && _curSequence.Frames != null
|
||||
@@ -137,7 +137,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Gets the animation frame rate
|
||||
/// </summary>
|
||||
/// <value>The frame rate.</value>
|
||||
/// <value>The frame rate</value>
|
||||
public float frameRate {
|
||||
get {
|
||||
return clip
|
||||
@@ -146,6 +146,18 @@ namespace FTRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current frame label count
|
||||
/// </summary>
|
||||
/// <value>The frame label count</value>
|
||||
public int currentLabelCount {
|
||||
get {
|
||||
var baked_frame = GetCurrentBakedFrame();
|
||||
var frame_labels = baked_frame != null ? baked_frame.Labels : null;
|
||||
return frame_labels != null ? frame_labels.Length : 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Functions
|
||||
@@ -171,7 +183,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Rewind current sequence to previous frame
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if animation was rewound, <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c>, if animation was rewound, <c>false</c> otherwise</returns>
|
||||
public bool ToPrevFrame() {
|
||||
if ( currentFrame > 0 ) {
|
||||
--currentFrame;
|
||||
@@ -183,7 +195,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Rewind current sequence to next frame
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if animation was rewound, <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c>, if animation was rewound, <c>false</c> otherwise</returns>
|
||||
public bool ToNextFrame() {
|
||||
if ( currentFrame < frameCount - 1 ) {
|
||||
++currentFrame;
|
||||
@@ -192,6 +204,19 @@ namespace FTRuntime {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current frame label by index
|
||||
/// </summary>
|
||||
/// <returns>The current frame label</returns>
|
||||
/// <param name="index">Current frame label index</param>
|
||||
public string GetCurrentFrameLabel(int index) {
|
||||
var baked_frame = GetCurrentBakedFrame();
|
||||
var frame_labels = baked_frame != null ? baked_frame.Labels : null;
|
||||
return frame_labels != null && index >= 0 && index < frame_labels.Length
|
||||
? frame_labels[index]
|
||||
: string.Empty;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Internal
|
||||
|
||||
@@ -21,15 +21,18 @@ namespace FTRuntime {
|
||||
|
||||
[System.Serializable]
|
||||
public class Frame {
|
||||
public string[] Labels = new string[0];
|
||||
public MeshData MeshData = new MeshData();
|
||||
public Material[] Materials = new Material[0];
|
||||
|
||||
public Frame() {
|
||||
Labels = new string[0];
|
||||
MeshData = new MeshData();
|
||||
Materials = new Material[0];
|
||||
}
|
||||
|
||||
public Frame(MeshData mesh_data, Material[] materials) {
|
||||
public Frame(string[] labels, MeshData mesh_data, Material[] materials) {
|
||||
Labels = labels;
|
||||
MeshData = mesh_data;
|
||||
Materials = materials;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Get or set a value indicating whether animation updates is paused
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if is paused; otherwise, <c>false</c>.</value>
|
||||
/// <value><c>true</c> if is paused; otherwise, <c>false</c></value>
|
||||
public bool isPaused {
|
||||
get { return _isPaused; }
|
||||
set { _isPaused = value; }
|
||||
@@ -72,7 +72,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Get or set a value indicating whether animation updates is playing
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if is playing; otherwise, <c>false</c>.</value>
|
||||
/// <value><c>true</c> if is playing; otherwise, <c>false</c></value>
|
||||
public bool isPlaying {
|
||||
get { return !_isPaused; }
|
||||
set { _isPaused = !value; }
|
||||
@@ -130,7 +130,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Determines whether group of animations is paused
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if group is paused; otherwise, <c>false</c>.</returns>
|
||||
/// <returns><c>true</c> if group is paused; otherwise, <c>false</c></returns>
|
||||
/// <param name="group_name">Group name</param>
|
||||
public bool IsGroupPaused(string group_name) {
|
||||
return _groupPauses.Contains(group_name);
|
||||
@@ -140,7 +140,7 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Determines whether group of animations is playing
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if group is playing; otherwise, <c>false</c>.</returns>
|
||||
/// <returns><c>true</c> if group is playing; otherwise, <c>false</c></returns>
|
||||
/// <param name="group_name">Group name</param>
|
||||
public bool IsGroupPlaying(string group_name) {
|
||||
return !IsGroupPaused(group_name);
|
||||
@@ -160,8 +160,8 @@ namespace FTRuntime {
|
||||
/// <summary>
|
||||
/// Get the group of animations rate scale
|
||||
/// </summary>
|
||||
/// <returns>The group rate scale.</returns>
|
||||
/// <param name="group_name">Group name.</param>
|
||||
/// <returns>The group rate scale</returns>
|
||||
/// <param name="group_name">Group name</param>
|
||||
public float GetGroupRateScale(string group_name) {
|
||||
float rate_scale;
|
||||
return _groupRateScales.TryGetValue(group_name, out rate_scale)
|
||||
|
||||
Reference in New Issue
Block a user