Copy link to clipboard
Copied
Hello,
I'm trying to update the "Description" field of a sequence but I'm stuck on the last step.
I know there's a function in the example panel that does it, but in all fairness it's quite a complicated read for an inexperienced coder like me and I'm trying to simplify it to suit my needs (and actually understand how it works).
I'm basically doing this:
var xmp = new XMPMeta(activeSeq.projectItem.getProjectMetadata())
xmp.setProperty(kPProPrivateProjectMetadataURI, 'Column.PropertyText.Description', note);
activeSeq.projectItem.setProjectMetadata(xmp);
}
It takes in the activeSequence and a user input new description. I can check that the getProjectMetadata works fine, I can read the Description property, update it with setProperty, and I can check the new property was updated in the xmp variable, but the setProjectMetadata doesn't seem to work.
From this: Project Item object — Premiere Pro Scripting Guide 1.0 documentation
it seems like the setProjectMetadata method takes one argument, and that argument has the same format as the result of the getProjectMetadata, so I'm not sure what isn't working. In the example panel the xmp variable is serialized first, which I've tried too and don't understand, and the setXMPMetadata takes 2 arguments.
Thanks for your help.
1 Correct answer
Also...are you passing an array indicating which fields have modified values, like PProPanel does?
Samples/Premiere.jsx at master · Adobe-CEP/Samples · GitHub
Copy link to clipboard
Copied
Hi,
please verify your script against the method proposed at https://github.com/Adobe-CEP/Samples/blob/a64797c6308c6c336f125c48615ceafc9636058d/PProPanel/jsx/PPR... , most importantly making sure you're initializing the ExternalObject, otherwise XMP metadata won't work at all.
Copy link to clipboard
Copied
Yes I'm initialising the ExternalObject. It all works aside from the last step of setProjectMetadata.
If I add an alert:
alert(xmp.getProperty(kPProPrivateProjectMetadataURI, 'Column.PropertyText.Description'))
after the setProjectMetadata, I do get the new value that I got from the user prompt earlier.
The issue seems to be the last line, which doesn't actually update the ProjectMetadata. I've tried both with and without serializing, and I get the same non-result, with no error being thrown to help me.
Copy link to clipboard
Copied
PProPanel's modifyProjectMetadata() works correctly, right?
https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx#L765
Copy link to clipboard
Copied
Also...are you passing an array indicating which fields have modified values, like PProPanel does?
Samples/Premiere.jsx at master · Adobe-CEP/Samples · GitHub
Copy link to clipboard
Copied
Thanks Bruce, the issue was indeed not passing the array of modified values. My code works like this:
function addNotes(activeSeq, note) {
var xmp = new XMPMeta(activeSeq.projectItem.getProjectMetadata());
xmp.setProperty(kPProPrivateProjectMetadataURI, 'Column.PropertyText.Description', note);
var xmpAsString = xmp.serialize()
activeSeq.projectItem.setProjectMetadata(xmpAsString, ['Column.PropertyText.Description']);
}
Might I suggest updating the docs so that it indicates the setProjectMetadata function needs that second argument? The example panel is useful for some things but while I saw that 2nd argument in it, I had no idea what it was for. When trying to build a simple function, looking at a more complicated version of it isn't really ideal and the docs are much more useful.
Copy link to clipboard
Copied
Updated.
Related: Yikes, looks like I have some more doc work to do.