@thehive (thehive) posted a new topic, subject "quick question layer set-up". It read:

   i have this global proc and im tryin to it in the the $SpecButtonCMD section an i cant seem to find a good way to add it in there so when you run the button from the textFieldButtonGrp.
    [code] 
        
        
        
        
        
        
        if (`window -exists LayerCake`)
        	deleteUI -window LayerCake;
        
        if (`windowPref -exists LayerCake`)
        	windowPref -remove LayerCake;
        
        window -t "LayerCake" -w 562 -h 350 LayerCake;
        
         rowLayout;
        
        
        
          global proc specular ()
        {
        setAttr "Specular.specular" 1;
        setAttr "Specular.beauty" 0;
        setAttr "Specular.color" 0;
        setAttr "Specular.shadow" 0;
        setAttr "Specular.diffuse" 0;
        }
        
        string $SpecTxtfieldGrp;
        string $SPECproc = "specular";
        
        
        
        //////////////////////////////
        
        string $SpecButtonCMD =
        
        "createRenderLayer -name (`textFieldButtonGrp " +
        "-q -text $SpecTxtfieldGrp`);
        
        
        
        /////////////////////////////////////////////////
        
        
        $SpecTxtfieldGrp = `textFieldButtonGrp
        -label "layer name"
        -text "layer"
        -buttonLabel "Make"
        -buttonCommand $SpecButtonCMD`;
        
        
        showWindow;
        
        
        
        
    [/code]

@mlefevre (mlefevre) replied

    Hey,
    [code] 
        global proc LayerCakeGUI(){
         
         if (`window -exists LayerCake`)
         	deleteUI -window LayerCake;
         
         if (`windowPref -exists LayerCake`)
         	windowPref -remove LayerCake;
         
         window -t "LayerCake" -w 562 -h 350 LayerCake;
         
         rowLayout;
         
         textFieldButtonGrp
         -label "layer name"
         -text "layer"
         -buttonLabel "Make"
         -buttonCommand "makeLayer()"
         TFBGControl;
         
         showWindow LayerCake;
         };
         
         //====================================
         
         proc makeLayer(){
         string $layerName = `textFieldButtonGrp -q -text TFBGControl`;	
         createRenderLayer -name $layerName;
         };
        
    [/code]
    
    Hope that helps in some way!
    
    -matt

Then @thehive (thehive) said

    oh so put all the commands in to a proc for the button helps a ton thanks

After which, @thehive (thehive) added

    i see what you did but my main concern was get the button to set the render pass on the layer which is this part but im gettin a syntax error i know its something dumb im not seeing how to attach the “setAttr” part.
    
    or do i need to define a string for the settAttr part ie like or i could be way off lol many thanks for the help
    
    string $layerAttr =`setAttr + "$layerName "`;
    [code] 
         
         
         proc makeLayer(){
          string $layerName = `textFieldButtonGrp -q -text TFBGControl`;	
          createRenderLayer -name $layerName;
         /////
         //setlayer render settings to specuar
         setAttr ($layerName) + .beauty 0;
         setAttr ($layerName) + .specular 1;
         setAttr ($layerName) + .color 0;
         setAttr ($layerName) + .shadow 0;
         setAttr ($layerName) + .diffuse 0;
         };
         
        
    [/code]

So @mlefevre (mlefevre) replied

    You were close enough - but you need to enclose the object and its attribute in ( ) and enclose the attribute itself in " ".
    [code] 
         proc makeLayer(){
          string $layerName = `textFieldButtonGrp -q -text TFBGControl`;	
          createRenderLayer -name $layerName;
         
          //setlayer render settings to specular
         
          setAttr ($layerName + ".specular") 1;
          };
        
    [/code]
    
    Hope that helps some
    
    -matt

To which @thehive (thehive) replied

    sweetness ill take it i knew what had to happen jus not sure of the syntax thank man really appreciate it

To which @CGTalk_Moderation (CGTalk_Moderation) replied

    This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.


{'source': 'discourse', 'url': 'https://forums.cgsociety.org/t/quick-question-layer-set-up/1293062', 'title': 'quick question layer set-up', 'views': 157, 'has_accepted_answer': False, 'word_count': 393, 'like_count': 0, 'reply_count': 4, 'participant_count': 3, 'posts': 7, 'tags': '', 'author': '@thehive (thehive)', 'participants': '@thehive (thehive), @mlefevre (mlefevre), @CGTalk_Moderation (CGTalk_Moderation)', 'image_url': '', 'created_at': '2009-03-07T08:10:42.000Z', 'last_posted_at': '2009-03-08T18:05:58.000Z'}