But im having problems with the query, i want a query that can return the name of the material of the selected object, and then change the transparency values someone can help me with this? I think the -o flag is wrong but i dont know what flag i can use to retrieve the name of the material.
Or what do you want to achieve? Note that you may have a texture on the selected surface and you may not access the transparency value if its connected to a texture node.
however: hyperShade -o selects objects that have the given shader assigned. You cannot querry the shader(s) on the selection with that (as the Maya-docs say). Furthermore its impossible to querry shaders on the selection directly with the hyperShade command.
What you can do is hyperShade -smn. That replaces the selection with the shader(s) that are assigned to the former selection. Now you can do a ls -sl and you have the shader(s).
i tryed -smn because de script for maya 6 uses that, but dont work in maya 5.0. I think in maya 5.0 we have to use another flag instead of -smn. But i dont know what flag.
With the -smn flag gives me this error: // Error: Invalid flag: -smn // // Error: No object matches name: .transparency //
that should work in every maya: have a look at the hypergraph: at every shape should be a shadinggroup attached. But I don't know to query them all... sometimes there are these green arrows with the double divided attribute path: eg: pCubeShape3.instObjGroups[0].objectGroups[1];
If you have all the shadinggroups on a surface you have also the shaders: shader.outColor --> shadingGroup.surfaceShader.
(Brute force you could query all SGs for the faces they supply and substract the faces you don't have selected.. but I guess there IS a better way)
Note that the dude in the video didn't pack the script into "{...}"!! If you run this, there might be other scripts having trouble.: btw here its a lil shoter:
CODE { string $sel[] = ls -sl -ap -dag -type surfaceShape; for ($s in $sel) { int $xRayState[] = displaySurface -q -xRay $s; displaySurface -xRay (!$xRayState[0])$s; } }
All by myself. Being interested in Maya. Being Lazy on the one hand and enthusiastic on the other to write stuff that makes your maya experience a lot more dynamic. (I'm a context-sesitivity and Hotkey-addicted!! ) Usually I spend a lot more time trying out stuff that helps me to save less time. But after all you learn and learn... ;]
furthermore: listen to and read code from: Joojaa, Naughty, failure, Rob Bateman, Brian Ewert... rolleyes
Someday you write a script an wonder why it really executes and works at the first time!! No Error? .. I was so baffled that I made it crash in a next attempt to see if everything is ok...