[Closed] Accessing the SKIN modifier
Hi everyone!
I’ve run into a small problem here. I’m writing a small ASCII model exporter. I’m at the part of exporting the bones weight data. I have the proper function to do that, that’s not a problem so far. The point is, to access the data I need, I first have to … SELECT the skin modifier ( for what reason, don’t have an idea ). So here’s my script to do that:
max modify mode
modPanel.setCurrentObject skinMod
Sadly, it also updates the UI and stuff, which takes the precious time! I can’t believe my whole model is being exported in over 20 minutes, and it’s just a half of a way … Come one, there’s got to be any other solution to this … I hope?
Thomas
some modifiers allow to set/get data just when they are opened in modifiers panel. The Skin modifier is one of them. There is nothing what we can do with it.
if you want to disable modpanel redraw you can do it:
(
WM_SETREDRAW=0xB
commandHWND = windows.getChildHWND #max "Command Panel"
windows.sendmessage commandHWND[1] WM_SETREDRAW 0 0
/* ... the code */
windows.sendmessage commandHWND[1] WM_SETREDRAW 1 0
)
but the performance of your skin data exporting depends on the way how you do it. Check the sample and see the difference:
(
WM_SETREDRAW=0xB
commandHWND = windows.getChildHWND #max "Command Panel"
windows.sendmessage commandHWND[1] WM_SETREDRAW 0 0
delete objects
bx = box isselected:on
bn = box()
addmodifier bx (Skin())
setCommandPanelTaskMode mode:#modify
skinOps.addbone bx.skin bn 1
select bx
gc()
-- USUAL WAY
t1 = timestamp()
m1 = heapfree
for k=1 to 10000 do skinOps.GetVertexWeight bx.skin 1 1
format "usual - time:% memory:%
" (timestamp() - t1) (m1 - heapfree)
gc()
-- SMART WAY
t1 = timestamp()
m1 = heapfree
sk = bx.skin
getvertweight = skinOps.GetVertexWeight
for k=1 to 10000 do getvertweight sk 1 1
format "smart - time:% memory:%
" (timestamp() - t1) (m1 - heapfree)
gc()
windows.sendmessage commandHWND[1] WM_SETREDRAW 1 0
)
I’m using MaxScript 9, and the Windows structure doesn’t have that getChildHWND method. Is there another way to get the HWND to the Modifier panel?
EDIT: Impressive results; I didn’t know storing the pointers would give such a boost.
Just for the sake of knowledge, here is the way to find the Command Panel’s HWND in Max 9 (which doesn’t have the ‘getChildHWND’ method): http://forums.cgsociety.org/archive/index.php/t-758914.html