Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828

    Extra Attributes in AE

    Question 1:
    I need help with adding sections to the Attribute Editor. What I want is to add a color picker group slider with a mapable (checker) button like the attached image. Problem is when I addAttr a double3 it places 3 float fields in the Attribute Editor extra attributes flyout. The code I'm using is to add attributes to a locator that will be the master controls for a light rig.

    Here is the code I'm using:
    Code:
       addAttr -ln masterColor -at double3 $locatorName[0];
       addAttr -ln masterColorR -at double -p masterColor $locatorName[0];
       addAttr -ln masterColorG -at double -p masterColor $locatorName[0];
       addAttr -ln masterColorB -at double -p masterColor $locatorName[0];
       setAttr -type double3 ($locatorName[0] + ".masterColor") 1 1 1;
       setAttr -e -keyable true ($locatorName[0] + ".masterColor");
       setAttr -e -keyable true ($locatorName[0] + ".masterColorR");
       setAttr -e -keyable true ($locatorName[0] + ".masterColorG");
       setAttr -e -keyable true ($locatorName[0] + ".masterColorB");
    Is there something special I need to do to get this to be a color picker instead of 3 float fields?

    Question 2:
    What do I need to do if I want to create tabs or special rollouts in the Attribute Editor instead of having all of my custom attributes going into the "Extra Attributes" rollout? I don't need exact syntax help, just a pointer as to what MEL commands I should be looking at to customize the Attribute Editor with.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	extattr.jpg 
Views:	77 
Size:	123.4 KB 
ID:	29865  
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  2. #2
    Join Date
    Sep 2002
    Location
    Indonesia
    Posts
    494
    You could use -usedAsColor or -uac to define your attribute as color, but you need to change the data type to "float3" and "float".

    Code:
    addAttr -ln masterColor -uac -at float3 $locatorName[0];
    addAttr -ln masterColorR -at "float" -p masterColor $locatorName[0];
    addAttr -ln masterColorG -at "float" -p masterColor $locatorName[0];
    addAttr -ln masterColorB -at "float" -p masterColor $locatorName[0];
    setAttr -type float3 ($locatorName[0] + ".masterColor") 1 1 1;
    setAttr -e -keyable true ($locatorName[0] + ".masterColor");
    setAttr -e -keyable true ($locatorName[0] + ".masterColorR");
    setAttr -e -keyable true ($locatorName[0] + ".masterColorG");
    setAttr -e -keyable true ($locatorName[0] + ".masterColorB");
    =========================
    I have put some Maya Tutorial at
    http://misterdi.cgpot.com
    Latest tut: "Instancing without instance "

  3. #3
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    SWEET!

    Thank you very much! This works perfectly for what I'm trying to do...good deal.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  4. #4
    Join Date
    Jun 2003
    Location
    Seattle, WA
    Posts
    533

    Re: Extra Attributes in AE

    Originally posted by DezFX
    Question 2:
    What do I need to do if I want to create tabs or special rollouts in the Attribute Editor instead of having all of my custom attributes going into the "Extra Attributes" rollout? I don't need exact syntax help, just a pointer as to what MEL commands I should be looking at to customize the Attribute Editor with. [/B]
    Probably what you could do (this is a total hack) is open the attribute editor, then use the window and layout commands to get the hierarchy of the Attr Editor, query the extra attributes layout for its children and then build your tabs or extra layouts based on that.

    Probably a more elegant solution is to edit the scripts that actually build the AE, I'm not sure if all that functionality is contained in MEL scripts.
    Technical Artist - 106th ODST Division, Fireteam Tango Alpha Echo

  5. #5
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Cool, thanks for the tip, I will look into that. I got the script working exactly how I want it to, but I just need to fine tune and tweak a couple things before I hand it off as "finished". I am 99.9% there and just need to know two more things.

    In the default AE for a spot light, under the shadow section, how do you setup attributes to toggle on and off (like the Dmap Shadow settings and Ray Tracing settings) when you check their check box?

    Also, I am trying to figure out how to get url linking in a UI window. Say I want to hotlink an email address from inside Maya. I'm pretty sure I've seen this in the past, I just cannot remember the script it was from off the top of my head.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  6. #6
    Join Date
    Jun 2003
    Location
    Seattle, WA
    Posts
    533
    Originally posted by DezFX
    In the default AE for a spot light, under the shadow section, how do you setup attributes to toggle on and off (like the Dmap Shadow settings and Ray Tracing settings) when you check their check box?
    If you can somehow store the control name, you can use connectControl to link the checkBox control to a specific attr.
    Technical Artist - 106th ODST Division, Fireteam Tango Alpha Echo

  7. #7
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    Nope, that's not exactly what I need to do. That will link two attribute values to eachother and lock them. What I am trying to do is something like the "-enable" flag for UI creation where if you check the box, it unlocks fields for editing. And when the box is unchecked the fields are greyed out and you cannot access them. Any ideas?
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  8. #8
    Join Date
    Jun 2003
    Location
    Seattle, WA
    Posts
    533
    Oh you mean toggle enable states. Setup your check box so that the -onc and -ofc switches call the specific control in edit mode and enable or disable it.

    //So if this is your textField
    textField <ctrl_name>;

    //this is what your checkBox should do
    checkBox -onc "textField -e -en 1 <ctrl_name>"
    -ofc "textField -e -en 0 <ctrl_name>";
    And obviously you can have the -onc and -ofc enable a bunch of different controls if need be or call a single proc to enable or disable a bunch of controls.
    Last edited by djtomservo; 07-09-2004 at 09:24 PM.
    Technical Artist - 106th ODST Division, Fireteam Tango Alpha Echo

  9. #9
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    OK, that's cool for GUI windows...but please bare with me on this one, I'm working on fried brain matter. (been at this script for almost 20 hrs straight)

    Say I have the following script:
    Code:
    string $locatorName[] = `spaceLocator -p 0 0 0`;
    string $locatorShape[] = `listRelatives -shapes $locatorName[0]`;
    
    addAttr -ln castShadows -at bool -keyable true -dv 1 $locatorShape[0];
    
    addAttr -ln useDepthMapShadows -at bool -keyable true -dv 0 $locatorShape[0];
    
    addAttr -ln useRayTraceShadows -at bool -keyable true -dv 0 $locatorShape[0];
    How do I get locatorShape.castShadows to disable the check boxes for locatorShape.useDepthMapShadows and locatorShape.useRayTraceShadows when I uncheck it's box (in the Attribute Editor) and then enable them again if I re-check the box for locatorShape.castShadows?

    Go ahead and run this script and then open the "Extra Attributes" folder in the Attribute Editor for the Locator Shape node. You will see the check boxes I'm trying to enable/disable.

    There has to be a way, this is driving me crazy! LoL
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

  10. #10
    Join Date
    Jan 2004
    Location
    Sunny Southern California
    Posts
    3,828
    YES!!!

    With a little help from Campbell over at Highend3d.com I was able to get the script working by using an "enum" attribute to create a drop-down field for selecting the shadow options. I did not know what this was, so that's where I was stuck at. Thanks again for the help here, too.
    Dez
    Pipeline Technical Director
    Legend 3D | VFX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •