PDA

View Full Version : How do I get editable poly face list via material ID?


macrod
04-05-2008, 12:31 PM
There is a selectByMaterial command, with the same function as the Select ID button on the UI.

Yes, I can use setMaterialIndex to set the ID, but it depends on the face selection.

I can also use setFaceMatID, which takes a face list as its input. That's really what I want.

So, the only thing I need to know is how to get the face list via material ID.

Thanks in advance! ;-)

Bobo
04-05-2008, 08:29 PM
There is a selectByMaterial command, with the same function as the Select ID button on the UI.

Yes, I can use setMaterialIndex to set the ID, but it depends on the face selection.

I can also use setFaceMatID, which takes a face list as its input. That's really what I want.

So, the only thing I need to know is how to get the face list via material ID.

Thanks in advance! ;-)

You can either use

<void><EditablePoly>.selectByMaterial <index>materialID [clearCurrentSelection:<bool>]

clearCurrentSelection default value: true

Select the faces with the specified materialID. If the optional clearCurrentSelection is set to false, the existing selection will be kept.



and then get the selection to see which faces were selected, or you can loop through all faces and ask them one by one using polyop.getFaceMatID().

macrod
04-06-2008, 03:32 AM
Bobo, :-), it's you again, thanks!

In fact, I'm looking for a one-shot command to get the face list via material ID..

Because,

1. The following code is executed for every materials in a Multi/Sub-Object material, and I have to process the material for every geometry.

currObj.selectByMaterial matOfCurrObj.materialIDList[i]
currObj.setMaterialIndex matID 1

I guess the selectByMaterial process might not be able to keep up with the program. That means, as long as the selectByMaterial command is issued, the program control jumps to the next, and the selection process might not be done yet, so I get the wrong result.

2. Looping through all faces and ask them one by one using polyop.getFaceMatID() will be too long a process for a high polygon number.

I'm struggling to find the one-shot solution..

CGTalk Moderation
04-06-2008, 03:32 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.