Page 1 of 1

MediaPool.GetCurrentFolder() returns None on a smart bin

PostPosted: Fri Sep 30, 2022 7:40 pm
by iz2022
Hello,

When executing the following code (Python3):
Code: Select all
pm = resolve.GetProjectManager()
proj = pm.GetCurrentProject()
mp = proj.GetMediaPool()
bin = mp.GetCurrentFolder()
print('In bin', bin.GetName())


If the user first clicks a real bin, then the value of bin contains the correct folder (that is, bin.GetName() prints the currently selected bin name)
However if the user has clicked a smart bin, the value of bin is None.


1) Is there an API to get which smart bin the user is on? naturally it is sometimes desirable to iterate over clips in a smart bin, not just a regular bin.

2) As an alternative, is there an API to get a list of the selected clips? if so, then selecting all clips would allow the script to enumerate them.

3) Where is the updated scripting documentation, anyway? the latest "formal" docs seem to be from 2016.

Thank you fellow developers!

Ido

Re: MediaPool.GetCurrentFolder() returns None on a smart bin

PostPosted: Sun Oct 02, 2022 6:20 am
by Peter Chamberlain
Documentation is in the help menu.

Re: MediaPool.GetCurrentFolder() returns None on a smart bin

PostPosted: Tue Oct 04, 2022 7:09 pm
by Octavian Mot
iz2022 wrote:1) Is there an API to get which smart bin the user is on? naturally it is sometimes desirable to iterate over clips in a smart bin, not just a regular bin.
Nope, not that I know of. This is a limitation of the API. You also get None when the user selects multiple bins.

iz2022 wrote:2) As an alternative, is there an API to get a list of the selected clips? if so, then selecting all clips would allow the script to enumerate them.
Nope, there isn't any option for this either.


Overall there are a lot of things one can do with the API, but unfortunately there are a lot of limitations too, especially when it comes to user interactions with the UI...