Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds)

This commit is contained in:
2017-05-16 03:07:26 +07:00
parent 26e30e45f2
commit f9b9acd3b7
4 changed files with 32 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
* Fix optimizator bitmap trim problems * Fix optimizator bitmap trim problems
* Fix Unity 5.6 submesh sorting bug * Fix Unity 5.6 submesh sorting bug
* Add shape tween warning * Add shape tween warning
* Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds)
* Remove excess "if" instruction from shaders * Remove excess "if" instruction from shaders
###### Version 1.3.7 ###### Version 1.3.7

View File

@@ -190,6 +190,34 @@ namespace FTRuntime {
} }
} }
/// <summary>
/// Gets the current frame mesh bounding volume in local space
/// (Since 1.3.8)
/// </summary>
/// <value>The bounding volume in local space</value>
public Bounds currentLocalBounds {
get {
var frame = GetCurrentBakedFrame();
return frame != null
? frame.CachedMesh.bounds
: new Bounds();
}
}
/// <summary>
/// Gets the current frame mesh bounding volume in world space
/// (Since 1.3.8)
/// </summary>
/// <value>The bounding volume in world space</value>
public Bounds currentWorldBounds {
get {
Internal_UpdateMesh();
return _meshRenderer
? _meshRenderer.bounds
: new Bounds();
}
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// //
// Functions // Functions
@@ -255,7 +283,7 @@ namespace FTRuntime {
// //
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
internal void Internal_LateUpdate() { internal void Internal_UpdateMesh() {
if ( _meshFilter && _meshRenderer && _dirtyMesh ) { if ( _meshFilter && _meshRenderer && _dirtyMesh ) {
var baked_frame = GetCurrentBakedFrame(); var baked_frame = GetCurrentBakedFrame();
if ( baked_frame != null ) { if ( baked_frame != null ) {

View File

@@ -262,7 +262,7 @@ namespace FTRuntime {
for ( int i = 0, e = _clips.Count; i < e; ++i ) { for ( int i = 0, e = _clips.Count; i < e; ++i ) {
var clip = _clips[i]; var clip = _clips[i];
if ( clip ) { if ( clip ) {
clip.Internal_LateUpdate(); clip.Internal_UpdateMesh();
} }
} }
} }

View File

@@ -55,7 +55,7 @@ https://gist.github.com/talecrafter/111ea3345911bd238f4998b4d5a04bf3
**** DONE Ворнинг на shape-tween **** DONE Ворнинг на shape-tween
**** TODO Интеграция с автобилдами **** TODO Интеграция с автобилдами
**** DONE Избавиться от условия на _ExternalAlpha **** DONE Избавиться от условия на _ExternalAlpha
**** TODO Добавить возможность брать bounds у клипа **** DONE Добавить возможность брать bounds у клипа
**** TODO Не реимпортить на каждый чих анимацию, хранить хэш **** TODO Не реимпортить на каждый чих анимацию, хранить хэш
dipyalov: фишка в том, что swf обновился, но и собранные ассеты-то тоже обновились dipyalov: фишка в том, что swf обновился, но и собранные ассеты-то тоже обновились
**** DONE Элемент может быть залокан (element.locked) **** DONE Элемент может быть залокан (element.locked)