Reading the action commands sent to max and recompiling those set of actions as a script.

Hello All,

I have just finished a project with a happy ending and i want to librarize some models that i have created for future use on other projects and also share my workflow that i will use for the next decade (hopefully).

#1 - group the objects

 

#2 - rename the objects inside that group same as group's name

 

3# re-align pivots  considering the group as on objects.

 

4# move the grouped objects to "0" coordinates.

 

5# assign the grouped objects to a new layer

 

6# rename the layer , same as the group name.

 

7# save every layer to separated maxfiles. ("layers 2 files script from "tanya wiesner" works very wellin this case.)

 

8# launch a third party plugin to render the new max files, the program will render the preview and save the output named as the group's name.

so in total,

i will have a preview file

a max file

a group,a layer bunch bunch of objectsthat are named same as the max file.

"I had a plan"...

My initial idea was realying on the max script listener so any tool i used through the GUI, would be read from the listener. but it does not say anything usefull. so is here any other way around?

the first 6 steps are sufficient.

 

 

 

 

 

 

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

The new version

Here the script that allows you to set the name of the group. Also, if you have the layer with group name the script will automatically change the group name to avoid errors.

About render - what exactly do you want? When you press the "Save" button the script create new max file and preview file. If you want to create 5 groups you have to select objects, then set the group name and then you have to press the "Save" button for every group = 5 times, which will crete 5 max files and 5 preview images.

(
	global rol_crystal3d
	try(destroyDialog rol_crystal3d)catch()
	rollout rol_crystal3d ""
	(
		local savePath = undefined
		edittext et_savePath "Output path:" pos:[5,5] fieldwidth:220 labelontop:true readOnly:true
		button btn_getPath "Browse" pos:[230,22]
		edittext et_grpName "Name:" pos:[5,45] fieldwidth:220 labelontop:true
		button btn_Save "Save" width:100 align:#center 
 
		on btn_getPath pressed do
		(
			savePath = getSavePath caption:"Folder to save"
			et_savePath.text = savePath
		)
 
		on btn_Save pressed do
		(
			--	#1 - group the objects
			grp = group selection name:et_grpName.text select:true 
			--	4# move the grouped objects to "0" coordinates.
			grp.pos = [0,0,0]
			--	6# create and rename the layer , same as the group name.			
			grpLayer = layermanager.newLayerFromName grp.name
			--	if there is a layer with group name rename this layer by adding the timestamp numbers as sufix
			if grpLayer == undefined do grpLayer = layermanager.newLayerFromName (grp.name+(timestamp() as string))
			grpLayer.current = true	--	set layer as current layer 
			for o in grp do
			(
				o.name = grp.name 	--	#2 - rename the objects inside that group same as group's name
				o.pivot = grp.pivot 	--	3# re-align pivots  considering the group as on objects.
				grpLayer.addNode o	--	add objects in the group to the layer
			) 
			--	7# save every layer to separated maxfiles. ("layers 2 files script from "tanya wiesner" works very wellin this case.)
			saveNodes selection (savePath+"\\"+grp.name+".max") quiet:true 
			--8# launch a third party plugin to render the new max files, the program will render the preview and save the output named as the group's name.
			--	instead of using third party plugin
			max select invert
			objToHide = selection as array
			max hide selection
			render renderhiddenobjects:false outputfile:(savePath+"\\"+grp.name+".png") vfb:false -- render grp
			for o in objToHide do o.isHidden = false		--	unhide other objects			
		)
	)
	createdialog rol_crystal3d width:300
)
crystal3d's picture

Hi again, thank you for coming back for more!

I tried it and it worked really cool, i disabled the 8th step as it is much better to create previews on a latter stage however, i have some suggestions and they are utterly superficial and non-crucial so be warned and dont get mad at me.

* can you make it remember the last used export path?

* Pasteable output paths, just like the name entry, pasting a path without clicking the "browse" button.

*Name prefixes, that i used on previous script launch...

these would make it fabulous :)

miauu's picture

Here it is.Every time when

Here it is.

Every time when you press the Browse button, the selected path will be added in dropdownlist. Tha last used path is the last added - in the bottom of the ddl. To clear all paths in the ddl right-click over ddl. Note that you can save 100 and more paths if you want.

You can paste the output path. When you close the dialog the text in the name box will be saved and next time when you lounch the script this name will be loaded.

 

 

AttachmentSize
c3d.ms 3.88 KB
crystal3d's picture

amazing!.

MIAU's amazing organized exporter... there it's this gem's name!
thanks a million.

miauu's picture
crystal3d's picture

btw, gz !

your new released pack of scripts are wonderfull, i am sold on "clone betweeen" and "involume scatter" tools and will have a visit ;)

miauu's picture

Small optimization

(
	global rol_crystal3d
	try(destroyDialog rol_crystal3d)catch()
	rollout rol_crystal3d ""
	(
		local savePath = undefined
		edittext et_savePath "Output path:" pos:[5,5] fieldwidth:220 labelontop:true readOnly:true
		button btn_getPath "Browse" pos:[230,22]
		button btn_Save "Save" width:100 align:#center 
 
		on btn_getPath pressed do
		(
			savePath = getSavePath caption:"Folder to save"
			et_savePath.text = savePath
		)
 
		on btn_Save pressed do
		(
			--	#1 - group the objects
			grp = group selection select:true 
			--	4# move the grouped objects to "0" coordinates.
			grp.pos = [0,0,0]
			--	6# create and rename the layer , same as the group name.
			grpLayer = layermanager.newLayerFromName grp.name
 
			grpLayer.current = true	--	set layer as current layer
 
			for o in grp do
			(
				o.name = grp.name 	--	#2 - rename the objects inside that group same as group's name
				o.pivot = grp.pivot 	--	3# re-align pivots  considering the group as on objects.
				grpLayer.addNode o	--	add objects in the group to the layer
			)
 
			--	7# save every layer to separated maxfiles. ("layers 2 files script from "tanya wiesner" works very wellin this case.)
			saveNodes selection (savePath+"\\"+grp.name+".max") quiet:true
 
			--8# launch a third party plugin to render the new max files, the program will render the preview and save the output named as the group's name.
			--	instead of using third party plugin
			max select invert
			objToHide = selection as array
			max hide selection
			render renderhiddenobjects:false outputfile:(savePath+"\\"+grp.name+".png") vfb:false -- render grp
			for o in objToHide do o.isHidden = false		--	unhide other objects			
		)
	)
	createdialog rol_crystal3d width:300
)
crystal3d's picture

thank you miauu, i tested it.

but i cant get this work, if it s not "asking alot, i want to whine about it alittle bit and describe more about it

First problem is, it does not let me rename the group so every model comes out as "group001","groupd02"

the other problem is rendering...

having it save a preview file and name it accordingly is an ACE feature but it only renders once per script launch. So it had to launch 5 renders for 5 separate groups=5 previews files.

 

i did not just sit at my chair "bla bla" here and prepared a sample scene with lo-poly models to better reflect what i have in mind.

http://dl.dropbox.com/u/35816487/sample_assets.max

incase you can help me further...

miauu's picture

Hi! Sory, but I see your

Hi!
Sory, but I see your answer a minute ago. I will make the changes that you want, but you have to wait a few days, because I'm quite busy with releasing my new script pack.

crystal3d's picture

sure, i can wait.

take care

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.