static int GetSlotTimeline(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); DragonBones.AnimationData obj = (DragonBones.AnimationData)ToLua.CheckObject(L, 1, typeof(DragonBones.AnimationData)); string arg0 = ToLua.CheckString(L, 2); DragonBones.SlotTimelineData o = obj.GetSlotTimeline(arg0); ToLua.PushObject(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** * @private */ internal void _updateTimelineStates() { var time = _time; if (!_animationData.hasAsynchronyTimeline) { time = _timeline._currentTime; } var boneTimelineStates = new Dictionary <string, BoneTimelineState>(); var slotTimelineStates = new Dictionary <string, SlotTimelineState>(); foreach (var boneTimelineState in _boneTimelines) // Creat bone timelines map. { boneTimelineStates.Add(boneTimelineState.bone.name, boneTimelineState); } foreach (var bone in _armature.GetBones()) { var boneTimelineName = bone.name; var boneTimelineData = _animationData.GetBoneTimeline(boneTimelineName); if (boneTimelineData != null && ContainsBoneMask(boneTimelineName)) { var boneTimelineState = boneTimelineStates.ContainsKey(boneTimelineName) ? boneTimelineStates[boneTimelineName] : null; if (boneTimelineState != null) // Remove bone timeline from map. { boneTimelineStates.Remove(boneTimelineName); } else // Create new bone timeline. { boneTimelineState = BaseObject.BorrowObject <BoneTimelineState>(); boneTimelineState.bone = bone; boneTimelineState.FadeIn(_armature, this, boneTimelineData, time); _boneTimelines.Add(boneTimelineState); } } } foreach (var boneTimelineState in boneTimelineStates.Values) // Remove bone timelines. { boneTimelineState.bone.InvalidUpdate(); // _boneTimelines.Remove(boneTimelineState); boneTimelineState.ReturnToPool(); } foreach (var slotTimelineState in _slotTimelines) // Create slot timelines map. { slotTimelineStates[slotTimelineState.slot.name] = slotTimelineState; } foreach (var slot in _armature.GetSlots()) { var slotTimelineName = slot.name; var parentTimelineName = slot.parent.name; var slotTimelineData = _animationData.GetSlotTimeline(slotTimelineName); if (slotTimelineData != null && ContainsBoneMask(parentTimelineName) && _fadeState <= 0) { var slotTimelineState = slotTimelineStates.ContainsKey(slotTimelineName) ? slotTimelineStates[slotTimelineName] : null; if (slotTimelineState != null) // Remove slot timeline from map. { slotTimelineStates.Remove(slotTimelineName); } else // Create new slot timeline. { slotTimelineState = BaseObject.BorrowObject <SlotTimelineState>(); slotTimelineState.slot = slot; slotTimelineState.FadeIn(_armature, this, slotTimelineData, time); _slotTimelines.Add(slotTimelineState); } } } foreach (var slotTimelineState in slotTimelineStates.Values) // Remove slot timelines. { _slotTimelines.Remove(slotTimelineState); slotTimelineState.ReturnToPool(); } _updateFFDTimelineStates(); }
/** * @private */ internal void _updateTimelineStates() { var boneTimelineStates = new Dictionary <string, BoneTimelineState>(); var slotTimelineStates = new Dictionary <string, SlotTimelineState>(); var ffdTimelineStates = new Dictionary <string, FFDTimelineState>(); for (int i = 0, l = _boneTimelines.Count; i < l; ++i) // Creat bone timelines map. { var boneTimelineState = _boneTimelines[i]; boneTimelineStates[boneTimelineState.bone.name] = boneTimelineState; } var bones = _armature.GetBones(); for (int i = 0, l = bones.Count; i < l; ++i) { var bone = bones[i]; var boneTimelineName = bone.name; if (ContainsBoneMask(boneTimelineName)) { var boneTimelineData = _animationData.GetBoneTimeline(boneTimelineName); if (boneTimelineData != null) { if (boneTimelineStates.ContainsKey(boneTimelineName)) // Remove bone timeline from map. { boneTimelineStates.Remove(boneTimelineName); } else // Create new bone timeline. { var boneTimelineState = BaseObject.BorrowObject <BoneTimelineState>(); boneTimelineState.bone = bone; boneTimelineState._init(_armature, this, boneTimelineData); _boneTimelines.Add(boneTimelineState); } } } } foreach (var boneTimelineState in boneTimelineStates.Values) // Remove bone timelines. { boneTimelineState.bone.InvalidUpdate(); // _boneTimelines.Remove(boneTimelineState); boneTimelineState.ReturnToPool(); } for (int i = 0, l = _slotTimelines.Count; i < l; ++i) // Creat slot timelines map. { var slotTimelineState = _slotTimelines[i]; slotTimelineStates[slotTimelineState.slot.name] = slotTimelineState; } for (int i = 0, l = _ffdTimelines.Count; i < l; ++i) // Creat ffd timelines map. { var ffdTimelineState = _ffdTimelines[i]; var display = ffdTimelineState._timelineData.display; var meshName = display.inheritAnimation ? display.mesh.name : display.name; ffdTimelineStates[meshName] = ffdTimelineState; } var slots = _armature.GetSlots(); for (int i = 0, l = slots.Count; i < l; ++i) { var slot = slots[i]; var slotTimelineName = slot.name; var parentTimelineName = slot.parent.name; var resetFFDVertices = false; if (ContainsBoneMask(parentTimelineName)) { var slotTimelineData = _animationData.GetSlotTimeline(slotTimelineName); if (slotTimelineData != null) { if (slotTimelineStates.ContainsKey(slotTimelineName)) // Remove slot timeline from map. { slotTimelineStates.Remove(slotTimelineName); } else // Create new slot timeline. { var slotTimelineState = BaseObject.BorrowObject <SlotTimelineState>(); slotTimelineState.slot = slot; slotTimelineState._init(_armature, this, slotTimelineData); _slotTimelines.Add(slotTimelineState); } } var ffdTimelineDatas = _animationData.GetFFDTimeline(_armature._skinData.name, slotTimelineName); if (ffdTimelineDatas != null) { foreach (var pair in ffdTimelineDatas) { if (ffdTimelineStates.ContainsKey(pair.Key)) // Remove ffd timeline from map. { ffdTimelineStates.Remove(pair.Key); } else // Create new ffd timeline. { var ffdTimelineState = BaseObject.BorrowObject <FFDTimelineState>(); ffdTimelineState.slot = slot; ffdTimelineState._init(_armature, this, pair.Value); _ffdTimelines.Add(ffdTimelineState); } } } else { resetFFDVertices = true; } } else { resetFFDVertices = true; } if (resetFFDVertices) { for (int iA = 0, lA = slot._ffdVertices.Count; iA < lA; ++iA) { slot._ffdVertices[iA] = 0.0f; } slot._meshDirty = true; } } foreach (var slotTimelineState in slotTimelineStates.Values) // Remove slot timelines. { _slotTimelines.Remove(slotTimelineState); slotTimelineState.ReturnToPool(); } foreach (var ffdTimelineState in ffdTimelineStates.Values)// Remove ffd timelines. { _ffdTimelines.Remove(ffdTimelineState); ffdTimelineState.ReturnToPool(); } }