Announcement

Collapse
No announcement yet.

Shading networks: Can't use vray textures and plugins in mel scripts

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

  • Shading networks: Can't use vray textures and plugins in mel scripts

    Hi

    I'm trying to write some extremely basic mel scripts to speed up my workflow when creating shader networks. Basically just copying commands from the script editor and adding a few string variables here and there, so that i can build my favourite shader networks at the touch of a shelf button.
    However the vray nodes don't seem to work. For example if i try

    shadingNode -asTexture VrayDirt

    sometimes it works, other times it doesn't. Even though all i've done is copy it from the script editor history!

    also i don't seem to be able to use 'textures from plugin' (for example compMaxtex or FalloffTex)

    is it actually possible to do this? should I give up? or are there correct procedures to use to ensure vray nodes are correctly loaded with mel?


    thanks

  • #2
    sorry, just read back my post and saw that in 'VRay' the r was lower case. Changed it now and it works!

    Comment


    • #3
      However i still have the problem of not being able to use Textures from Plugin. How do i go about adding these to my scripts?

      thanks

      Comment


      • #4
        Have you tried to use evalDeferred for connecting if this is what fails?
        Can you post you script and steps to reproduce the problem?
        V-Ray developer

        Comment


        • #5
          for example, how do you create a falloff node?
          if i try
          shadingNode -asTexture TexFalloff;
          it doesn't work...

          Comment


          • #6
            Code:
            vrayCreateNodeFromDll("FalloffTex", "texture", "TexFalloff", 1)
            Code:
            vrayCreateNodeFromDll($nodeName, $pluginType, $pluginName, $placement);
            www.deex.info

            Comment


            • #7
              Great thanks! That works for creating a node. But when i try to define it as a variable, it doesn't seem to like it? Do imported nodes use a different syntax?

              Basically I'm trying to create a topdown falloff node and connect it via out_intensity to a remap value node... this is how i have it at the mo, it's giving me syntax error

              // create nodes and set variables

              string $F = `vrayCreateNodeFromDll("TopDown#", "texture", "TexFalloff", 1)`;
              string $R = `shadingNode -asUtility remapValue -name "Mixer#"`;

              // set attributes

              setAttr ($F+ ".type") 1;
              setAttr ($F+ ".direction_type") 8;
              setAttr ($F+".color2") -type double3 1 1 1 ;
              setAttr ($F+".color1") -type double3 0 0 0 ;

              // connect nodes

              connectAttr -f ($F + ".out_intensity") ($RV + ".inputValue");

              Comment


              • #8
                If you look at the source code of vrayCreateNodeFromDll, you'll find that it doesn't return the name/path of the created node.
                So the code you're trying to execute is not valid and it won't work.

                Probably you can use code like this (taken from vrayCreateNodeFromDll and not tested) for now:
                Code:
                global proc string vrayCreatePluginTexture(string $ndeName, string $pluginType, int $placement) {
                	string $node = `shadingNode -asTexture -name $nodeName VRayPluginNodeTex`;
                	vray addAttributesFromDll $node $pluginType $pluginName;
                	evalDeferred ("vrayCreateNodeFromDll_connectUVW "+$node +" "+$placement);
                	return $node;
                }
                V-Ray developer

                Comment


                • #9
                  I'm afraid that seems a bit beyond my mel skills!

                  I was simply trying to copy and paste a list of commands taken from the script editor, and define some variables so that the new nodes are recognised and can be connected. , I guess the plugin nodes work differently. It's a shame as it's often useful to have the shading networks on the shelf for quick use.

                  Comment


                  • #10
                    Just use the function below in your own scripts instead of vrayCreateNodeFromDll.

                    Code:
                    global proc string bertjenkins_vrayCreatePluginTexture(string $nodeName, string $pluginType, int $placement) {
                    	string $node = `shadingNode -asTexture -name $nodeName VRayPluginNodeTex`;
                    	vray addAttributesFromDll $node "texture" $pluginType;
                    	evalDeferred ("vrayCreateNodeFromDll_connectUVW "+$node +" "+$placement);
                    	return $node;
                    }
                    V-Ray developer

                    Comment


                    • #11
                      great thanks, would you mind applying it to the example from before (falloff connected to remap value), so that i can see how it works and copy for other nodes?
                      apologies, my mel is extremely limited...

                      Comment


                      • #12
                        You just skip the type of nodes to create, everything else is the same.
                        Code:
                        string $nodeName=bertjenkins_vrayCreatePluginTexture("FalloffTex", "TexFalloff", 1);
                        note: Maya has a relatively easy help on MEL, which explains the basic concepts and features of the language. If you've not read them it is not bad idea to read it.
                        V-Ray developer

                        Comment


                        • #13
                          I think i've got it to work. Does this look right?

                          // set the procedure for creating plugin textures

                          global proc string bertjenkins_vrayCreatePluginTexture(string $nodeName, string $pluginType, int $placement) {
                          string $node = `shadingNode -asTexture -name $nodeName VRayPluginNodeTex`;
                          vray addAttributesFromDll $node "texture" $pluginType;
                          evalDeferred ("vrayCreateNodeFromDll_connectUVW "+$node +" "+$placement);
                          return $node;
                          }
                          // create nodes and set variables

                          string $F = bertjenkins_vrayCreatePluginTexture("Topdown#", "TexFalloff", 1);
                          string $R = `shadingNode -asUtility remapValue -name "Mixer#"`;

                          // set attributes

                          setAttr ($F + ".type") 1;
                          setAttr ($F + ".direction_type") 8;
                          setAttr ($F +".color2") -type double3 1 1 1 ;
                          setAttr ($F +".color1") -type double3 0 0 0 ;

                          // connect nodes

                          connectAttr -f ($F + ".out_intensity") ($RV + ".inputValue");

                          Comment


                          • #14
                            Yes, seems correct, but you can easily verify it using hypershade or the new nodegraph.
                            V-Ray developer

                            Comment

                            Working...
                            X