diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index d1dfa4f438..aa30b2b2fe 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -313,18 +313,14 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root) } void ActionNode::initActionNodeFromRoot(Ref* root) -{ - Node* rootNode = dynamic_cast(root); - if (rootNode != nullptr) +{ + Widget* rootWidget = dynamic_cast(root); + if (rootWidget != nullptr) { - Widget* rootWidget = dynamic_cast(root); - if (rootWidget != nullptr) + Widget* widget = Helper::seekActionWidgetByActionTag(rootWidget, getActionTag()); + if (widget != nullptr) { - Widget* widget = Helper::seekActionWidgetByActionTag(rootWidget, getActionTag()); - if (widget != nullptr) - { - setObject(widget); - } + setObject(widget); } } } @@ -367,14 +363,6 @@ Node* ActionNode::getActionNode() { return cNode; } - else - { - Widget* rootWidget = dynamic_cast(_object); - if (rootWidget != nullptr) - { - return rootWidget; - } - } return nullptr; }