Create Generic V-Ray Material

Hi everyone,

I’m working on a Ruby script for SketchUp that aims to create a Generic Material in the V-Ray Asset Editor. I’ve managed to get the script to create the material, but it seems to be missing the VRay Mtl layer. Currently, only the Binding layer is present, as shown in the attached screenshot. Could anyone advise on how to modify the script to ensure that both the Binding layer and the VRay Mtl layer are included when the material is created?

Here’s the script I’ve come up with:

    def self.create_vray_material(material_name)
      # Initialize the V-Ray context
      context = VRay::Context.active
      model = context.model
      scene = context.scene
      renderer = context.renderer
      
      # Ensure V-Ray for SketchUp is present
      unless scene && renderer
        puts "V-Ray for SketchUp is not detected!"
        return
      end
    
      # Define my_material_plugin here so it's accessible throughout the method
      my_material_plugin = nil
      
      # Start a scene change transaction
      scene.change do
        # Create a new V-Ray material as a plugin in the scene
        material_plugin_path = "/#{material_name}"
        my_material_plugin = scene.create(:MtlSingleBRDF, material_plugin_path)
      end
    
      if my_material_plugin
    
        puts "V-Ray material '#{material_name}' created successfully."
      else
        puts "Failed to create V-Ray material '#{material_name}'."
      end
    end