private bool ExportGameController(IIGameControl control, string property, List <BabylonAnimation> animations, IGameControlType type, BabylonAnimation.DataType dataType, Func <IIGameKey, float[]> extractValueFunc) { var keys = ExportBabylonKeysFromGameController(control, type, extractValueFunc); if (keys == null) { return(false); } var loopBehavior = BabylonAnimation.LoopBehavior.Cycle; return(ExportBabylonKeys(keys, property, animations, dataType, loopBehavior)); }
private List <BabylonAnimationKey> ExportBabylonKeysFromGameController(IIGameControl control, IGameControlType type, Func <IIGameKey, float[]> extractValueFunc) { if (control == null) { return(null); } ITab <IIGameKey> gameKeyTab = GlobalInterface.Instance.Tab.Create <IIGameKey>(); control.GetQuickSampledKeys(gameKeyTab, type); if (gameKeyTab == null) { return(null); } var keys = new List <BabylonAnimationKey>(); for (int indexKey = 0; indexKey < gameKeyTab.Count; indexKey++) { #if MAX2017 || MAX2018 || MAX2019 var gameKey = gameKeyTab[indexKey]; #else var gameKey = gameKeyTab[new IntPtr(indexKey)]; #endif var key = new BabylonAnimationKey() { frame = gameKey.T / Loader.Global.TicksPerFrame, values = extractValueFunc(gameKey) }; keys.Add(key); } return(keys); }
private List <BabylonAnimationKey> ExportBabylonKeysFromGameController(IIGameControl control, IGameControlType type, Func <IIGameKey, float[]> extractValueFunc) { if (control == null) { return(null); } ITab <IIGameKey> gameKeyTab = GlobalInterface.Instance.Tab.Create <IIGameKey>(); control.GetQuickSampledKeys(gameKeyTab, type); if (gameKeyTab == null) { return(null); } var keys = new List <BabylonAnimationKey>(); for (int indexKey = 0; indexKey < gameKeyTab.Count; indexKey++) { #if MAX2017 || MAX2018 var gameKey = gameKeyTab[indexKey]; #else var indexer = Marshal.AllocHGlobal(sizeof(int)); Marshal.WriteInt32(indexer, indexKey); var gameKey = gameKeyTab[indexer]; Marshal.FreeHGlobal(indexer); #endif var key = new BabylonAnimationKey() { frame = gameKey.T / Ticks, values = extractValueFunc(gameKey) }; keys.Add(key); } return(keys); }