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

TV Paint: Set initial project settings. #1299

Conversation

tokejepsen
Copy link
Member

@tokejepsen tokejepsen commented Apr 9, 2021

This sets the TVP project settings when launching for the first time.

To figure out when the users is launching for the first time, I've added PYPE_TVPAINT_LAUNCHED_TEMPLATE_FILE to the environment. Only when this environment variable is present will the code modify the project settings.

Pype 3 PRs
pype #1325

@@ -31,6 +33,44 @@ def on_instance_toggle(instance, old_value, new_value):
pipeline._write_instances(current_instances)


def application_launch():
# Setup project settings if its the template that's launched.
if "PYPE_TVPAINT_LAUNCHED_TEMPLATE_FILE" in os.environ:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.) This can be function in lib (like set_context_settings or something like that) so it's callable from different places. (Like when button is clicked - future).
- function should expect asset document as an argument because in TVPaint it is possible to have opened multiple workfiles with different asset in context at the same time
2.) Be more specific in environment condition and rather skip unnecessary indentation block of whole function with oposite logic:

if os.environ.get("PYPE_TVPAINT_LAUNCHED_TEMPLATE_FILE") != "1":
    return
...

3.) Frame start/end values are not checked.

NOTE:
Resolution, frame start/end and handle start/end are always a pair of data. If data.get("width") is None but data.get("height") is 1000, the height should not be used (happened few times).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points. Done.

@mkolar mkolar added type: enhancement Enhancements to existing functionality 2x-dev labels Apr 9, 2021
- moved settings code to lib.
- checks for framerate, resolution and frame range.
@mkolar
Copy link
Member

mkolar commented Apr 12, 2021

@iLLiCiTiT ready for 3.0 port

@mkolar mkolar added this to the 2.16.1 milestone Apr 13, 2021
@mkolar mkolar changed the title Set initial project settings. TV Paint: Set initial project settings. Apr 13, 2021
Copy link
Member

@iLLiCiTiT iLLiCiTiT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@mkolar mkolar changed the base branch from 2.x/main to 2.x/develop April 14, 2021 09:17
@mkolar mkolar modified the milestones: 2.16.1, 2.16.2 Apr 14, 2021
@mkolar mkolar merged commit e3327a1 into ynput:2.x/develop Apr 14, 2021
@tokejepsen tokejepsen deleted the 2.x/feature/tvpaint_initial_project_settings branch April 14, 2021 09:21
@mkolar mkolar modified the milestones: 2.16.2, 2.16.1 Apr 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: TV Paint type: enhancement Enhancements to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants