PDA

View Full Version : MaxScript : Lightwave Smoothwires - please help


proteus2002
04-10-2003, 04:44 PM
hi

i am currently working on a script to simulate the lightwave modelling visualisation.
i found a solution to achieve this effect by adding two modifiers to the editable poly.

the first is a turntopoly modifier, to pass the baseobject edge selection and invert it

the second is a edit-mesh modifier to set all unneccessary edges invisible

but it does not update automatically. for example if you change the geometry of the baseobject, the edges are renumbered and the result will become distorted.

this script is written for max 5. i never tested it on previous versions.

the main part of the script is :


$.surfSubdivide = on
$.iterations = 3
select $.Edges
modPanel.addModToSelection (Turn_to_Poly ()) ui:on
$.modifiers[1].selectionConversion = 2
$.modifiers[1].selectionLevel = 3
modPanel.addModToSelection (Edit_Mesh ()) ui:on
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
showendresult = true


it is like a simple batch processing

to view the effect it is important that you set your viewport to edged faces.

i am learning max-script at the moment, so please excuse the unproper code.
my main goal was to write a scripted plugin to get the same effect.
but i failed. my skills are to low.

the scripted plugin should do :
- get all edges of the baseobject-poly (as subdivided edges)
- invert this edge selection and turn them invisible
- update automatically when the geometry of the baseobject changes

i know that a lot of people are interested in a script like this.
so all good scripters like bobo or lfshade please take a look at it and help me to improve it. feel free to modify it

thanks

proteus2002
04-10-2003, 04:46 PM
this is the script with an user interface:

--- smoothwire script beta
--- edged faces need to be turned on to see the smoothwire


(

rollout smoothwire "smooth wire" width:120 height:440
(
---
--- button and spinner definitions
---

--- button and spinner main rollout

groupBox grpb1 "SW Modifiers" pos:[5,5] width:110 height:90
groupBox grpb1b "" pos:[120,5] width:240 height:90

button btn1 "generate" pos:[10,25] width:100 height:20
button btn2 "delete" pos:[10,45] width:100 height:20
button btn3 "update" pos:[10,65] width:100 height:20

groupBox grpb2 "Display Settings" pos:[5,100] width:110 height:145
groupBox grpb2b "" pos:[120,100] width:240 height:145

button btn4 "base level" pos:[10,120] width:100 height:20
button btn5 "normal wire" pos:[10,140] width:100 height:20
button btn6 "red wire" pos:[10,160] width:100 height:20
button btn7 "backface cull on" pos:[10,180] width:100 height:20
button btn8 "control cage off" pos:[10,200] width:100 height:20

spinner spn1 "" pos:[79,225] width:30 height:16 range:[0,5,3] type:#integer --- subdivision iterations spinner
label lbl0 "Iterations" pos:[20,225] width:49 height:15

groupBox grpb3 "misc" pos:[5,250] width:110 height:183
groupBox grpb3b "" pos:[120,250] width:240 height:183

button btn9 "create spline" pos:[10,265] width:100 height:20
button btn10 "render viewport" pos:[10,285] width:100 height:20
button btn11 "preview" pos:[10,305] width:100 height:100
button btn12 " quick help >" pos:[10,405] width:100 height:20


-- help text

button map1butt1 "" pos:[130,355] width:50 height:50
button map1butt2 "" pos:[190,355] width:50 height:50
button map1butt3 "" pos:[250,355] width:50 height:50
--bitmap map1 pos:[120,270] width:50 height:50 bitmap:(render outputwidth:50 outputheight:50 vfb:false mapping:true shadows:true )--bitmap:render ()
--bitmap map2 pos:[180,270] width:50 height:50 bitmap:(render outputwidth:50 outputheight:50 vfb:false mapping:false shadows:false)--bitmap:render ()
--bitmap map3 pos:[240,270] width:50 height:50 bitmap:(render outputwidth:50 outputheight:50 vfb:false forcewireframe:true mapping:false shadows:false)--bitmap:render ()
label lbl1 "<--- generates smooth-wire modifiers" pos:[125,25] width:230 height:20
label lbl2 "<--- deletes smooth-wire modifiers" pos:[125,45] width:230 height:20
label lbl3 "<--- updates smooth-wire (after geometry change)" pos:[125,65] width:230 height:20
label lbl4 "<--- toggles to base level and back" pos:[125,120] width:230 height:20
label lbl5 "<--- toggles to normal nurms wire and back" pos:[125,140] width:230 height:20
label lbl6 "<--- toggles to red subdiv mode and back" pos:[125,160] width:230 height:20
label lbl7 "<--- toggles backface cull on and off" pos:[125,180] width:230 height:20
label lbl8 "<--- toggles controll cage on and off" pos:[125,200] width:230 height:20
label lbl9 "<--- set the subdiv iterations" pos:[125,220] width:230 height:20
label lbl10 "<--- creates a spline of smoothwire line" pos:[125,265] width:230 height:20 color:blue
label lbl11 "<--- renders the viewport" pos:[125,285] width:230 height:20 color:blue
label lbl12 "<--- click to render a small preview" pos:[125,305] width:230 height:20 color:blue
label lbl13 "or use the other render types below" pos:[143,320] width:210 height:20 color:blue
label lbl14 "mapping" pos:[135,338] width:100 height:20 color:blue
label lbl15 "V solid" pos:[195,338] width:100 height:20 color:blue
label lbl16 "V wire" pos:[255,338] width:100 height:20 color:blue
spinner spn2 "" pos:[310,356] width:45 height:16 range:[0,1024,500] type:#integer
spinner spn3 "" pos:[310,389] width:45 height:16 range:[0,1024,500] type:#integer

--- toggle states

global abutt =1 -- button btn4 "base level" toggle state
global bbutt =1 -- button btn5 "normal wire" toggle state
global cbutt =1 -- button btn6 "red wire" toggle state
global dbutt =1 -- button btn12 " quick help >" state
global ebutt =1 -- button btn7 "backface cull on" toggle state
global fbutt =1 -- button btn8 "control cage off" toggle state

-- mics globals

global spntemp = 1 --- spinner spn1 iterations tempstate
global baseedgeselection = #() -- stores original edgeselection

global modname1 = "SW Edit Mesh" --- define modifier name #1
global modname2 = "SW Turn to Poly" --- define modifier name #2

--- functions

fn testPoly = --- single editable poly check
(
if selection.count == 1 AND classof selection[1] == Editable_Poly do (setcommandpaneltaskmode mode:#modify; return true)
)

fn modifiertest = --- no modifiers check

(
if $.modifiers.count == 0 do (setcommandpaneltaskmode mode:#modify; return true)
)

fn modifiertest2 = --- checks if smoothwire modifiers are assigned

(
if $.modifiers.count == 2 and $.modifiers[1].name == modname1 do (setcommandpaneltaskmode mode:#modify; return true)
)

fn catchoperation = --- error handling (redrawviews + messagebox)

(
enablesceneredraw()
redrawViews()
messagebox "error occured" title:"Smooth Wire"
)






on btn1 pressed do -- generate modifiers button

(
try
(
undo "sw generate" off
(
modPanel.setCurrentObject $.baseObject
if modifiertest2() == true do (messagebox "modifiers already generated!" title:"Smooth Wire"; return())
if testPoly() != true do (messagebox "Single Editable Poly only" title:"Smooth Wire"; return())
if modifiertest() != true do (messagebox "please delete or collapse all other modifiers first" title:"Smooth Wire"; return())
setWaitCursor()
disablesceneredraw()
$.surfSubdivide = on
$.iterations = spn1.value
baseedgeselection = (polyop.getEdgeSelection $.baseobject as array)
subobjlev = subobjectLevel
select $.Edges
modPanel.addModToSelection (Turn_to_Poly ()) ui:on
$.modifiers[1].name = modname2
$.modifiers[1].selectionConversion = 2
$.modifiers[1].selectionLevel = 3
modPanel.addModToSelection (Edit_Mesh ()) ui:on
$.modifiers[1].name = modname1
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
subobjectLevel = subobjlev
polyop.setEdgeSelection $.baseobject baseedgeselection
showendresult = true
enablesceneredraw()
redrawViews()
--btn1.enabled=false
)
)
catch
(
catchoperation ()
)
)


on btn2 pressed do --- delete modifiers button
(
if modifiertest2() == true then (
try
(
setWaitCursor()
disablesceneredraw()
deleteModifier $ 1
deleteModifier $ 1
enablesceneredraw()
redrawViews()
setArrowCursor()
)
catch
(
catchoperation ()
)
)
else
()

)


on btn3 pressed do -- update modifiers button
(
try
(
undo "sw update" off
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
setWaitCursor()
disablesceneredraw()
showendresult = false
modPanel.setCurrentObject $.baseObject
baseedgeselection = (polyop.getEdgeSelection $.baseobject as array)
subobjlev = subobjectLevel
select $.Edges
deleteModifier $ 1
modPanel.addModToSelection (Edit_Mesh ()) ui:on
$.modifiers[1].name = modname1
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
subobjectLevel = subobjlev
showendresult = true
polyop.setEdgeSelection $.baseobject (baseedgeselection as array)
enablesceneredraw()
redrawViews()
setArrowCursor()

)
)
catch
(
catchoperation () -- function
)
)

on btn4 pressed do -- base level button
(
try
(
undo "sw base level" off
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
case of
(
(abutt == 1) : (
setWaitCursor()
disablesceneredraw()
showendresult = false
modPanel.setCurrentObject $.baseObject
$.iterations = 0
$.surfSubdivide = off
btn4.text = "leave base level"
btn3.enabled=false
btn5.enabled=false
spn1.enabled=false
btn6.enabled=false
btn7.enabled=false
btn8.enabled=false
btn9.enabled=false
lbl0.enabled=false
spntemp = spn1.value
spn1.value = 0
abutt = 0 -- switch button state
enablesceneredraw()
redrawViews()
)
(abutt == 0) : (
setWaitCursor()
disablesceneredraw()
showendresult = true
modPanel.setCurrentObject $.baseObject
$.iterations = spntemp
$.surfSubdivide = on
btn4.text = "base level"
btn3.enabled=true
btn5.enabled=true
spn1.enabled=true
btn6.enabled=true
btn7.enabled=true
btn8.enabled=true
btn9.enabled=true
lbl0.enabled=true
spn1.value = spntemp
abutt = 1 -- switch button state
enablesceneredraw()
redrawViews()
)

)
)
)
catch
(
catchoperation ()
)
)


on btn5 pressed do -- normal wire button
(
try
(
undo "sw wire change1" off
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
case of
(
(bbutt ==1) : (
setWaitCursor()
showendresult = false
bbutt = 0
btn5.text = "lightwave style"
btn4.enabled=false
btn3.enabled=false
spn1.enabled=false
btn6.enabled=false
btn9.enabled=false
lbl0.enabled=false
)

(bbutt ==0) : (
setWaitCursor()
showendresult = true
bbutt = 1
btn5.text = "normal wire"
btn4.enabled=true
btn3.enabled=true
spn1.enabled=true
btn6.enabled=true
btn9.enabled=true
lbl0.enabled=true
)
)
)
)
catch
(
catchoperation ()
)
)

on btn6 pressed do -- red wire button
(
try
(
undo "sw wire change2" off
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
case of
(
(cbutt ==1) : (
setWaitCursor()
disablesceneredraw()
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
meshOps.visibleEdge $.modifiers[1]
modPanel.setCurrentObject $.baseObject
--subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
cbutt = 0
btn6.text = "smoothwire line"
)

(cbutt ==0) : (
setWaitCursor()
disablesceneredraw()
modPanel.setCurrentObject $.modifiers[1]
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
--subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
cbutt = 1
btn6.text = "red wire"
)
)
)
)
catch
(
catchoperation ()
)
)



on btn7 pressed do -- backface cull button

(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
case of
(
(ebutt == 1) : (
setWaitCursor()
disablesceneredraw()
$.backfacecull = off

ebutt = 0 -- switch button state
enablesceneredraw()
redrawViews()
btn7.text = "backface cull on"
)
(ebutt == 0) : (
setWaitCursor()
disablesceneredraw()
$.backfacecull = on

ebutt = 1 -- switch button state
enablesceneredraw()
redrawViews()
btn7.text = "backface cull off"
)

)
)


on btn8 pressed do -- controll cage button
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
case of
(
(fbutt == 1) : (
setWaitCursor()
disablesceneredraw()
$.showCage = off

fbutt = 0 -- switch button state
enablesceneredraw()
redrawViews()
btn8.text = "control cage on"
)
(fbutt == 0) : (
setWaitCursor()
disablesceneredraw()
$.showCage = on

fbutt = 1 -- switch button state
enablesceneredraw()
redrawViews()
btn8.text = "control cage off"
)

)
)



on btn9 pressed do -- create spline button (creates a spline of the smoothwire-line)
(
try
(
undo "sw create spline" off
(
if modifiertest2() != true do (messagebox "no modifiers generated! press generate first!" title:"Smooth Wire";return())
setWaitCursor()
disablesceneredraw()
showendresult = false
modPanel.setCurrentObject $.baseObject
baseedgeselection = (polyop.getEdgeSelection $.baseobject as array)
subobjlev = subobjectLevel
select $.Edges
deleteModifier $ 1
modPanel.addModToSelection (Edit_Mesh ()) ui:on
$.modifiers[1].name = modname1
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
max select invert
meshOps.createShapeFromEdges $.modifiers[1]
max select invert

if cbutt == 0 then
(
meshOps.visibleEdge $.modifiers[1]
subobjectLevel = 2
modPanel.setCurrentObject $.baseObject
subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
)
else
(
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
)

)
)
catch
(
catchoperation ()
)
)







on btn10 pressed do -- render viewport button

(
undo off
(
local tempstate = showEndresult
showEndresult = True
local tempsurf = $.surfSubDivide
$.surfSubDivide = True
local temprender = render renderer:#draft
$.surfSubDivide = tempsurf
showEndresult = tempstate
temprender = undefined
gc light: true
)
)


on btn11 pressed do ---- preview render button
(
setWaitCursor()
previewmap =(render outputwidth:133 outputheight:100 vfb:false mapping:true shadows:true rendertype:#selected)
btn11.images=#(previewmap, undefined, 1, 1, 1, 1, 1)
gc light: true
)



on btn12 pressed do -- help button
(
--try
--(
undo "help button" off
(
case of
(
(dbutt ==1) : (
for e = 120 to 365 by 5 do
(
smoothwire.width = e
sleep 0.002
dbutt=0
)
btn12.text = " quick help <"
map1bitmap=(render outputwidth:50 outputheight:50 vfb:false mapping:true shadows:true renderer: #draft rendertype:#selected)--bitmap:render ()
map2bitmap=(render outputwidth:50 outputheight:50 vfb:false mapping:false shadows:false renderer: #draft rendertype:#selected)--bitmap:render ()
map3bitmap=(render outputwidth:50 outputheight:50 vfb:false forcewireframe:true mapping:false shadows:false renderer: #draft rendertype:#selected)--bitmap:render ()

map1butt1.images=#(map1bitmap, undefined, 1, 1, 1, 1, 1)
map1butt2.images=#(map2bitmap, undefined, 1, 1, 1, 1, 1)
map1butt3.images=#(map3bitmap, undefined, 1, 1, 1, 1, 1)
)

(dbutt ==0) : (
for f = 350 to 120 by -5 do
(
sleep 0.002
smoothwire.width = f
dbutt=1
)
btn12.text = " quick help >"
)
)
)
--)
--catch
-- (
-- catchoperation ()
-- )
)

on spn1 changed val1 do -- subdivision iteration spinner
(
undo "sw iterations" off
(
setWaitCursor()
if modifiertest2() != true do return()
try
(

if val1 == 0 then
(
disablesceneredraw()
showendresult = false
modPanel.setCurrentObject $.baseObject
$.iterations = val1
$.surfSubdivide = off
enablesceneredraw()
redrawViews()
)

else
(
disablesceneredraw()
showendresult = false
modPanel.setCurrentObject $.baseObject
$.surfSubdivide = on
$.iterations = val1
select $.Edges
deleteModifier $ 1
modPanel.addModToSelection (Edit_Mesh ()) ui:on
$.modifiers[1].name = modname1
modPanel.setCurrentObject $.modifiers[1]
subobjectLevel = 2
if cbutt == 0 then
(
meshOps.visibleEdge $.modifiers[1]
subobjectLevel = 2
modPanel.setCurrentObject $.baseObject
subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
)
else
(
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
subobjectLevel = 1
showendresult = true
enablesceneredraw()
redrawViews()
)

)

)
catch
(
catchoperation ()
)
)
)

on map1butt1 pressed do --- render an image with mapping, shadows, render selected, draft
(
render outputwidth:spn2.value outputheight:spn3.value vfb:true mapping:true renderer: #draft shadows:true rendertype:#selected
gc light: true
)

on map1butt2 pressed do --- render an image with no mapping, no shadows, render selected, draft
(
render outputwidth:spn2.value outputheight:spn3.value vfb:true mapping:false renderer: #draft shadows:false rendertype:#selected
gc light: true
)

on map1butt3 pressed do --- render an image with no mapping, no shadows, render selected, draft, force wireframe
(
render outputwidth:spn2.value outputheight:spn3.value vfb:true forcewireframe:true mapping:false renderer: #draft shadows:false force2sided:true wireThickness:2 rendertype:#selected
gc light: true
)


)
createdialog smoothwire
)

A4R
04-10-2003, 06:04 PM
goddamn. Was it necessary to post the whole script like that? I scrolled for hours. Sorry, sounds like a cool script but please post a link next time.

Thanks

A4R

Namroth
04-10-2003, 06:12 PM
I hope you get this to work good, I miss this from lightwave in max.:annoyed:

lebada
04-10-2003, 06:21 PM
wow..thats long...umm..dunno what you're reffering to in lightwave since i never use it...as soon as i saw its interface..(after using max) i was like"nuh uh...this aint gonna work"....hope u have luck tho..:buttrock:

EricChadwick
04-10-2003, 06:44 PM
Can you post a screenshot of how Lightwave modeling looks? I'd like to see what you're trying to achieve...

proteus2002
04-10-2003, 08:43 PM
i never used lightwave, but i saw a lot of screenshots, showing a clever way of displaying subdivided meshes.
for all of you, who don`t know what i mean by lightwave modelling style.

http://homepages.img.fh-mainz.de/~proteus/images/wip_images/examples.gif

the advantage of modelling like this, is that you see only the original edges subdivided. that makes it easier to work with edgeloops. it is a bit like "nurbsmodelling".

Dave Black
04-10-2003, 08:53 PM
That is simply wonderful. Let me extend thanks on behalf of everyone in the Sub-D thread for sharing this with us. It's simply awsome that you would take the time to build this, and then to share it with us.

Very, very cool.

I'm looking forward to the final polished version, but even still, this rocks. There are some obvious problems, but this could really be a big deal to alot of people.

Congrats!

A4R: dude, come on, that's a totally fine way of showing a script. Heaven for bid you have to scroll a few times.

:rolleyes:

-3DZ

:D

Namroth
04-10-2003, 09:02 PM
Have someone tested how is it?
Is it like in lightwave?

Dave Black
04-10-2003, 09:17 PM
Yup, I've tested it.

It's definately displaying the smoothed mesh like LW, ie, with the spline loops, but I cannot seem to edit them...well, I can, but only using the control cage.

It's really great, actually.

Just copy and paste the script to an empty document and then ssame it as a .mcr file.

Then, just drag and drop it into an open session of Max, and POOF! it's there.

Have a look at it.

-3DZ

:D

sireel
04-10-2003, 09:42 PM
Holy Schmokys this is cool! :)

proteus2002
04-10-2003, 09:50 PM
thanks 3dzealot

you can only work on the control cage of the baseobject. i found no solution to work directly on the smoothed mesh.
every time you add geometry (for example add an edge-loop), you have to press the update button to update the display.

Namroth
04-10-2003, 09:55 PM
What a great script, I miss only working on direct smooth like in Lightwave, I hope someone that know maxscript bater can help you.

ToddD
04-11-2003, 12:16 AM
You are off to a fantastic start, very "lightwave" indeed! Thank you for your efforts, and thanx for sharing! I'm sure we all are anxious to watch this script develop:beer:

robioto
04-11-2003, 12:35 AM
I never knew what I was missing in LW but now I want more. I'm looking forward to the time <hopefully soon> that this script is polished and kinks worked out. The Discreet 3dsmax dev team could take a few tips here, this would be a very nice display option.

Maybe this could be posted on the Discreet 3dsmax web board for some feedback?

Thanks for spending the time and sharing with us!

-r

Equinoxx
04-11-2003, 08:49 AM
i'll see if i can get my buddy magicM into this thread, he's pretty strong with maxscript, so he might be able to offer some solutions . . . ;)

looks like a great script. and indeed if we are able to edit the smoothed version, that would OWN

Xaya
04-11-2003, 01:34 PM
really nice script :thumbsup:


the only problem is that the viewport speed in 3ds max is so slow
that you can only use it for simple object......


but nevertheless :eek:

Xaya

proteus2002
04-11-2003, 01:48 PM
when the viewport gets slow, you have to decrease the iterations spinner value.

Xaya
04-11-2003, 03:49 PM
yes... i already saw that

but look:
my female character has got about 3500 polys
when i do a iteration of 1 on this model i have about 27000 polys
the rotation is acceptable fast
( probably because of the mesh-select)
but when i want to move a vertex for example
my pc getting sloooooooooow

i really like 3ds max for polygon - modeling
but i would love it if it would have a fast viewport
(i.e. like the lightwave one)

ToddD
04-11-2003, 03:50 PM
Xaya, I haven't tried it yet, but I would imagine adding mesh select to the top of the stack might help.

proteus2002
04-11-2003, 04:14 PM
the top of the stack is already a edit-mesh modifier. this should speed up things a little bit.
but as xaya said, max viewport becomes slow on mid- or hires meshes.
i recommend working on the baseobject and switching to smoothwire with low iteration only to check the loopflow.

@ xaya :

do you remember our discussion on using maps to simulate the lightwave look? you had the idea with the checker-map.
this was my initial approach to write this script.
:-)

proteus2002
04-11-2003, 04:25 PM
to render images with the smoothwire lines:

press the create spline button. select linear type.
set the spline to renderable. adjust the thickness.
give the spline a pure white material with selfillumination of 100.

Xaya
04-11-2003, 04:34 PM
Damn, yes, i remember our smalltalk...

i didn´t look at your name... really funny

i even wanted to write my method for this effect
in your thread :D

here the discribtion:
- add a uvw map on your model
-click face
-change u / v / w - parameter from 1 to 0.25
-add meshsmooth (1 or 2 iterations)
-and finally put a checker map on your model
(click visable in viewport...)
[proteus2002 have also found out that you can use a ramp map..
with quite better result.... but what to do with this ask him]

fin


- sorry but i even have to smile

:thumbsup: once again my respect for your script :thumbsup:
(i have really NO knowledge about writing something like that)

Xaya

Tony Richardson
04-11-2003, 07:27 PM
I put the script in the UI/macroscript directory but I can't locate it to apply a button.

What is it called? What should I be looking for and where?

Nice script!

proteus2002
04-11-2003, 07:43 PM
open the script with the max scripteditor and add some lines at the top of the script:

macroscript Smoothwire
category:"Smoothwire"
tooltip:"Smoothwire"
-- Icon:#("SW",1) -- no icon at the moment will do that



save it with the file-extension .mcr in ui/macroscripts.
next time you start max it will be available.

Nando
04-11-2003, 10:34 PM
proteus2002:

ive spoke to some folks/maxscripters, I know in the Brazil R/S channel and they are looking it over to see what they can doo, but dont promise anything ;)

Its a start

:thumbsup:

Tony Richardson
04-12-2003, 05:05 AM
proteius

I would suggest adding those lines to your script on the first page. It really helps to be able to find the script and assign a button.

Thanks for the help!

b1m2x3
04-12-2003, 07:03 AM
i JUST formatted... this made me jump to get my 3dsMAX back on.
this would make modeling so much easier... ive never used lightwave, so i cant wait to try this. :applause:

xynaria
04-12-2003, 11:25 AM
Great stuff Proteus, I really hope you can get this going.. looks very elegant. LW does some things very well and its smooth display is one of them.....how many times do you actually need to see the full mesh description under the poly cage.. right. Kudos. :)

gundog
04-12-2003, 06:55 PM
very cool. an option some max users have asked for.

proteus2002
04-14-2003, 07:39 PM
i saw that a lot of people have visited this thread.
is there nobody with some ideas or tips to improve the script?
just give me some hints how to make it update automatically, without reassigning the modifiers.
is it possible to write a scripted modifier, that does the same?
if yes, just give me some basic informations about how.

i have posted the same script on the discreet board in the maxscript section too. there it is available as a macroscript and the code has bracket offsets (i hope this makes it easier to read it).

ivo D
04-14-2003, 08:42 PM
damn.. i dont have any knowlidge of scripting what so ever

but maybe i have some solution.. or something to give you an idear.. if it really isnt possible to get it the lightwave way

could ther be set some copy.. in the smoothed one..that you cant see.. so when you click the vertexes you.. just move the unsmoothed mesh..but you dont see that mesh

than ther is a prob.. when you smooth.. the mesh always gets smaller.. but i think.. that is always the same value of scalling that ocures when adding a mesmooth.. so let the base object scale.. in some way..

make the vertexes just visible in edit poly.. and the edges never displayed.. only wen you select one.. that it gets vissible.. because the edge is at the same place as it is on the smoothed one..

thats why the base mesh has to be invisible and scaled.. so it fits the smoothed one.. as far as it is possible..

i have one request.. dont understand a damn thing of the script part..could you put it in a script file..so i can drop it in my max..and have a look ?


you have done a great thing!!!..

you have blown away discreet :P

robioto
04-15-2003, 02:25 AM
Ivo, just copy/paste it into notepad and save it as an .mcr then you can drag it into max.

then you can follow proteus's directions to add this to your ui...

open the script with the max scripteditor and add some lines at the top of the script:

macroscript Smoothwire
category:"Smoothwire"
tooltip:"Smoothwire"
-- Icon:#("SW",1) -- no icon at the moment will do that



save it with the file-extension .mcr in ui/macroscripts.
next time you start max it will be available.

If you read this entire thread the guys here show you how to get it into max, he dosen't need to post an .mcr file for you when you can do it yourself in less than a minute :)

MammaMuu
04-15-2003, 11:35 AM
First: the script looks great :), but i dont know anything about scripting so i cant make any sugesstions on improvments..

I would like to se another script that i think is in lightwave..
its a sphere but its not included i max..
You can make the sphere by making a box and then meshsmooth it twice.
What i would like to see is a script that can make this sphere where i can change the radius and the number of subdivisions without making it in steps.. first the box then meshsmooth..

as the meshsmooth makes the box lenght smaller a sphere with a radius of 50 is bigger than a box with a length of 50 with meshsmooth applied.. i think its bigger even with a lenght of 100..

EricChadwick
04-15-2003, 02:11 PM
Hmmm. Well there are a few ways you could try to make spheres similar to this, without needing scripts. As long as you want a sphere, that is.

1. Create a sphere primitive, increasing the segments.

2. Create a box primitive, add Meshsmooth, add Push.

3. Create a sphere primitive, increase segments, add a Spherify modifier.

4. Create a sphere primitive, convert to NURBS (or patches), increase subdivs.

Maybe you're thinking of more than just a sphere tho. Stab in the dark here...

MammaMuu
04-15-2003, 04:30 PM
Im gonna try to explain more i detail what i mean Posm...

When im modelling im always modelling low poly, and then later on subdivide it with meshsmooth, nothing special here.
If i want to have a round end of my mesh the most common way is to use the standard primitive sphere. But as they generate polygons with only 3 points i try to avoid them.
Geospheres has to many faces to begin with so they aren't that useful at all.
What i have found to be most useful is creating a box with 1 lenght, hight and width segment and then meshsmooth it.
This will give me a good sphere that looks the same att all x and y directions. The problem with doing this is that you dont get a perfect radius kontroll as you are basicly converting a box into a sphere..
What i would like to see is a script that adds this box sphere as a new primitive there i can select the radius the box will have when it have been subdivided.. I would also want do decide how many subdivisions the sphere will have..

I post it here cause i think this primitive is already implemented in lightwave and as we were talking about lightwave scripts to max i though i could just post my ideas here..

this is what i mean:

red: standard sphere
blue: box with meshsmooth
green: geosphere


http://www.solander.org/upload/3_spheres.jpg

EricChadwick
04-15-2003, 04:47 PM
Wouldn't be too hard to script this I imagine.

1. Create a cube, give it a few segments.
2. Add a Spherify modifier.
3. Add a Smooth modifier, give 1 smoothing group.

A few clicks too many. A script might put a nice GUI on it, let you choose radius (cube height/2), number of divisions (cube L segs/W segs/H segs), add the spherify/smoothing for you.

Besides, this gives me a perfect sphere, whereas MeshSmooth gives me a flat-ish one.

DDrake
04-16-2003, 12:57 AM
Really great script!
That style of modelling is one of the things i love most in XSI (I´m a MAX and XSI user).
It would be so cool that ends in something fast and smooth :D

GREAT WORK and Thanks for sharing!

Namroth
04-16-2003, 02:31 AM
Have you posted on discreet script forum, I think that there you can get more help.
http://support.discreet.com/webboard/wbpx.dll/~3dsmax

MammaMuu
04-16-2003, 10:16 AM
Originally posted by posm
Wouldn't be too hard to script this I imagine.

1. Create a cube, give it a few segments.
2. Add a Spherify modifier.
3. Add a Smooth modifier, give 1 smoothing group.

A few clicks too many. A script might put a nice GUI on it, let you choose radius (cube height/2), number of divisions (cube L segs/W segs/H segs), add the spherify/smoothing for you.

Besides, this gives me a perfect sphere, whereas MeshSmooth gives me a flat-ish one.

Your right, making the sphere your way makes the sphere more round and easyer to controll the length and subdivisions..
Would you mind helping me by making a script like that, with ui and all.. as i said before i cant script and you said yourself that the script wouldn't be to hard to make...

EricChadwick
04-16-2003, 02:00 PM
Sorry, not a scripter myself. Though it does look fairly easy, given the other script development I've seen.

JHN
04-19-2003, 12:22 PM
Originally posted by posm
Sorry, not a scripter myself. Though it does look fairly easy, given the other script development I've seen.

I also posted this on the discreetforum
I'm not exactly a maxscript crack here, still learning, but I looked into scripted plugins and I think it is not possible with a scripted plugin, because. If I understand this right, there's noway to edit your mesh with a scripted plugin, plz correct me if I'm wrong, or can you extent edit_mesh?

An other option is to "reinitialize" the editMesh plugin (cause this one doesn't update the selection and visibilty) every time a cut is made or edge is chamfert. I really think this is gonna be slow though.

Maybe with an event handler set the selection of the edit mesh and the visibilty of the edgeselection. I think that this would make a nice adition to the meshsmooth mod and EPoly object, it shouldn't be that hard to make the edges of a smoothing level dissapear, right?

GoodLuck,
JHN
check the maxscripts section (http://pong.hku.nl/~jhn/)

After writing this, I realize that there is a halfway solution... I have written a script that simply creates a meshsmooth mod. on top of the stack, and renames this. (I called it "Meshsmooth toggle" :surprised ) it would be easy to do the same trick and have it to toggle, still not auto updates, but more interactive...
I'll look in to this, if there is any interrest...

proteus2002
04-19-2003, 08:12 PM
hi jhj

for sure i am interested in your solution.

polymath
04-19-2003, 08:46 PM
lol, I've got no scripting skills whatso ever - I mean I couldn't even get that script to work. However, I was thinking possibly you could make the mesh derive its shape from splines - sorta like surface tools, except with more interactivity. I don't think its possible through scripts but i dunno, the mesh could be bound to the splines set to bezier or whatnot.

just tossing some ideas :)

lol, I just woke up so excuse any mistakes or vagueness ;)

JHN
04-20-2003, 03:28 PM
Ok, already some progress, we don't need the Turn to poly mod. Cause we can select all edges before adding the Emesh mod, simply invert edge slection in Emesh, done!

I'll keep you updated...

Cheers JHN

proteus2002
04-20-2003, 05:18 PM
hi jhn

i really appreciate your support. it seems that nobody of the other scripters here and on the discreet board are interested in helping me.

LFShade
04-20-2003, 07:48 PM
proteus2002 -
I've been occasionally checking in here to see if you've made any progress, but I'm reluctant to chip in because I don't have time to take on any new projects right now. If my time becomes a little more free I'd be interested in seeing if there's any way I could help the development of your script. Just off the top of my head, though, I can't think of any way to get auto-updates when the cage is edited without really slowing down the interactivity. There may be a way, but I'd have to spend some R&D time on it -- time I don't have at the moment.

Best of luck, though, as you continue the project!
-RH

JHN
04-20-2003, 08:07 PM
Yôh,

LFshade - Any pointers would be great...

Well, I'm currently trying to extend the Emesh mod with a plugin script, I thought this wasn't possible, but I got Emesh extendend in a simple test, so now I'm trying to figure out how to acces the edges and update the mod on stack changes, so maybe no script but a mod, even better I think. If anyone has some exerience with plugin scripts, plz join in.

I do second that this will NOT increase interactivity, cause Emesh is a big memory hog :argh: and this functionality should be included in the meshsmooth plugin and Epoly object.

Cheers JHN

googlo
04-20-2003, 09:11 PM
proteus2002

Hey, I did this really quick to help, I had to hurry thoug because I have to leave somewhere for the day.

You just have to press the popup dialogue's box on/off to switch between seeing smooth polylines or not.

It doesn't do a spline cage of the mesh (didn't have time for that), but it does make only the original edges of the poly visible. And when you check the button of the script again, it will remove the editmesh modifier and return everything they way it was before, except you will loose any edge subobject selections you had prior to using the script.

I'll copy and past the code below. Either run it in a new Maxscript editor window, or highlight the whole text and mouse drag it onto an open spot of a toolbar, and it will become a macroscript that you just have to click on to activate the script (this second way is better to me)

Make sure you are using NURMS activated from within the editable_poly object to see the results.

Here's the code:

rollout quickOutliner "Make Polylines"
(

checkbutton dotracker "SmoothPolyLines"

on dotracker changed arg1 do (

try (

if arg1 then (

polyOp.setEdgeSelection $ #All;update $
modPanel.addModToSelection (Edit_Mesh ()) ui:on
subobjectLevel = 2
max select invert
meshOps.invisibleEdge $.modifiers[1]
subobjectLevel = 0
modPanel.setCurrentObject $.baseObject
subobjectLevel = 0
$.showCage = off
showendresult=true
)
else(
try(
deleteModifier $ 1
)catch(
$.showCage = on
showendresult=false
)

$.showCage = on
showendresult=false

)
)
catch(
messageBox "Select an object that is at it's\nbase level an Editable Poly"
doTracker.state=false
)

)
)

pDialogue=newRolloutFloater "Smooth Polylines Thing" 150 75
addRollout quickOutliner pDialogue

JHN
04-20-2003, 09:22 PM
Cool, exactly like I had in mind...
Now for some auto update functionality... still working on a scripted mod though!...

We'll see....

proteus2002
04-21-2003, 12:55 AM
@jhn
i am really interested in your attempt to write a scripted mod. post here as soon as you make any progress.

@lfshade
thanks for tuning in. i hope you will find some time and have a look at it.

@ googlo
cool
this is really a good solution. if you agree, i will include this into my script later.
unfortunately i don`t have the time to work on the script at the moment. i am working on my diploma and i have only one month left. as soon as i am finished with this i will continue scripting.
but i hope that the development of the script will go on, without me.

thank you all for sharing your ideas and time.

LFShade
04-21-2003, 06:38 PM
I'm going to try and spend a few minutes looking into this tonight or tomorrow. I have some ideas I'd like to bounce off Max; I might have a way to get the automatic update working without too much lag (very iffy right now since I can't do any testing yet). I'll post the results as soon as I prove myself either right or wrong:)

JHN
04-22-2003, 10:33 AM
proteus2002: You're not the only one working on a diploma... I have 2 months left, and the deadline is closing fast, so don't expect an daily updates... :annoyed:

But this will work eventually, I'll post a wip as soon as it's working more proper...

everybody keep posting!

proteus2002
04-22-2003, 02:33 PM
jhn

no need to hurry.
i have made the experience that scripting is a lot of fun, but a timekiller. so don´t spend to much time on it right now. i have made the same "mistake". your diploma should be prior.
;)

Neox
04-22-2003, 02:42 PM
Interssant! ich schaus mir mal an sobald ich dazu komme :thumbsup:

what about the performance when using this script?

proteus2002
04-22-2003, 04:03 PM
the performance on mid and hires models with iterations set to more than 1 is rather slow (also depends on the hardware you are using).
i recommend setting the iterations to 1, to get an impression of the edgeflow and keep working fluently.
if you mainly work on the basemesh and use the script only for checking the smoothlines or visualisation you can set the iterations higher.
make sure you also check the script googlo posted here. it is slightly faster, because it doesn´t need the "convert_to_poly"-modifier.

also keep in mind what tamas varga posted in the "theoretical sub-d" thread. he had a legitim issue with working like this:

"Regarding Lightwave's subpatch preview, I generally don't like it. It encourages the bad habit of trying to work with too few polygons, and also what's called 'crossover'. ......, where polygons are overlapping each other so that the smoothed mesh will get the desired curvature... It'll bite you when you try to animate or texture your model. "

but nevertheless try it

proteus2002

googlo
04-22-2003, 06:18 PM
Hey,
Here's the fixed version from the earlier post. I was playing around with the original version and realized that Max would crash when one tried to undo things. This version also doesn't interfere with sub-object selections at the base level of the object like the other one did (it would erase them), now it doesn't.

Also it has an update button now. Update is for changes to the mesh while the utility is active. You can still double click on teh activate button (off then on essentially), but that takes two clicks everytime, as opposed to just one click for the update button after it's been activated.

I also modified how it was done internally, I think it's faster and more efficient with less reopening of mod panal/sub selections.
Just copy it like before into a new maxscript editor window and ctrl-e to run it or highlight it all and drag it over to a blank spot on a tool bar to make it into a macroscript (push button to activate).

rollout quickOutliner "Show Polylines"
(

local originalss

checkbutton dotracker "Activate Polylines"
button updater "Update Polylines" enabled:false
checkBox cageshow "Show Poly Cage" enabled:false


on cageshow changed arg1 do ( if arg1 \
then ($.showcage=true) else ($.showcage=false)
)

on dotracker changed arg1 do (

undo off ( -- prevents enclosed code from crashing max
-- when trying to undy history to the object
-- but doesn't actually affect undo history
-- of anything else outside of the paranthesis
-- i.e. actual editing history of the
-- editable poly is safe :)

originalss=subObjectLevel --*used so the utility can
-- can keep track of user
-- subselections

try (

if arg1 then (

dotracker.caption="Deactivate Polylines"
cageshow.enabled=true
updater.enabled=true
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on --*applies editMesh modifier to polyobject
z=copy $.baseObject --*Stores poly info in variable
polyOp.setEdgeSelection z #All --*sets poly edges internally
z.surfsubdivide=$.baseObject.surfSubDivide; --*performs what has happend
z.iterations=$.baseObject.iterations --to the poly object in Max
--to the poly object in the
--variable
y=z.mesh; --*Convert and store the poly object into y
-- NURMS Results 'baked' into mesh object and as a result
-- poly subobject selections are carried over
-- as well :)
yes=getEdgeSelection y -- get the mesh edges that are selected

setEdgeSelection $ $.modifiers["Polylines"] -yes --*Invert selection and apply to

-- them to the editMesh modifier
modPanel.setCurrentObject $.modifiers["Polylines"] --*Make all selected edges in
subobjectLevel = 2 --mesh modifier invisible
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject --*resets the modify panel back to the
subObjectLevel=originalss -- the poly object level and user
-- subobject selection
showendresult=true --*Places focus at top of the modifier stack so smooth
-- polylines will be seen while still at editable poly
-- level
)
else(
try( --*this causes the utility to not explode if there isn't
deleteModifier $ $.modifiers["Polylines"] -- a modifer to delete (editMesh)
updater.enabled=false
cageshow.enabled=true
dotracker.caption="Activate Polylines"
showendresult=true
subObjectLevel=originalss
)catch(
)
)
)
catch(
messageBox "Select an object that is at it's\nbase level an Editable Poly"
doTracker.state=false
)

) -- undo context end
)-- dotracker button end


on updater pressed do (
undo off (
originalss=subObjectLevel
deleteModifier $ $.modifiers["Polylines"]
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on
z=copy $.baseObject
polyOp.setEdgeSelection z #All
z.surfsubdivide=$.baseObject.surfSubDivide;
z.iterations=$.baseObject.iterations
y=z.mesh
yes=getEdgeSelection y
setEdgeSelection $ $.modifiers["Polylines"] -yes
modPanel.setCurrentObject $.modifiers["Polylines"]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject
subObjectLevel=originalss
showendresult=true
)
) -- end updater button
)

pDialogue=newRolloutFloater "Smooth Polylines Thing" 150 120
addRollout quickOutliner pDialogue


If there was a way that edges could be hidden in the EditMesh modifier without having to directly go up to it in the mod panel, then open it's edge subobject level to use the meshOp edge hiding stuff, I think it would be pretty easy to get it to update automatically.

I thought about setting up a change handler to monitor the poly's topology, and then just run this script when the topology changes, but one of the problems is that it crashes every time because while one is extruding, etc, the topology is changing constantly and so Max is trying to move to the right place in the modifier stack, open panels, select subobject levels, etc.. All of which is way to slow to keep up with the practically instantaneous calls to do all of that over and over again as the topoplogy is repeatedly registering as changed.

At least I think that's why Max is crashing.

Then I thought that maybe there could be a way to extend the Mesh modifier as scripted plugin and make it's ui invisible, so that all the commands could be used, but without all of the active ui visually changing. I don't have that much experience (ok none) with writing scripted extended plugins.

I tried it, but Max would crash then too, I think because when I told the scripted modifier to go to the ui that was hidden, it didn't really have a ui to go to and so it would get 'confused' and crash.

So then I tried a normal utility floater type of script that would just use a change handler that could somehow selectively tell when the topology changed at the right time to activat the internal edge hiding part of the script.

I've gotten it to work with one click-then-drag editing (live update works :) ) like when extruding a poly, but when it comes to click-drag-drag like bevelling a poly, it crashes because I haven't figured out a way yet to tell the difference between when someone is click-drag-drag'ing for something like bevelling as opposed to click-drag-drag'ing because they finished and are just moving the mouse, like after extruding.


Really, I think the block to getting this whole thing to update automatically is that regardless if how it's down, we still have to go to the editMesh level of the stack with the mod panel open and be at the edge Sub Object level to use the meshOp command for invisiblizing specific edges.

I think if we didn't have to do that, we could use a change handler watching the objects topology without it having any crash problems.

I gave up on trying to just hide edges on the base poly while it's in NURMS subdivision mode. I don't think there is any maxscript access granted for that.

Anyone know if there is?

like if you look at it while it's like at some Nurm's iteration (and prior to that some edges were already hidden) you can see how the topology has changed via the highlighed edges, but the only acces we have at that level with maxscript is BEFORE the NURMS algorithm as been applied, not after, unless we add an editMesh modifier or something similar on top of it to capture the change.

But all of the topology dependent modifiers like EditMesh don't have any options for procedurally updating themselves if the underlying topology changes. It's like they just capture what has happend below them the moment they are applied and that's it, once it's done, it's done! And I don't think there is a way in Maxscript to tell a modifier like that to update or 'look' again at what has happend below and reacquire the changes automatically.

Example:

Make box with only 6 polys/faces ie. with only 1 segments for it's legnth,width, and hieght.

Convert it to an editable poly.

Then apply a level 3 NURM'ing :).

If you apply say level 3 iterations in the NURMS subd part of the editable poly and then type this into the listener window and hit enter;

polyOp.setEdgeSelection $ #All;polyOp.getEdgeSelection $

You should get;

OK
#{1..12}

Which is how many there should be for a 6 sided cube, but obviously the NURMS preview shows that the result is many more than that.

I wonder if there is a way to tell the preview edges to remain invisible without having to 'bake' the results higher up the stack above the base poly object, finagle this and that, etc, to get rid of them?

Neox
04-22-2003, 06:25 PM
ok i'll test it out asap... and i'm always modelling with just one iterations, because working on complex meshes with 2 Iterations is just a pain ;)

LFShade
04-22-2003, 07:36 PM
I tried a couple of ideas out last night. The first was actually similar to googlo's version, trying as much as possible to optimize the process. While faster than the original version, it unfortunately still suffers crippling problems when you try to make it update automatically. My second experiment called on an idea I had used in my CleanCut and DeselectLoop scripts: drawing the edges in with calls to gw. This offered the advantage of a much faster update (no modifiers required) and supported auto-updates without crashing, but was still way too slow working with a reasonable poly count. It also introduced some distracting visual artifacts such as flickering and "x-ray-ing" through the object. In other words, it's back-end worked better than the invisibleEdges method, but the visuals suffered beyond useability IMO.

I've pretty much come to the conclusion that this probably isn't viable through scripting. The speed and interactivity that is required on anything more than a small number of polygons really seems more in the domain of highly optimized drawing code, written into a plugin dll. Ideally, this would be incorporated directly into the Editable Poly object itself. I am not a C++ programmer, so I won't volunteer for that project;)

-RH

proteus2002
04-22-2003, 08:32 PM
@googlo
that is cool.
my original script has many unnecessary stuff in it. your version is reduced to the important thing. :thumbsup:

I gave up on trying to just hide edges on the base poly while it's in NURMS subdivision mode. I don't think there is any maxscript access granted for that.
i tried the same, but failed too.

I wonder if there is a way to tell the preview edges to remain invisible without having to 'bake' the results higher up the stack above the base poly object, finagle this and that, etc, to get rid of them?
i had the idea with setting edgeflags. but i found no way to get or set the edgeflags in the e-mesh modifier.

@lfshade
i think you are right. the best way is to write a c++ plugin for that purpose. thank you anyway, for having a look.

@neox
hau rein. i hoffe wir lernen uns mal kennen auf dem nächsten ttt.

JHN
04-22-2003, 09:32 PM
What's up with this german stuff. Ik ga toch ook niet in één keer nederlands praten :p

But indeed there's noway this plugin/script will be fast, but still it would be nice for visualisation/screengrabs... So I will try to continue this scripted plugin

Ahwel gute nachte! ofzo... :thumbsup:

Cheers Johan

S_3D_A
04-23-2003, 12:25 AM
Wow this is really sweet guys. Been awhile since I've been back to the max forum. I usually surf the WIP and general forums but this is a god send if you can get this up and running. I'm going to have to test this out but I originally started out using lightwave 5.0 through 6.6 and I have to tell you smoothwire helped alot.

I plan to definitly watch this thread closely.

Neox
04-23-2003, 08:30 AM
@JHN: Zum Glück ist holländisch relativ nah am deutschen, so dass ich einigermaßen verstehe was du mir sagen willst :D

achso guten Morgen :D

@Proteus: Ich werde da sein, als TTT Veteran kann ich doch nicht fehlen ;)

@all stupid lowpoly stuff, i have currently no need of this script :/

JHN
04-23-2003, 11:09 AM
@all stupid lowpoly stuff, i have currently no need of this script :/

wow...

googlo
04-23-2003, 11:21 AM
Well, that's fine, but the attitude about it isn't! Just disregard the thread; you don't have to take it so seriously

proteus2002
04-23-2003, 12:01 PM
here are some people working on a free script to aid nurms modelling, which is in my opinion far away from "stupid lowpoly stuff". if you don´t need it, just don´t use it. but there is no need to be impolite.

2LoOp
04-25-2003, 08:40 AM
Hi all, i write litle script
for simulate LightWave Smooth on 3dsMax
him dont create any spline or something else
just hide any edge...
i think it's don't slow your viewport, and work
also fast(or slow) as standard meshsmooth.
tnx, check it =)))

=== here begin script ===

----------------------------------------------------------------------
--- LightWave Smooth Style For 3ds Max5 by 2LoOp <2lp@nm.ru> --
--- Version 0.7 Alpha --
----------------------------------------------------------------------
--- Put this script to the 3dsmax5\UI\Macroscripts folder or just ---
--- drag into max viewport, restart max and go to Customize UI ---
--- menu, under category lptools you can find LWSmooth ---
----------------------------------------------------------------------

macroScript LWSmooth
category:"lptools"
tooltip:"LWSmooth"
buttontext:"LWSmooth"
(

rollout LWStyle "LWStyleSmooth" width:152 height:88
(
groupBox grp1 "LW-Style Smooth Control" pos:[7,13] width:138 height:59
button btn3 "On" pos:[27,29] width:48 height:15
button btn4 "Off" pos:[75,29] width:48 height:15
spinner spn4 "Interatinos:" pos:[37,50] width:86 height:16 range:[0,5,3]type:#integer scale:1
on btn4 pressed do
(
deleteModifier $ 1
deleteModifier $ 1
max select none
$.surfSubdivide = off
)

on btn3 pressed do
(
subobjectLevel = 2
max select all
$.iterations = spn4.value
$.surfSubdivide = on
modPanel.addModToSelection (Turn_to_Mesh ()) ui:on
$Box02.modifiers[#Turn_to_Mesh].selectionConversion = 2
modPanel.addModToSelection (Edit_Mesh ()) ui:on
subobjectLevel = 2
macros.run "Editable Mesh Object" "EMesh_EInVisible"
max select none
)
)
createDialog lwstyle width:152 height:88
)

=== End Script ===

Neox
04-25-2003, 08:53 AM
i guess...
...you understood me wrong :(

i'm working in a game company, and i have nothing to do highpoly right now, so i currently have no need of this script, but as i promised i'll test it asap :thumbsup:

as i said before i like the idea of that script how could i change my mind by 180 degrees?! :D

...
..
.

so keep up the good work

:beer:

googlo
04-25-2003, 10:48 AM
Sorry Neox, I totally thought that you meant low poly modelling was stupid and that's why you had no need.

2loop, nice to join, what people are talking about though is a modifier or script to hide all of the edges produced by the NURMS process other than those that are directly descended from the original mesh, if possible automatically

Neox
04-25-2003, 10:52 AM
no problem maybe its just my f****** english :D

2LoOp
04-25-2003, 11:03 AM
sorry i post code error =)))

change this
===
modPanel.addModToSelection (Turn_to_Mesh ()) ui:on
$Box02.modifiers[#Turn_to_Mesh].selectionConversion = 2
modPanel.addModToSelection (Edit_Mesh ()) ui:on
===
to
===
modPanel.addModToSelection (Turn_to_Mesh ()) ui:on
$.modifiers[#Turn_to_Mesh].selectionConversion = 2
$.modifiers[#Turn_to_Mesh].selectionLevel = 3
modPanel.addModToSelection (Edit_Mesh ()) ui:on
===

2LoOp
04-25-2003, 11:05 AM
googlo, ok i shall try do this..

byzantium
04-25-2003, 11:59 AM
2LoOp, your script works fine with some shapes and doesn't work with other (like a simple poly cube).
With this shape it works! :cool: :shrug:

proteus2002
04-25-2003, 12:20 PM
@ neox
sorry. :)
i totally misunderstood you, too. i thought you were talking about the whole thread.
my english is also very "eingeschlafen"

@ 2LoOp
thanks for joining. :thumbsup:

@ all
i am really glad that this thread has so many response. keep it up.

Libor
04-25-2003, 01:50 PM
Hi everybody!! Its really nice from you that you are writing scripts like this! I think many maxers appreciate it!

Regarding max´s display of SubDs I read somewhere that max actually doesnt have true SubD and algorithms are very old and slow (since max 2.5) compared to competition so thats probably the reason why model wires looks like this :thumbsdow (just my opinion) I know shit about tech. aspect of them so correct me if Im wrong.

However I ve found max´s poly tools are the great in terms of workflow so keep trying guys it could be definetely huge improvement!!!

Well, its time to shut up....

Just wanted to say thank you
:thumbsup:

JHN
04-25-2003, 02:19 PM
Neox: Ok cool!:beer: Dan is dat ook weer uit de wereld :)

Libor: check this thread for some more info on SubD's very interresting -> Subd's (http://www.cgtalk.com/showthread.php?s=&threadid=40373)

2loop: Some general tips, don't use "$" but "selection" or "selection[1]" it is easy then to loop trough a selection, with $ it would be hard! Look it up in the manual!

Cheers JHN

Signal2Noise
04-25-2003, 02:24 PM
You had me at 'hi'.:love:

2LoOp
04-25-2003, 03:53 PM
so this is final version on today

separate thanks to googlo for his "Smooth Polylines Thing"
whence i have stolen several things

JHN i never before write scripts :rolleyes:
tnx for tips

===start code===

----------------------------------------------------------------------
--- LightWave Smooth Style For 3ds Max5 by 2LoOp <2lp@nm.ru> --
--- Version 1.0 beta --
----------------------------------------------------------------------
--- Put this script to the 3dsmax5\UI\Macroscripts folder or just ---
--- drag into max viewport, after restart max and go to costomize ---
--- menu and under category lptools you find LWSmooth ---
----------------------------------------------------------------------

macroScript LWSmooth
category:"lptools"
tooltip:"LWSmooth"
buttontext:"LWSmooth"
(
rollout LWSmooth "LWSmooth Control" width:162 height:61
(
checkButton ckb2 "Smooth" pos:[99,15] width:48 height:16
checkbox chk2 "Editable?" pos:[65,34] width:71 height:21
spinner spn1 "Interations:" pos:[20,16] width:75 height:16 range:[0,5,3] type:#integer
on ckb2 changed state do
(
if state then
(

try
(
polyOp.setEdgeSelection $ #All;update $
modPanel.addModToSelection (Edit_Mesh name:"LWSmooth") ui:on
subobjectLevel = 2
$.iterations = spn1.value
$.surfSubdivide = on
max select invert
meshOps.invisibleEdge $.modifiers[1]
max select none
modPanel.setCurrentObject $.baseObject
subobjectLevel = 0
$.showCage = off
showendresult=true
)
catch( messageBox "Work only with Editable Poly" )
)
else
(

try(
deleteModifier $ $.modifiers["LWSmooth"]
$.surfSubdivide = off
showendresult=false
)
catch ( messageBox "Nothing to off")
)
)
on chk2 changed state do
if state then
($.showCage = on)
else
($.showCage = off)
)
LW=newRolloutFloater "LWSmooth" 162 91
addRollout LWSmooth LW
)

===end code===

Neox
04-25-2003, 04:18 PM
Originally posted by JHN
Neox: Ok cool!:beer: Dan is dat ook weer uit de wereld :)


hehe i hope so :)

thedaemon
04-26-2003, 05:36 AM
Any new updates? I just found this and I find it really neat, and possibly greatly useful. If its true, what LFShade said, that it would have to be a .dll, I wish someone could write it :) anyways, nice work on the scripting people!

xasteycracker
04-26-2003, 06:49 PM
WTF one minute you maxers say you hate lightwave and the next minute you are trying to steal some of lightwave stuff. As an lightwave user i have to say that you need to make up your mind and stop using lightwave stuff if you say it is crap.

googlo
04-26-2003, 07:04 PM
cracker..

Go rant somewhere else please, this has nothing to do with that and it's not the purpose of this thread nor is it constructive.

Some people here like to use lightwave as well and would like to see something similar in Max, that's all. It's really not the kind of issue you are making it out to be..

Don't turn this into some kind of software war issue!

xasteycracker
04-26-2003, 08:11 PM
Originally posted by googlo
cracker..

Go rant somewhere else please, this has nothing to do with that and it's not the purpose of this thread nor is it constructive.

Some people here like to use lightwave as well and would like to see something similar in Max, that's all. It's really not the kind of issue you are making it out to be..

Don't turn this into some kind of software war issue!

Hey i wasn't trying to come off in a bad way. sometime iam no good with words. all i was doing was stating some facts. But the script stays true to lightwave subpacth. Great work. And soory again for getting anyone mad.

ThirdEye
04-26-2003, 08:35 PM
xasteycracker: lose this attitude please.

googlo
04-26-2003, 09:17 PM
It's ok, :)


Hey everyone check this out! This version updates automatically! the only place (of those that i've tested) that doesn't work right is the 'slice plane' option in the geometry rollout for the polyobject, the other slicing options seeme to be working. It 'deson't crash or anything it just boots out the slice plane without there being any effect, but it seems to work with most all the poly editing features like 'bevel' 'extrued' 'poly hinge around edge' 'connect edges', cut, etc.. Even cutting works so far


I haven't set up the interface of the script to be anything speical, but it works really good I think.

Remember in order to use it, copy the script text from the quote below holidng it all and either run it directly in Max by pasting it into a new maxscript editor window and then pressing Ctrl-e at the same time to start it, or copy and past it into a new maxscript editor window and then click-drag the entire contents of the script onto a blank space of a toolbar (like the helper one--it has a lot of extra space on it) then it will become available as a push button just like a macroscript. if you want to name it right click on the macroscript and then choose "Edit appearanc" there you can select the naming option and give ithe macroscript button a name.


The script basically uses two timer items available for you use in rollouts; one to check the mesh for topology changes every millisecond and another one to handle when the auto-updating should occur to the mesh. They 'signal' each other when to activate and when to deactate.

Anyway, here it is:


--Beginning of polylines script

rollout quickOutliner "Polylines"
(

local x,y,z
local OM
local originalss

checkbutton dotracker "Activate Polylines"
button updater "Update Polylines" enabled:false
checkBox cageshow "Show Poly Cage" enabled:false
checkBox autoupdater "Auto Update" enabled:false
timer topochecker interval:1 active:false
timer topoedit interval:1 active:false

on quickOutliner open do (

try (If $.showcage=true then cageshow.checked=true else cageshow.checked=false)\
catch (messageBox "Must have an editable poly object\nselected first.")
)

on cageshow changed arg1 do ( if arg1 \
then ($.showcage=true) else ($.showcage=false)
)


on dotracker changed arg1 do (

undo off ( -- prevents enclosed code from crashing max
-- when trying to undy history to the object
-- but doesn't actually affect undo history
-- of anything else outside of the paranthesis
-- i.e. actual editing history of the
-- editable poly is safe

originalss=subObjectLevel --*used so the utility can
-- can keep track of user
-- subselections

try (

if arg1 then (

OM=($.mesh).numverts

dotracker.caption="Deactivate Polylines"
autoupdater.enabled=true
cageshow.enabled=true
updater.enabled=true
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on --*applies editMesh modifier to polyobject
z=copy $.baseObject --*Stores poly info in variable
polyOp.setEdgeSelection z #All --*sets poly edges internally
z.surfsubdivide=$.baseObject.surfSubDivide; --*performs what has happend
z.iterations=$.baseObject.iterations --to the poly object in Max
--to the poly object in the
--variable
y=z.mesh; --*Convert and store the poly object into y
-- NURMS Results 'baked' into mesh object and as a result
-- poly subobject selections are carried over
-- as well
yes=getEdgeSelection y -- get the mesh edges that are selected

setEdgeSelection $ $.modifiers["Polylines"] -yes --*Invert selection and apply to
-- them to the editMesh modifier
modPanel.setCurrentObject $.modifiers["Polylines"] --*Make all selected edges in
subobjectLevel = 2 --mesh modifier invisible
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject --*resets the modify panel back to the
subObjectLevel=originalss -- the poly object level and user
-- subobject selection
showendresult=true --*Places focus at top of the modifier stack so smooth
-- polylines will be seen while still at editable poly
-- level


)
else(
try(--*this causes the utility to not explode if there isn't
autoupdater.checked=false
autoupdater.enabled=false
topochecker.active=false
deleteModifier $ $.modifiers["Polylines"]-- a modifer to delete (editMesh)
updater.enabled=false
cageshow.enabled=false
dotracker.caption="Activate Polylines"
showendresult=true
subObjectLevel=originalss
)catch()
)
)
catch(
messageBox "Select an object that is at it's\nbase level an Editable Poly"
deleteModifier $ $.modifiers["Polylines"]
doTracker.state=false
)

) -- undo context end
)-- dotracker button end


on updater pressed do (
undo off (
originalss=subObjectLevel
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on
deleteModifier $ $.modifiers["Polylines"]
z=copy $.baseObject
polyOp.setEdgeSelection z #All
z.surfsubdivide=$.baseObject.surfSubDivide;
z.iterations=$.baseObject.iterations
y=z.mesh
yes=getEdgeSelection y
setEdgeSelection $ $.modifiers["Polylines"] -yes

modPanel.setCurrentObject $.modifiers["Polylines"]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject
subObjectLevel=originalss
showendresult=true
)
) -- end updater button
--===============================THIS PART HANDLES THE TOPOLOGY CHECKING AND Auto-UPDATING==========================
on autoupdater changed arg1 do (
if arg1 then topochecker.active=true else (topochecker.active=false;topoedit.active=false)
) -- end of autoupdater check box

on topochecker tick do (
--print "topochecker, checking..."
if (OM!=($.mesh).numverts) then (topoedit.active=true;topochecker.active=false)
if topochecker.ticks==5000 then gc()
) -- end of mtopopchecker timer

on topoedit tick do (
state1=(mouse.buttonStates[1]==true and (mouse.mode==2 or mouse.mode==1))
state2=(mouse.buttonStates[1]==false and (mouse.mode==2 or mouse.mode==1))
state3=(mouse.buttonStates[1]==true and mouse.buttonStates[3]==true)
--print "topedit checking..."

if state3 then (topochecker.active=true;topoedit.active=false) else (

if (state1 or state2) then () else (--print "update Mesh"

undo off(
originalss=subObjectLevel
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on
deleteModifier $ $.modifiers["Polylines"]
z=copy $.baseObject
polyOp.setEdgeSelection z #All
z.surfsubdivide=$.baseObject.surfSubDivide;
z.iterations=$.baseObject.iterations
y=z.mesh
yes=getEdgeSelection y
setEdgeSelection $ $.modifiers["Polylines"] -yes
modPanel.setCurrentObject $.modifiers["Polylines"]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject
subObjectLevel=originalss


showendresult=true;
)

OM=($.mesh).numverts;topochecker.active=true;topoedit.active=false

)

if topoedit.ticks==5000 then gc()
) -- end of topoedit timer



)
)
createDialog quickOutliner style:#style_toolwindow

--End of polyline script

proteus2002
04-26-2003, 09:43 PM
googlo

really great. it works.
btw. you forgot a " ) " before the createdialog command.

googlo
04-26-2003, 09:51 PM
Thanks Proteus.


thanks for catching that error too, I edited the post and fixed it :)

I should also have said that the 'auto update' has to be turned by checking the "auto update' option in the dialog that appears.

I left the manual update button in just in case it was needed for updating where the automatic way might fail.

proteus2002
04-26-2003, 10:04 PM
another issue i found

the auto update increases the memory usage. the gc() function seems not to work as it should. open task manager and take a look at the memory usage.

ivo D
04-27-2003, 03:08 PM
i have pasted the script and run it.. the poly lines..but it doesnt work..asks for a entity..that is an editable poly at its base mesh..

so i make a box.. set it to edit poly.. than use the script.. but it doesnt do anything??!

it just gives another sort of edit poly modifier..dont see the differents in them..:(

Neox
04-27-2003, 03:17 PM
yep same here.. nothing changes... ehere do i have to put it in the stack? i had it over the epoly and on top of the stack, nothing happened

ivo D
04-27-2003, 03:20 PM
and this is another script.. than the one with the lightwave lines right..caus i dont get it anymore:P

nadeemmar
04-27-2003, 03:20 PM
it works with me
and it is really fast

thanx googlo:thumbsup: :thumbsup:

ivo D
04-27-2003, 03:21 PM
oke..for the people who got it to work.. explain it step by step plz... caus maybe i am doing somthing wrong...

proteus2002
04-27-2003, 03:26 PM
@ neox & ivo d

i guess you forgot something:
in the editable poly baseobj you have to switch the "use nurms subdivision" on, and set the iterations higher than 0.
also make sure that your viewport is set to edged faces.

googlo
04-27-2003, 03:31 PM
proteus,

I was able to fix the memory problem. Apparently while the timer is running Max isn't cleaning something up with memory internally unless the garbage collector is manually invoked (I just changed how/when it was evoked from the previous script).. It's fixed now, but at the consequence of flushing out the undo history.

So if you want to use 'auto update', go ahead, it's fixed but an undo history won't be kept.

If you want to have undo history maintaned, or on/off throughout editing, then switch to manual mode when needed. Just remember that using auto updating erases the undo history each time it is used.

ivo D,

It should work. This isn't a script for actually doing smooth poly line editing like in Lightwave, this is mainly for visual purposes, like an aid to viewing the mesh and the 'true' polylines that directly involved with the editing process.


Here's the new script:



--Script beginning

--This way works without the internal memory growing forever problem, but at the cost of
--flushing out the undo buffer. i.e.: You can't undo anything once it's done
--unless you use the manual update button instead of the auto update
--option

rollout quickOutliner "Polyline Viewer"
(

local x,y,z
local OM
local originalss

checkbutton actDeactChButton "Create Polylines"
button updateButton "Update Polylines" enabled:false
checkBox cageshow "Show Poly Cage" enabled:false
checkBox autoupdateChecker "Auto Update" enabled:false
button closeButton "Close"
timer topochecker interval:1 active:false
timer topoedit interval:1 active:false

on quickOutliner open do (

try (If $.showcage=true then cageshow.checked=true else cageshow.checked=false)\
catch (messageBox "Must have an editable poly object\nselected first.")
)

on cageshow changed arg1 do ( if arg1 \
then ($.showcage=true) else ($.showcage=false)
)


on actDeactChButton changed arg1 do (

undo off ( -- prevents enclosed code from crashing max
-- when trying to undy history to the object
-- but doesn't actually affect undo history
-- of anything else outside of the paranthesis
-- i.e. actual editing history of the
-- editable poly is safe

originalss=subObjectLevel --*used so the utility can
-- can keep track of user
-- subselections

try (

if arg1 then (

OM=($.mesh).numverts

actDeactChButton.caption="Remove Polylines"
autoupdateChecker.enabled=true
cageshow.enabled=true
updateButton.enabled=true
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on --*applies editMesh modifier to polyobject
z=copy $.baseObject --*Stores poly info in variable
polyOp.setEdgeSelection z #All --*sets poly edges internally
z.surfsubdivide=$.baseObject.surfSubDivide; --*performs what has happend
z.iterations=$.baseObject.iterations --to the poly object in Max
--to the poly object in the
--variable
y=z.mesh; --*Convert and store the poly object into y
-- NURMS Results 'baked' into mesh object and as a result
-- poly subobject selections are carried over
-- as well
yes=getEdgeSelection y -- get the mesh edges that are selected

setEdgeSelection $ $.modifiers["Polylines"] -yes --*Invert selection and apply to
-- them to the editMesh modifier
modPanel.setCurrentObject $.modifiers["Polylines"] --*Make all selected edges in
subobjectLevel = 2 --mesh modifier invisible
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject --*resets the modify panel back to the
subObjectLevel=originalss -- the poly object level and user
-- subobject selection
showendresult=true --*Places focus at top of the modifier stack so smooth
-- polylines will be seen while still at editable poly
-- level


)
else(
try(--*this causes the utility to not explode if there isn't
autoupdateChecker.checked=false
autoupdateChecker.enabled=false
topochecker.active=false
deleteModifier $ $.modifiers["Polylines"]-- a modifer to delete (editMesh)
updateButton.enabled=false
cageshow.enabled=false
actDeactChButton.caption="Create Polylines"
showendresult=true
subObjectLevel=originalss
)catch( print "Error occured when check button turned off")
)
)
catch(
messageBox "Select an object that is at it's\nbase level an Editable Poly"
deleteModifier $ $.modifiers["Polylines"]
actDeactChButton.state=false
)

) -- undo context end
)-- actDeactChButton button end


on updateButton pressed do (
undo off (
originalss=subObjectLevel
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on
deleteModifier $ $.modifiers["Polylines"]
z=copy $.baseObject
polyOp.setEdgeSelection z #All
z.surfsubdivide=$.baseObject.surfSubDivide;
z.iterations=$.baseObject.iterations
y=z.mesh
yes=getEdgeSelection y
setEdgeSelection $ $.modifiers["Polylines"] -yes

modPanel.setCurrentObject $.modifiers["Polylines"]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject
subObjectLevel=originalss
showendresult=true
)
) -- end updateButton button

on closeButton pressed do (DestroyDialog quickOutliner
)-- end closeButton
--===============================THIS PART HANDLES THE TOPOLOGY CHECKING AND Auto-UPDATING==========================
on autoupdateChecker changed arg1 do (
if arg1 then (topochecker.active=true;updateButton.enabled=false) else (topochecker.active=false;topoedit.active=false;\
updateButton.enabled=true)
) -- end of autoupdateChecker check box

on topochecker tick do (
--print "topochecker, checking..."
if (OM!=($.mesh).numverts) then (topoedit.active=true;topochecker.active=false)
--topochecker.ticks=0
gc()
) -- end of mtopopchecker timer

on topoedit tick do (

try(
state1=(mouse.buttonStates[1]==true and (mouse.mode==2 or mouse.mode==1))
state2=(mouse.buttonStates[1]==false and (mouse.mode==2 or mouse.mode==1))
state3=(mouse.buttonStates[1]==true and mouse.buttonStates[3]==true)
--print "topedit checking..."

if state3 then (topochecker.active=true;topoedit.active=false) else (

if (state1 or state2) then () else (--print "update Mesh"

undo off(
originalss=subObjectLevel
modPanel.addModToSelection (Edit_Mesh name:"Polylines") ui:on
deleteModifier $ $.modifiers["Polylines"]
z=copy $.baseObject
polyOp.setEdgeSelection z #All
z.surfsubdivide=$.baseObject.surfSubDivide;
z.iterations=$.baseObject.iterations
y=z.mesh
yes=getEdgeSelection y
setEdgeSelection $ $.modifiers["Polylines"] -yes
modPanel.setCurrentObject $.modifiers["Polylines"]
subobjectLevel = 2
meshOps.invisibleEdge $.modifiers["Polylines"]
subObjectLevel = 0
modPanel.setCurrentObject $.baseObject
subObjectLevel=originalss

showendresult=true;

)

OM=($.mesh).numverts;topochecker.active=true;topoedit.active=false)

)

)catch(print "Error occured within topoedit timer")
) -- end of topoedit timer



)

createDialog quickOutliner style:#style_toolwindow width:115 height:125


--End of Script

googlo
04-27-2003, 03:37 PM
nadeemmar,

Thanks, Proteus is the one that started it all :wavey:

proteus2002
04-27-2003, 03:40 PM
hi googlo

haven´t tried it yet, but i am sure it works. ;)
maybe there is a solution to maintain the undo history.

really great work :thumbsup:

2LoOp
04-27-2003, 07:46 PM
wow googlo good idea with timer :thumbsup:


btw here my updated script..
i remove the user interface,
and add options dialog, all
settings store in dat file

check it


----------------------------------------------------------------------
--- LightWave Smooth Style For 3ds Max5 by 2LoOp <2lp@nm.ru>
--- Version 1.8 beta
----------------------------------------------------------------------
--- Put this script to the 3dsmax5\UI\Macroscripts folder or just
--- drag into max viewport, after restart max and go to customize
--- menu and under category lptools you find LWSmooth and LWShowCage
----------------------------------------------------------------------

macroScript LWSmooth
category:"lptools"
tooltip:"LWSmooth"
buttontext:"LWSmooth"
(
if (selection.count == 1) then (
--read info from store file
fn existFile fname = (getfiles fname).count != 0
_fo=((GetDir #scripts)+"\LWSmooth.dat")
if not existFile(_fo) then --dat file not exist, create him with default setings
(
_AutoConvert=1
_ShowCage=0
_Interations=2
_SeeThrough=0
_output =_AutoConvert as string + _ShowCage as string + _Interations as string + _SeeThrough as string
_fw=createfile _fp
format _output to:_fw
close _fw
)
_fr=openfile _fo
_ac=readchar _fr --AutoConvert
_sc=readchar _fr --ShowCage
_di=readchar _fr --Derault Interations
_st=readchar _fr --SeeThrough
close _fr
--end read


try (modPanel.getModifierIndex $ selection[1].modifiers[#LWSmooth];_present=true)
catch (_present=false)

if _present then
(
_sobjlvl=subobjectLevel
deleteModifier $ $.modifiers["LWSmooth"]
$.surfSubdivide = off
showendresult=false
subobjectLevel=_sobjlvl
selection[1].visibility = true
if subobjectLevel !=0 then max select none
)

else
(
if (classof $.baseobject != Editable_Poly) then (
if _ac=="1" then (Try(ConvertTo Selection[1] Editable_Poly)Catch(print"suxx"))
)

if (classof $.baseobject == Editable_Poly) then
(

polyOp.setEdgeSelection $ #All;update $
modPanel.addModToSelection (Edit_Mesh name:"LWSmooth") ui:on
subobjectLevel = 2
if $.iterations == 0 then $.iterations=_di as integer --incrase interations from default zero(if running first time)
-- $.iterations = _di as integer
$.surfSubdivide = on
max select invert
meshOps.invisibleEdge $.modifiers[1]
max select none
modPanel.setCurrentObject $.baseObject
if _sc=="1" then selection[1].showcage = true else selection[1].showcage = false
if _st=="1" then selection[1].visibility = false else selection[1].visibility = true
if subobjectLevel !=0 then max select none
showendresult=true

)else messageBox"Object is not an Editable Poly\nand autoconvert to Editable Poly disabled\nyou can activate autoconvert in options menu"
) --
)--end selection and class check
else (messageBox "Object must be selected" Title:"LWSmooth")
)

macroScript LWOptions
category:"lptools"
tooltip:"LWOptions"
buttontext:"LWOptions"
(
-- byte define
-- _ac --AutoConvert
-- _sc --ShowCage
-- _di --Derault Interations
-- _st --SeeThrough
rollout LWOptions "LWSmooth options" width:208 height:176
(
button btn1 "Save" pos:[23,126] width:80 height:24
button btn2 "Cancel" pos:[111,126] width:80 height:24
groupBox grp1 "LWSmooth options" pos:[8,8] width:191 height:158
checkbox ac "Auto Convert to Editable Poly" pos:[21,31] width:170 height:21
checkbox sc "Show Cage" pos:[21,50] width:148 height:20
checkbox st "See-Through" pos:[21,69] width:168 height:22
spinner di "Default Interations" pos:[73,93] range:[0,5,3] type:#integer width:75 height:16
on LWOptions open do
(
fn existFile fname = (getfiles fname).count != 0
_fo=((GetDir #scripts)+"\LWSmooth.dat")
if not existFile(_fo) then --dat file not exist, create him with default setings
(
_AutoConvert=1
_ShowCage=0
_Interations=2
_SeeThrough=0
_output =_AutoConvert as string + _ShowCage as string + _Interations as string + _SeeThrough as string
_fw=createfile _fp
format _output to:_fw
close _fw
)
_fr=openfile _fo
_ac=readchar _fr --AutoConvert
_sc=readchar _fr --ShowCage
_di=readchar _fr --Derault Interations
_st=readchar _fr --SeeThrough
close _fr
if _ac=="1" then ac.checked=true
if _sc=="1" then sc.checked=true
if _st=="1" then st.checked=true
di.value=_di as integer

)
on btn1 pressed do
(
_di= di.value
if ac.checked then _ac=1 else _ac=0
if sc.checked then _sc=1 else _sc=0
if st.checked then _st=1 else _st=0

_fp = ((GetDir #scripts)+"\LWSmooth.dat")
_output =_ac as string + _sc as string + _di as string + _st as string
_fw=createfile _fp
format _output to:_fw
close _fw
print _output
DestroyDialog LWOptions
)
on btn2 pressed do
(DestroyDialog LWOptions)
)
CreateDialog LWOptions
)

macroScript LWShowCage
category:"lptools"
tooltip:"LWShowCage"
buttontext:"LWShowcage"
(
try (selection[1].showcage=not selection[1].showcage)
catch (messageBox "Operation Failed" Title:"LWShowCage Error")
)

2LoOp
04-28-2003, 12:30 AM
any one know how change "visibility value" from script?

I thought change is like this selection[1].visibility=0.5 but this does not work....

2LoOp
04-28-2003, 01:25 AM
i find it selection[1].visibility.controller.value=0.5

IkerCLoN
04-28-2003, 01:45 AM
Googlo's script works nicely!!! Thanks for the archive!!! I've uploaded a test image for showing you the result ^_^

http://webs.ono.com/ikerclon/testlw.JPG

Libor
04-28-2003, 08:56 AM
Hi all!
I ve just tested a bit Googlo´s script (really nice btw) and found some bug.

Every time I deselect my object with applied script (with auto update on) by clicking anywhere in viewport some error pops up.

Thanks again to all guys involved :) You rocks!!

I attached a screen grab (I know shit about coding:thumbsdow )

googlo
04-28-2003, 10:03 AM
Iker, Thanks.

Libor,

Yeah, that's because the script requires the object you are editing to be selected while it's doing it's thing. When you unselect the object that you are working on while the script is running in auto update mode (particularly because it's a continuing 'live' process), it can't 'see' what it is assuming to be there i.e. the polyobject you had selected when you started that mode.
The script assumes that you won't be selecting anything else (or deslecting the the current object while script is 'activated'), this is generally true regardless if it's in auto-update mode or not.

It's just that auto-update mode is constantly checking the selected poly for changes, so if you leave that poly by deselecting it while it's checking for it, suddenly it's looking for something that's not 'there' anymore. That's why the error comes up as undefined.

damesqlo
04-28-2003, 12:16 PM
First that all... great work...:buttrock:

I was Testing the script.. and i see some important details to fix.. for example .. the selection..
Wolud be great select the vertex,edges,etc.. usign the LW lines and not the Cage

http://usuarios.lycos.es/damesqlo/3D/script.jpg

i´m sorry but i dont remember who is the owner of this script... Please.. if the owner read this...Scream!:scream:

Libor
04-28-2003, 12:46 PM
googlo: I see:)

damesqlo: Yeah, the smooth polyline scripts still missing a lot of functionality but who knows, maybe in the near future these cool guys make it work:bounce:

JHN
04-28-2003, 01:07 PM
@ damesqlo: hate to say this, but that's not going to happen, with this version of Max, because that kind of stuff is located under the hood of Max, no scripter will be allowed there!

As far as I can remember even LW doesn't do this! It will let you select more intuitive by clicking on the mesh, but the control vertex, is in the place were it should be, just like in Max, only no control cage in LW

Correct me if I'm wrong, though... Haven't used LW in a while.

@googlo, you should also take a look at scripted plugins, to extend a Emesh mod, with your timing function, maybe. I also wonder why you aren't using changehandlers, I think they were invented for this kinda thing and work more efficient then the timer... Look it up...

Cheers JHN

Libor
04-28-2003, 01:12 PM
Googlo, here´s my little contribution - maybe for showing of your script usage;) Its the only way how I can help you - me just dump artist:p

Cheers!

http://www.cg.mysteria.cz/3d/sm_polyline.jpg

fez
04-28-2003, 01:47 PM
Cool scripts! Thanks.

JHN, you CAN select points using the subpatch lines in Lightwave. I think they called em Phantom Points.

JHN
04-28-2003, 02:07 PM
Originally posted by fez
JHN, you CAN select points using the subpatch lines in Lightwave. I think they called em Phantom Points.

Yeah, I stated that, but once you start editting the selected vertice, you get the control vertice right!? And the control vertice is not on the mesh, am I still right?

Cheers JHN

googlo
04-28-2003, 02:30 PM
JHN,

Yeah, it was the first thing I was trying to use, but the idea of using timers has been more fluid witht more immediate control and less error prone logic for me in making the transition between the mesh changing and keeping track of what keys are pressed at that time (at least for things I've been doing right now, I've started to look into it more though), when a changehandler like one set to monitor topology is used, it signals a change at each moment the mesh is modified, even when the topology really hasn't changed.
Like if you do an extrude, throughout the whole dragging part of the extrude, the changehandler ala the topology option is sending a message continuously that the topology is changing, the moment you stop dragging, it stops, and if you start dragging again, it sends out the change signal again. I am looking into a way of using it, like having the changehandler disable itself after one changehandle call.. or on screenredraws. But things start to get buggy. The way mouse.buttonStates and mouse.mode work is a little different then because of it too (I think, I haven't really thoroughly tested it yet though, I'm a bit learning it all as I go too).
I've still been exploring it though, it's just that right now I've been adding some new features into the script that I think people here are going to like :), hopefully.
One idea is kind of experimental, I don't know if it will be that useful though. I'm almost done though, and bleary eyed because of it :)
I also started to explore the possibility of turning all of this into a scripted modifier. I'm still pretty new to all of this though. I've only made one scripted plugin so far (unrelated to what has been happening here), I might reveal that one after all of this :).


Libor,
That's totally cool man :) Make more things! :bounce:

Neox
04-28-2003, 04:18 PM
i love it, its nothing for working with right now but for showing wires its just great!!!

http://neox.gfx-scene.de/public/advices/smoothwire.gif

shaman
04-29-2003, 05:53 PM
very good script,thanks for this:bounce:

goodlag
04-30-2003, 04:38 AM
very very cool~~

thanks for this script:drool:

JokerMax
04-30-2003, 06:37 AM
the script with autoupdate noticeably slowdown 3dsmax :(
i would rather work old way, without autoupdate it does not make any sense i think

proteus2002
04-30-2003, 03:25 PM
@ googlo

it seems that the command "gc light:true" maintains the undo buffer, without any trouble. you just have to change the line "gc ()" to "gc light:true". it is a new feature in max5 and doesn´t work in previous versions.

googlo
04-30-2003, 03:58 PM
yeah I tried that before I released it but it doesn't seem to help

3dioot
05-28-2003, 09:52 PM
Maybe its a little late too ask for this but ive been trying to find a solution for showing the smoothed wireframe as made capable by this script. Regretfully im using max4.2 so i cant use this script as it is. Id like to use it for presentation purposes.

So far ive tried varies methods of mapping per face (gradient ramp set to box to name one) but they all fail when you have something beside's quads in your mesh. They also give pretty bad results when looked at under steep angles. Snotmonsters wiremap has been the best so far but there is no way to make it show only the control edges on the smoothed mesh.

So im asking for help. I quess it would be very complicated to rewrite this script so it works with 4.2 Maybe a new material (like the one from snotmonster) which works with editable poly is the best solution. I dont really know. You guys have anymore suggestions? They would be appreciated :)

GrtZ 3dioot

googlo
05-28-2003, 09:55 PM
3diot,

Which version did you use?

EricChadwick
05-28-2003, 10:16 PM
Maybe you could MeshSmooth the model, collapse to Editable Mesh, make all but the control edges Invisible, then use Edgemap?

Just a random idea. Not tested or anything.

3dioot
05-28-2003, 10:43 PM
wow! A response so fast! So far i think i tried all of them. Maybe i need to clean them all out so i wont have any problems with older versions still floating around. Its late now so i cant spend much more time on it but ill be right back here tomorrow. I would really appreciate it if this could be solved! thanks for your help so far.

GrtZ 3dioot

KiboOst
05-28-2003, 11:26 PM
So, is there any working version of this amazing script ?
Kib

3dioot
05-29-2003, 10:36 AM
I tried all of them and even after manually removing them and adding them again i cant seem to make any of them work.

googlo
05-29-2003, 11:56 AM
I made a newer version but just haven't posted it 'cause I thought the rest were ok.

what kind of error do you get with the one I did?

damesqlo
05-29-2003, 12:25 PM
Googlo.. post it.. for the "beta Testers"... :buttrock:

LFShade
05-29-2003, 04:58 PM
I'd just like to thank the moderator who took the initiative to move this thread to its new home:airguitar


RH

visualboo
05-29-2003, 05:14 PM
Yeah, I was wondering what was goin on :D

Equinoxx
05-29-2003, 05:26 PM
Originally posted by LFShade
I'd just like to thank the moderator who took the initiative to move this thread to its new home:airguitar


RH

you're welcome ;)

KiboOst
05-29-2003, 06:04 PM
Yes it's astonishing that this script idea don't get more interest for a few moments. I've never answer this thread before but fulyy read it, and it's really interesting. Modeling with this (which means a fast viewport script) would be really amazing. One of the only thing I fing interesting under lw modeler.

Kib

proteus2002
05-29-2003, 11:18 PM
first i want to say that it was a good idea to create a script sub forum. for me it is really nice to see this thread growing bigger and bigger. i just finished my diploma and i will soon spend some time on the development of the script again.

@ googlo
can´t wait to see your update

@ all
really nice feedback.
especially i like the wireframe-pictures of the script in action. post some more.

here is mine. she is my avatar and the main character in my diploma short movie. i will post the movie here on cgtalk as soon as i got my own webpage finished.


http://homepages.img.fh-mainz.de/~proteus/images/wip_images/wireframe.jpg

Cyberdigitus
06-11-2003, 12:40 PM
:thumbsup: this is pretty interesting, i hope you can develop it further.

something i miss when using it is that selected polys are not displayed anymore. would that be fixable?

i really hope the next version of max will have a edit poly modifier, seems odd that it needs to use an edit mesh when you work with polys in the first place, and it might be a bit less memory intensive.

byzantium
07-29-2003, 06:14 PM
Look here: http://www.discreet.com/products/3dsmax6/features.html

...
"Meshsmooth and Editable Poly now includes Isoline display (results in a much cleaner mesh in the Viewport and) - allowing the artist to focus on the defining topology without having to see every resulting edge."

:thumbsup:

googlo
07-29-2003, 06:37 PM
Goodness gracious me!

JHN
07-30-2003, 10:24 AM
Yep... development stops here... :)
Excellent effort though... maybe it was this thread that inspired them!? Or is that too much credit to ask?

Ennewee, excellent feature... looking out for this new release! Mental Ray...mmm... start saving some money!

ivo D
07-30-2003, 10:53 AM
well..before people forget you guys.....the ones who made it able to look at the breathtaking smoothed whires in max..

thank you all;)

your the ones.. (all the people that make the extra for max)

that make max.. , *my favo ab* outstand the other 3d programs :thumbsup:

Starv
07-30-2003, 12:55 PM
This is why I love cgtalk.
Kudos proteus.
:beer:

ReneAlex
07-30-2003, 01:54 PM
hope this has to do with you guys...

in max 6 seems to be a lw like display of the NURMS polys...

correct me if i wrong...

damesqlo
07-30-2003, 11:25 PM
Yeeeeeaaaahhhh!!!!!!... :buttrock:

ivo D
07-31-2003, 08:47 AM
yea,and we will love it and honour it!!:D

Tharyn
08-09-2003, 04:36 AM
I was thinking about doing somthing like this the other day and tried everything but the darn Editable_Mesh based solution presented here.

Nice job! Some of the simplest solutions are hardest to see :eek:

I'm going to see if I can bang something out for this tonight and if all goes we'll I'll post it this weekend.

Cheers,
Tharyn

Johnyskij
10-27-2003, 04:16 PM
hi all and thanks for thiss good script ,

im still waiting for my max6 to arrive but from what i hear ,
that whith the iso-lines in max 6 you still have to use the
cage ,you cant select the iso lines minipulations

so the question is that if you all are gonna try to continu whith the script ??, to have it like LW where you can select the vertex
on the smooth lines




sorry for my stubid english :hmm:

TNTJack
01-01-2004, 08:52 PM
Hi there, lots of effort in this thread, good stuff, congratulations.

I installed the script by Googlo in page 7 of the thread (it seems to be the last and better working), but it doesn´t seem to work. Details:

I use Max 5

I hilighted the script and dropped in Max toolbar. Ok, there is the button

I create a box, and convert it to editable poly

I set the viewport to show edges

I apply meshsmooth, NURMS selection is on, and I set iterations to 2

Next, I start the macroscript by clicking the new button. The menu appears

BUT, when I press the "Create polylines" button, it shows the classical stack warning, and after that, with no error, nothing changes in the viewport. It keeps
showing all the geometry.

I swapped the polylines and meshsmooth modifiers in the stack, but still nothing happens.

Am I doing anything wrong? If so, could someone help me?

Thank you very much, and happy new year!

-EDIT-

Never mind, I didn´t notice that this thread was dead long ago...

Anyway, for those who may have the same problem, I found what I was doing wrong: NURMS, meshsmooth and iterations must be set in the editable poly interface, and not as a modifier.

C ya

Rodi
01-21-2004, 02:51 PM
isin't something like this script in max6 as part of the standard package?

EDIT** lol, most of you have noticed this!!!:thumbsup:

CGTalk Moderation
01-14-2006, 08:00 PM
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.