diff --git a/Assets/FlashTools/Docs/CHANGELOG.md b/Assets/FlashTools/Docs/CHANGELOG.md index 2f0f7e7..ff9be9b 100644 --- a/Assets/FlashTools/Docs/CHANGELOG.md +++ b/Assets/FlashTools/Docs/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix optimizator bitmap trim problems * Fix Unity 5.6 submesh sorting bug * Add shape tween warning +* Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds) * Remove excess "if" instruction from shaders ###### Version 1.3.7 diff --git a/Assets/FlashTools/Scripts/FTRuntime/SwfClip.cs b/Assets/FlashTools/Scripts/FTRuntime/SwfClip.cs index 8091c82..07d3d50 100644 --- a/Assets/FlashTools/Scripts/FTRuntime/SwfClip.cs +++ b/Assets/FlashTools/Scripts/FTRuntime/SwfClip.cs @@ -190,6 +190,34 @@ namespace FTRuntime { } } + /// + /// Gets the current frame mesh bounding volume in local space + /// (Since 1.3.8) + /// + /// The bounding volume in local space + public Bounds currentLocalBounds { + get { + var frame = GetCurrentBakedFrame(); + return frame != null + ? frame.CachedMesh.bounds + : new Bounds(); + } + } + + /// + /// Gets the current frame mesh bounding volume in world space + /// (Since 1.3.8) + /// + /// The bounding volume in world space + public Bounds currentWorldBounds { + get { + Internal_UpdateMesh(); + return _meshRenderer + ? _meshRenderer.bounds + : new Bounds(); + } + } + // --------------------------------------------------------------------- // // Functions @@ -255,7 +283,7 @@ namespace FTRuntime { // // --------------------------------------------------------------------- - internal void Internal_LateUpdate() { + internal void Internal_UpdateMesh() { if ( _meshFilter && _meshRenderer && _dirtyMesh ) { var baked_frame = GetCurrentBakedFrame(); if ( baked_frame != null ) { diff --git a/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs b/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs index e54f766..fabe133 100644 --- a/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs +++ b/Assets/FlashTools/Scripts/FTRuntime/SwfManager.cs @@ -262,7 +262,7 @@ namespace FTRuntime { for ( int i = 0, e = _clips.Count; i < e; ++i ) { var clip = _clips[i]; if ( clip ) { - clip.Internal_LateUpdate(); + clip.Internal_UpdateMesh(); } } } diff --git a/ProjectStuff/FlashTools.org b/ProjectStuff/FlashTools.org index 1c97d23..2f72f90 100644 --- a/ProjectStuff/FlashTools.org +++ b/ProjectStuff/FlashTools.org @@ -55,7 +55,7 @@ https://gist.github.com/talecrafter/111ea3345911bd238f4998b4d5a04bf3 **** DONE Ворнинг на shape-tween **** TODO Интеграция с автобилдами **** DONE Избавиться от условия на _ExternalAlpha -**** TODO Добавить возможность брать bounds у клипа +**** DONE Добавить возможность брать bounds у клипа **** TODO Не реимпортить на каждый чих анимацию, хранить хэш dipyalov: фишка в том, что swf обновился, но и собранные ассеты-то тоже обновились **** DONE Элемент может быть залокан (element.locked)