| Dub's Maxscript Tutorial Index |
Dub. |
Try keeping a bitarray that records if a set of dupes have already been recorded. You can then just check the bitarray before recording any future occurances.
Look up bitarrays in the maxscript manual if you are not sure what they are.
They are basically similar to arrays except each index holds a single bit toggled either true or false.
Sorry I don't have max right here so I won't post any code in case it has bugs.
read 2769 times 9/17/2009 4:43:26 AM (last edit: 9/17/2009 4:44:14 AM)
|
Garp |
Sorry for the sloppy counting :/
This one should be fine:
TheName = "TheBox" c = 0 sC = selection.count
for i = 1 to sC - 1 do ( sN = selection[i].name for j = i + 1 to sC do if selection[j].name == sN do ( selection[j].name = uniquename TheName c += 1 ) )
if c != 0 do messageBox ((c as string) + " objects renamed.")
Look for uniquename in the reference. It's pretty useful.

read 2752 times 9/17/2009 6:23:59 AM (last edit: 9/17/2009 6:26:23 AM)
|
wazzee |
Works like a charm garp. Thanks a million.
I have finished what i wanted to do. Here's the script with due credits to garp.
-- Script Name: Duplicate Name Finder
-- Author: Aditya Karanjkar, Navaneeth Ramamurthy and Patrice Garret.
-- Creation Date: 17/09/2009
-- Last update Date: 18/09/2009
-- Description: - Checks all geometry in scene for duplicate object names - Auto renames such objects appropriately. - Also checks for spaces in the names and replaces them with underscores.
--Renames the objects with a prefix "Rename" Rename = "Rename"
c = 0
--Count of the total selection collected in a array selectioncount = selection.count
For i = 1 to selectioncount - 1 do ( sN= selection[i].name for j = i + 1 to selectioncount do if selection[j].name == sN do ( selection[j].name = uniquename Rename c += 1 ) )
If c != 0 do messageBox ((c as string) + " objects renamed.")
--Check for spaces in object names and replace them with underscores.
renobj=0 --no of renamed objects sprep=0 --no of spaces replaced by underscores For i = 1 to selectioncount do ( renflag=0 --rename flag sN =selection[i].name for j = 1 to sN.count do ( if sN[j] == " " do ( sN[j] = "_" renflag=1 --this object was renamed. set flag to 1 sprep+=1 --a space was replaced by underscore ) ) selection[i].name=sN if renflag==1 do renobj+=1 --this object was renamed. increment renobj ) messageBox((renobj as string)+" objects renamed.") messageBox((sprep as string)+" spaces were replaced by underscores.")
-- end of script
read 2638 times 9/25/2009 2:31:47 AM (last edit: 9/25/2009 6:24:13 PM)
|
Dub. |
nice scripting!
Glad you've found the tut's handy. Maxscript is pretty easy to learn once you get started. It was the difficulty of getting started that I wanted to help people with.
read 2632 times 9/25/2009 3:33:18 AM (last edit: 9/25/2009 3:33:18 AM)
|
wazzee |
thanks to you too. Amazing how a thread created in 2006 never fails to surprise with active participation. will keep in touch.
sincerely, navaneeth
read 2616 times 9/25/2009 6:17:34 PM (last edit: 9/25/2009 6:17:34 PM)
|
urgaffel |
I posted some scripts I wrote here:http://environment-artist.blogspot.com/2009/09/helpful-scripts-that-help.html
And the scripting tutorials helped me get in to scripting! Thank you Dubbie :)
 All I remember was shaving... then *BLAM*
Environment art/gamesindustry blog thing
read 2605 times 9/25/2009 7:01:36 PM (last edit: 9/25/2009 7:01:36 PM)
|
wazzee |
Wow. Nice little tools for every user. Thanks for sharing urgaffel.(can i call you Peter instead?! :P) I'll try to visit often.:)
read 2521 times 10/1/2009 5:47:57 AM (last edit: 10/1/2009 5:47:57 AM)
|
wazzee |
Hi. I'm back! Coming straight to the point, I recently got a spec sheet which required me to model a building. Low poly and should use three texture pages. Sounds good. But there was this one catchy line that read -- " 5ft x 5ft should use 512 pixels " ! I am guessing thats the pixel ratio of some sort, yeah? I mean, of what i understand, 5ftx5ft should have ~512x512 pixels. Is there any way i can check for the ratio on an object with the user specified inputs and highlight/select the faces which does not fall in the ratio for the user? I know the pixel ratio is of atmost importance considering the importance given to textures as the model is of low poly.
I have noticed some textured models displayed here as well, where the ratio is off the charts. This might help everyone.
Please do guide if there is already a script doing this. Looking forward to your help guys.
read 2424 times 10/7/2009 6:08:55 AM (last edit: 10/7/2009 6:11:16 AM)
|
wazzee |
Can anyone throw light on the above post? Please do oblige.
read 2362 times 10/11/2009 8:28:07 AM (last edit: 10/11/2009 8:28:07 AM)
|
urgaffel |
Check outhttp://www.renderhjs.net/textools/
 All I remember was shaving... then *BLAM*
Environment art/gamesindustry blog thing
read 2349 times 10/11/2009 9:46:12 AM (last edit: 10/11/2009 9:46:12 AM)
|
mrgrotey |
There is an option in the material editor (in each slot i.e. diffuse) called 'real world scale' which lets you give the texture sheet a real world size when applied to a model that has been modelled to scale. so stick the texture sheet in teg diffuse slot, check the box and say its 5ftx5ft
read 2348 times 10/11/2009 9:50:04 AM (last edit: 10/11/2009 9:50:53 AM)
|
wazzee |
Thanks urgaffel! The tools are quite amazing.Just the thing i was looking for.
mrgrotey, Could you throw more light on the subject and explain how 3dsmax works and calculates to a layman in a general term? i apologize for my lack of know how on this matter. But keeping in mind i was planning to write a script to do this for me.
Thanks so much for the quick reply.
read 2336 times 10/11/2009 3:12:10 PM (last edit: 10/12/2009 1:33:40 AM)
|
parkerfamily |
i don't suppose the genius dub could do a 6th tutorial on how to add, edit and remove modifiers in maxscript? i've figured out a bit more in maxscript and even the visual maxscript editor after doing your 5 tuts, but cannot for the life of me find the commands to add modifiers and then edit them. i could really use help with this.
edit: AHA! i finally found the page in maxscript help that's exactly what i needed. many others could benefit from a tutorial still, but go to maxscript help>learning maxscript>manipulating the box - first steps in maxscript>more box transformations
read 2169 times 10/21/2009 8:09:55 PM (last edit: 10/21/2009 8:38:50 PM)
|
Dub. |
Now you've got the idea Parker. :) the maxscript manual is your friend. I write pages of maxscript each month but still refer to the maxscript manual all the time.
I was thinking of doing a tut on how to understand the maxscript manual. To new people, it can be confusing sometimes. I know I didn't have a clue what it meant sometimes when I was starting.
read 2151 times 10/22/2009 2:30:03 AM (last edit: 10/22/2009 2:30:44 AM)
|
vishesh |
Big thanks to you DUB for writing these awesome tuts. i do learn a lot from them. keep up the good work !!!
I also started playing with MaxScript. i am stuck somewhere, i hope any one here can help me :-
My scene has 20 spheres. they are hidden. all i want is to unhide one sphere and then render and it should be saved too...... this should go on for all 20 spheres.
this is the script what i wrote --->
myColl = $Sphere* -- putting all spheres in my collection myArray = myColl as array -- converting collection to array
For i = 1 to myArray.count do ( Unhide myArray[i] -- unhide sphere Render frame:i outputfile:("E:\Practice\MaxScript\Sphere.jpg") )
.....................................................
The problems i am facing are :-
1. It is opening 20 VFB's. why it can't just open one VFB and then keep rendering the furthur images in the same VFB.
2. it is not saving files as sphere001.jpg..... sphere002.jpg......... sphere003.jpg. it is just saving only one image as sphere.jpg
any help is appreciated to solve these probelms.
Cheers !!!
"Passion is the flame that burns forever."
read 1874 times 11/9/2009 8:08:52 AM (last edit: 11/9/2009 8:08:52 AM)
|