Home Technical Talk

Show non-quad polys script

FatAssasin
polycounter lvl 18
Offline / Send Message
FatAssasin polycounter lvl 18
I wrote this script today for myself and thought it might come in handy for some of you doing high poly models. It selects all non four sided polys in an EPoly object in Max. This way, you can see where you need to do some cleanup if you want an all quad mesh for bringing in to ZBrush. You can use it in an editable poly modifier also, but I'd suggest using it on a collapsed editable poly object because it runs much faster that way.


<font class="small">Code:</font><hr /><pre>(
max modify mode
local obj = selection[1]
local objMod = modPanel.getCurrentObject()
if classOf objMod == editable_poly then (
local faceSelArr = for i = 1 to objMod.getNumFaces() collect(
if (polyop.getVertsUsingFace objMod i).numberSet != 4 then i else continue
)
polyop.setFaceSelection objMod faceSelArr
)
else if classOf objMod == edit_poly then (
local faceSelArr = for i = 1 to objMod.getNumFaces() collect(
if (
objMod.setSelection #face #{i}
objMod.convertSelection #face #vertex
) != 4 then i else continue
)
objMod.setSelection #face (faceSelArr as bitarray)
)
else messagebox "Make sure an Editable Poly object or Edit Poly modifier is selected."
update obj
subObjectLevel = 4
)</pre><hr />

Replies

  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Nice, I can see this will be useful. Thanks! smile.gif
  • John Warner
    Options
    Offline / Send Message
    John Warner polycounter lvl 18
    nice! thanks very much man!
  • arshlevon
    Options
    Offline / Send Message
    arshlevon polycounter lvl 18
    cool man.. you probably know way more than me about maxscript.. but i have been using the select non quad script that comes in the maxscript reference.. is yours better?? here is the one in the reference..
    <font class="small">Code:</font><hr /><pre>macroscript SelectNonQuadPolys category:"HowTo"
    (
    on isEnabled return
    (
    selection.count == 1 and classOf selection[1].baseobject == Editable_Poly
    )
    on execute do
    (
    local face_selection = #{}
    local base_obj = $.baseobject
    local num_faces = polyop.getNumFaces base_obj
    for f = 1 to num_faces do
    (
    local num_face_verts = polyop.getFaceDeg base_obj f
    if num_face_verts != 4 do face_selection[f] = true
    )--end f loop
    polyop.setFaceSelection base_obj face_selection
    max modify mode
    modPanel.setCurrentObject base_obj
    subobjectlevel = 4
    )--end on execute
    )--end script </pre><hr />
  • FatAssasin
    Options
    Offline / Send Message
    FatAssasin polycounter lvl 18
    Well, what do you know? Uh, mine was made with love. smile.gif

    I didn't know that was there. Guess I should check out the sample scripts more often. One thing mine does do is work within an Edit Poly modifier, whereas that one only works with the base Editable Poly object. But using mine on a high poly model in an Edit Poly modifier is very slow, which is probably why that option wasn't added in the How To version.
  • Jhotun
    Options
    Offline / Send Message
    Jhotun polycounter lvl 18
    All you need is love, dab, dadadada...

    hehe, cool script, thanks for sharing smile.gif Polyboost does a very good job there too.

    Cheers
Sign In or Register to comment.