IFL's broken?

Try this snippet of code, run these in this order and you'll noticed the IFL will not update for the second sequence. It will still attempt to load 30 images even though there are only 5.

capture_viewport filepath 0 30 -- Run first
capture_viewport filepath 0 5 -- Run second

Here is all the code..

fn capture_viewport filepath start end =
(
	local dir = getFilenamePath filepath
	local filename = getFilenameFile filepath
	local filefilter = pathconfig.appendpath dir filename
	local files = getFiles (filefilter + "*" + (getFilenameType filepath))
 
	-- delete any pre existing files
	for f in files do deleteFile f
 
	-- capture scene
	view_size = getViewSize()
	temp_bmp = bitmap view_size.x view_size.y gamma:1.0 filename:filepath
	for t = start to end do
	(
		sliderTime = t
		temp_bmp = bitmap view_size.x view_size.y gamma:1.0 filename:filepath
		dib = gw.getViewportDib()
		pasteBitmap dib temp_bmp (box2 0 0 view_size.x view_size.y) [0,0]
		b = save temp_bmp frame:t
		close temp_bmp
	)
 
	-- open in ram player 
	local dir = getFilenamePath filepath
	local filename = getFilenameFile filepath
	local filefilter = pathconfig.appendpath dir filename
	local files = getFiles (filefilter + "*" + (getFilenameType filepath))
 
	local theIfl = pathconfig.appendpath dir (filename + ".ifl")
	local file_handle = createFile theIfl
	for f in files do format "%\n" (filenameFromPath f) to:file_handle
	close file_handle
 
	RAMPlayer (theIfl) ""
)
 
 
filepath = (getDir #preview)+"/test.jpg"
 
 
capture_viewport filepath 0 30 -- Run first
 
-- capture_viewport filepath 0 5 -- Run second

Comments

Comment viewing options

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

`

this is some way around

local theIfl = pathconfig.appendpath dir (filename + "_" + start as string + "_" + end as string + "_" + ".ifl")

I tried also delete ifl first and save with

(dotnetClass "System.IO.File").WriteAllLines theIfl files

but still ramplayer tries to loads previous ifl file

only saving with other filename helps for now

It looks like RAMPlayer keeps ifl list in memory if ifl file name is the same as previous

If you run it with (0-30 and 0-5) you will get error - than changing to (0-5 and 0-5) still show the same error

pixamoon's picture

`

oki, so one more way around is to use temp Ifl file:

	local tempIfl = pathconfig.appendpath dir (filename + timestamp() as string + ".ifl")
	copyfile theIfl tempIfl
 
	RAMPlayer (tempIfl) ""
 
	deletefile tempIfl

and whole code:

fn capture_viewport filepath start end =
(
	local dir = getFilenamePath filepath
	local filename = getFilenameFile filepath
	local filefilter = pathconfig.appendpath dir filename
	local files = getFiles (filefilter + "*" + (getFilenameType filepath))
 
	-- delete any pre existing files
	for f in files do deleteFile f
 
	-- capture scene
	view_size = getViewSize()
	temp_bmp = bitmap view_size.x view_size.y gamma:1.0 filename:filepath
	for t = start to end do
	(
		sliderTime = t
		temp_bmp = bitmap view_size.x view_size.y gamma:1.0 filename:filepath
		dib = gw.getViewportDib()
		pasteBitmap dib temp_bmp (box2 0 0 view_size.x view_size.y) [0,0]
		b = save temp_bmp frame:t
		close temp_bmp
	)
 
	-- open in ram player 
	local dir = getFilenamePath filepath
	local filename = getFilenameFile filepath
	local filefilter = pathconfig.appendpath dir filename
	local files = getFiles (filefilter + "*" + (getFilenameType filepath))
 
	local theIfl = pathconfig.appendpath dir (filename + ".ifl")
 
	local file_handle = createFile theIfl
	for f in files do format "%\n" (filenameFromPath f) to:file_handle
	close file_handle
 
	----------------------------------------------------
	--- new by pixamoon
	----------------------------------------------------
	local tempIfl = pathconfig.appendpath dir (filename + timestamp() as string + ".ifl")
	copyfile theIfl tempIfl
 
	RAMPlayer (tempIfl) ""
 
	deletefile tempIfl
	----------------------------------------------------
	--- end new 
	----------------------------------------------------
 
)
 
 
filepath = (getDir #preview)+"/test.jpg"
 
 
capture_viewport filepath 0 30 -- Run first
 
capture_viewport filepath 0 5 -- Run secondw

basically Ramplayer needs to be started with new ifl filename eatch time - otherwise uses old list

hope this helps

JokerMartini's picture

that is a good solution :)

that is a good solution :)

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Comment viewing options

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