Page 1 of 1

Python - Save Project as (missing)

PostPosted: Mon Mar 30, 2020 8:02 pm
by Benjamin Kratzin
Hi all,

I'm missing the opportunity to save my current open resolve project as a new project with a new name in python.

CreateProject() Saves it as a completely clean project but with my given name.
Saveproject() Only saves the project under the current name.
SetName() Only sets a new name.

Am I missing something, I just want to save my current project with a new name without overwriting it?
Similar to the "Save Project as" function from the menu.

Thanks in advance,
Ben

Re: Python - Save Project as (missing)

PostPosted: Mon Mar 30, 2020 8:29 pm
by roger.magnusson
Doesn't SetName("new name"), then SaveProject() do exactly that? Or do you mean SaveProject() uses the old name?

If you mean you want to save it to another folder within the Project Manager then that doesn't look like it's possible. Then again, you can't do that in the "Save Project As" dialog either.

Re: Python - Save Project as (missing)

PostPosted: Mon Mar 30, 2020 10:54 pm
by Benjamin Kratzin
No, I don't need to place it into another folder, since I know how I would approach this. My current issue is, that it simply overwrites the current open project instead of copying the project and then saving it under a new name as a new project file. So I have no chance to version up. Hope that makes sense. Thanks for your thoughts on that.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 1:44 am
by roger.magnusson
Using my admittedly messed up Resolve projects on my dev machine I can't get SetName() to do what I expect it to and it always returns false.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 7:01 am
by Igor Riđanović
roger.magnusson wrote:it always returns false.


Same for me on MacOS, Resolve Studio 15.3.1, Python 2.8 (or so). I encoded the string as ASCII and as UTF-8. Both returned False.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 9:11 am
by Peter Chamberlain
I think you can except any dev support for 15.3 which is quite superseded, particularly with the scripting work up to 16.2.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 9:32 am
by roger.magnusson
I'm on Resolve Studio v16.2.0.055, using Lua, Windows 10 v1909 and seeing this issue with Project.SetName().

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 9:40 am
by Benjamin Kratzin
On my machine "Resolve 16.2" SetName() works and renames the project.

# This is False as it is the same proj name
proj_name = project.GetName()
print(project.SetName(proj_name))

# I'm removing the last four chars of the proj name so it's no longer the same. Result is True
print(project.SetName(proj_name[:-4]))


But as said, this alone is not what I'm looking for.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 8:46 pm
by Igor Riđanović
I think Roger and I went off on another tangent here. The SetName() works in 16.2.0 for me while it failed for both of us in 15.3.1.

But that's not what Benjamin was asking. SetName() changes the project name in the database. He would like to fork a copy of the project equivalent to "Save As."

I haven't tested it but it may be possible to achieve this by exporting a DRP using ExportProject() method, creating a new project with a unique name, and importing this DRP into the project.

Re: Python - Save Project as (missing)

PostPosted: Tue Mar 31, 2020 11:11 pm
by Benjamin Kratzin
Hi Igor,
No worries, I hope you solve that question as well.

We've been thinking the same :) since I was already trying the drp export route. But I thought this probably would take longer (closing and reopening the session and could have effects to the gallery) and feels like a "hack". I think I will go with that route if we can't find another solution for it. I thought I probably missed something in the API as it's a very basic function.

Re: Python - Save Project as (missing)

PostPosted: Thu May 14, 2020 11:04 pm
by julian_b
For me, SetName() is not working.

Code: Select all
proj = project_manager.GetCurrentProject()
proj.setName("New Name")


It always returns False.
Any help?

Re: Python - Save Project as (missing)

PostPosted: Tue Apr 13, 2021 6:06 pm
by morkaman
julian_b wrote:For me, SetName() is not working.

Code: Select all
proj = project_manager.GetCurrentProject()
proj.setName("New Name")


It always returns False.
Any help?

UPDATE: Doesn´t work in 17.1 - Python 3.6 neither :(