I have a Measure that's a random number generator from 0 - 2, which updates only every 100-150 intervals. If the value is 1 or 2, I set a base filename and start a Loop Measure, and enable a Meter to display one of two sets of 10 frames in sequence. If the random value is 0 I just leave that image Meter, and the Loop measure controlling its filename reset and disabled.
The Loop Measure is actually set to have range 1 - 11, so once the image clips play when it hits 11 another measure resets it and then disables it. (which fixes it at 0, until the next time the random measure triggers it off again. (Took me a while to figure out I couldn't have that Ifcondition in the rando trigger because it only updates every 150 cycles...)
The ONLY issue with this functioning the way I want is the log is being hit every update that the frames are not playing (so something like 140 of every 150 cycles) with: "Unable to open: {path}\Frame-0.png " error messages.
Any pointers? Should I also maybe when 'finishing' my 10 frames, besides hiding the image meter, reset its UpdateDivider to a high count to reduce these messages? I can (I think) drop the Update divider back down to the frame rate I want when I re-enabled it the next time my random triggers.
Or IS there a way to entirely disable/renable a Meter like a measure, vs. just show/hide/toggle??
Or...don't care, the Errors don't harm anything if logging is off, they just buffer for a little while then drop off?
Pertinent Code (Missing some surrounding context, and another couple meters that show text and shapes along with the image, but I hope clear enough otherwise):
Code: Select all
[MeasureRando3]
;Use for Poole Animations, 3 states
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=0
HighBound=2
UpdateDivider=150
;10 frames per short clip segment, turn on and start frame count if 1 or 2
IfCondition=((MeasureRando3 = 1) && (MeasureImageLoop = 0))
IfTrueAction=[!SetVariable FileBase "Frame-"] [!EnableMeasure MeasureImageLoop] [!CommandMeasure MeasureImageLoop "Reset"] [!SetOption MeterPooleText Text "transponder re-acquired"] [!ShowMeter "Meter_Brackets_Small2"] [!ShowMeter "MeterPooleFloat"]
IfCondition2=((MeasureRando3 = 2) && (MeasureImageLoop = 0))
IfTrueAction2=[!SetVariable FileBase "Frame_2-"] [!EnableMeasure MeasureImageLoop] [!CommandMeasure MeasureImageLoop "Reset"] [!SetOption MeterPooleText Text "*medical link updating... *"] [!ShowMeter "Meter_Brackets_Small2"] [!ShowMeter "MeterPooleFloat"]
;turn off and reset counter if 0, don't show images by hiding meter
IfCondition3=(MeasureRando3 = 0)
IfTrueAction3=[!SetOption MeterPooleText Text "**SIGNAL LOST**"] [!CommandMeasure MeasureImageLoop "Reset"] [!DisableMeasure MeasureImageLoop] [!HideMeter "Meter_Brackets_Small2"] [!HideMeter "MeterPooleFloat"]
[MeasureImageLoop]
Measure=Loop
StartValue=1
EndValue=11
;Last value triggers reset, should hide meter but might see a 'no frame 11' or '0' message depending on when reset happens.
Increment=1
LoopCount=1
UpdateDivider=2
;slow the animation rate a little
;Rando3 only triggers every 150 updates, so need another measure to reset and shut off MeasureImageLoop when it hits 11. (Can't seem to have Ifconditions inside the Loop measure, but there might be a cleaner way than another measure i haven't figured out)
[MeasureImageReset]
Measure=Calc
Formula=1
IfCondition=(MeasureImageLoop = 11)
IfTrueAction=[!SetOption MeterPooleText Text "**SIGNAL LOST**"] [!CommandMeasure MeasureImageLoop "Reset"] [!DisableMeasure MeasureImageLoop] [!HideMeter "Meter_Brackets_Small2"] [!HideMeter "MeterPooleFloat"]
[MeterPooleFloat]
;display a brief clip of tumbling dead astronaut which does not "close" so I can't loop it endlessly, just play and then hide again...
Meter=Image
X=550
Y=200
W=304
H=300
PreserveAspectRatio=1
ImageCrop=460,80,220,220
ImageName=C:\Users\rtrem\OneDrive\Documents\2020_CPU_Build\PooleTumbling\#FileBase#[MeasureImageLoop].png
AntiAlias=1
Padding 2,2,2,2
SolidColor=180,50,50,(50+[MeasureBlinker])
UpdateDivider=2
DynamicVariables=1