| 134 | } |
| 135 | |
| 136 | void Animation::executeInstruction() |
| 137 | { |
| 138 | vili::node& currentCommand = m_code[m_codeIndex]; |
| 139 | Debug::Log->trace("<Animation> Executing instruction {} / {} : {}", m_codeIndex, |
| 140 | m_code.size() - 1, currentCommand.dump()); |
| 141 | if (currentCommand.at("command") == Config::Templates::wait_command) |
| 142 | { |
| 143 | m_feedInstructions = true; |
| 144 | m_sleep = currentCommand.at("time"); |
| 145 | } |
| 146 | else if (currentCommand.at("command") == Config::Templates::play_group_command) |
| 147 | { |
| 148 | if (!m_currentGroupName.empty()) |
| 149 | m_groups[m_currentGroupName]->reset(); |
| 150 | m_feedInstructions = false; |
| 151 | m_currentGroupName = currentCommand.at("group"); |
| 152 | m_groups[m_currentGroupName]->setLoops(currentCommand.at("repeat")); |
| 153 | } |
| 154 | else if (currentCommand.at("command") == Config::Templates::set_animation_command) |
| 155 | { |
| 156 | m_feedInstructions = false; |
| 157 | m_status = AnimationStatus::Call; |
| 158 | m_nextAnimation = currentCommand.at("animation"); |
| 159 | } |
| 160 | else |
| 161 | { |
| 162 | throw Exceptions::UnknownAnimationCommand( |
| 163 | m_name, currentCommand.at("command"), EXC_INFO); |
| 164 | } |
| 165 | m_codeIndex++; |
| 166 | if (m_feedInstructions && m_codeIndex > m_code.size() - 1 |
| 167 | && m_playMode != AnimationPlayMode::OneTime) |
| 168 | { |
| 169 | this->reset(); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | void Animation::updateCurrentGroup() |
| 174 | { |