Announcement

Collapse
No announcement yet.

User Attributes

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

  • #16
    Thanks Vlado!

    Using the condition nodes would have worked but I can see us having lots and lots of similar but varied textures for this job and it'd be nice to store the file name string with the geo.

    Comment


    • #17
      Are User Attributes working in the 2.20.01 official release?

      Trying to swap out the diffuse colour of a shader and can't seem to get it working....

      I'm using the same script I used before (see below) then creating a vrayUserColor node and using diffuseColor as the string.

      On a separate note, is it possible to do this over instances? Maybe putting the colour attribute on the transform node?


      Code:
      //random diffuse colour
      string $sel[] = `ls -sl`;
      for($current in $sel)
      {
      string $shape[] = `listRelatives -s -path $current`;
          print ($shape[0] + "\n");
              if(!`attributeExists vrayUserColor_diffuseColor $shape[0]`)
              {
              addAttr -at float3 -usedAsColor -longName vrayUserColor_diffuseColor $shape[0];
              addAttr -at "float" -parent vrayUserColor_diffuseColor -longName vrayUserColor_diffuseColorR $shape[0];
              addAttr -at "float" -parent vrayUserColor_diffuseColor -longName vrayUserColor_diffuseColorG $shape[0];
              addAttr -at "float" -parent vrayUserColor_diffuseColor -longName vrayUserColor_diffuseColorB $shape[0];
              setAttr -e -keyable true ($shape[0] + ".vrayUserColor_diffuseColor");
              setAttr -e -keyable true ($shape[0] + ".vrayUserColor_diffuseColorR");
              setAttr -e -keyable true ($shape[0] + ".vrayUserColor_diffuseColorG");
              setAttr -e -keyable true ($shape[0] + ".vrayUserColor_diffuseColorB");
              }
          vector $color = <<rand(0,0.3),rand(0,0.2),rand(0,0.2)>>;
          print ($color + "\n");
      setAttr -type double3 ($shape[0] + ".vrayUserColor_diffuseColor") ($color.x) ($color.y) ($color.z);
      }

      Comment


      • #18
        Originally posted by MartinB View Post
        Are User Attributes working in the 2.20.01 official release?
        Yes, however they work in their original form, as described in the current documentation on spot3d (i.e. you have just a single string attribute that contains all attributes).

        Trying to swap out the diffuse colour of a shader and can't seem to get it working.... I'm using the same script I used before (see below) then creating a vrayUserColor node and using diffuseColor as the string.
        This will not work in the official builds, but should work in the nightly/stable builds.

        On a separate note, is it possible to do this over instances? Maybe putting the colour attribute on the transform node?
        In their original form (the single string attribute) you can put user attributes anywhere in a hierarchy of objects and this will affect all objects below. The separate attributes (ones that start with vrayUserColor_ or vrayUserScalar_) only work for shapes.

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

        Comment


        • #19
          Thanks for the prompt response Vlado

          Comment

          Working...
          X