Merge pull request #788 from pypeclub/3.0/maya_plugins_use_settings

Maya plugins use settings
This commit is contained in:
Milan Kolar 2020-12-04 18:21:24 +01:00 committed by GitHub
commit 5b57ecb1e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 911 additions and 751 deletions

View file

@ -61,8 +61,12 @@ class ValidateFtrackAttributes(pyblish.api.InstancePlugin):
"Missing FTrack Task entity in context")
host = pyblish.api.current_host()
to_check = context.data["presets"].get(
host, {}).get("ftrack_custom_attributes")
to_check = (
context.data["project_settings"]
["ftrack"]
.get(host, {})
.get("ftrack_custom_attributes")
)
if not to_check:
self.log.warning("ftrack_attributes preset not found")
return

View file

@ -202,7 +202,7 @@ class CreateRender(avalon.maya.Creator):
"""Load Muster credentials.
Load Muster credentials from file and set ``MUSTER_USER``,
``MUSTER_PASSWORD``, ``MUSTER_REST_URL`` is loaded from presets.
``MUSTER_PASSWORD``, ``MUSTER_REST_URL`` is loaded from settings.
Raises:
RuntimeError: If loaded credentials are invalid.

View file

@ -15,7 +15,7 @@ class CreateRenderSetup(avalon.maya.Creator):
super(CreateRenderSetup, self).__init__(*args, **kwargs)
# here we can pre-create renderSetup layers, possibly utlizing
# presets for it.
# settings for it.
# _____
# / __\__

View file

@ -102,10 +102,11 @@ class ExtractCameraMayaScene(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
# get settings
ext_mapping = (instance.context.data["presets"]["maya"]
.get("ext_mapping")) # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -24,9 +24,11 @@ class ExtractMayaSceneRaw(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -31,9 +31,11 @@ class ExtractModel(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -43,7 +43,9 @@ class ExtractPlayblast(pype.api.Extractor):
# get cameras
camera = instance.data['review_camera']
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = (
instance.context.data['project_settings']['maya']['capture']
)
try:
preset = lib.load_capture_preset(data=capture_preset)

View file

@ -18,9 +18,11 @@ class ExtractRig(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -33,7 +33,10 @@ class ExtractThumbnail(pype.api.Extractor):
camera = instance.data['review_camera']
capture_preset = ""
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = (
instance.context.data["project_settings"]['maya']['capture']
)
try:
preset = lib.load_capture_preset(data=capture_preset)
except:

View file

@ -101,9 +101,11 @@ class ExtractYetiRig(pype.api.Extractor):
def process(self, instance):
"""Plugin entry point."""
ext_mapping = instance.context.data["presets"]["maya"].get("ext_mapping") # noqa: E501
ext_mapping = (
instance.context.data["project_settings"]["maya"]["ext_mapping"]
)
if ext_mapping:
self.log.info("Looking in presets for scene type ...")
self.log.info("Looking in settings for scene type ...")
# use extension mapping for first family found
for family in self.families:
try:

View file

@ -153,7 +153,7 @@ class MayaSubmitMuster(pyblish.api.InstancePlugin):
def _load_credentials(self):
"""
Load Muster credentials from file and set `MUSTER_USER`,
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from presets.
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from settings.
.. todo::

View file

@ -22,9 +22,12 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
actions = [pype.api.RepairContextAction]
optional = True
attributes = None
def process(self, context):
# Check for preset existence.
if not context.data["presets"]["maya"].get("attributes"):
if not self.attributes:
return
invalid = self.get_invalid(context, compute=True)
@ -43,7 +46,6 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
@classmethod
def get_invalid_attributes(cls, context):
presets = context.data["presets"]["maya"]["attributes"]
invalid_attributes = []
for instance in context:
# Filter publisable instances.
@ -53,23 +55,23 @@ class ValidateAttributes(pyblish.api.ContextPlugin):
# Filter families.
families = [instance.data["family"]]
families += instance.data.get("families", [])
families = list(set(families) & set(presets.keys()))
families = list(set(families) & set(self.attributes.keys()))
if not families:
continue
# Get all attributes to validate.
attributes = {}
for family in families:
for preset in presets[family]:
for preset in self.attributes[family]:
[node_name, attribute_name] = preset.split(".")
try:
attributes[node_name].update(
{attribute_name: presets[family][preset]}
{attribute_name: self.attributes[family][preset]}
)
except KeyError:
attributes.update({
node_name: {
attribute_name: presets[family][preset]
attribute_name: self.attributes[family][preset]
}
})

View file

@ -58,7 +58,7 @@ class ValidateMusterConnection(pyblish.api.ContextPlugin):
def _load_credentials(self):
"""
Load Muster credentials from file and set `MUSTER_USER`,
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from presets.
`MUSTER_PASSWORD`, `MUSTER_REST_URL` is loaded from settings.
.. todo::

View file

@ -93,6 +93,10 @@
"enabled": true,
"note_with_intent_template": "",
"note_labels": []
},
"ValidateFtrackAttributes": {
"enabled": false,
"ftrack_custom_attributes": {}
}
}
}

View file

@ -111,7 +111,7 @@
}
},
"tools": {
"Creator": {
"creator": {
"families_smart_select": {
"Render": [
"light",
@ -179,4 +179,4 @@
}
}
}
}
}

View file

@ -1,5 +1,5 @@
{
"maya_capture": {
"capture": {
"Codec": {
"compression": "jpg",
"format": "image",
@ -107,6 +107,7 @@
"overscan": 1.0
}
},
"ext_mapping": {},
"publish": {
"CollectMayaRender": {
"sync_workfile_version": false

View file

@ -6,261 +6,310 @@
"checkbox_key": "enabled",
"is_file": true,
"children": [
{
"type": "splitter"
},
{
"type": "label",
"label": "Additional Ftrack paths"
},
{
"type": "list",
"key": "ftrack_actions_path",
"label": "Action paths",
"object_type": "text"
},
{
"type": "list",
"key": "ftrack_events_path",
"label": "Event paths",
"object_type": "text"
},
{
"type": "splitter"
},
{
"type": "splitter"
},
{
"type": "label",
"label": "Additional Ftrack paths"
},
{
"type": "list",
"key": "ftrack_actions_path",
"label": "Action paths",
"object_type": "text"
},
{
"type": "list",
"key": "ftrack_events_path",
"label": "Event paths",
"object_type": "text"
},
{
"type": "splitter"
},
{
"type": "dict",
"key": "events",
"label": "Server Events",
"children": [
{
"type": "dict",
"key": "events",
"label": "Server Events",
"key": "sync_to_avalon",
"label": "Sync to avalon",
"checkbox_key": "enabled",
"children": [
{
"type": "dict",
"key": "sync_to_avalon",
"label": "Sync to avalon",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "label",
"label": "Allow name and hierarchy change only if following statuses are on all children tasks"
},
{
"type": "list",
"key": "statuses_name_change",
"label": "Statuses",
"object_type": {
"type": "text",
"multiline": false
}
}
]
},
{
"type": "dict",
"key": "push_frame_values_to_task",
"label": "Sync Hierarchical and Entity Attributes",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}, {
"type": "list",
"key": "interest_entity_types",
"label": "Entity types of interest",
"object_type": {
"type": "text",
"multiline": false
}
}, {
"type": "list",
"key": "interest_attributess",
"label": "Attributes to sync",
"object_type": {
"type": "text",
"multiline": false
}
}]
},
{
"type": "dict",
"key": "thumbnail_updates",
"label": "Update Hierarchy thumbnails",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},{
"type": "label",
"label": "Push thumbnail from version, up through multiple hierarchy levels."
},{
"type": "number",
"key": "levels",
"label": "Levels"
}]
},
{
"type": "dict",
"key": "user_assignment",
"label": "Run script on user assignments",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}]
},
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "label",
"label": "Allow name and hierarchy change only if following statuses are on all children tasks"
},
{
"type": "list",
"key": "statuses_name_change",
"label": "Statuses",
"object_type":
{
"type": "dict",
"key": "status_update",
"label": "Update status on task action",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"key": "mapping",
"type": "dict-modifiable",
"object_type": {
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_task_to_parent",
"label": "Sync status from Task to Parent",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"key": "parent_status_match_all_task_statuses",
"type": "dict-modifiable",
"label": "Change parent if all tasks match",
"object_type": {
"type": "list",
"object_type": "text"
}
},
{
"key": "parent_status_by_task_status",
"type": "dict-modifiable",
"label": "Change parent status if a single task matches",
"object_type": {
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_task_to_version",
"label": "Sync status from Task to Version",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}, {
"type": "dict-modifiable",
"key": "mapping",
"object_type": {
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_version_to_task",
"label": "Sync status from Version to Task",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}, {
"type": "dict-modifiable",
"key": "mapping",
"object_type": {
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "first_version_status",
"label": "Set status on first created version",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},{
"type": "text",
"key": "status",
"label": "Status"
}
]
},
{
"type": "dict",
"key": "next_task_update",
"label": "Update status on next task",
"checkbox_key": "enabled",
"children": [{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},{
"type": "dict-modifiable",
"key": "mapping",
"object_type": {
"type": "text"
}
}]
"type": "text",
"multiline": false
}
]
}]
},
{
"type": "dict",
"collapsable": true,
"key": "publish",
"label": "Publish plugins",
"is_file": true,
"children": [{
"key": "push_frame_values_to_task",
"label": "Sync Hierarchical and Entity Attributes",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "list",
"key": "interest_entity_types",
"label": "Entity types of interest",
"object_type":
{
"type": "text",
"multiline": false
}
},
{
"type": "list",
"key": "interest_attributess",
"label": "Attributes to sync",
"object_type":
{
"type": "text",
"multiline": false
}
}]
},
{
"type": "dict",
"key": "thumbnail_updates",
"label": "Update Hierarchy thumbnails",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "label",
"label": "Push thumbnail from version, up through multiple hierarchy levels."
},
{
"type": "number",
"key": "levels",
"label": "Levels"
}]
},
{
"type": "dict",
"key": "user_assignment",
"label": "Run script on user assignments",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}]
},
{
"type": "dict",
"key": "status_update",
"label": "Update status on task action",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"key": "mapping",
"type": "dict-modifiable",
"object_type":
{
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_task_to_parent",
"label": "Sync status from Task to Parent",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"key": "parent_status_match_all_task_statuses",
"type": "dict-modifiable",
"label": "Change parent if all tasks match",
"object_type":
{
"type": "list",
"object_type": "text"
}
},
{
"key": "parent_status_by_task_status",
"type": "dict-modifiable",
"label": "Change parent status if a single task matches",
"object_type":
{
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_task_to_version",
"label": "Sync status from Task to Version",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "dict-modifiable",
"key": "mapping",
"object_type":
{
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "status_version_to_task",
"label": "Sync status from Version to Task",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "dict-modifiable",
"key": "mapping",
"object_type":
{
"type": "list",
"object_type": "text"
}
}]
},
{
"type": "dict",
"key": "first_version_status",
"label": "Set status on first created version",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "text",
"key": "status",
"label": "Status"
}]
},
{
"type": "dict",
"key": "next_task_update",
"label": "Update status on next task",
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "dict-modifiable",
"key": "mapping",
"object_type":
{
"type": "text"
}
}]
}]
},
{
"type": "dict",
"collapsable": true,
"key": "publish",
"label": "Publish plugins",
"is_file": true,
"children": [
{
"type": "dict",
"collapsable": true,
"checkbox_key": "enabled",
"key": "IntegrateFtrackNote",
"label": "IntegrateFtrackNote",
"is_group": true,
"children": [{
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}, {
},
{
"type": "text",
"key": "note_with_intent_template",
"label": "Note with intent template"
}, {
},
{
"type": "list",
"object_type": "text",
"key": "note_labels",
"label": "Note labels"
}]
}]
}
]
},
{
"type": "dict",
"collapsable": true,
"checkbox_key": "enabled",
"key": "ValidateFtrackAttributes",
"label": "ValidateFtrackAttributes",
"is_group": true,
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "raw-json",
"key": "ftrack_custom_attributes",
"label": "Custom attributes to validate"
}]
}
]
}]
}

View file

@ -7,7 +7,7 @@
{
"type": "dict",
"collapsable": true,
"key": "Creator",
"key": "creator",
"label": "Creator",
"children": [
{

View file

@ -134,7 +134,13 @@
"type": "boolean",
"key": "enabled",
"label": "Enabled"
}]
},
{
"type": "raw-json",
"key": "attributes",
"label": "Attributes"
}
]
},
{
"type": "splitter"