Merge pull request #4551 from Sharkitty/enhancemen_kitsu_note_family_requirements

This commit is contained in:
Milan Kolar 2023-03-29 11:04:56 +02:00 committed by GitHub
commit cd34028552
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 29 deletions

View file

@ -14,7 +14,10 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
# status settings
set_status_note = False
note_status_shortname = "wfa"
status_conditions = list()
status_change_conditions = {
"status_conditions": [],
"family_requirements": [],
}
# comment settings
custom_comment_template = {
@ -55,7 +58,7 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
continue
kitsu_task = instance.data.get("kitsu_task")
if kitsu_task is None:
if not kitsu_task:
continue
# Get note status, by default uses the task status for the note
@ -65,13 +68,39 @@ class IntegrateKitsuNote(pyblish.api.ContextPlugin):
# Check if any status condition is not met
allow_status_change = True
for status_cond in self.status_conditions:
for status_cond in self.status_change_conditions[
"status_conditions"
]:
condition = status_cond["condition"] == "equal"
match = status_cond["short_name"].upper() == shortname
if match and not condition or condition and not match:
allow_status_change = False
break
if allow_status_change:
# Get families
families = {
instance.data.get("family")
for instance in context
if instance.data.get("publish")
}
# Check if any family requirement is met
for family_requirement in self.status_change_conditions[
"family_requirements"
]:
condition = family_requirement["condition"] == "equal"
for family in families:
match = family_requirement["family"].lower() == family
if match and not condition or condition and not match:
allow_status_change = False
break
if allow_status_change:
break
# Set note status
if self.set_status_note and allow_status_change:
kitsu_status = gazu.task.get_task_status_by_short_name(
self.note_status_shortname

View file

@ -8,7 +8,10 @@
"IntegrateKitsuNote": {
"set_status_note": false,
"note_status_shortname": "wfa",
"status_conditions": [],
"status_change_conditions": {
"status_conditions": [],
"family_requirements": []
},
"custom_comment_template": {
"enabled": false,
"comment_template": "{comment}\n\n| | |\n|--|--|\n| version| `{version}` |\n| family | `{family}` |\n| name | `{name}` |"

View file

@ -54,30 +54,62 @@
"label": "Note shortname"
},
{
"type": "list",
"key": "status_conditions",
"label": "Status conditions",
"object_type": {
"type": "dict",
"key": "conditions_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
"type": "dict",
"collapsible": true,
"key": "status_change_conditions",
"label": "Status change conditions",
"children": [
{
"type": "list",
"key": "status_conditions",
"label": "Status conditions",
"object_type": {
"type": "dict",
"key": "condition_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
]
},
{
"type": "text",
"key": "short_name",
"label": "Short name"
}
]
},
{
"type": "text",
"key": "short_name",
"label": "Short name"
}
]
},
"label": "Status shortname"
},
{
"type": "list",
"key": "family_requirements",
"label": "Family requirements",
"object_type": {
"type": "dict",
"key": "requirement_dict",
"children": [
{
"type": "enum",
"key": "condition",
"label": "Condition",
"enum_items": [
{"equal": "Equal"},
{"not_equal": "Not equal"}
]
},
{
"type": "text",
"key": "family",
"label": "Family"
}
]
}
}
]
},
{
"type": "dict",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Before After
Before After

View file

@ -43,10 +43,11 @@ Task status can be automatically set during publish thanks to `Integrate Kitsu N
`Admin -> Studio Settings -> Project Settings -> Kitsu -> Integrate Kitsu Note`.
There are three settings available:
- `Set status on note` -> turns on and off this integrator.
There are four settings available:
- `Set status on note` -> Turns on and off this integrator.
- `Note shortname` -> Which status shortname should be set automatically (Case sensitive).
- `Status conditions` -> Conditions that need to be met for kitsu status to be changed. You can add as many conditions as you like. There are two fields to each conditions: `Condition` (Whether current status should be equal or not equal to the condition status) and `Short name` (Kitsu Shortname of the condition status).
- `Status change conditions - Status conditions` -> Conditions that need to be met for kitsu status to be changed. You can add as many conditions as you like. There are two fields to each conditions: `Condition` (Whether current status should be equal or not equal to the condition status) and `Short name` (Kitsu Shortname of the condition status).
- `Status change conditions - Family requirements` -> With this option you can add requirements to which families must be pushed or not in order to have the task status set by this integrator. There are two fields for each requirements: `Condition` (Same as the above) and `Family` (name of the family concerned by this requirement). For instance, adding one item set to `Not equal` and `workfile`, would mean the task status would change if a subset from another family than workfile is published (workfile can still be included), but not if you publish the workfile subset only.
![Integrate Kitsu Note project settings](assets/integrate_kitsu_note_settings.png)