Home Coding, Scripting, Shaders

[MEL Script] Getting the new component IDs after editing a geometry.

null
Offline / Send Message
Falxo null
Is there a simple way of getting the new component IDs after performing any poly-edit action on a mesh via MEL?

For example, after performing a "polyExtrudeFacet" on a specified mesh, how would you go about getting the component IDs of those new faces surrounding the extruded face?
Or if you perform a  "polyChamferVtx" how could you efficiently get the new vertices that resulted from that command?

I understand that you could keep a duplicate of the original mesh and through a lengthy process of component comparison between the original and the modified, someone could determine (with some amount of risk) which components are the new ones and which are not.
But it really is too much trouble for a solution that is not all that efficient and can be prone to errors if the modifications are small enough to avoid detection if they were to be compared in terms of component positions, areas, angles etc.

I tried searching for a method but all the results I get are irrelevant to what I'm looking for so I decided to just directly ask you guys.
How would you go about doing that?

Thank you for your time.


Replies

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    mesh edits alter component order immediately so that comparison wouldn't work .   

    Does the tweak node (or equivalent) contain that sort of information ?  
  • Falxo
    Offline / Send Message
    Falxo null

    poopipe said:
    mesh edits alter component order immediately so that comparison wouldn't work .   
    The method mentioned does work for figuring out which components are the same or not by comparing:
    1. Position
    2. Area
    3. UV position
    4. UV area
    5. Neighbouring components
    6. Component colour (if any)
    The actual ID of the components is not used to figure out and match them. The ones that cannot be matched between the original and the edited one are to be listed as new.
    It works 90% of the time but it's not reliable enough, requires the script to make a duplicate and then deleting it, it's insanely slow and it feels like a bodge-job. So that's why I'm asking here.

    poopipe said:
    Does the tweak node (or equivalent) contain that sort of information ?  
    Well, each command returns only the name of the resulting nodes. Each node contains only the info for the modification, not the result and what created in the process.

    The whole question spawned from when I wanted to delete the face resulted from a "polyChamferVtx". I could do it manually, but the purpose of the script is to do it a few hundred times for me. Visual attached for clarification:

    Again, my current issue might be with poly chamfer, but I would be interested on finding out how to get the added/removed component IDs from any poly-edit operation.



  • onionhead_o
    Offline / Send Message
    onionhead_o polycounter lvl 16
    im trying to figure this out as well. but from what i can tell it usually keeps the original ids and only adds ontop meaning if the original faces were polyMesh.f[0:6],  the new face will polyMesh.f[7].  You can use polyEvaluate to test. Also might have to look into using scriptJob to catch the newly created faces. I might be wrong.
Sign In or Register to comment.