r/Maxscript • • Jan 18 '25

How that the "Group" for Hotkey a macroscript

1 Upvotes

Hi, i write a script to toggle the PeltPointToPointSeamsMode.

But this marco script is showing in Hotkey-Editor as group "Main UI". How can change this to Unwarp_UVW?

I think its simple but i don't find this in the MaxScript Docu.


r/Maxscript • • Jan 07 '25

How do switch between pivot selection per hotkey?

1 Upvotes

Hi,

in 3ds max i have 3 modes to switch the pivot selection.

Pivot Point Center
Use Selection Center
Use Transform Coordinate center

for faster work, i will switch it per hotkey. But in the Hotkey-Editor i don't find a name like and the max script listener has no print from it.

Has anyone tried to grab this per script or found a Hotkey-Editor name?

regards,
Ulrich


r/Maxscript • • Dec 20 '24

Need help with folder structure for mzp

1 Upvotes

Hello everyone,

I am working on a small utility to make my workflow faster.

I have written some functions and have made few rollouts, buttons, etc. in MaxScript, and have them in Macro folder, and icons in Icons folder.

Now, I am working on its UX/UI for better experience and adding some more functionalities. For that I have some images for UI and for functionalities I have few MAX files along with textures, which will be merged/imported with MaxScript functions.

So, I am confused what folder structure should I use for creating MZP file. Right now I have Icons (folder), Macro (folder), install.ms (file) and mzp.run (file) in my main folder.

Thanks in advance.

Cheers!


r/Maxscript • • May 28 '24

selecting objects with real world maps

1 Upvotes

I wonder if someone can help me with this...

I wanted to make a script to find all the objects in my scene with real world maps. This is what I've got so far:

(
	function collectRealWorldMats = (
		local rwMats = #()
		for o in objects where o.material != undefined do appendIfUnique rwMats o.material
		for mat in rwMats do (
					for m=1 to mat.numsubs do (
						if classof mat[m] == SubAnim and superclassof (tM = mat[m].object) == textureMap do (
	if mat[m].realWorldScale do 
print mat.name as string
						)
					)
				)
	)
	collectRealWorldMats()
)

this runs but I have several problems with it.
First of all, I have no idea how to select the objects. This is the smaller issue, even just printing out the names helps a lot.

The real problem is that this only works with really simple materials. As soon as I have a colour correct/mask/anything that introduces sub levels, the script breaks.

Any idea how to make this work?

thanks!


r/Maxscript • • Apr 19 '24

3Ds Max crashes while running script

1 Upvotes

I need to run this code on multiple files. But sometimes it crashes and 3Ds Max closes ending my loop. I tried the try-catch statement but it didn't work.

Can anyone please guide me?

function turnToPoly = (
	for obj in geometry do (
		if isKindOf obj GeometryClass do
		(
			local turnToPolyMod = Turn_to_Poly()
			turnToPolyMod.removeMidEdgeVertices = off
			turnToPolyMod.keepConvex = on
			addModifier obj turnToPolyMod
		)
	)
)

r/Maxscript • • Jan 16 '24

select and detach faces by vertex color

1 Upvotes

Hi,

trying to write a script that detaches faces to separate objects based on their vertex color. No luck.

Any ideas?

obj = selection[1]

convertToPoly obj

for f = 1 to obj.numfaces do

(

verts = polyOp.getVertsUsingFace obj f

color = polyOp.getVertColor obj verts[1]

sameColor = true

for v in verts do

(

if(polyOp.getVertColor obj v != color) then

(

sameColor = false

break

)

)

if(sameColor) then

(

polyOp.detachFaces obj #{f} asNode:true

)

)


r/Maxscript • • Sep 07 '23

A little help with structs?

1 Upvotes

I'm trying to make my script more readable and for the declaration of the struct it is beautiful:

struct SequenceBase
(
Name,
Spline,
Dolly,
LockTargetToCam,
FocusDist,
FStop,
TargetPos,
SplineHeight,
Rotate,
Speed,
Start,
End
)

But when it comes to assigning values I have to type everything in one long line like this:

Sequence[ActiveSequence] = SequenceBase Name:EA_Rollout.txtSeqName.text Spline:SplineList[EA_Rollout.DDLPathSelection.selection] Dolly:EA_Rollout.DollyCam.value LockTargetToCam: EA_Rollout.chkLockTarget.checked FocusDist:EA_Rollout.spnFocus.value FStop:EA_Rollout.spnDOF.value TargetPos:Cam.Target.pos SplineHeight:EA_Rollout.spnArcSpline.value Rotate:EA_Rollout.spnRotateObj.value Speed:EA_Rollout.spnSeqSpeed.value Start:SequenceMarkStart End:SequenceMarkEnd

Is it possible to make this last line comma-separated or in another way make it look more structured?


r/Maxscript • • Sep 04 '23

Help with rollout variables

1 Upvotes

I hope someone can help me out here. (It's probably a very basic misunderstanding on my side)...

I have a rollout with lots of buttons and sliders.First button is a load-button to load a model into max, and the following sliders and buttons can access the properties of the object and for instance rotate the object.But when I run the script, I get a lot of errors because the sliders don't yet know the object or the properties of it...Now, how do I get around this problem?Ideally the bottom of the rollout shouldn't be active until an object has been loaded.

I have tried with two rollouts as floaters where the second one doesn't load until there's an object. But then I get errors in THAT part because Max STILL doesn't know anything about the object yet.

Can someone tell me in what order Max evaluates the script?


r/Maxscript • • Jan 15 '23

save- load animation problem

1 Upvotes

Hi to everyone. I am animator and recently noticed a ridiculous problem in 3ds max. As you well know you can save and load animation in 3dsmax easily. It have "relative" option in loading that make it more useful. But the problem. If your object is linked to another one the relative option not working and result is "absolute".even there is no different if you try it in "save load animation" in curve editor right click menu. So I think to scripting. The script that do this in curve editor: 1-Set selected keys into an array.it should be dependent of object and track name so it can operate on any track. 2-Subtract last array member value from first one. And hold it into something like "A" or copy it to clipboard. 3- Subtract last array member frame number from first one. And hold it into something like "B". 4-move the selected keys to "B" frame after 5-add "A" to the values of selected keys . My main problem is the "1-" making right array. I Know this is very basic idea. Thanks for better ideas and any help.


r/Maxscript • • Jan 01 '23

Simplifying Vray and Corona Material with maxscript

1 Upvotes

Hi, I am very new to maxscript and I want to simplify vray and corona materials with maxscript.

I want to connect each and every map directly to its corresponding socket. Please check the attached example below to get a clear idea.

If anyone can help I will be very grateful as I want to do this on 100s of materials.

Thanks


r/Maxscript • • Aug 26 '22

corona material - create, assign, modify via maxscript - how to? Please help, my bruddahs 🤝

1 Upvotes

r/Maxscript • • Jun 28 '22

How to Use selectTrack to Select a Custom Attribute in a TrackView

1 Upvotes

Hey everyone - I’m new to Maxscript and struggling to get some things to work. Wondering if someone might have an idea to help out.

I have a model with many mechanical components. I created a dummy helper object called MechanicalSystem and used this dummy as the parent for all of the components in the model - in other words, all of the model components are nested within MechanicalSystem.

For the mechanical system dummy object, I created a custom attribute called BeamRotation that is linked to the Euler rotation of one of the model components.

The hierarchy thus shows as the following: MechanicalSystem

  • Transform

  • Object (Dummy)

    • Custom_Attributes

      • BeamRotation

I am trying to use the selectTrack function to select the BeamRotation custom attribute in a Curve Editor trackview but I am not sure how to write the indexing.

I am trying the following but keep getting errors:

nCurve = trackviews.gettrackview “Rotation” nCurve.selectTrack MechanicalSystem.custom_attributes[#BeamRotation] True

Does anyone have any ideas of how I can select the custom attribute this way?

Thank you!


r/Maxscript • • Feb 28 '22

Bake to Texture VRay elements

1 Upvotes

I am trying to use MAXScript to add VRay elements to the Bake to Texture utility in 3ds Max 2022, specifically VRayExtraTex. For instance, this code adds the complete map:

bakeToTexture.addmap $ #CompleteMap

I can’t find a list of commands for the VRay elements. For instance, this does NOT work:

bakeToTexture.addmap $ #VRayExtraTex

Does anyone know where to find info on the Bake to Texture utility (not Render to Texture) for VRay elements and how to script for it?

Thank you.


r/Maxscript • • Jan 25 '22

Selecting a single vertex out of an array of vertices

1 Upvotes

I have vertices that are selected by another function. It doesn't matter which vertex, but I need to reduce this selection to one. I just can not figure out how this is done to manipulating the array in Editable Poly mode?

Can anyone help? Thanks


r/Maxscript • • Jan 19 '22

How to access Euler curve tangent of Biped Object?

1 Upvotes

Hi, one of our animator wants block out biped animation.

It can be done in manual by convert quaternion to Euler rotation mode then set curve tangent to step via Workbench or Curve Editor. Working with Euler Curves on Biped Animation

I wonder how this can be automated with maxscript.


r/Maxscript • • Jan 13 '22

objXRefMgr question: How to access the "Match Layers By Name And Parent" checker option from the Xref Objects UI dialog via maxscript?

1 Upvotes

Hi, does anyone faced the same problem? I couldn't find the answer.


r/Maxscript • • Nov 10 '21

Getting a single child in hierarchy

1 Upvotes

I'm used to C# and Maxscript is a bit alien at this stage.

I have an object selected, and I would like to get the child of the object - I can get the parent, the children, but finding the single child below the current object is proving difficult.

I have a single parent node with several children I can deal with later recursively.


r/Maxscript • • Nov 08 '21

Weld vertecies of editable spline

1 Upvotes

Hi guys i have looked around for scripting vertex weld solutions... but i'm only fining examples for Object mesh (meshop.weldVertsByThreshold) and polys, but not splines.

Im trying to make a script that:

  • loops through only the "Editable Splines" individually (classof i == SplineShape do)

  • selects the sub level "Vertex" (subobjectLevel = 1)

  • Selects all vertices on that level (actionMan.executeAction 0 "40021")

  • Weld all the selected verts by a threshold value (splineOps.weld $)

Thanks in advance


r/Maxscript • • Jun 15 '21

Script to select all 'similar objects' in scene, then attach them together

1 Upvotes

20 yrs using max no idea how to use max script. Any kind stranger's want to help me out? Would be much appreciated.


r/Maxscript • • May 04 '21

Batch Render Preset

1 Upvotes

I'm using the following code to populate the Max Batch Render utility with a view for each camera in the scene:

for b = batchRenderMgr.numViews to 1 by -1 do
(
temp = batchRenderMgr.GetView b
temp.overridePreset = false
temp.outputFilename = (edtxt_outputPath.text + "\\view0" + (b as string) + ".jpg")
temp.presetFile = "C:\\Presets\\production.rps"
)

The preset file exists, the path is correct, and the script throws no errors when executed. However, nothing appears in the dropdown list for presets. Does anyone know why, and how to force it?


r/Maxscript • • Apr 21 '21

Do you have a better way to write this tournament function. I will do things like run an operation on the verts of a face with it.

1 Upvotes
testArr = #("a","b","c","d","e","f","g")
fn Tournament arr =
(
    local numberOfPlayers = arr.count
    local numberOfMatches = numberOfPlayers - 2
    for i = 1 to numberOfPlayers - 1 do
    (
	for n = (numberOfPlayers-numberOfMatches) to numberOfPlayers do
	(
		print (arr[i] as string + " vs " + arr[n] as string)
	)
	numberOfMatches -= 1
    )
)
Tournament testArr

r/Maxscript • • Apr 20 '21

Select even vertices

1 Upvotes

Hello guys, I am a noob but I really need to select evenly the vertices of my geometry (1,3,5,ecc), or better ione vertex every two.. and i can’t find a script/command. please can you help me?


r/Maxscript • • Mar 16 '21

Pickpoint() with mouseMoveCallback

1 Upvotes

Hi all,

I'm stumbling on Pickpoint() to get the real-time pos.z of my mouse cursor position in 3D space.

I'm not really sure how to use these arguments. Hoping for some help :)

https://help.autodesk.com/view/3DSMAX/2018/ENU/?guid=__files_GUID_42CD05...

Thank you.


r/Maxscript • • Feb 26 '21

Just Select the Parent Folder of Files

1 Upvotes

I am trying to do a simple script to load files (.max.obj.fbx) apply a material that I made and save them n the same original folder. So far I did all that, but I am stuck in how it loads the files. I have to manually go trough the subfolders to select the files.

I want to just select the parent folder, then it will go trough it by itself.

I tried all I could find so far:

global iniFile = getFileNamePath(getThisScriptFilename()) + getFilenameFile (getThisScriptFilename()) + ".ini"

----

fn getfilesFromDir ext = (

local theDialog = dotNetObject "System.Windows.Forms.OpenFileDialog"

FolderBrowserDialog diag = new FolderBrowserDialog(); 

----

fn getFilesRecursive root pattern = (

	local dirs = GetDirectories (root+"/\*")

	for d in dirs do join dirs (GetDirectories (d+"/\*"))

	files = getFiles (root+pattern)

	for f in dirs do join files (getFiles (f + pattern))

	files

----

fn getDirs A NULL = (

for i in (getDirectories (A + “\*”)) do (

append NULL i

getDirs i NULL

))

-----

OpenFileDialog = dotnetobject "System.Windows.Forms.OpenFileDialog"

	OpenFileDialog.multiselect = false

	OpenFileDialog.ShowDialog()

----

fn walkDir dir pattern =

(

dirArr = GetDirectories (dir + "\\*")

for d in dirArr do

(

join dirArr (getDirectories (d + "\\*"))

)

append dirArr (dir + "\\") -- Need to include the original top level directory

for f in dirArr do

(

print (getFiles (f + pattern))

)

)

----

fn getFilesRecursive root pattern =

(

dir_array = GetDirectories (root+ " /* " )

for d in dir_array do

join dir_array (GetDirectories (d + " /* " ))

my_files = #()

append dir_array (root + " \\ " )

for f in dir_array do

join my_files (getFiles (f + pattern))

my_files

)

----

I want it to just open the dialog, I select the parent folder and that's it.

What am I missing?

Thanks!


r/Maxscript • • Aug 01 '20

Freelance MAXScripting

1 Upvotes

I have several years of experience writing MAXScripts, but always as a full-time employee. I've been asked to write a script on a freelance/contract basis. Can anyone give me advice about what to charge? What are some tips for estimating the number of hours it will take, or should I just quote a flat price?

Thanks in advance.