Browse Source

added fix for percentage time sliders going beyond the end of the file length due to rounding errors when set to 100%

Jonathan Higgins 6 months ago
parent
commit
a729858950
1 changed files with 5 additions and 1 deletions
  1. 5 1
      scenes/main/scripts/run_thread.gd

+ 5 - 1
scenes/main/scripts/run_thread.gd

@@ -763,7 +763,11 @@ func make_process(node: Node, process_count: int, current_infile: String, slider
 				if time == true:
 					var infile_length = await run_command(control_script.cdpprogs_location + "/sfprops", ["-d", current_infile])
 					infile_length = float(infile_length.strip_edges())
-					value = infile_length * (value / 100) #calculate percentage time of the input file
+					if value == 100:
+						#if slider is set to 100% default to a millisecond before the end of the file to stop cdp moaning about rounding errors
+						value = infile_length - 0.01
+					else:
+						value = infile_length * (value / 100) #calculate percentage time of the input file
 				#line += ("%s%.2f " % [flag, value]) if flag.begins_with("-") else ("%.2f " % value)
 				args.append(("%s%.2f " % [flag, value]) if flag.begins_with("-") else str(value))