file_path = File.join(PRESETS_DIR, "#name.json") File.open(file_path, "w") do |f| f.write(JSON.pretty_generate(data)) end UI.messagebox("Preset saved as #name") end
This is a complete guide to developing a feature for SketchUp (using the V-Ray for SketchUp API and Ruby). vray render settings for sketchup
preset = JSON.parse(File.read(file_path)) apply_custom_preset(preset) end file_path = File
def vray return nil unless vray_loaded? VRay::Renderer.instance end end module VRaySettingsManager DEFAULT_PRESETS = "Draft" => "image_sampler" => "Fixed", "min_subdivs" => 1, "max_subdivs" => 4, "noise_threshold" => 0.05, "gi_enabled" => false, "gi_primary" => "Brute force", "gi_secondary" => "None", "resolution_width" => 800, "resolution_height" => 600, "quality" => 0.3 , "Medium" => "image_sampler" => "Progressive", "min_subdivs" => 1, "max_subdivs" => 16, "noise_threshold" => 0.01, "gi_enabled" => true, "gi_primary" => "Brute force", "gi_secondary" => "Light cache", "resolution_width" => 1920, "resolution_height" => 1080, "quality" => 0.6 , "High" => "image_sampler" => "Progressive", "min_subdivs" => 1, "max_subdivs" => 32, "noise_threshold" => 0.005, "gi_enabled" => true, "gi_primary" => "Brute force", "gi_secondary" => "Light cache", "resolution_width" => 3840, "resolution_height" => 2160, "quality" => 0.9 end Step 3: Apply Settings to V-Ray module VRaySettingsManager def apply_preset(preset_name) preset = DEFAULT_PRESETS[preset_name] return unless preset && vray # Access V-Ray settings through its API settings = vray.settings file_path = File.join(PRESETS_DIR