r/Maxscript • • Mar 26 '26

MAXScript 101 by John Wainwright - Essential Free Resource on Vimeo

10 Upvotes

(Sorry if this has been posted before!)

I stumbled across this again and had to share - John Wainwright's MAXScript 101 series on Vimeo is legit gold.
Dude's basically the father of MAXScript.

https://vimeo.com/user5796788

Goes from language fundamentals through practical scripting tasks, custom UI stuff, and real examples. Yeah it's old but the core logic hasn't changed and it's still super relevant for 3ds Max.

Total classic


r/Maxscript • • Mar 14 '14

MAXScript 101 by John Wainwright (The creator of MAXScript.)

Thumbnail
vimeo.com
7 Upvotes

r/Maxscript • • Feb 22 '21

XRefs selection sets - 3ds Max script

5 Upvotes

Hello friends, I made a 3ds Max script to make the Organisation of XRefs in selection sets. This will save your time when you working with many XRefs and you have to turn dem on and off for every camera before you send it in the renderfarm.

You can download it from this link.

https://todorvankov.com/3ds-max-scripts#XrefsSelectionSets

There is a small tutorial .

Wish you a nice day

3dsmax #Maxscript #3dsmaxscript


r/Maxscript • • May 08 '19

New to scripting--

5 Upvotes

For people here, who do maxscipting professionally-- did you study another language prior to this?

I am an animator who does rigging, but I need to learn scripting to quicken my work flow. I have been learning little bits of scripting through deconstruction, but so much of it makes no sense to me. I want to improve, but I want to hear from others on how they improved.


r/Maxscript • • Feb 16 '15

WIP - Building Maker script.

5 Upvotes

I often need to make buildings and play with their heights.
I wrote a simple script mostly using the maxscript listener to create a building:
The buildings are simple boxes extruded
But because the buildings I need to use don't have simple rectangular footprints I seldom will use that script
The building footprints I use are slightly more articulated
Here's my wishlist for a script I'm trying to figure out:

  • I want a similar script to run on any closed spline

  • It'd be magical if the stack could be live in a way that I can update the number of floors (possible at all?)

  • I want to find a way to add extra detail on the rooftop (Greeble-like)

I'll leave my current simpler script below. I'd really appreciate any help/pointers to achieve this script, I think others could find it useful too. Cheers!

edit: Standby for formatting edits.


r/Maxscript • • Mar 16 '14

Using Print & Format to help debug your scripts

5 Upvotes

Print one item with the print command

print "some text" --can also replace string with any variable

Print multiple variables with the format command

nameVar ="Marty McFly"
ageVar =50
format "name:%, age:%\n" nameVar ageVar

Result in max listener window: name:Marty McFly, age:50

F11 opens listener window, or from the menu MAXScript -> MAXScript Listener


1st '%' will be replaced with your 1st variable, the 2nd '%' by the 2nd varible you list, and so on.

"\n" is the new line character, it does not appear in the listsener output, it simply acts as if you had hit the return key at that point and moves to a new line.

Handy for debugging values at certain points in your code.

Max Help


r/Maxscript • • May 10 '22

Maxscript : Arrays - Iteration

Thumbnail
youtu.be
4 Upvotes

r/Maxscript • • Aug 07 '19

Maxscript to access key in Curve editor

4 Upvotes

I know how to create a snapping pose tool, or a copy all poses tool, but I've no idea how to access keys from the "Curve editor" and flipping them in scripts.

I could easily go through the "Curve editor", and just flip rotations and positions, so the animations are mirrored. But yeah, it would be awesome to access these keys, and modify them in code/script.

Is anyone familiar with this?

-Thank you


r/Maxscript • • Apr 10 '14

[Script] Instance and rename duplicate standard/multi materials

4 Upvotes

Made this for a project I'm working on, posting it here at /u/ssillyboy's suggestion in the event that this can help someone else having the same issues as me. It will take every standard/multimaterial in the scene, instance all materials sharing the same diffuse map, and rename them to have the same name as the diffuse map.

This is the only maxscript I've ever written and I pretty much learned everything I needed to write it in about a day, so it is probably not written optimally.

--  This script will process all standard materials and multimaterials in the scene, rename them to the diffuse texture's name, and instance all duplicates
difTexName = #()
matArray = #()
listOfMats = #()
listOfMultiMats = #()
listOfStdMats = #()

fn getTexName str = -- Function that returns texture name without filepath
(
    filteredName = filterString str "\\."
 	numTokens = filteredName.count - 1
	return filteredName[numTokens]
)

for m in geometry where m.mat != undefined do append listOfMats m -- List of materials
for m in listOfMats where findstring (m.mat as string) "#Multi/Sub-Object" != undefined do append listOfMultiMats m -- List of objects wiith multi-materials
for m in listOfMats where findstring (m.mat as string) ":Standard" != undefined do append listOfStdMats m -- List of objects with standard materials

for m in listOfStdMats do (
	try ( 
		curDifMap = getTexName m.mat.diffuseMap.filename
		mtlPos = findItem difTexName curDifMap -- Checking list of diffuse textures to see if this material is a duplicate
		if (mtlPos > 0) then (
			m.mat = matArray[mtlPos] -- If there is a match, assign the original material
		)
		if (mtlPos == 0) then (
			m.mat.name = curDifMap -- If there isn't a match, rename the material and add it to the list
			append difTexName curDifMap
			append matArray m.mat
		)
	)
catch()
)

for m in listOfMultiMats do ( -- Same thing for multi materials
	try (
		curSubSlot = 0
		for curSubMaterial in m.mat do (
			curSubSlot += 1
			curDifMap = getTexName curSubMaterial.diffuseMap.filename
			mtlPos = findItem difTexName curDifMap -- Checking list of diffuse textures to see if this material is a duplicate
			if (mtlPos > 0) then (
				m.mat[curSubSlot] = matArray[mtlPos] -- If there is a match, assign the original material
			)
			if (mtlPos == 0) then (
				curSubMaterial.name = curDifMap -- If there isn't a match, rename the material and add it to the list
				append difTexName curDifMap
				append matArray curSubMaterial
			)
		)
	)
catch()
)

r/Maxscript • • Mar 17 '14

Duber's Studio: Structs in MAXScript. (A basic understanding.)

Thumbnail
blog.duber.cz
4 Upvotes

r/Maxscript • • Mar 15 '14

[Script] 0 Size Face Check (select smallest poly)

4 Upvotes
macroScript ZeroSizeFace category:"_GRS Scripts" ButtonText:"0 Size Face Check" tooltip:"0 Size Face Check"
(	
smallest =65535
face=1

try (
	for i=1 to polyop.getNumFaces $ do(
	
		area_ = polyop.getFaceArea $ i
		if area_ < smallest then (
			face=i
			smallest=area_
		)
	)
	
	$.SetSelection #Face #{face}

	subobjectLevel=4

	)

catch()
)

r/Maxscript • • May 06 '22

Maxscript : Arrays

Thumbnail
youtu.be
3 Upvotes

r/Maxscript • • Aug 07 '21

Reset Material Editor

Post image
3 Upvotes

r/Maxscript • • Mar 11 '21

Null Objects Cleaner

3 Upvotes

This script find the null objects in your scene, show you a list of these objects and give you the possibility to delete them from your scene.

Null Objects Cleaner


r/Maxscript • • Feb 16 '21

Manipulated on the local axis within the controller script?

3 Upvotes

https://drive.google.com/file/d/1H7Ii-KYjTNObB_ffX264TX0b0kamWzsy/view?usp=sharing
I wonder how it can be manipulated on the local axis within the controller script?


r/Maxscript • • Jan 22 '21

Modpost: When asking for help on specific sections of code...

3 Upvotes

I love that this sub has survived this long and I am incredibly proud of all of you for being helpful when you're able to.

That said, there's something that I think should be mentioned in terms of asking for help with code you've written... If you don't post the code you're using, the help that you get will be more likely to be shots in the dark rather than tangible assistance.

So... from here on in I'd like to make a suggestion (this is not a rule but I may consider making it one if things go a certain direction) in that when you are in need of assistance with a segment of code, please post the segment of code in the body of your post.

This will help others narrow down what's going on and it will make it so that others can more easily learn.

Also, when you do get help, please leave your post up. I haven't noticed any deletions after the help has been recieved, but I know that that could happen.

This means that when you do post code, you will need to be the one that wrote it, and you need to be comfortable with other people borrowing it... so, in the interests of keeping your IP secure, posting segments of code does /NOT/ mean the entire thing. If you want to keep some cards held close to your chest, that's fine and protection of one's IP is a valid reason.

That being said, the more code you can post, the easier it will be for others to be able to identify what you're asking for help with, and it will also be a good opportunity for newbies to learn as well.

I am going to repeat this next bit though... this is not a new rule, and this is not a requirement. This is only the team here making mention on ways that you can get the help you're seeking faster and easier.

Thank you very much for your time and consideration and I look forward to seeing more activity (even though it's not as busy as some other subreddits out there.)


r/Maxscript • • Aug 27 '19

Simple Grab Viewport and Save it - HELP

3 Upvotes

I want a very simple script to grab the viewport and save it on the same opened project folder.

I did it all, select the viewport that I want, change the shading method, but I cannot make up the script line to get the file path and save the image into it.

I tried:

1

print (getBitmapInfo (getDir #maxroot +"\\capture\\+(getFilenameFile)+ ".jpeg"))

--

2

img.filename = MyPath + (getfileNameFile maxFileName) + ".jpg"

save img

--

3

getFilenamePath() + "\\"

--

4

img.filename = getSaveFileName (getfileNameFile + getMAXSaveFileName) + ".jpg"

save img

The last one, works once, but strangely when you run it again, it doesn't. No explanation, just saves once, even if you delete the image, it does not save it again. Only when Max is restarted.

I found in the ScriptSpot this but I just want one button click to run this, no further options.

Thank you.


r/Maxscript • • Sep 02 '18

Vertex Color Gradient tool

3 Upvotes

Hello,

I need help (or at least a pointer) where can i start if i want to create a Vertex color gradient tool.

I want the base of an object to be 0 value (dark) and top to be 1(white).

My thoughts so far on it: Get vertex position, if below or at grid level put it black. That should be quite easy.

My problem tho would be to do the gradient higher than grid level.

I'm really beginner level and im not even sure if its possible to achieve this.

Any help would be welcome.


r/Maxscript • • Jan 18 '18

Executing MaxScript from external IDE

3 Upvotes

Found this tool: https://github.com/JeffHanna/MXSPyCOM/releases

Was able to successfully configure it with PyCharm, and imagine that it works with any other IDE as intended. Thought this would be of interest.

Note: One of the final steps in configuration is to pass along a filepath argument (to ID which script should be executed). The instructions listed on the GitHub page describe using the %f format to do this. I found that PyCharm did not accept this, and that the use of a built in 'macro' $FilePath$ did the trick. I'd imagine that other IDEs might have similar nuances.


r/Maxscript • • Sep 08 '17

Maxscript for pulling and using EXIF data from a photo?

3 Upvotes

Ideally, I would love to have a script with which you can drag'n'drop a photo onto it, and it grabs all the data it can. Focal length, f/stop, iso, shutter speed, and perhaps even date/time of day. And uses that information to create a new camera in a scene, at approximate human scale with all those camera attributes as well as matching the resolution, setting the photo as the environment/viewport background and possibly even setting up a daylight system with the date/time information brought across.

Is that even possible? How would one go about learning to code something like that? Has someone already made one? Does someone want to do it for me? How much money would you like to be paid to do such a thing?

For bonus points, is it possible to get a script to write exif data to a render with data on focal length etc.

Thanks!


r/Maxscript • • May 19 '17

Undocumented MAXScript Features

3 Upvotes

Blogspot post I made to make my life easier since I keep forgetting these.

Apart from stuff most of you already know (edit poly methods), there's more than 30 other sections. Everything reported previously as missing/incomplete, and once again brought to attention of the documentation team after compiling all the info in that post, so a more complete version will hopefully appear in the official docs in the future.

There's bound to be much more of these that I'm not aware of so if you didn't find something you know is undocumented or documented in a misleading way in the list, I'd be happy to hear that.

There are also numerous function-holding structs and global functions defined in stdscripts like snaps, filters, functions from controllerfunctions.ms, VFB_methods, lvops (.net listview helper fns), tvops (dtto for treeview), PolyToolsUI, PolyBoost, Ribbon_Modeling, Main_Ribbon. While those are not documented either and quite useful (there's a lot of stuff that almost everyone who starts writing maxscript reinvents again since there's no mention about it in the reference), I didn't include those as anyone can access them, see what arguments are expected and what the function does.


r/Maxscript • • Oct 11 '15

Color correcting multiple materials at once?

3 Upvotes

Hi,

I have a crapload of unique materials in my scene, and wish to go in and shift the hue/brightness/etc for a bunch of them. Some of them are are "multi/sub object" materials, others aren't.

I can shift+drag the color-correct map within the Slate Editor to copy it, then de-link the copy and apply it to another map, but I need to do this with so many materials that it would get really tedious.

Ideally, I'd have the ability to select several objects and then run a script that applies a color correction map to each diffuse map... WITH color correction settings. So, perhaps, enter a numerical value into a box for "hue shift" and have that be applied to each selected map.

If not, just having "blank" color correct slots applied would be good.

Perhaps a variation upon this script? http://www.scriptspot.com/forums/3ds-max/scripts-wanted/place-colorcorrect-map-in-all-diffuse-slots

(I don't use Vray so that one doesn't work for me, but seems a promising start? Right now I'm using standard materials but may use Mental Ray in the future as well... but just requesting Standard to keep things simple.)

Many thanks in advance!


r/Maxscript • • Jun 19 '15

How to delete a position constraint?

3 Upvotes

HI guys I'm new to scripting. Especially in MAX...literally my first script.
I have a bone with an attachment constraint but I'd like to remove it!

I've looked at the help section and I'd imagine this is supposed to help me?
<boolean>deleteTarget <index>targetNumber
But I have absolutely no idea what its telling me.
HAVE MERCY! Many thanks.


r/Maxscript • • Jun 16 '15

Batch import with an operation between each import.

3 Upvotes
files = getFiles "C:\Users\Name\Desktop\import test\3d\import\*.obj"
for i in files do
(
	importFile i #noPrompt --Im still getting a prompt for the first import?
) 
baseName = "*"
execute ("objArr = $" + basename + "* as array")
for obj in objArr do
(
	addModifier obj (MultiRes ())
	obj.modifiers[#MultiRes].vertexPercent = 10
	obj.modifiers[#MultiRes].reqGenerate = off
)
for i in 1 to objArr.count do
(
	objArr[i].modifiers[#MultiRes].reqGenerate = off
	maxOps.CollapseNodeTo objArr[i] 1 off
)

This imports .objs and then applies a multi res and collapses.
How could I change the operation to act like this:

  • Import a file

  • Multires and collapse

  • Import next file

  • Multires and collapse

  • Import next file
    etc
    Because I have a lot of imports to go through (500+) and crunching each one asap is a good workflow for me.


r/Maxscript • • Jun 12 '15

How to periodically test whether autobackup is disabled?

3 Upvotes
checkbutton checkBtn1 "Auto Back Up" checked:(autoBackup.enabled)
spinner spSpinner1 "minutes between back ups: " type:#integer range:[1,100,(autoBackup.time)]
on checkBtn1 changed state do --Auto Back Up enabled
		if state then
		(
			autoBackup.enabled = true
		)
		else
		(
			autoBackup.enabled = false
		)
		on checkBtn1 rightclick do
		(
			autoBackup.time = spSpinner1.value
		)

I've got a simple autobackup toggle button in my toolset, it's nice and visual because sometimes I don't know if the backup is enabled or not.
A useful function would be to test if autobackup is enabled after one hour, if not enabled a popup gives you the option to enable or discard, I'd only want the prompt to ask just once in 6 hours.
Here's the MAXScript help for calling a function periodically using DotNet.
http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012/index.html?url=files/GUID-DB82F222-B77F-4F85-865F-A4D54B53107-347.htm,topicNumber=d28e115768
Does someone know how to script this together? I think it'd be helpful for people that don't know that their autobackup is disabled.
Also, I'd like to share the script, what is the easiest way for a noob to install a script like this?