Adobe Premiere Pro导入插件开发遇到的一个问题

      最近在更新公司一款Premiere Pro CC导入插件的时候,遇到了一个神奇的现象。具体的现象是这样的:我们的插件需要将一些私有的文件数据放到插件中,比如说当前活动的文件名。当插件中收到不同的selector时,我们能够随时获取到这些私有数据进行操作。具体来说,我们是在收到imGetPrefs8这个selector时,进行设置的。回调函数代码如下:

static prMALError SDKGetPrefs8( imStdParms *stdParms, imFileAccessRec8 *fileInfo8, imGetPrefsRec *prefsRec) { //----------------- // The first time you are called (or if you've been Quieted or Closed) // you will get asked for prefs data. First time called, return the // size of the buffer you want Premiere to store prefs for your plug-in. // Note: if canOpen is not set to kPrTrue, I'm not getting this selector. Why? // Answer: because this selector is associated directly with "hasSetup" if (prefsRec->prefsLength == 0) { prefsRec->prefsLength = sizeof(MediaSettings); } else { MediaSettings* settings = (MediaSettings*)prefsRec->prefs; //do not show dialog for the first time. if (fileInfo8->fileref != imInvalidHandleValue) { auto ctx = (FileContext*)(fileInfo8->fileref); if (!ctx || !ctx->media_source) { return malNoError; } auto oldSettings = ctx->media_source->GetMediaSettings(); settings->layout = oldSettings.layout; settings->lock_direction = oldSettings.lock_direction; settings->use_flowstate = oldSettings.use_flowstate; settings->media_case = oldSettings.media_case; settings->need_update = !settings->need_update; std::string currentFile = ctx->media_source->GetFilePath(); ctx->media_source->ShowSettingsDialog(settings, currentFile); updateSettingFromFile(settings); ctx->media_source->UpdateSettings(settings); } else { //init settings settings->use_flowstate = true; } } return malNoError; }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpwjgd.html