# Reload a new copy of the entities array into to be used with the next material renders.ĭef = Returns the current setting for # # Remove and return the next entity in the list. So this must be set prior toĭef Remove and return the next material in the list. # A method to get whether the VRay live scene is rendering?Įntity.material = material_t_material(matl) Reload_entities() # for next material passĪpply_material(entity, = _i # Starts the control loop that controls the material interation.ĭef control_loop(interval = UI.start_timer(interval,true) \"." If control > = * = VRay::LiveScene.active Module Example # =( interval > 0 ? interval : 5.0 ) Otherwise it loads without syntax errors.Įxample_VRay_BatchRender_1.0.0.rb (7.9 KB) "Example_VRay_BatchRender_1.0.0.rb":227:in `block in 'ĪDD: You’ll also need to fix material_handler access in the apply_material() method. "Example_VRay_BatchRender_1.0.0.rb":17:in `render_command' So running on a selection gives … Error: # I assumed in the render_command method that there would exist material_handler.get_materials to return the array of materials.
I don’t have a Vray license to test it, and I don’t have your material_handler object. So I wrapped the call inside a rendering? method in hopes the loop procs will call it each time through. Sometimes we can force the proc to get a new value by using a method call instead of a variable reference. Possibly because sometimes Ruby procs encapsulate the current state of things, so it may be getting the return value once when it processes the block prior to starting up the timer loop. The only way it does change to false is if i continously enter live_scene.rendering? in the console.Īm i missing something clever or is there no way to optimize the rendering process short of checking if there has appeared a new image in the render destination folder? The problem is that no matter how i form the loop, the live_scene.rendering? boolean never changes to false. # Find something clever to do while the render completes in around 7-10 secondsĪgain, this is a simplification of my code, and it all seems to work except for the rendering status bit.
# Start loop to stop code from progressing while rendering is in progress Sketchup.active_ do |entity| # On the selected entity (assuming you only select one thing to change)Įntity.material = material_t material(materialjpg) # Simplification of applying material to entity The general solution i’m trying to get working is along the lines of: live_scene = VRay::LiveScene.activeĪrray_materials.each do |materialjpg| # For every material in array of materials I’ve now experimented with UI.start_timer now, but there is no obvious way to get the live_scene.rendering? to change while in the loop even then.