Animation.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. using System.Text;
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Animation
  10. * @{
  11. */
  12. /// <summary>
  13. /// Determines how an animation clip behaves when it reaches the end.
  14. /// </summary>
  15. public enum AnimWrapMode // Note: Must match C++ enum AnimWrapMode
  16. {
  17. /// <summary>
  18. /// Loop around to the beginning/end when the last/first frame is reached.
  19. /// </summary>
  20. Loop,
  21. /// <summary>
  22. /// Clamp to end/beginning, keeping the last/first frame active.
  23. /// </summary>
  24. Clamp
  25. }
  26. /// <summary>
  27. /// Represents an animation clip used in 1D blending. Each clip has a position on the number line.
  28. /// </summary>
  29. public class BlendClipInfo
  30. {
  31. public AnimationClip clip;
  32. public float position;
  33. }
  34. /// <summary>
  35. /// Defines a 1D blend where two animation clips are blended between each other using linear interpolation.
  36. /// </summary>
  37. public class Blend1DInfo
  38. {
  39. public BlendClipInfo[] clips;
  40. }
  41. /// <summary>
  42. /// Defines a 2D blend where two animation clips are blended between each other using bilinear interpolation.
  43. /// </summary>
  44. public class Blend2DInfo
  45. {
  46. public AnimationClip topLeftClip;
  47. public AnimationClip topRightClip;
  48. public AnimationClip botLeftClip;
  49. public AnimationClip botRightClip;
  50. }
  51. /// <summary>
  52. /// Contains information about a currently playing animation clip.
  53. /// </summary>
  54. [StructLayout(LayoutKind.Sequential), SerializeObject]
  55. public struct AnimationClipState // Note: Must match C++ struct AnimationClipState
  56. {
  57. /// <summary>
  58. /// Layer the clip is playing on. Multiple clips can be played simulatenously on different layers.
  59. /// </summary>
  60. public int layer;
  61. /// <summary>
  62. /// Current time the animation is playing from.
  63. /// </summary>
  64. public float time;
  65. /// <summary>
  66. /// Speed at which the animation is playing.
  67. /// </summary>
  68. public float speed;
  69. /// <summary>
  70. /// Determines how much of an influence does the clip have on the final pose.
  71. /// </summary>
  72. public float weight;
  73. /// <summary>
  74. /// Determines what happens to other animation clips when a new clip starts playing.
  75. /// </summary>
  76. public AnimWrapMode wrapMode;
  77. /// <summary>
  78. /// Initializes the state with default values.
  79. /// </summary>
  80. public void InitDefault()
  81. {
  82. speed = 1.0f;
  83. weight = 1.0f;
  84. wrapMode = AnimWrapMode.Loop;
  85. }
  86. }
  87. /// <summary>
  88. /// Handles animation playback. Takes one or multiple animation clips as input and evaluates them every animation update
  89. /// tick depending on set properties.The evaluated data is used by the core thread for skeletal animation, by the sim
  90. /// thread for updating attached scene objects and bones (if skeleton is attached), or the data is made available for
  91. /// manual queries in the case of generic animation.
  92. /// </summary>
  93. public class Animation : Component
  94. {
  95. private NativeAnimation _native;
  96. [SerializeField] private SerializableData serializableData = new SerializableData();
  97. private FloatCurvePropertyInfo[] floatProperties;
  98. /// <summary>
  99. /// Contains mapping for a suffix used by property paths used for curve identifiers, to their index and type.
  100. /// </summary>
  101. internal static readonly Dictionary<string, PropertySuffixInfo> PropertySuffixInfos = new Dictionary
  102. <string, PropertySuffixInfo>
  103. {
  104. {".x", new PropertySuffixInfo(0, true)},
  105. {".y", new PropertySuffixInfo(1, true)},
  106. {".z", new PropertySuffixInfo(2, true)},
  107. {".w", new PropertySuffixInfo(3, true)},
  108. {".r", new PropertySuffixInfo(0, false)},
  109. {".g", new PropertySuffixInfo(1, false)},
  110. {".b", new PropertySuffixInfo(2, false)},
  111. {".a", new PropertySuffixInfo(3, false)}
  112. };
  113. /// <summary>
  114. /// Returns the non-component version of Animation that is wrapped by this component.
  115. /// </summary>
  116. internal NativeAnimation Native
  117. {
  118. get { return _native; }
  119. }
  120. /// <summary>
  121. /// Determines the default clip to play as soon as the component is enabled. If more control over playing clips is
  122. /// needed use the <see cref="Play"/>, <see cref="Blend1D"/>, <see cref="Blend2D"/> and <see cref="CrossFade"/>
  123. /// methods to queue clips for playback manually, and <see cref="SetState"/> method for modify their states
  124. /// individually.
  125. /// </summary>
  126. public AnimationClip DefaultClip
  127. {
  128. get { return serializableData.defaultClip; }
  129. set
  130. {
  131. serializableData.defaultClip = value;
  132. if (value != null && _native != null)
  133. {
  134. RebuildFloatProperties(value);
  135. _native.Play(value);
  136. }
  137. }
  138. }
  139. /// <summary>
  140. /// Determines the wrap mode for all active animations. Wrap mode determines what happens when animation reaches the
  141. /// first or last frame.
  142. /// <see cref="AnimWrapMode"/>
  143. /// </summary>
  144. public AnimWrapMode WrapMode
  145. {
  146. get { return serializableData.wrapMode; }
  147. set
  148. {
  149. serializableData.wrapMode = value;
  150. if (_native != null)
  151. _native.WrapMode = value;
  152. }
  153. }
  154. /// <summary>
  155. /// Determines the speed for all animations. The default value is 1.0f. Use negative values to play-back in reverse.
  156. /// </summary>
  157. public float Speed
  158. {
  159. get { return serializableData.speed; }
  160. set
  161. {
  162. serializableData.speed = value;
  163. if (_native != null)
  164. _native.Speed = value;
  165. }
  166. }
  167. /// <summary>
  168. /// Checks if any animation clips are currently playing.
  169. /// </summary>
  170. public bool IsPlaying
  171. {
  172. get
  173. {
  174. if (_native != null)
  175. return _native.IsPlaying();
  176. return false;
  177. }
  178. }
  179. /// <summary>
  180. /// Plays the specified animation clip.
  181. /// </summary>
  182. /// <param name="clip">Clip to play.</param>
  183. public void Play(AnimationClip clip)
  184. {
  185. if (_native != null)
  186. {
  187. RebuildFloatProperties(clip);
  188. _native.Play(clip);
  189. }
  190. }
  191. /// <summary>
  192. /// Plays the specified animation clip on top of the animation currently playing in the main layer. Multiple such
  193. /// clips can be playing at once, as long as you ensure each is given its own layer. Each animation can also have a
  194. /// weight that determines how much it influences the main animation.
  195. /// </summary>
  196. /// <param name="clip">Clip to additively blend. Must contain additive animation curves.</param>
  197. /// <param name="weight">Determines how much of an effect will the blended animation have on the final output.
  198. /// In range [0, 1].</param>
  199. /// <param name="fadeLength">Applies the blend over a specified time period, increasing the weight as the time
  200. /// passes. Set to zero to blend immediately. In seconds.</param>
  201. /// <param name="layer">Layer to play the clip in. Multiple additive clips can be playing at once in separate layers
  202. /// and each layer has its own weight.</param>
  203. public void BlendAdditive(AnimationClip clip, float weight, float fadeLength, int layer)
  204. {
  205. if (_native != null)
  206. _native.BlendAdditive(clip, weight, fadeLength, layer);
  207. }
  208. /// <summary>
  209. /// Blends multiple animation clips between each other using linear interpolation. Unlike normal animations these
  210. /// animations are not advanced with the progress of time, and is instead expected the user manually changes the
  211. /// <see cref="t"/> parameter.
  212. /// </summary>
  213. /// <param name="info">Information about the clips to blend. Clip positions must be sorted from lowest to highest.
  214. /// </param>
  215. /// <param name="t">Parameter that controls the blending, in range [0, 1]. t = 0 means left animation has full
  216. /// influence, t = 1 means right animation has full influence.</param>
  217. public void Blend1D(Blend1DInfo info, float t)
  218. {
  219. if (_native != null)
  220. _native.Blend1D(info, t);
  221. }
  222. /// <summary>
  223. /// Blend four animation clips between each other using bilinear interpolation. Unlike normal animations these
  224. /// animations are not advanced with the progress of time, and is instead expected the user manually changes the
  225. /// <see cref="t"/> parameter.
  226. /// </summary>
  227. /// <param name="info">Information about the clips to blend.</param>
  228. /// <param name="t">Parameter that controls the blending, in range [(0, 0), (1, 1)]. t = (0, 0) means top left
  229. /// animation has full influence, t = (0, 1) means top right animation has full influence,
  230. /// t = (1, 0) means bottom left animation has full influence, t = (1, 1) means bottom right
  231. /// animation has full influence.
  232. /// </param>
  233. public void Blend2D(Blend2DInfo info, Vector2 t)
  234. {
  235. if (_native != null)
  236. _native.Blend2D(info, t);
  237. }
  238. /// <summary>
  239. /// Fades the specified animation clip in, while fading other playing animation out, over the specified time period.
  240. /// </summary>
  241. /// <param name="clip">Clip to fade in.</param>
  242. /// <param name="fadeLength">Determines the time period over which the fade occurs. In seconds.</param>
  243. public void CrossFade(AnimationClip clip, float fadeLength)
  244. {
  245. if (_native != null)
  246. _native.CrossFade(clip, fadeLength);
  247. }
  248. /// <summary>
  249. /// Stops playing all animations on the provided layer.
  250. /// </summary>
  251. /// <param name="layer">Layer on which to stop animations on.</param>
  252. public void Stop(int layer)
  253. {
  254. if (_native != null)
  255. _native.Stop(layer);
  256. }
  257. /// <summary>
  258. /// Stops playing all animations.
  259. /// </summary>
  260. public void StopAll()
  261. {
  262. if (_native != null)
  263. _native.StopAll();
  264. }
  265. /// <summary>
  266. /// Retrieves detailed information about a currently playing animation clip.
  267. /// </summary>
  268. /// <param name="clip">Clip to retrieve the information for.</param>
  269. /// <param name="state">Animation clip state containing the requested information. Only valid if the method returns
  270. /// true.</param>
  271. /// <returns>True if the state was found (animation clip is playing), false otherwise.</returns>
  272. public bool GetState(AnimationClip clip, out AnimationClipState state)
  273. {
  274. if (_native != null)
  275. return _native.GetState(clip, out state);
  276. state = new AnimationClipState();
  277. return false;
  278. }
  279. /// <summary>
  280. /// Searches the scene object hierarchy to find a property at the given path.
  281. /// </summary>
  282. /// <param name="root">Root scene object to which the path is relative to.</param>
  283. /// <param name="path">Path to the property, where each element of the path is separated with "/".
  284. ///
  285. /// Path elements prefixed with "!" signify names of child scene objects (first one relative to
  286. /// <paramref name="root"/>. Name of the root element should not be included in the path.
  287. ///
  288. /// Path element prefixed with ":" signify names of components. If a path doesn't have a
  289. /// component element, it is assumed the field is relative to the scene object itself (only
  290. /// "Translation", "Rotation" and "Scale fields are supported in such case). Only one component
  291. /// path element per path is allowed.
  292. ///
  293. /// Path entries with no prefix are considered regular script object fields. Each path must have
  294. /// at least one such entry. Last field entry can optionally have a suffix separated from the
  295. /// path name with ".". This suffix is not parsed internally, but will be returned as
  296. /// <paramref name="suffix"/>.
  297. ///
  298. /// Path examples:
  299. /// :MyComponent/myInt (path to myInt variable on a component attached to this object)
  300. /// !childSO/:MyComponent/myInt (path to myInt variable on a child scene object)
  301. /// !childSO/Translation (path to the scene object translation)
  302. /// :MyComponent/myVector.z (path to the z component of myVector on this object)
  303. /// </param>
  304. /// <param name="suffix">Suffix of the last field entry, if it has any. Contains the suffix separator ".".</param>
  305. /// <returns>If found, property object you can use for setting and getting the value from the property, otherwise
  306. /// null.</returns>
  307. internal static SerializableProperty FindProperty(SceneObject root, string path, out string suffix)
  308. {
  309. suffix = null;
  310. if (string.IsNullOrEmpty(path) || root == null)
  311. return null;
  312. string trimmedPath = path.Trim('/');
  313. string[] entries = trimmedPath.Split('/');
  314. // Find scene object referenced by the path
  315. SceneObject so = root;
  316. int pathIdx = 0;
  317. for (; pathIdx < entries.Length; pathIdx++)
  318. {
  319. string entry = entries[pathIdx];
  320. if (string.IsNullOrEmpty(entry))
  321. continue;
  322. // Not a scene object, break
  323. if (entry[0] != '!')
  324. break;
  325. string childName = entry.Substring(1, entry.Length - 1);
  326. so = so.FindChild(childName);
  327. if (so == null)
  328. break;
  329. }
  330. // Child scene object couldn't be found
  331. if (so == null)
  332. return null;
  333. // Path too short, no field entry
  334. if (pathIdx >= entries.Length)
  335. return null;
  336. // Check if path is referencing a component, and if so find it
  337. Component component = null;
  338. {
  339. string entry = entries[pathIdx];
  340. if (entry[0] == ':')
  341. {
  342. string componentName = entry.Substring(1, entry.Length - 1);
  343. Component[] components = so.GetComponents();
  344. component = Array.Find(components, x => x.GetType().Name == componentName);
  345. // Cannot find component with specified type
  346. if (component == null)
  347. return null;
  348. }
  349. }
  350. // Look for a field within a component
  351. if (component != null)
  352. {
  353. pathIdx++;
  354. if (pathIdx >= entries.Length)
  355. return null;
  356. SerializableObject componentObj = new SerializableObject(component);
  357. StringBuilder pathBuilder = new StringBuilder();
  358. for (; pathIdx < entries.Length - 1; pathIdx++)
  359. pathBuilder.Append(entries[pathIdx] + "/");
  360. // Check last path entry for suffix and remove it
  361. int suffixIdx = entries[pathIdx].LastIndexOf(".");
  362. if (suffixIdx != -1)
  363. {
  364. string entryNoSuffix = entries[pathIdx].Substring(0, suffixIdx);
  365. suffix = entries[pathIdx].Substring(suffixIdx, entries[pathIdx].Length - suffixIdx);
  366. pathBuilder.Append(entryNoSuffix);
  367. }
  368. else
  369. pathBuilder.Append(entries[pathIdx]);
  370. return componentObj.FindProperty(pathBuilder.ToString());
  371. }
  372. else // Field is one of the builtin ones on the SceneObject itself
  373. {
  374. if ((pathIdx + 1) < entries.Length)
  375. return null;
  376. string entry = entries[pathIdx];
  377. if (entry == "Position")
  378. {
  379. SerializableProperty property = new SerializableProperty(
  380. SerializableProperty.FieldType.Vector3,
  381. typeof(Vector3),
  382. () => so.LocalPosition,
  383. (x) => so.LocalPosition = (Vector3) x);
  384. return property;
  385. }
  386. else if (entry == "Rotation")
  387. {
  388. SerializableProperty property = new SerializableProperty(
  389. SerializableProperty.FieldType.Vector3,
  390. typeof(Vector3),
  391. () => so.LocalRotation.ToEuler(),
  392. (x) => so.LocalRotation = Quaternion.FromEuler((Vector3) x));
  393. return property;
  394. }
  395. else if (entry == "Scale")
  396. {
  397. SerializableProperty property = new SerializableProperty(
  398. SerializableProperty.FieldType.Vector3,
  399. typeof(Vector3),
  400. () => so.LocalScale,
  401. (x) => so.LocalScale = (Vector3) x);
  402. return property;
  403. }
  404. return null;
  405. }
  406. }
  407. /// <summary>
  408. /// Changes the state of a playing animation clip. If animation clip is not currently playing the state change is
  409. /// ignored.
  410. /// </summary>
  411. /// <param name="clip">Clip to change the state for.</param>
  412. /// <param name="state">New state of the animation (e.g. changing the time for seeking).</param>
  413. public void SetState(AnimationClip clip, AnimationClipState state)
  414. {
  415. if (_native != null)
  416. _native.SetState(clip, state);
  417. }
  418. private void OnUpdate()
  419. {
  420. // TODO: There could currently be a mismatch between the serialized properties and the active animation clip
  421. // - Add PrimaryClip field to NativeAnimation, then compare to the active clip and update if needed
  422. // TODO: If primary animation clip isn't playing, don't update float properties
  423. // - Add dirty flags to each curve value and don't update unless they changed
  424. // Apply values from generic float curves
  425. foreach (var entry in floatProperties)
  426. {
  427. float curveValue;
  428. if (_native.GetGenericCurveValue(entry.curveIdx, out curveValue))
  429. entry.setter(curveValue);
  430. }
  431. }
  432. private void OnEnable()
  433. {
  434. RestoreNative();
  435. }
  436. private void OnDisable()
  437. {
  438. DestroyNative();
  439. }
  440. private void OnDestroy()
  441. {
  442. DestroyNative();
  443. }
  444. /// <summary>
  445. /// Creates the internal representation of the animation and restores the values saved by the component.
  446. /// </summary>
  447. private void RestoreNative()
  448. {
  449. if (_native != null)
  450. _native.Destroy();
  451. _native = new NativeAnimation();
  452. _native.OnEventTriggered += EventTriggered;
  453. // Restore saved values after reset
  454. _native.WrapMode = serializableData.wrapMode;
  455. _native.Speed = serializableData.speed;
  456. if (serializableData.defaultClip != null)
  457. _native.Play(serializableData.defaultClip);
  458. RebuildFloatProperties(serializableData.defaultClip);
  459. Renderable renderable = SceneObject.GetComponent<Renderable>();
  460. if (renderable == null)
  461. return;
  462. NativeRenderable nativeRenderable = renderable.Native;
  463. if (nativeRenderable != null)
  464. nativeRenderable.Animation = _native;
  465. }
  466. /// <summary>
  467. /// Destroys the internal animation representation.
  468. /// </summary>
  469. private void DestroyNative()
  470. {
  471. Renderable renderableComponent = SceneObject.GetComponent<Renderable>();
  472. if (renderableComponent != null)
  473. {
  474. NativeRenderable renderable = renderableComponent.Native;
  475. if (renderable != null)
  476. renderable.Animation = null;
  477. }
  478. if (_native != null)
  479. {
  480. _native.Destroy();
  481. _native = null;
  482. }
  483. }
  484. /// <summary>
  485. /// Builds a list of properties that will be animated using float animation curves.
  486. /// </summary>
  487. /// <param name="clip">Clip to retrieve the float animation curves from.</param>
  488. private void RebuildFloatProperties(AnimationClip clip)
  489. {
  490. if (clip == null)
  491. {
  492. floatProperties = null;
  493. return;
  494. }
  495. AnimationCurves curves = clip.Curves;
  496. List<FloatCurvePropertyInfo> newFloatProperties = new List<FloatCurvePropertyInfo>();
  497. for (int i = 0; i < curves.FloatCurves.Length; i++)
  498. {
  499. string suffix;
  500. SerializableProperty property = FindProperty(SceneObject, curves.FloatCurves[i].Name, out suffix);
  501. if (property == null)
  502. continue;
  503. int elementIdx = 0;
  504. if (!string.IsNullOrEmpty(suffix))
  505. {
  506. PropertySuffixInfo suffixInfo;
  507. if (PropertySuffixInfos.TryGetValue(suffix, out suffixInfo))
  508. elementIdx = suffixInfo.elementIdx;
  509. }
  510. Action<float> setter = null;
  511. Type internalType = property.InternalType;
  512. switch (property.Type)
  513. {
  514. case SerializableProperty.FieldType.Vector2:
  515. if (internalType == typeof(Vector2))
  516. {
  517. setter = f =>
  518. {
  519. Vector2 value = property.GetValue<Vector2>();
  520. value[elementIdx] = f;
  521. property.SetValue(value);
  522. };
  523. }
  524. break;
  525. case SerializableProperty.FieldType.Vector3:
  526. if (internalType == typeof(Vector3))
  527. {
  528. setter = f =>
  529. {
  530. Vector3 value = property.GetValue<Vector3>();
  531. value[elementIdx] = f;
  532. property.SetValue(value);
  533. };
  534. }
  535. break;
  536. case SerializableProperty.FieldType.Vector4:
  537. if (internalType == typeof(Vector4))
  538. {
  539. setter = f =>
  540. {
  541. Vector4 value = property.GetValue<Vector4>();
  542. value[elementIdx] = f;
  543. property.SetValue(value);
  544. };
  545. }
  546. else if (internalType == typeof(Quaternion))
  547. {
  548. setter = f =>
  549. {
  550. Quaternion value = property.GetValue<Quaternion>();
  551. value[elementIdx] = f;
  552. property.SetValue(value);
  553. };
  554. }
  555. break;
  556. case SerializableProperty.FieldType.Color:
  557. if (internalType == typeof(Color))
  558. {
  559. setter = f =>
  560. {
  561. Color value = property.GetValue<Color>();
  562. value[elementIdx] = f;
  563. property.SetValue(value);
  564. };
  565. }
  566. break;
  567. case SerializableProperty.FieldType.Bool:
  568. setter = f =>
  569. {
  570. bool value = f > 0.0f;
  571. property.SetValue(value);
  572. };
  573. break;
  574. case SerializableProperty.FieldType.Int:
  575. setter = f =>
  576. {
  577. int value = (int)f;
  578. property.SetValue(value);
  579. };
  580. break;
  581. case SerializableProperty.FieldType.Float:
  582. setter = f =>
  583. {
  584. property.SetValue(f);
  585. };
  586. break;
  587. }
  588. if (setter == null)
  589. continue;
  590. FloatCurvePropertyInfo propertyInfo = new FloatCurvePropertyInfo();
  591. propertyInfo.curveIdx = i;
  592. propertyInfo.setter = setter;
  593. newFloatProperties.Add(propertyInfo);
  594. }
  595. floatProperties = newFloatProperties.ToArray();
  596. }
  597. /// <summary>
  598. /// Called whenever an animation event triggers.
  599. /// </summary>
  600. /// <param name="clip">Clip that the event originated from.</param>
  601. /// <param name="name">Name of the event.</param>
  602. private void EventTriggered(AnimationClip clip, string name)
  603. {
  604. // TODO - Find a scene object, component and method based on the event name, and call it
  605. }
  606. /// <summary>
  607. /// Holds all data the animation component needs to persist through serialization.
  608. /// </summary>
  609. [SerializeObject]
  610. private class SerializableData
  611. {
  612. public AnimationClip defaultClip;
  613. public AnimWrapMode wrapMode = AnimWrapMode.Loop;
  614. public float speed = 1.0f;
  615. }
  616. /// <summary>
  617. /// Contains information about a property animated by a generic animation curve.
  618. /// </summary>
  619. private class FloatCurvePropertyInfo
  620. {
  621. public int curveIdx;
  622. public Action<float> setter;
  623. }
  624. /// <summary>
  625. /// Information about a suffix used in a property path.
  626. /// </summary>
  627. internal struct PropertySuffixInfo
  628. {
  629. public PropertySuffixInfo(int elementIdx, bool isVector)
  630. {
  631. this.elementIdx = elementIdx;
  632. this.isVector = isVector;
  633. }
  634. public int elementIdx;
  635. public bool isVector;
  636. }
  637. }
  638. /** @} */
  639. }