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

Method SetSegmentIndexValue

lib/macro/macro-action-variable.cpp:655–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655void MacroActionVariable::SetSegmentIndexValue(int value)
656{
657 DecrementCurrentSegmentVariableRef();
658
659 auto m = GetMacro();
660 if (!m) {
661 _macroSegment.reset();
662 return;
663 }
664
665 if (value < 0) {
666 _macroSegment.reset();
667 return;
668 }
669
670 std::shared_ptr<MacroSegment> segment;
671 if (_action == Action::SET_CONDITION_VALUE) {
672 if (value < (int)m->Conditions().size()) {
673 segment = m->Conditions().at(value);
674 }
675 } else if (_action == Action::SET_ACTION_VALUE) {
676 if (value < (int)m->Actions().size()) {
677 segment = m->Actions().at(value);
678 }
679 }
680
681 _macroSegment = segment;
682 if (segment) {
683 IncrementVariableRef(segment.get());
684 }
685}
686
687int MacroActionVariable::GetSegmentIndexValue() const
688{

Callers 1

SegmentIndexChangedMethod · 0.80

Calls 5

GetMacroFunction · 0.85
IncrementVariableRefFunction · 0.85
sizeMethod · 0.80
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected