is it possible to flag mulitiple pieces in a model?

I load a model which have hundreds of pieces. I want to manipulate many of them. I know running this code in command prompt could set flag to piece:

egg-optchar -o new.egg -flag Sphere01=something old.egg

but this only works for one piece at one time. I have about 100 pieces to set flag, it becomes very troublesome. So I’m wondering if there is a way to set multiple ones at one time?

You can use the “*” syntax if all of your pieces have a similar name:

egg-optchar -o new.egg -flag "Sphere*"=something old.egg 

In any case, you might want to consider putting the troublesome command into a .bat file so you only have to type it once, rather than every time. And you can even write a Python program to generate the .bat file if that helps.


Thanks David. You know everything…
I’m still a little confused. Will that one line code of

egg-optchar -o new.egg -flag "Sphere*"=something old.egg 

flag all the pieces with the same “something”. What if I want their flag to be unique?
And could you please give me more hints on how to generate and use .bat file to do this?

Thanks a lot!


If you want to flag all the geometry as its own name, you can just do:

egg-optchar -o new.egg -flag "Sphere*" old.egg

or even:

egg-optchar -o new.egg -flag "*" old.egg 

which flags each and every object, giving you full access (but at some render performance cost).

To construct a .bat file, just write a program that generates the command line you want to run in a string, with each of the -flag options you want. There might be dozens or hundreds of -flag options, whatever you need. Then write that string to a .bat file.


oh, cool! This works!

egg-optchar -o new.egg -flag "*" old.egg 

Save me a lot of trouble. Why there is no instruction about this in the tutorial…
I’ll try to use .bat file too, it sounds interesting.