File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,33 @@ namespace Networks {
123123 }
124124 }
125125
126+ template <class T >
127+ T convertVariable (const Core::Algorithms::Variable&)
128+ {
129+ return {};
130+ }
131+
132+ template <>
133+ inline int convertVariable<int >(const Core::Algorithms::Variable& var)
134+ {
135+ return var.toInt ();
136+ }
137+
138+ template <class T >
139+ T transient_value_cast_with_variable_check (const ModuleStateInterface::TransientValueOption& x)
140+ {
141+ if (!x)
142+ return {};
143+
144+ if (transient_value_check<T>(x))
145+ return any_cast_or_default_<T>(*x);
146+
147+ if (transient_value_check<Core::Algorithms::Variable>(x))
148+ return convertVariable<T>(any_cast_or_default_<Core::Algorithms::Variable>(*x));
149+
150+ return {};
151+ }
152+
126153 class SCISHARE StateChangeObserver
127154 {
128155 public:
Original file line number Diff line number Diff line change @@ -85,8 +85,7 @@ void GetMatrixSlice::execute()
8585 throw ;
8686 }
8787
88-
89- auto playMode = transient_value_cast<int >(state->getTransientValue (Parameters::PlayModeActive));
88+ auto playMode = transient_value_cast_with_variable_check<int >(state->getTransientValue (Parameters::PlayModeActive));
9089 if (playMode == GetMatrixSliceAlgo::PLAY)
9190 {
9291 auto sliceIncrement = state->getValue (Parameters::SliceIncrement).toInt ();
You can’t perform that action at this time.
0 commit comments