MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / SetSequenceIndex

Method SetSequenceIndex

plugins/base/macro-action-sequence.cpp:108–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool MacroActionSequence::SetSequenceIndex()
109{
110 auto macro = _macro.GetMacro();
111 if (!macro) {
112 SetTempVarValue("nextMacro", "");
113 return true;
114 }
115
116 auto actions = GetMacroActions(macro.get());
117 if (!actions) {
118 SetTempVarValue("nextMacro", "");
119 return true;
120 }
121
122 std::string nextMacroName;
123 for (const auto &action : *actions) {
124 if (action->GetId() != id) {
125 continue;
126 }
127
128 auto sequenceAction =
129 dynamic_cast<MacroActionSequence *>(action.get());
130 if (!sequenceAction) {
131 continue;
132 }
133 // -2 is needed since the _lastIndex starts at -1 and the reset
134 // index starts at 1
135 sequenceAction->_lastIdx = _resetIndex - 2;
136 nextMacroName = GetMacroName(
137 sequenceAction->GetNextMacro(false).GetMacro().get());
138 }
139 SetTempVarValue("nextMacro", nextMacroName);
140 return true;
141}
142
143void MacroActionSequence::SetupTempVars()
144{

Callers

nothing calls this directly

Calls 6

SetTempVarValueFunction · 0.85
GetMacroNameFunction · 0.85
GetNextMacroMethod · 0.80
GetMacroMethod · 0.45
getMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected