Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Enhancement: Add custom start frame for tvpaint start frame validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyprien CAILLOT committed Sep 11, 2024
1 parent d9731d0 commit b3b4944
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<root>
<error id="main">
<title>First frame</title>
<description>## MarkIn is not set to 0
<description>## MarkIn is not set to {start_frame_expected}

MarkIn in your scene must start from 0 fram index but MarkIn is set to {current_start_frame}.
MarkIn in your scene must start from frame {start_frame_expected} but MarkIn is set to {current_start_frame}.

### How to repair?

You can modify MarkIn manually or hit the "Repair" button on the right which will change MarkIn to 0 (does not change MarkOut).
You can modify MarkIn manually or hit the "Repair" button on the right which will change MarkIn to {start_frame_expected} (does not change MarkOut).
</description>
</error>
</root>
12 changes: 7 additions & 5 deletions openpype/hosts/tvpaint/plugins/publish/validate_start_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class RepairStartFrame(pyblish.api.Action):
on = "failed"

def process(self, context, plugin):
execute_george("tv_startframe 0")
execute_george(f"tv_startframe {plugin.start_frame}")


class ValidateStartFrame(
Expand All @@ -28,19 +28,21 @@ class ValidateStartFrame(
hosts = ["tvpaint"]
actions = [RepairStartFrame]
optional = True
start_frame = 0

def process(self, context):
if not self.is_active(context.data):
return

start_frame = execute_george("tv_startframe")
if start_frame == 0:
scene_start_frame = execute_george("tv_startframe")
if scene_start_frame == self.start_frame:
return

raise PublishXmlValidationError(
self,
"Start frame has to be frame 0.",
f"Start frame has to be frame {self.start_frame}.",
formatting_data={
"current_start_frame": start_frame
"start_frame_expected": self.start_frame,
"current_start_frame": scene_start_frame
}
)
3 changes: 2 additions & 1 deletion openpype/settings/defaults/project_settings/tvpaint.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"ValidateStartFrame": {
"enabled": false,
"optional": true,
"active": true
"active": true,
"start_frame": 0
},
"ValidateAssetName": {
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,37 @@
]
},
{
"type": "schema_template",
"name": "template_publish_plugin",
"template_data": [
{
"key": "ValidateStartFrame",
"label": "Validate Scene Start Frame",
"docstring": "Validate first frame of scene is set to '0'."
}
]
"type": "dict",
"key": "ValidateStartFrame",
"label": "Validate Start Frame",
"is_group": true,
"checkbox_key": "enabled",
"children": [
{
"type": "boolean",
"key": "enabled",
"label": "Enabled"
},
{
"type": "boolean",
"key": "optional",
"label": "Optional"
},
{
"type": "boolean",
"key": "active",
"label": "Active"
},
{
"type": "label",
"label": "Validate start frame of scene is set to the value configured below."
},
{
"type": "text",
"key": "start_frame",
"label": "Start frame"
}
]
},
{
"type": "schema_template",
Expand Down
3 changes: 2 additions & 1 deletion server_addon/tvpaint/server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class LoadPluginsModel(BaseSettingsModel):
"ValidateStartFrame": {
"enabled": False,
"optional": True,
"active": True
"active": True,
"start_frame": 0
},
"ValidateAssetName": {
"enabled": True,
Expand Down

0 comments on commit b3b4944

Please sign in to comment.