| 616 | } |
| 617 | |
| 618 | PropertyResult CancelAnimations(HCollection collection, HInstance instance, dmhash_t component_id, |
| 619 | dmhash_t property_id) |
| 620 | { |
| 621 | if (instance == 0) |
| 622 | return PROPERTY_RESULT_INVALID_INSTANCE; |
| 623 | |
| 624 | AnimWorld* world = GetWorld(collection); |
| 625 | uint16_t* head_ptr = world->m_InstanceToIndex.Get((uintptr_t)instance); |
| 626 | if (property_id == 0) |
| 627 | { |
| 628 | StopAnimations(world, head_ptr, component_id, 0); |
| 629 | return PROPERTY_RESULT_OK; |
| 630 | } |
| 631 | PropertyDesc prop_desc; |
| 632 | PropertyOptions property_opt; |
| 633 | AddPropertyOptionsIndex(&property_opt, 0); |
| 634 | PropertyResult prop_result = GetProperty(instance, component_id, property_id, property_opt, prop_desc); |
| 635 | if (prop_result != PROPERTY_RESULT_OK) |
| 636 | { |
| 637 | return prop_result; |
| 638 | } |
| 639 | uint32_t element_count = GetElementCount(prop_desc.m_Variant.m_Type, prop_desc.m_ElementIds); |
| 640 | if (element_count == 0) |
| 641 | { |
| 642 | return PROPERTY_RESULT_UNSUPPORTED_TYPE; |
| 643 | } |
| 644 | StopAnimations(world, head_ptr, component_id, property_id); |
| 645 | if (element_count > 1) |
| 646 | { |
| 647 | for (uint32_t i = 0; i < element_count; ++i) |
| 648 | { |
| 649 | StopAnimations(world, head_ptr, component_id, prop_desc.m_ElementIds[i]); |
| 650 | } |
| 651 | } |
| 652 | return PROPERTY_RESULT_OK; |
| 653 | } |
| 654 | |
| 655 | void CancelAnimations(HCollection collection, HInstance instance) |
| 656 | { |