[Closed] SDK – writing a maxscript extension
Hi,
I have a script that is running pretty slow, and integral to the script is a function that checks distance from a point to a line segment. Now I was thinking, that if this function could be made into a maxscript command through the SDK, the speed increase should be massive. And also, writing a maxscript command should be a doddle compared to writing, say, a modifier? Especially when it’s just a simple trigonometric command?
But I can’t find where to start! Inside the Plugin Wizard there are no categories for maxscript, and I can’t seem to find any samples inside the SDK either. I only see a curve controller, an activex thingy, a dotNet thing, and then a folder of general functions (which I assume is used by the other ones?).
Could anyone point me in the right direction, so that I at least can have the framework for such a plugin up and running?
There is basic maxscript extensions samples in maxsdk\howto\maxscript. Also see maxsdk documentation about maxscript sdk, MAXScriptSDK.chm in maxsdk\help (“How to Write a Basic MAXScript Plugin” tutorial is very handy to start).
Thanks, I somehow missed the separate maxscript help file. After a brief look, it seems like they don’t use the wizard at all, and there’s probably a reason for that
Yes I am, for portions of the code. It’s inside the function that calculates the length from a point to a line segment. That part is the main loop, and the one I’m looking at accelerating.
What the script is doing, is figuring out what bone is closest to each polygon in a mesh. It then splits up the mesh in parts and parents each part to the bone, effectively doing a very crude low-res mesh for my animation rig (it’s great with fingers!).
I made it a lot faster yesterday, actually. I accelerated the script by precalculating some of the bone information, and then storing them in arrays. The main loop is now a bare-bones distance search. I have successfully split up a 90.000 polygon object in two minutes, and I probably won’t be going beyond half a million polygons. I probably don’t need to go to the SDK, but I’m thinking it might be a good exercise!
no Pun intended for the “Bare-Bones Distance” search I’m sure!
If you have them arrayed, you may want to implement a half step search algorithm, where you check the first point vs the “middle” data point. If a the middle is a shorter distance, you check end point vs “middle” point else First vs Middle… repeat until the resolution of your array is expired.