Try this, wrap the very last line of the script in the timer (obviously, first remove the timer you’ve added before):
UI.start_timer(1, false) {
main
}
Try this, wrap the very last line of the script in the timer (obviously, first remove the timer you’ve added before):
UI.start_timer(1, false) {
main
}
Hmmm, same thing. Still repeats, and gives the “vray is still rendering…” pop up.
Can you show me the log/console output?
wow, this is getting tricky. I tried to pull the ruby and vray console, however, because it keeps repeating, I have limited control of the ui (effectively its frozen). I was able to grab a screen of the ruby console right before it froze, and the only error it gives is:
error: unable to get backtrace for systemstackerror error: unable to get backtrace for systemstackerror error: #<systemstackerror: stack level too deep> c:/program files (x86)/RenderPal v2/client/temp/rpscript_0133_001.rb:58
Note: I ran it a few times, and also got an error pointing to line 40
the RB in question is (basically, what we altered) :
require "sketchup.rb"
class AnimationExport
def initialize
@pages = $model.pages
if @pages[1] == nil
puts "Error: No pages were found, ensure that you have at least 2 pages before exporting an image sequence"
close_sketchup
return
end
if $chunkEndFrame != nil
@end_frame = $chunkEndFrame
else
@end_frame = (($model.pages.slideshow_time * $frame_rate) + 1).to_i
end
if $chunkStartFrame != nil
@frame = $chunkStartFrame
else
@frame = 1
end
@frame_interval = 1.0 / $frame_rate
@frame_count = @end_frame
@end_time = $model.pages.slideshow_time
Sketchup.active_model.active_view.animation = self
end
def update_view(view)
end
def nextFrame(view)
Sketchup.active_model.active_view.animation = nil
frame_fmt = "%0" + "#{$padding}" + "d"
frame_num = sprintf frame_fmt, @frame
output_file = File.basename($output_name, File.extname($output_name)) + frame_num + $format
output_path = File.join($output_directory, output_file)
if @frame > @end_frame
Sketchup.set_status_text("Finished exporting 2d image sequence to #{File.dirname(output_path)}")
puts "Finished exporting 2d image sequence to #{File.dirname(output_path)}"
close_sketchup
return
end
time = @frame * @frame_interval
@pages.show_frame_at(time.to_f)
Sketchup.set_status_text("Rendering frame #{@frame} of #{@end_frame} to #{output_path}")
puts "Rendering frame #{@frame} of #{@end_frame} to #{output_path}"
begin
#currentImgPath = self.append_to_filename( origPath, "-#{pages[i].name}" )
VRayForSketchUp.set_option_value("/SettingsOutput", "img_file", "string", output_path)
VRayForSketchUp.launch_vray_render
# wait for render to start
while not PythonBridge.is_rendering_image()
PythonBridge.pump_message
end
# wait for render to finish
while not PythonBridge.is_render_finished()
PythonBridge.pump_message
end
#break if PythonBridge.was_render_cancelled()
$stdout.flush
puts "Successfully exported frame #{@frame} of #{@end_frame} to #{output_path}"
rescue
puts "Error: Failed to write image sequence: #{output_path}, check input and folder permissions"
close_sketchup
return
end
@frame += 1
Sketchup.active_model.active_view.animation = self
end
end
def is_osx?
(/darwin/ =~ RUBY_PLATFORM) != nil
end
def is_win?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
def close_sketchup
Sketchup.send_action(57603)
Sketchup.quit
end
def main
$stdout = STDOUT
$stderr = STDERR
$model = Sketchup.active_model
$view = $model.active_view
$output_directory = "V:/Tmp/VRAY 2016 TEST"
$output_name = "grassbravo.tif"
$format = "." + "tif"
if $output_name.chomp == ""
$output_name = File.basename($model.path, ".skp")
end
$chunkStartFrame = nil
$chunkEndFrame = nil
$width = nil
$height = nil
$padding = 1
$frame_rate = 0
if $frame_rate == 0
$frame_rate = 30
end
VRayForSketchUp.set_option_value("/SettingsOutput", "frames_per_second", "float", $frame_rate)
$width = 500
$height = 251
if $width == 0
$width = $view.vpwidth
end
if $height == 0
$height = $view.vpheight
end
VRayForSketchUp.setOutputSize($width, $height)
$chunkStartFrame = 1
$chunkEndFrame = 1
VRayForSketchUp.set_option_value("/SettingsOutput", "save_render", "bool", 1)
AnimationExport.new
end
UI.start_timer(1, false) {
main
}
line 40:
frame_fmt = "%0" + "#{$padding}" + "d"
line58:
puts "Rendering frame #{@frame} of #{@end_frame} to #{output_path}"
I don’t understand where the issue is.
It all works fine without the timer? (except Skatter of course)
Do you know where this rb file is called? How it is executed?
Right, everything works fine with the default, original script (not our modded one) - except for skatter. When the timer delay is inserted, skatter does work, but then vray just repeats the render process.
with my very limited understanding, here is what I believe happens: job is generated and given a unique ID. Job is sent to the client, which opens sketchup.exe with the -rubystartup command line switch with the parameter set to the script $(scriptfile) and scene file of the job $(scene) - which is why they generate the temporary .rb file based off the script template we’ve been looking at. Haven’t been able to track down any additional xml or RB files
I’m guessing this probably doesn’t help, and I know I’m asking you to diagnose someone elses software, so I understand this may not be something that’s fixable, and I really appreciate all the help you provided
Now that we figured that Skatter does work if we have a small delay (1 second) between the time Sketchup opens and the time Vray actually starts rendering, it would be good to have RenderPal’s input on how to properly implement this delay.
LOL, yeah, they are a fairly absentee dev. I’ve been hounding them for help, but to no avail. I’ve all but given up on them helping, which means I’m probably out of luck for the time being.
Sorry I can’t help you more
There’s nothing in the code above that loops, so it has to be a level above.