How would I go about linking objects in the Attribute Editor so that they behave the same way the render settings for dmap shadows do on a spot light. What I mean is that when you check the dmap checkbox it enables the dmap settings and when you uncheck the box it disables them and they turn grey. I know how to enable/disable when setting up for a GUI window, but how do you do it to existing attributes in the attribute editor? Or can you do it at the time when you "addAttr" while creating custom attributes?
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];
/code
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.
to do it in a non-invasive manner (i.e, not hacking away at the AETemplates), your best bet is to use either expression or scriptJobs that get triggered when the attribute changes, and does the en/diss-ablement from w/i them (the only choice of 'disable' is to delete the attribute, and add them again when the toggle gets hit. you dont have access to the interface items themselves unless you edit the templates, which is totally doable, but potentialy dangerous and can bog general interaction down if done poorly) is there a reason why you cant have a window interface that loads the currently selected object (if appropriate), and you do your edits from there?
Well, what I am doing is generating a light rig via a script and creating a locator to hold custom attributes that are master controls for the lights in the rig. Problem is that the custom attributes allow having raytrace and depth map shadows both enabled at the same time. Where if you were to create a single light and open the shadows section of the attrivute editor, if you check the depth map box, the raytrace box gets unchecked and the other way around, too. This prevents Maya from rendering out both shadows types at the same time. But in my script if you have both boxes checked, Maya will generate both Ray Traced Shadows and Depth Map Shadows in the same render. My script is done, I just wanted to fix this one thing so it's a little more intuative and idiot proof like the default Maya settings for shadows on a light.
yep, i got that first time! ![]()
i reckon for this situation, you'll probably just find it easier to use an enum attribute, which'll allow you to excluserfy the different setups. attach an expression to that attribute, which cases up the situations, and (if you are having the master attacthed to it dominions in a connection based manner) sets the states on some dummy, hidden, attributes that you can wire into the controlled attributes ...
it starts to gets messy otheriwse. if you want to be changing/enabling rafts of attributes for different global conditions (like on the light nodes), then you've got to start adding and removing the attributes on the fly (you cant enable/disable the actual AE interface elements/items that carry/house the attributes unless you schming with the AETemplates, which arent the best thing to mess with unless you know what your doing).
let me know if above works for ya!
Hey, great job! Your script is very similar to what I'm doing so with what you have provided me I am able to take it apart and extract the pieces of what I need. I did not know what "enum" did and disecting your script will lead me down the right path. Thanks for the help!
Edit: Yes! The script is complete now. After I test to make sure everything works perfectly I will upload it. Thanks again! WooHoo!
no wuckers,
glad you've got it working! ![]()
OK, I am trying to get something else to work. I don't know enough about the AE Template files to be going in and messing with them. But I wanted to add sub folders in the "Extra Attributes" folder. Say I have a group node called "Light Rig" with extra attributes for the sun, sky, and ground lights. I would like to add folders under the group's Extra Attributes folder for "Sun Controls" "Sky Controls" and "Ground Controls". Is this possible without hacking into the AE Template files?
Well atleast if you make it a multi value you can connect a dummy atribute to it and it will become a collapsable item but, its a bit of a hack i know.
example:
{
CreatePolygonSphere;
addAttr -longName rainbow -m -attributeType float3 ;
addAttr -longName redBow -attributeType "float" -parent rainbow;
addAttr -longName greenBow -attributeType "float" -parent rainbow;
addAttr -longName blueBow -attributeType "float" -parent rainbow;
connectAttr -f pSphere1.translate pSphere1.rainbow[0];
disconnectAttr pSphere1.translate pSphere1.rainbow[0];
}
Thanks Joojaa, I tried your script and it does very close to what I'm wanting to do. From this I should be able to extract enough information to do what it is that I'm trying to do.
One question: You said, "...it's a bit of a hack i know." What did you mean by this? Did you mean a cheesy/cheap way about doing things, or is it a hack as in this can cause problems with the script and/or AE Template files?
Its a hack only because it works for multi atributes taht realy werent meant for this, and you couldnt feeley set up groups as you like.
It is possible to manipulate the ae templates on the fly tough!
OK, thanks...I have a MEL class starting in a few weeks at school, so this is definatly something I will bug the instructor about. ![]()