ScriptSpot home

Forum topic · General Scripting

New\Keep Objects - no prompt

By Piotr · 2013-12-04

Description

I'm looking for function which will do
actionMan.executeAction 0 "17" -- File: New Scene, Keep Objects
but without asking for save, I already tried:

actionMan.executeAction 0 "17" #noprompt

and

if checkForSave() do
(
actionMan.executeAction 0 "17" -- File: New Scene, Keep Objects
)

I also notice if I launch "New\keep objects" on medium level of complexity scene it almost always=max crssh. I work on max2013 however this problem don't exist on max2011. Is also any other access to this New\keep objects without involving
actionman?

Comments (5)
Piotr

popups

It also lose view perspective view:) and script give me popup with missing plugins in case of missing plugins on scene. Is there way to get rid of this annoying popups at least?

Reply to Piotr
Branko Živković

And why you lose it what do you think? :)
For missing plugins i don't know how to block this

Piotr

close but not close enough

Thank you, smart nice script, I like it but Keep Objects - new/keep objects - remove hierarchy and all animations. Your script seems to only merge objects to new scene.

I menage to do this like:

select objects
deleteKeys objects #allKeys
(
for o in selection do for c in o.children do c.parent = undefined
)
saveMaxFile sceneName quiet:true
ResetMaxFile #noPrompt
mergeMAXFile sceneName #noRedraw #AutoRenameDups #useMergedMtlDups #alwaysReparent

but in this case objects with skin modyfier on it seems are broken additional settings are removed - Keep Objects don't behave in this way.

Reply to Piotr
Branko Živković

Why is so important to remove hierarchy? Leave it as it is and just removes keys

Branko Živković

Try this

fn newSceneKeepNodes =
(
local tmpFile = ((getdir #autoback)+"\myScene.max")
local viewTM = getViewTM()
saveNodes objects tmpFile
resetMaxFile #noPrompt
mergemaxfile tmpFile
viewport.setTM viewTM
deleteFile tmpFile
)