Marco Brunetta post a maxscript for all people asking to use more than 24 materials in Max Material Editor. Well, 24 material limit in Max is not "stupid" for me, Material Editor is a temp art (working) palette, and 24 are enough slots. Marco's script dont extend the MEditor itself, he create material "pages" each having 24 materials. This "pages" are virtual array copies which saved in the scene (on root) by Custom Attributes and can be used after the file has been reopen. By default Max save into the file all used in the scene materials. That's enough and safe. There is Libraries files (.mat files) in Max where to keep your materials. However, I know an army of fans of this idea out there :) so if you are one of them then just try Marco's script.

There is standard (without scripts) work-around if 24 slots come not enouth:1. Put to current Library your material (before clean the slot).

2. Backup all slots at once to Library(and then clean all by MEdit menu / Utilities / Reset Material Editor Slots).

Thursday, January 28, 2010

This is a topic ("Key Up Event") related to MaxScript that I found into ScriptSpot forum, where asked for how to track the state of a keyboard key, and in the current context - how to keep rollout dialog window open until the key is pressed and when the key is released to close the rollout.

Yes, there no such event handler like "on key up ..." in 3ds Max, but I suggest some fake "to do" trick based on timer (rollout controller). So if you feel an interest in this, just look at the forum here.

Wednesday, January 27, 2010

There is a new (just for fun) maxscript from me. It's a custom attributes that must be added to the Shape object on base level, not add them to the Attribute Holder or other modifiers, else will not work. For more details read the comments inside the code. The script you can find on my MaxScript page. The trick is in the ratio between Radius1 and Radius2 of the Star, which is binded to 1 Radius spinner (animatable, see the video). And the radio buttons switch between 2 presets - Pentagonal and Hexagonal star. Enjoy! :)

Tuesday, January 26, 2010

With this site I go back in time, hehe... :) yes, I remember all these models there. The last upload on 3Dup.com is almost 3 years old. Although not something unique as art work, the models and textures there are still free.

We all know that Link Constraint is your best friend for this purpose at all, but... baking (collapse transform) to keys is Not exactly the same as swaping transform controllers. You yourself will feel the difference (if you try my scripted tool) and you'll find benefit from this method in some cases.

So, the core of the method based on the 3ds Max built-in function swap() . Very useful function (at least for me).

MXS help description for the swap():Takes two valid assignment destinations (property, array index, or variable) as arguments and swaps their values.

You'll see the objects wire colors swaped. I left some comments in the code. The script you can find on my MaxScript page.

I don't give you direct download link, not cause I wish to show you my site, hehe..., no, it's a hosting server complication. Posted download links out side are detected and will redirect you to page where need to fill out a security code.

Monday, January 18, 2010

Instantly Auto Edges is a MaxScript that I just I published today. As usual I can share the link to the ScriptSpot post where you can read short description and usage notes, but... I would like to add some tips comments, which could be useful in writing other scripts, so...

First, I looked for a similar script and found 2 old that just loop through selected objects and performs auto edge, shortly - nothing special. Also I found a script by Pierre-Felix Breton. Interesting in the code is excluding instances optimization, which part come from Chris P. Johnson. But honestly, all code snippet looks like Chris job :) However. Well, even in this code, I saw many things that could be improved. As you will see yourself, I used mapped funcions. They are real magic, but the final awesome runtime speed result would be impossible without some tricks. So I wish to focus your attention at them.

First one is about collecting objects edges. Here needed all edges, and Max has easy ways to get faces but not edges. For example there no$MeshObject.NumEdges . Knowing that any face in mesh has 3 edges, Chris use loop from 1 to 3 end expression to collect all edges. This is slow. There is my way (using bitArray and ".numFaces" all is done in 1 command):

edgeList = #{1..(objs.numFaces * 3)}

Ok, Im add it to my mapped function and even this is enough optimization, i.e. my tests show that the script can operate almost 3 million edges per second ! But why not improve it if possible, right?

So the Second step is as Chris idea but in different method. Knowing that InstanceMgr.GetInstances output an array, it's clear so if the array keep only 1 item then the object has not instances (it's unique). Simple :) And if has more then we need just one of them, so here also not need separate commands. All what we need is to collect the 1st item only. Note: appendIfUnique function is also important! For more see inside the script code.

Well, the fast collecting instances deputy/delegate is not affect directly the final auto edges procedure, but I like it faster :) and as a said - this is a good trick for coding at all.

However, this step is also important because affects drastic scenes with many instances. If you have to say 100 instances - the script will proceed only 1, so it will end 100 times faster. In other words, even large scenes with many instances will end in no time !

In plain speed test both ((bigVal v1 v2) and (amax v1 v2), or (smallVal v1 v2) and (amin v1 v2)) has equal runtime. Well, even this is enough to skip writing of such functions, right? I know many people with a nice reputation in coding which still continue to do just that :) ... but not to digress from the topic... instead, let see the strong hand of those functions by simple test:

Friday, January 15, 2010

Some quick and simple update over my WireFence script today. Nothing special, yep :) but just in case you curious about how to open scripted utilities (from button or macros for example) - take a look at openUtility() function ;) and ...

if you like some of my scripts then please vote for them (at ScriptSpot) to have more incentive to share, thanks ! :D