Announcement

Collapse
No announcement yet.

Python scene access list

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

  • #16
    Ok, will add this to our "todo" list.
    V-Ray/PhoenixFD for Maya developer

    Comment


    • #17
      Ok, thank you !

      I have an other question to ask :
      How could we "interpolate" in post translate python script ?

      Like in this :


      Node pSphereShape1@node {
      transform=interpolate(
      (2, Transform(Matrix(Vector(1, 0, 0), Vector(0, 1, 0), Vector(0, 0, 1)), Vector(0, 0, -3.228602899708137))),
      (3, Transform(Matrix(Vector(1, 0, 0), Vector(0, 1, 0), Vector(0, 0, 1)), Vector(0, 0, -6.457205799416276)))
      );
      nsamples=interpolate(
      (3, 0)
      );
      }

      Comment


      • #18
        Hi,

        I would like to thank you again for lists in post translate python script, the vrend abort command !
        It works really well and is really helpfull !!!

        By the way, what about my previous ask regarding interpolation ?*

        Thanks,

        Max

        Comment


        • #19
          Originally posted by CGMas View Post
          By the way, what about my previous ask regarding interpolation ?
          That one is a bit more difficult to do and we need to think it through a little first.

          Best regards,
          Vlado
          I only act like I know everything, Rogers.

          Comment


          • #20
            Ok,
            I understand very well. I knew that one would be harder to do.
            So we might have a workaround that could work for us and solve a lot of things :
            Having the possibility to add a string or a StringIO to the addSceneContent variable rather than a scenefile !!!

            What do you think about this ?

            Thanks,

            Max

            Comment


            • #21
              Hi,

              I would like to know if there is any news about my previous asks ?
              Also, I have another request about lists in python scene access.
              It seems that we cannot access to positions in ramps.
              Here is an example:

              def postTranslateScript():
              import vray

              ramp = vray.utils.findByName('ramp1')[0] #(Type is 'TexRamp')

              positions = ramp.get('positions')
              print positions # prints "[0.0, 0.5, 1.0]"

              # This line warns: // Warning: line 1: Invalid value given for parameter "positions" in plugin "ramp1". //
              ramp.set('positions', [0.0, 0.5, 1.0])

              Thanks in advance ,


              Max

              Comment


              • #22
                Originally posted by CGMas View Post
                Hi,

                I would like to know if there is any news about my previous asks ?
                Also, I have another request about lists in python scene access.
                It seems that we cannot access to positions in ramps.
                Here is an example:

                def postTranslateScript():
                import vray

                ramp = vray.utils.findByName('ramp1')[0] #(Type is 'TexRamp')

                positions = ramp.get('positions')
                print positions # prints "[0.0, 0.5, 1.0]"

                # This line warns: // Warning: line 1: Invalid value given for parameter "positions" in plugin "ramp1". //
                ramp.set('positions', [0.0, 0.5, 1.0])

                Thanks in advance ,


                Max
                Nearly a year since I have asked that one.
                Maybe now there's an answer to that question ?

                Thanks a lot,

                Max

                Comment


                • #23
                  I think this was fixed a long time ago, though I have to give it a try in newer builds.

                  Best regards,
                  Vlado
                  I only act like I know everything, Rogers.

                  Comment


                  • #24
                    Hi Vlado,

                    Thanks for your answer.
                    I've just tried and it still doesn't work with Vray 3.00.01.
                    I might need to try with a nightly build...

                    Kind regards,
                    Max

                    Comment


                    • #25
                      Hi Vlado,

                      Any news about that ?

                      Cheers,

                      Max

                      Comment


                      • #26
                        Hm, this is a special parameter. It can act like a list of floats, but the python scene access doesn't know that. We can make it work in this way:

                        Code:
                        from vray.utils import *
                        
                        ramp = findByName('ramp1')[0]
                        positions = ramp.get('positions')
                        texFloat1 = create("TexFloatOp", "rampPos1")
                        texFloat1.set("float_a", 0.5)
                        texFloat2 = create("TexFloatOp", "rampPos2")
                        texFloat2.set("float_a", 0.0)
                        ramp.set('positions', [texFloat1, texFloat2])
                        Not sure if such verbose format works for you...
                        V-Ray/PhoenixFD for Maya developer

                        Comment


                        • #27
                          Yes, it would be great if it works that way !

                          Comment


                          • #28
                            Ok, this should work with the nightly build from today.
                            V-Ray/PhoenixFD for Maya developer

                            Comment


                            • #29
                              Awesome !
                              It works perfectly.
                              Thanks a lot !

                              Comment


                              • #30
                                Hi,

                                Another list I have difficulties to deal with is the object select "ids" list.
                                If I do something like this:

                                import vray.utils

                                obj_sel = vray.utils.findByType('RenderChannelObjectSelect')[0]
                                before_ids = obj_sel.get('ids')


                                obj_sel.set('ids', [3, 1] )
                                after_ids = obj_sel.get('ids')

                                print before_ids
                                print after_ids

                                Only the first value of the list is set.

                                Maybe I've missed something...

                                Thanks,

                                Max

                                Comment

                                Working...
                                X