Turbo Squid
Turbo SquidProductsSearchShopping CartMemberForumsCompanySupport
gmax Community and Support : maxscript : Maxscript and Editable Poly
Forum: Posts From:
MutantCel
Poster
95 Posts
1 Product
Maxscript and Editable Poly
Posted 02-Nov-2007 6:39 AM

Ok, two questions.

#1>I have a video game level I have made, and need to cut it up for the import to my engine. The object to cut up is 7200 units wide and 5760 tall in 80 square pieces. (10x8)

I could separate the parts manually but I want to automate this as best I can with maxscript.

I know of polyop.setFaceSelection $ #{1..3} but I don't want to select faces sequentially, I want to select things in a bounding box from the top view. NOT BY HAND but in script. Is it even possible to define one point to start a bounding box in the top view and an end point? or define select all faces within an XYZ start point to an XYZ end point?

#2>I plan to use the polyops.detach but it brings up a naming diolouge for each detach. Can I define the name of the new object from the detach in my script and stifle the diolouge?
MutantCel
Poster
95 Posts
1 Product
RE: Maxscript and Editable Poly
Posted 02-Nov-2007 7:58 AM
Modified by MutantCel On 02-Nov-2007  10:12 AM

Ok, I use polyop.getFaceCenter $ 1.  It returns Local Coordinates of the face [-23,35,0] so I can
select any face which is with a specified XY location and then use
polyop.detachFaces with a name: option to name the new node.  I do see
the face numbers change after a selection is detached but it should not
matter if I select faces within a certain XY.



Now I simply have to read up on how to read and manipulate Local
Coordinates and it should just be a job of logic to create the script.

EDIT->ok, duh.  you simply add an .x .y or .z to the variable.  I feel dumb for even writing the above statement.  I have been coding PHP for 2 years and am just coming back to MaxScript so I am back a few steps.
MutantCel
Poster
95 Posts
1 Product
New Problem
Posted 02-Nov-2007 9:56 AM
Modified by MutantCel On 02-Nov-2007  10:14 AM

This feels like a REAL newbie question.  I am sorry if I offend anyone :)


faces = polyOp.getFaceSelection $Plane01



This should work, it works in the listener window but not in my script! What am I doing wrong?



It gives me the error...



-- Syntax error: at =, expected name

-- In line: faces = polyOp.getFaceSelection $Plane01




I am unsure what this means.

Here is my code (don't laugh too hard)
rollout levelSplitFloat "Level Splitter" width:300 height:60
(
    button split "Split the Level" pos:[26,94] width:169 height:43 toolTip:"Split the Level - GO!"
    label lbl1 "Evil Tiger Demo Level Splitter" pos:[37,17] width:167 height:24
    editText edt1 "" pos:[80,55] width:0 height:0
    editText startX "" pos:[51,52] width:128 height:28
    on split pressed  do
    faceArray = "#{"

faces = polyOp.getFaceSelection $Plane01
faceCount = faces.count
    for i = 1 to facecount do

    (

    loc = polyop.getFaceCenter $ i

    faceNum = i as string

    print "face #:" + faceNum

    print loc

    if loc.x<0 then

       (

       if loc.y < 0 then (addTo = 1)else(addTo = 0)

       )

       else(addTo = 0)

    if addTo == 1 then (join faceArray i)

    )

   

    polyop.setFaceSelection $ faces
)

)
-- create the rollout window and add the  rollout
if levelSplitFloat != undefined do
                (
                closerolloutfloater stlimportFloater
                )       
CreateDialog levelSplit width:300 height:60
Items per page