qmasingarbe / pymiere

Python for Premiere pro
GNU General Public License v3.0
353 stars 46 forks source link

clone() method in Sequence class returns None #42

Closed shaibruhis closed 2 years ago

shaibruhis commented 2 years ago

the docstring says that clone() returns the cloned sequence but it returns None. The reason this is an issue is because if I call clone() on the same sequence more than once, I will create 2 new sequences with the same name (" Copy") and I don't have a way of identifying which one is which.

Possible solutions: 1) actually returned the clones sequence (or some sort of handle to it) 2) allow for a name to be passed into the clone() method so I can make distinct clones 3) use the "Duplicate" feature in Premiere Pro (instead of "Copy" and "Pasting" the sequence, which is what I imagine is being used currently) because this generates a unique name, and then return this name

shaibruhis commented 2 years ago

I found this article that describes the same problem in extend script and provides a possible solution: https://community.adobe.com/t5/premiere-pro-discussions/extendscript-sequence-clone-returns-boolean/m-p/11593962

qmasingarbe commented 2 years ago

Hi @shaibruhis thank you for reporting this issue, I will have a look at improving the function when I have more time. In the mean time I suggest you list the sequences before and after a clone operation so you can compare both lists and deduce the newly duplicated sequence. Putting this in a function and calling this function in your loop instead of clone should solve your problem.

shaibruhis commented 2 years ago

I'm happy to put up a PR for this but curious if you think the clone() function should follow the adobe docs and return a boolean indicating whether the cloning was successful or if it should actually return the cloned sequence?

qmasingarbe commented 2 years ago

Hi @shaibruhis , Pymiere is at its core a wrapper for Premiere's scripting language. It should therefore follow Adobe methods signatures as closely as possible, so any documentation can translate to the python binding. I've modified the Sequence.clone() method to return the success as a boolean (6d195e3be62c4e13098dc33a4f66b228c9734980) and added a new custom function in the wrappers.py file for cloning a sequence with renaming and a return value (9fd83de4ef52be27e2ecf221bbe7b4290ba647b2). Hope that it suits your needs.