ScriptSpot home

Forum topic · Scripts Wanted

Sort Batch Render Cameras sequence by camera name

By compuhms · 2018-08-25

Description
Comments (13)
appius

same here, i can't get it work

miauu

.

I suppose that the cameras are displayed in the order they are selected. So, select the cameras in proper order and you will see them with correct order.
Also you have to be able to click the header of the comuns with cameras and the list to be sorted.

Reply to compuhms
miauu

.

Try this:


(
	function SortByNames obj01 obj02 = stricmp obj01.name obj02.name
		
	camArr = for c in cameras where classOf c != targetObject collect  c	
	
	qsort camArr SortByNames
		
	select camArr
	
	actionMan.executeAction -43434444 "4096"  -- Render: Batch Render Dialog Toggle
)

Load the scene and run the script. It will open the Batch Render dialog
The last line works in 3ds Max 2019. I don't know what version of 3ds Max do you have, so if there are error in the last line, just delete it, load the scene, run the script and then opem the Batch Render dialog manually.

Reply to miauu
compuhms

I'm using 3ds Max 2016, the script gives no errors but after running the script it JUST select all cameras and open the Batch Render dialog ONLY. Still cameras are not sorted. what do you think?

Reply to compuhms
Panteleev Sergey

.

0. collect views
1. sort
2. duplicate
3. delete old
4. set original view names back

Reply to compuhms
Panteleev Sergey

.

nope, it's just a maxscript demo of the proposed algorithm

Reply to compuhms
miauu

.

Try this one:


(	
	function SortByXMember arr1 arr2 x:1 =
	(
		stricmp arr1[x] arr2[x]
	)	
	
	brmNumViews = batchRenderMgr.numViews 
	
	if brmNumViews != 0 do
	(
		viewsArr = for v = 1 to brmNumViews collect ( #(v, (batchRenderMgr.GetView v).camera.name) )
		qsort viewsArr SortByXMember x:2		
		sortedViewsArr = for arr in viewsArr collect ( batchRenderMgr.DuplicateView arr[1] )

		for v = 1 to brmNumViews do (batchRenderMgr.DeleteView 1 )	
	)
	actionMan.executeAction -43434444 "4096"  -- Render: Batch Render Dialog Toggle	
)
Reply to miauu
compuhms

unhighlight or "deselect all cameras" batch render dialogue

greetings.. incase if there is a scene with 20 render batch cameras added in batch render dialogue..is there a script to deselect all cameras from batch render dialogue so that i can manually select only certain jobs that i need to render?

Reply to compuhms
Panteleev Sergey

.


for i=1 to batchRenderMgr.numViews do (batchRenderMgr.GetView i).enabled = false

but you'll have to reopen batch render dialog to see the changes