A custom script that allows users to copy selected objects (including transforms, modifiers, materials, and properties) and paste them into the same scene or across different 3ds Max sessions. This goes beyond the native Ctrl+C/Ctrl+V by preserving hierarchies, custom attributes, and instancing options.
fn getModifierData m =
(
md = #()
for p in m.parameters where p != undefined do ()
for prop in (getProperties m) do ()
-- simpler: capture name and public properties via snapshoth
try
(
props = dotNetClass "System.Collections.Generic.Dictionary`2[System.String,System.Object]"
for pn in (getPropNames m) do
props.Add pn (m[pn] as string)
)
catch()
append md (name:m.name class:(classof m) props:props)
md
)
data = #()
for o in selection do
(
obj = #()
obj.name = o.name
obj.transform = (matrix3ToArray o.transform)
mods = #()
for m in o.modifiers do
(
modProps = #()
for pn in getPropNames m do
append modProps #(pn, (m[pn] as string))
append mods #(class=(classof m).name name:m.name props:modProps)
)
obj.mods = mods
append data obj
)
json = dotNetObject "System.Web.Script.Serialization.JavaScriptSerializer"
clipText = json.Serialize (dotNetObject "System.Collections.ArrayList" data)
dotNetClass "System.Windows.Forms.Clipboard".SetText clipText
format "Copied % objects to clipboard.\n" selection.count
Replace the copyScript function with file I/O:
fn robustCopy = ( local tempFile = (getDir #temp) + "\\max_copy_temp.max" saveNodes selection tempFile --Saves selected objects to a temp .max file print "Saved to temp file. Ready to paste anywhere." )
fn robustPaste = ( local tempFile = (getDir #temp) + "\max_copy_temp.max" if doesFileExist tempFile do ( mergeMAXFile tempFile #select #promptDups #useMergedMaterialDups ) )
This basic script is the foundation of every professional Copy-Paste script on the market.
| Limitation | Workaround |
|------------|-------------|
| Cannot copy lights/cameras natively | Use instance mode or save as .max snippet |
| Animation controllers lost | Store as .xaf file internally |
| Cross-version compatibility | Use XML/JSON export instead of binary |
Native material copying (Shift + Drag from one slot to another) is decent, but a script can copy a material from a specific object in Scene A and apply it to all objects with a specific name mask in Scene B, even if the material editor is closed.