View Full Version : Query if a shader is assigned to any objects?

11 November 2005, 11:09 PM
Anyone know if it is possible to query a shader and see if it is applied to any objects in the scene? I couldn't find any MEL commands in the reference guide that would do this.

Basically, I just need to run a check to see if a specific shader is applied to any objects in the scene, and if it isn't, delete the shader... But I don't want to delete it if it is applied to anything.


11 November 2005, 11:17 PM
Ah hah! Two minutes later I figure it ou. :-D

But yeah, you can use hyperShade -objects MyShader, and it will select the objects with the shader attached. Can't query it, so you have to throw in the extra step of doing an `ls -sl` to get those objects associated it, but good enough, I do suppose! Let me know if anyone else knows another way to do this and have a queried result returned...

el diablo
11 November 2005, 06:57 AM
hyperShadePanelMenuCommand("hyperShadePanel1", "deleteUnusedNodes");

CGTalk Moderation
11 November 2005, 06:57 AM
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.