-
Notifications
You must be signed in to change notification settings - Fork 129
Publisher: Convertors for legacy instances #4020
Publisher: Convertors for legacy instances #4020
Conversation
Task linked: OP-4285 Convertors for legacy instances |
try: | ||
self.run_convertor(convertor_identifier) | ||
|
||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use bare except:
, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer except Exception:
. If you're sure what you're doing, be explicit and write except BaseException:
.
do not use bare 'except'
new_item["label"] = new_item.pop("creator_label") | ||
new_item["identifier"] = new_item.pop("creator_identifier") | ||
new_failed_info.append(new_item) | ||
self.add_error_message_dialog(event["title"], new_failed_info, "Creator:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (82 > 79 characters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it is working but I would add two things:
- Reset publisher after conversion is done
- add log to the converter (to access
self.log.*
)
Both should be available now. |
Brief description
Give ability to have convertor plugins for conversion from legacy instances to new creators.
Description
Added Convertor plugins which can collect
ConvertorItem
intoCreateContext
. These items are shown in UI next to instances with a label that the convertor plugin defines. Convertor collect items after Creator's collection so there should not be a clash if any creator would convert something automatically and also has access to shared data. Has 2 methodsfind_instances
andconvert
both without any arguments. Plugin must be in files next to creators (can be in file with creator). In UI is conversion button always before creator attributes. So multiple conversion plugins can be selected and UI does not break when instances are selected too.Screenshots
Testing notes:
Create fake convertor in TrayPublisher e.g.
~/openpype/hosts/traypublisher/plugins/create/converter_test.py
with this content.