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

Function getNextMacros

plugins/base/macro-action-random.cpp:23–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23static std::vector<std::shared_ptr<Macro>>
24getNextMacros(std::vector<MacroRef> &macros, MacroRef &lastRandomMacroRef,
25 bool allowRepeat)
26{
27 std::vector<std::shared_ptr<Macro>> res;
28 if (macros.size() == 1) {
29 auto macro = macros[0].GetMacro();
30 if (validNextMacro(macro)) {
31 res.push_back(macro);
32 }
33 return res;
34 }
35
36 auto lastRandomMacro = lastRandomMacroRef.GetMacro();
37 for (auto &m : macros) {
38 auto macro = m.GetMacro();
39 if (validNextMacro(macro) &&
40 (allowRepeat || (lastRandomMacro != macro))) {
41 res.push_back(macro);
42 }
43 }
44 return res;
45}
46
47bool MacroActionRandom::PerformAction()
48{

Callers 1

PerformActionMethod · 0.85

Calls 3

validNextMacroFunction · 0.85
sizeMethod · 0.80
GetMacroMethod · 0.45

Tested by

no test coverage detected