ScriptSpot

Forum topic · General Scripting

New\Keep Objects - no prompt

By kredka · 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)

popups

kredka · 2013-12-04

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?

barigazy · 2013-12-04

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

close but not close enough

kredka · 2013-12-04

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.

barigazy · 2013-12-04

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

barigazy · 2013-12-04

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
)