| 244 | } |
| 245 | |
| 246 | void AnimatedPartSet::freshenActiveState(StateType& stateType) { |
| 247 | if (stateType.activeStateDirty) { |
| 248 | auto const& state = *stateType.activeStatePointer; |
| 249 | auto& activeState = stateType.activeState; |
| 250 | activeState.frame = clamp<int>(activeState.timer / state.cycle * state.frames, 0, state.frames - 1); |
| 251 | |
| 252 | activeState.properties = stateType.stateTypeProperties; |
| 253 | activeState.properties.merge(state.stateProperties, true); |
| 254 | |
| 255 | for (auto const& pair : state.stateFrameProperties) { |
| 256 | if (activeState.frame < pair.second.size()) |
| 257 | activeState.properties[pair.first] = pair.second.get(activeState.frame); |
| 258 | } |
| 259 | |
| 260 | stateType.activeStateDirty = false; |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | void AnimatedPartSet::freshenActivePart(Part& part) { |
| 265 | if (part.activePartDirty) { |
no test coverage detected