Autodetect Clip length on loader

User avatar
miaz3
Fusioneer
Posts: 203
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 1 time
Contact:

Autodetect Clip length on loader

#1

Post by miaz3 » Thu Mar 07, 2019 8:07 am

Hello,

I can't find a way to print this value on a loader. Right Clic on Trim bar > Autodetect Clip Length
forum_help_screen001.jpg
thanks,
You do not have the required permissions to view the files attached to this post.

Tags:

User avatar
SirEdric
Fusionator
Posts: 1723
Joined: Tue Aug 05, 2014 10:04 am
Answers: 1
Real name: Eric Westphal
Been thanked: 77 times
Contact:

Re: Autodetect Clip length on loader

#2

Post by SirEdric » Thu Mar 07, 2019 8:39 am

Sorry, but what do you mean with "
miaz3 wrote:
Thu Mar 07, 2019 8:07 am
print this value on a loader
"?

User avatar
intelligent machine
Fusionista
Posts: 399
Joined: Fri May 13, 2016 10:01 pm
Answers: 2
Location: Austin, Texas, USA
Been thanked: 28 times
Contact:

Re: Autodetect Clip length on loader

#3

Post by intelligent machine » Thu Mar 07, 2019 8:58 am

from the manual:
Autodetect Clip Length
This rescans the clip to see if frames have been added or removed since the last time the clip was scanned (when it was loaded).
The function would just have a set of current values and new values to compare and adjust if there is a difference.
The current clip length will always be last - first. Is that what you want to print in console?

User avatar
miaz3
Fusioneer
Posts: 203
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 1 time
Contact:

Re: Autodetect Clip length on loader

#4

Post by miaz3 » Thu Mar 07, 2019 11:04 am

Erf, sorry.
I mean, how can i get this function with lua.

User avatar
intelligent machine
Fusionista
Posts: 399
Joined: Fri May 13, 2016 10:01 pm
Answers: 2
Location: Austin, Texas, USA
Been thanked: 28 times
Contact:

Re: Autodetect Clip length on loader

#5

Post by intelligent machine » Thu Mar 07, 2019 11:20 am

take a look at the ReloadLoaders python script from Reactor for some clues.

User avatar
miaz3
Fusioneer
Posts: 203
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 1 time
Contact:

Re: Autodetect Clip length on loader

#6

Post by miaz3 » Thu Mar 07, 2019 11:50 am

I do not want to reload a loader, but I just want to know how to recover this attributes.

User avatar
SirEdric
Fusionator
Posts: 1723
Joined: Tue Aug 05, 2014 10:04 am
Answers: 1
Real name: Eric Westphal
Been thanked: 77 times
Contact:

Re: Autodetect Clip length on loader

#7

Post by SirEdric » Thu Mar 07, 2019 11:58 am

As @intelligent machine pointed out, clues to that might live inside that script...:-)

User avatar
miaz3
Fusioneer
Posts: 203
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 1 time
Contact:

Re: Autodetect Clip length on loader

#8

Post by miaz3 » Thu Mar 07, 2019 12:12 pm

ok, so 'TOOLIT_Clip_Length' is just a trimIN - trimOUT. is that 'Autodetect Clip length' ?

User avatar
Movalex
Fusioneer
Posts: 87
Joined: Fri Nov 03, 2017 5:36 am
Been thanked: 19 times
Contact:

Re: Autodetect Clip length on loader

#9

Post by Movalex » Thu Mar 07, 2019 12:28 pm

The script does a false rename of the Loader to reload duration. So probably Alberto did not find the answer to that question:
viewtopic.php?p=16423#p16423

User avatar
SirEdric
Fusionator
Posts: 1723
Joined: Tue Aug 05, 2014 10:04 am
Answers: 1
Real name: Eric Westphal
Been thanked: 77 times
Contact:

Re: Autodetect Clip length on loader

#10

Post by SirEdric » Thu Mar 07, 2019 12:31 pm

'Autodetect Clip length' is a function inside Fusion.
Not sure if it can be called directly.
I normally check via bmd.readdir() to get the number of files on a sequence.

User avatar
intelligent machine
Fusionista
Posts: 399
Joined: Fri May 13, 2016 10:01 pm
Answers: 2
Location: Austin, Texas, USA
Been thanked: 28 times
Contact:

Re: Autodetect Clip length on loader

#11

Post by intelligent machine » Thu Mar 07, 2019 12:32 pm

Autodetect Clip length "rescans the clip to see if frames have been added or removed since the last time the clip was scanned (when it was loaded)."
That's kind of exactly what ReloadLoaders does - but to all selected loaders.
The scan happens automatically when you first select a sequence with the loader tool.

What is the end goal of your script?


The alternative if you want to write something from scratch to recreate the same functionality is:
Get the loader's value.
Separate the filename from path
Find the sequence number within the file name using a simple regex
Since that number may not be the first frame:
recursively step backward with the numbering in the name until it fails - now you have the first frame - store that number somewhere
and then step forward until you find the last frame

Added in 3 minutes 11 seconds:
SirEdric wrote:
Thu Mar 07, 2019 12:31 pm
'Autodetect Clip length' is a function inside Fusion.
Not sure if it can be called directly.
I normally check via bmd.readdir() to get the number of files on a sequence.
This will be correct if there are no missing files in the middle of the sequence and what I mentioned above will cut the sequence at the first missing file.

What are you looking for in the end?

User avatar
miaz3
Fusioneer
Posts: 203
Joined: Sat Jan 03, 2015 1:43 am
Location: Angoulême / France
Been thanked: 1 time
Contact:

Re: Autodetect Clip length on loader

#12

Post by miaz3 » Thu Mar 07, 2019 12:51 pm

movalex shows the right way,
I know how to load images in a loader, trim, duration time...either via readdir (), or via a simple len () or via a bdd (ftrack/shotgun...)

I just want to know what's going on below 'Autodetect Clip length', and especially if it's possible to call it.

User avatar
SirEdric
Fusionator
Posts: 1723
Joined: Tue Aug 05, 2014 10:04 am
Answers: 1
Real name: Eric Westphal
Been thanked: 77 times
Contact:

Re: Autodetect Clip length on loader

#13

Post by SirEdric » Thu Mar 07, 2019 9:31 pm

Once you detected Path and Filename/Extension in the loader,
bmd.readdir() can do great things for you:

Code: Select all

ct = comp.CurrentTime
mt = comp.Loader1.Clip[ct]
mp = bmd.parseFilename(mt).Path
pattern = '*' .. bmd.parseFilename(mt).Extension
--dump(bmd.parseFilename(mt))
count = 0
for n, FName in pairs(bmd.readdir(mp .. pattern)) do
	if FName['IsDir'] == false then
		dump(FName)
		count = count + 1
	end
end
print('Count: ' .. count)