MCPcopy Create free account
hub / github.com/defold/defold / LuaCancelAnimations

Function LuaCancelAnimations

engine/gui/src/gui_script.cpp:1633–1658  ·  view source on GitHub ↗

cancels a single animation or all animations * * If one or more animations of the specified node is currently running (started by gui.animate ), they will immediately be canceled. * * @name gui.cancel_animations * @param node [type:node] node that should have its animation canceled * @param [property] [type:nil|string|constant] optional property for which

Source from the content-addressed store, hash-verified

1631 * ```
1632 */
1633 static int LuaCancelAnimations(lua_State* L)
1634 {
1635 int top = lua_gettop(L);
1636 (void) top;
1637
1638 Scene* scene = GuiScriptInstance_Check(L);
1639
1640 HNode hnode;
1641 InternalNode* node = LuaCheckNodeInternal(L, 1, &hnode);
1642 (void) node;
1643
1644 dmhash_t property_hash = 0;
1645 if (top >= 2 && !lua_isnil(L, 2))
1646 {
1647 property_hash = dmScript::CheckHashOrString(L, 2);
1648 }
1649
1650 if (property_hash != 0 && !dmGui::HasPropertyHash(scene, hnode, property_hash)) {
1651 luaL_error(L, "property '%s' not found", dmHashReverseSafe64(property_hash));
1652 }
1653
1654 CancelAnimationHash(scene, hnode, property_hash);
1655
1656 assert(top== lua_gettop(L));
1657 return 0;
1658 }
1659
1660 void LuaPushNode(lua_State* L, dmGui::HScene scene, dmGui::HNode node)
1661 {

Callers

nothing calls this directly

Calls 9

lua_gettopFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
LuaCheckNodeInternalFunction · 0.85
CheckHashOrStringFunction · 0.85
luaL_errorFunction · 0.85
dmHashReverseSafe64Function · 0.85
HasPropertyHashFunction · 0.70
CancelAnimationHashFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected