The problem is that people here can help you with hints, or show you how to get some specific things, but we can't teach you how to script from scratch. It's like trying to teach you how to write a poem when you can't write a sentence.
Learning scripting without programming knowledge isn't something you can do it in a day.
Your code is completely broken and you are mixing things. it doesn't matter what language you learn, but first learn a few basic things like if, else, for loop, etc. and stick with them until you feel familiar with the language. You can do a lot of things with only that. The next step is learn the sdk, try to understand the OM structure, and keep improving your scripting skills with functions and other fancy things.
Specific shaders don't have a ClassID. I mean, the class is shaders so you can't filter "lambert" with that. I would use ProgID.
Code: Select all
//JScript
var exception = "phong" //specify unwanted shader
var obj = selection(0) //get selected object
var mats = obj.materials //get all mats from your selected object
//create a recipient for your result
var oColl = XSIFactory.CreateObject( "XSI.Collection" );
//loop your mats
for (var i=0; i<mats.count ; i++){
// loop your mats' shaders
var shaders = mats(i).GetAllShaders()
for (var j=0; j<shaders.count ; j ++){
// compare your shaders with your unwanted shader name
if (shaders(j).progid.indexOf(exception) == -1) oColl.Add(mats(i))
}
}
//select your filtered mats collection
selectobj (oColl)
Its looping inside a loop so it may not be very fast (although I doubt you have millions of shaders and materials), but it works and i wrote it using, for loop, if and indexOf.
So first, learn the basic stuff, read until you understand it before trying to do complex things. Step by step.
if you can't make a simple logmessage work, then you are not ready to walk through your material shaders.