Home Technical Talk

[Maxscript] Array Modifier for 3DS Max

polycounter lvl 15
Offline / Send Message
McGreed polycounter lvl 15
Array 3D v0.83

Summary:
This is a new Helper for 3DS Max, that does the same as the Array tool does, but with some more features and more importantly, the settings can be adjusted on the fly, so you can always change the spacing, rotation, scaling between the array objects, or use splines for either 1D, 2D, 3D position. Also feature an randomize addition that can randomize spacing, rotation, scaling.

Update (v0.83):
Converted the modifier into a Helper, and added an update Array3D script, to update scenes already made with the old version of the script. See full list of changes in the version log. Hopefully I haven't made too many new bugs. :)

Main features:
  • Select one or more objects for the array
  • Create array in 1D, 2D or 3D dimensions
  • Adjust the position/rotation/scaling in 1D/2D/3D per object or as total value.
  • Position incrementing from the previous position and rotation
  • Create array using 1-3 splines
  • Array group of objects or randomize the objects in the array
  • Add randomize values to the position/rotation/scaling
  • Turn freezing and bounding box on and off
  • Change wireframe color to source color, custom color or a gradient from x,y,z
  • Linking the array objects to dummy or custom object
  • Offset the array from the dummy
  • Convert and rename generated objects and group them
  • Adjust any value on the fly

array_v0.8_example1.gifarray3d_ui_v0.83.png

Download:
The script can be downloaded from my website here: http://www.mcgreed.dk/misc.asp or from ScriptSpot.com

Installation:

Just unzip all the files into your 3ds max's Scipts folder (..\3ds max 2009\Scripts\)
The modifier should automatically start when you restart 3ds max.

IMPORTANT! READ THIS IF YOU ARE UPDATING FROM OLD VERSION WITH EXISTING SCENES!

If you have scenes already using an older version of Array 3D, you need to take these steps to
update your scene, as the Array 3D Modifier has changed into a Helper:
  1. Install the script as usual
  2. Load your scene with the Array Modifiers
  3. Go up to MAXScript / Run Script... and find the script UpdateArray3D.ms in /scripts/Array3D/
  4. Run the script and you get a update dialog window. Follow the instructions there to update and convert the Array 3D modifiers to Array 3D Helpers.
  5. When you have updated all your scenes, and you don't need the old version of the script, feel free to delete the folder /ArrayModifier/ from /Scripts/. The new version is located in /Scripts/Array3D/ and the file ArrayModifier_startup.ms from /Scripts/Startup.
    If you don't want to remove it, please note that you will have two different randomize modifiers in your list, the old Array Randomize and the new Array 3D Randomize.

Uninstall:

Go into \Scripts\ folder and delete the folder \Array3D\, and the file Array3D_startup.ms in Scripts\Startup\

Quick start guide:
  1. Go to the Helper section and pick the one call Array3D and click somewhere in the scene
  2. Now go to the Modify fan
  3. Now either use the Pick or the Pick List to select the object(s) you would like to use in the array (cannot select groups).
  4. Select the amount of objects you like to generate in 1D/2D/3D (don't pick too large number, for example: 10x10x10 makes 1000 instances of one object)
  5. Now go change Spacing rollout and change the values there.

You should now be able to see all your instances created by your array. Play with the settings. :)

Array Modifier v0.82 Features video
[ame]http://www.youtube.com/watch?v=UNrAt0boZJo[/ame]

Array Modifier v0.8 Brickwall Example video
[ame]http://www.youtube.com/watch?v=rc4CVsOMWAo[/ame]

History:
v0.83(download link):
  • CHANGED: Converted the Array 3D modifier into a Helper
  • CREATED: Update Array Script for updating scenes made with old script version
  • ADDED: Option to show frozen in grey
  • ADDED: Option to Rotate by Spline path
  • ADDED: Option to Rotate Array Incrementing
  • ADDED: Character string check on prefix (avoid illegal characters)
  • ADDED: Option to link used splines to selected link parent
  • FIXED: Generel bugfixes
  • CHANGED: Rewrote a lot of the code, to make it work with incrementing and in the process the script should also have become faster. Also cleaned up the code
  • CHANGED: Activated the animation parameter for those who wants to try to use the script with animated parameter, though the script hasn't been tested with it. Only fields that doesn't create new objects will be animated (so fields like Amount will not be animatable). Recommend to set Creation to Modifiy to avoid creating/deleting objects when animating.
  • CHANGED: No encoding! Yeah, my code isn't so messy now, so you can see it now. :)

v0.825 (download link):
  • CHANGED: Improved object picking, can now pick more then one object, right click to stop
  • CHANGED: Optimized the way position is calculated, should make changing spacing faster
  • FIXED: Scaling calculation was using wrong axis for math, should be fixed and also faster
  • FIXED: Fixed a bug that didn't allow the user to change scaling type

v0.82 (download link):
  • FIXED: Wireframe colors updates when changing amount
  • CHANGED: Rearranged the UI to make room for new function
  • CHANGED: Scaling has been improved and now adjustable on all three dimensions
  • ADDED: Option to create array objects as group set, or random selected objects
  • ADDED: Linking array objects to dummy or custom object (can move dummy and array follows)
  • ADDED: Option to only show ever Nth object in array.
  • ADDED: Two different ways to do spacing/rotation/scaling, per object or total for all.
  • ADDED: Random object seed in UI
  • ADDED: Disable array option, which is automatic activated when converting
  • ADDED: Ask to delete array objects when removing from list
  • ADDED: Check that user can't pick the same object as the one the modifier is applied to
  • CHANGED: Made group creation mandatory when converting/renaming array objects
  • FIXED: A bunch of bugs and added confirmation boxes for some actions.
  • ADDED: Version number in script (backwards compatible for future versions)

v0.80 (download link):
  • CHANGED: Changed the modifier name to avoid conflict with old version
  • ADDED: Added unique array id for each modifier added to dummy
  • ADDED: Added custom prefix in front of array objects
  • ADDED: Option to create objects as Copies, Instances (default) or Referances
  • CHANGED: Seperated postion/rotation into seperate sections
  • ADDED: Now has scaling in %
  • ADDED: Option to enable/disable position/rotation/scaling
  • ADDED: Option to uniform values position/rotation/scaling
  • ADDED: New image for UI (padlock) and delete item icon
  • FIXED: Adjusted bracket image, made background transparent
  • REMOVED: Randomizing for seperate randomize modifier
  • ADDED: New Convert section, where you can convert/rename array objects
  • ADDED: New 'Array Randomize' modifier for randomize position/rotation/scale
  • Optimized the code

v0.75 (download link):
  • Change modifier to be attach to a dummy (or any object for that matter)
  • Pick 1+ objects that should be use in the array
  • Gave 3 options to how to create/update objects in array
  • Spacing/Rotation for each object and axis
  • Change array objects Wireframe color to match source, custom color or color gradiant
  • Freeze/Unfreeze array objects
  • Bounding box array objects
  • Update array on dummy move/rotation (scale?)
  • Seed generation
  • Randomize Position and Rotation
  • Auto update on most elements
  • Delete all objects in array
  • Manuel Update All button.

Replies

  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Someone suggested that I made the randomizing as an seperate modifier, so the UI would be more light and you could add several randomize modifiers to the array. Those who tried it out, what do you think? Personally I like the idea, though it will mean extra work to get it working, but it might make it faster as well.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    No problem, I have just gotten CamStudio installed and figured out how to make recordings, so going to have some up very soon I hope. :)
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Finally got the files uploaded, had some problems with conversion, but works out now. Two videos to show some uses of the array.
    Its the first time I ever made a video tutorial, so I do fumble at times, but I hope its useful anyway.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Still on the case and working on a new version. Ended up redoing the code somewhat, so it runs a bit better. unfortunately it also means that this version won't be comparable with the old version.

    This version will change into two-part modifier. One modifier is the array itself, the other is the randomize part of it. I decided to do it this way, so you could add several randomize on top of each another, which has its advantages.

    I would like it make the whole thing animate-able but I'm not sure if it would work, unless you stick in 'Modifiy' setting and place keyframes on the copies, change settings, place keyframes and so on. Might work.

    If you have any suggestions for it, please come with them and I'll see if I can implement them (if they make sense ;) )
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Updated Array Modifier to version v0.8. Go to first post to read about it and download the new version. :)
  • Fang
    Options
    Offline / Send Message
    Fang polycounter lvl 7
    Interesting, I began writing a script very similar to this, albeit I never took it this far. Good job :)
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Cheers. I just discovered that the link didn't quite work, was looking for v0.80 and not just v0.8. But it should work now, sorry.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Another update, added a new video tutorial for Array Modifier v0.8 to the first post.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Cheers and yeah, I have been thinking about how to make that and have it on my 'future feature' list, I just not quite sure how to do it, math-wise. Still brushing up on the more simple things from grade school I haven't used for years. ;)

    Currently I'm working on a little addition, so you can choose to make the array as it is now, where all the objects is used as they are, and then another option that it only use one object in the array, but the instances is picked randomly from the list.
    So if you have 15 sources, and make an 10x10x1 array, it will only make 100 objects (10x10), but the objects are randomly picked from the source list. Should be relative easy to add.
  • ScoobyDoofus
    Options
    Offline / Send Message
    ScoobyDoofus polycounter lvl 19
    McGreed: Great stuff there! Really very useful feature set, and the feature you describe in your last post is one of the few things I saw as "missing". Can't wait to see this update and evolve further.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Cheers, yeah the update ending up taking a bit longer, because there were some other things I needed fix as well, which requires some reconstructed of the code. Worse thing is that I think settings will be lost from one version to another, need to figure out a way to be able to upgrade without too much 'damage' to the settings in already made modifiers.
  • MattLichy
    Options
    Offline / Send Message
    Very cool stuff. I could definitely see using this at work or at home for certain things.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Thought I would drop a little update on my progress on the modifier. I have added some more functions, among some randomize objects, use of splines in array, and some more practical fixes, like linking array objects to the dummy or custom object.

    I got a functional version of it now, but haven't bug tested it properly yet and I would like like to make another video to showing off the new features. Also need to do some dull work in the shape of some proper documentation. Think I need to drop the text file and have something where I can use images as well.

    Unfortunately I still have a problem with updating the old array to the new one, when I fix one thing, it just breaks something else. So until I know a better way, I'm afraid that all settings in the first rollout will be reset to default when updating.
  • obliviboy
    Options
    Offline / Send Message
    obliviboy polycounter lvl 12
    why not make it a commercial plugin?
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Releasing stuff for free can have its advantages as well ;) like getting contacts in the industry of game and CG, those are things you can't buy.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    renderhjs is right, it has it advantages and while commercial does bring in money, it also makes more work, as you have to license it, update it, support it ect. I started on this maxscript because I wanted to expand my skillsets, and if by any chance the people I send my CV to, is using my script, all the better. :)

    Either way, if people really like my script, they can always donate by paypal on my website if they like.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I had so much pain with the donation stuff on TexTools - my friend pushed me into that as he wanted to track who was willing to donate something. Honestly I don't even care- I got a very exciting job and good payment. On the other hand I got some nice contacts from some of the bigger game studios around and in max 2012 apparently some credits now.

    For people that depend on money it sure sucks sometimes because there are so many awesome free scripts and plugins available, but I believe releasing stuff for free especially smaller tools draws the community only closer which is a good thing.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    yep. though even if its free, its not enough for some people: http://forums.cgsociety.org/showthread.php?t=980310&goto=newpost
    Why complain about things being encrypted just because its free, should rather complain about things being commercial then free. But that's just me. :P
  • havardsc
    Options
    Offline / Send Message
    Hola!
    Agreeing with renderhjs. Additionally, usability drops down to zero for me when encrypting. If I want to change something to my needs when using the script I am bound to the externally visible properties that are changeable. When not encrypted, those constraints are off.
    To make an example, a guy in this post
    http://www.polycount.com/forum/showthread.php?t=85051
    recommended a feature in the edgefinder script that is mostly based on another free script:
    http://www.scriptspot.com/3ds-max/scripts/make-parallel-edges.
    Making the code available helps the community so much more!
    I think encrypting scripts only are applicable for the larger scripts out there, e.g. ghostTown. For me, it makes no sense in encrpyting small utilities.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    interesting thread over there, though personally I have a different opinion. For me so far there never came up a reason for encrypting scripts and I am really grateful to the big max scripters out there (Bobo, James Haywood,...) who release their source code to read, learn and modify.
    Whenever I am obsessed with a project and research topics I am about to cover in tools or scripts I am just happy about anything I can get my hands on to learn and forge from (and I google sometimes for weeks). Some areas like UV mapping or RTT used to be very hard to get useful sample scripts for, like how to use certain classes proper because the documentation is missing on those etc.

    edit: oh and I too in general don't use scripts that are encrypted either, some kind of developer instinct I guess. If the script is readable however I am actually intrigued to use it, modify it or include it in my max ui setup.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    I understand what you are saying, however I still feel like its somewhat ungrateful to get angry about someone giving something for free, but not the source code, should rather get angry about stuff that you have to pay for.
    I fully understand the need to see how things are done, and I used a lot myself but its still free tools, if something is missing, you can always suggest it to the person who made it. If people start getting grief for encrypt their work they give out for free, they would just stop doing that and that would only hurt the community.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    let me put it from a different perspective:
    recently it was me who got a little bit of upset because of the very same nature you just mentioned. The thing that annoyed me actually was that there was no mention in the thread or post that there were commercial intentions and or the script is encrypted- even though it was obvious where the script had its origins from (many other free available scripts). To me thats very important to communicate with people, state right from the start if there are commercial intentions or if there are reasons to close the access to the script, source or extendibility.

    Ah well I guess what it means is that the word "free" has different meanings to different people, and people like me get sometimes upset that not everyone can or wants to share absolute free independent scripts.

    Havardsc: Yeah totally agree on the small scripts stuff for free and if its a really massive thing sure one could sell it, just like I would expect to pay for a real plugin with powerful functionality worthy paying for.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Either way, first post has been updated with a new version of Array Modifier, v0.82, which added new features like splines and randomize objects. Check the new video as well.
  • obliviboy
    Options
    Offline / Send Message
    obliviboy polycounter lvl 12
    I can't watch the video because it's private.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    aaand another fail from me...fixed :P sorry about that
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Did a quick update to v0.825 with some bug fixes and optimizing.
  • McGreed
    Options
    Offline / Send Message
    McGreed polycounter lvl 15
    Updated the first post with details about v0.83. The big changes is that the modifier has changed into a helper, so you won't need to create a dummy first, and rewrote a lot of the code, because I add incrementing position, meaning that you can select that the next object is places relative to the previous objects position and rotation.
    Also made an update script, so if you have already got scenes using the old version of the script, you can run the script and update all the instances of Array Modifier to the new version.
Sign In or Register to comment.