Announcement

Collapse
No announcement yet.

Duplicate material by Ruby console

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Duplicate material by Ruby console

    How to duplicate V-Ray material using ruby console in Sketchup?
    I can’t find the method in VRay for Sketchup Ruby API document.
    I'm not too proficient with Ruby so any guidance is much appreciated

  • #2
    You're after the VRay::Scene::Plugin#duplicate method
    Click image for larger version  Name:	image.png Views:	0 Size:	52.9 KB ID:	1199431
    So an example of that might be:
    Code:
    scene = VRay::Context.active.scene
    material = scene["/Heather_Band"]
    scene.change { material.duplicate(name: "/Foo", include_refs: true, family_only: true) }
    Which makes me realize that the example in the documentation is incorrect, so thanks for helping us catch that
    Last edited by noel.warren; 10-01-2024, 03:00 AM.

    Comment


    • #3
      Thanks a lot noel.warren for your help!

      I have some questions about material:
      1/ Can the Attribute in VrayMtl like Contour, Translucency… be deleted using code? If so, an example is appreciated.

      2/ I tried to set opacity of Contour to 0 but it doesn’t change. Any way to solve it?

      Code:
      context = VRay::Context.active
      scene = context.scene
      m = scene['/green fabric']
      scene.change {
          m[:brdf][:opacity_tex_tex_on] = false
          m[:brdf][:opacity_tex] = 0
      }​
      Here is the video recording of this problem: https://www.youtube.com/watch?v=T-crl4wMj3M
      Last edited by benmack180; 10-01-2024, 06:10 AM.

      Comment


      • #4
        1) Not sure I understand. You can delete plugins or you can modify their parameters
        2) I'm guessing you were after modifying the opacity_tex_float userdata param. Use that instead of opacity_tex. You can tweak parameters in the UI and then use Plugin#dump to get a better understanding of what's going on under the hood

        Comment

        Working...
        X