Notifications
Clear all

[Closed] makepreview multi cameras

Hello, I’m doing a script to mount a makepreview multi cameras,
but I’m building a script test to see how this code will be
behave, the more I’m not getting access to the fn populatelist
change the amount of frames:

try(destroyDialog theRollout)catch()

rollout theRollout “The Rollout” width:480 height:270
(
local pathR = “C:\”
local camRender = “”
local rW = (renderWidth )as string;
local rH = (renderHeight )as string;
global frStartv = animationRange.start
global frEndv = animationRange.end
local frameRend = “ccc”
local frameRstart = “ccc”

dotNetControl lv "system.windows.forms.listView" pos:[10,15] height:200 width:270
groupBox groupCamList "List Cam" pos:[1,1] height:220 width:290
groupBox groupGenSets "General Settings" pos:[300,1] height:220 width:170
button btRGo "Render" pos:[350,120] width:70 height:30
button refresh "Add" pos:[360,100] width:50 height:15	
button btPathR "..." pos:[400,220] width:20 height:20 
editText porRender pos:[315,25] text:(rW + " x " + rH) align:#center enabled: false width:140 height:20
progressbar renderF "Render" pos:[320,170] width:130 height:15
editText pathRender pos:[10,240] text:pathR width:385 height:20
spinner tRStart "From" pos:[330,75] width:50 height:16 type:#integer range:[-1000000,1000000,frStartv]
spinner tREnd "To" pos:[410,75] width:50 height:16 type:#integer range:[-10000000,1000000,frEndv]


on pathRender entered txt do
	pathRender.text = pathR

on btPathR pressed do
	pathRender.text = selectSaveBitMap()
	
on tRStart entered do
	frameRstart = (tRStart.range[3])as string
		
on tREnd entered do
	frameRend = (tREnd.range[3])as string

on refresh pressed do
(
	???
)	
--or
on tRStart entered do
(
	???
)
	
--Add columns.
fn populateList theLv=
(
	global camera_array = #()
	camera_array = for obj in cameras where iskindof obj camera collect obj
	rows=#()			--Empty array to collect rows of data
	for x in camera_array do		--Loop through all the objects in the scene. 
	(
		li=dotNetObject "System.Windows.Forms.ListViewItem" x.name	--Create a listViewItem object and name it. 
		li.subitems.add frameRstart --Frames a renderizar
		li.subitems.add "???x???" --Tamanho do frame de render
		append rows li		--Added the listViewItem to the rows array
	)
	theLv.items.addRange rows		--Add the array of rows to the listView control. 
)

fn initLv theLv=
(
	--Setup the forms view
	theLv.view=(dotNetClass "system.windows.forms.view").details
	theLv.Sorting = (dotNetClass "System.Windows.Forms.SortOrder").Ascending
	theLv.CheckBoxes = true
	theLv.FullRowSelect=true		--Set so full width of listView is selected and not just first column.
	theLv.GridLines=true			--Show lines between the items. 
	theLv.MultiSelect=true			--Allow for multiple selections.
	
	layout_def = #("Camera", "Frames", "Resolution")
	
	
	for i in layout_def do
		theLv.Columns.add i 90
)

on theRollout open do
(
	initLv lv
	populateList lv
)

)

createDialog theRollout

Tks!

1 Reply

[PT]

Joca, analisei seu código e acho que você poderia mudar um pouco a lógica da coisa, para evitar problemas futuros. Minhas sugestões:

  1. Escolher o path de output e retornar a string se valido

  2. Utilizar uma lista bem estruturada/organizada das cameras coletadas com descrição do nome, aspect ratio, animation range, view size, listagem de output (assim o user pode acessar e visualizar o que já existe), etc
    exemplo
    http://penproductions.ca/tutorials/dotNet/listView/dotNetListView.htm

  3. Faça um output de log sobre o acesso e resumo da utilização do user por data.

  4. Perguntar ao user se ele deseja mostrar a pasta com seus resultados no explorer

  5. separe a criação do acesso (load/save, read/write), assim você consegue maior flexibilidade entre o processo

Abaixo um pequeno exemplo extraido do próprio help para gerar um quick preview


-- How To ... Create a Quick Preview
(
	
	preview_name = (getDir #preview)+"/quickpreview.avi"
	view_size = getViewSize()
	anim_bmp = bitmap view_size.x view_size.y filename:preview_name
	
	for t = animationrange.start to animationrange.end do
	(
		sliderTime = t
		dib = gw.getViewportDib()
		copy dib anim_bmp
		save anim_bmp
	)
	close anim_bmp
	gc()
	ramplayer preview_name ""

)

E não esqueça de analisar referencias:
http://www.rockthe3d.com/multi-camera-preview-3dsmax-script/

Espero que ajude,
abraços