Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreal: Deadline support with Perforce #183

Closed
wants to merge 44 commits into from

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Mar 13, 2024

Changelog Description

This PR should add possibility to render Unreal project on Deadline with Perforce integration (and possibly without P4).

Additional info

It requires ynput/ayon-version-control#2, working Perforce server with user credentials and P4 workspace created following some P4 depot and stream

Testing notes:

  1. set info about P4
    image
    2,provide P4 user credentials (in Project Settings > Site Settings)
    image
  2. Deadline must have some environment variables set
  • either via OS environments
  • OR via env vars set on Unreal in Applications addon
    image
    Expected env var: (applicable values for DL WORKER, not artist machine)
   "UnrealExecutable": {"windows": "C:/Program Files/Epic Games/UE_5.3/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"},
   "UnrealExecutable_5_3": {"windows": "C:/Program Files/Epic Games/UE_5.3/Engine/Binaries/Win64/UnrealEditor-Cmd.exe"},
   "P4PORT":"localhost:1666",
   "P4USER":"admin",
   "P4PASSWD":"pass"
  1. Copy ayon_core/modules/deadline/repository/custom/plugins/UnrealEngine5 to DEADLINE_REPO/custom folder
  2. Render for DL uses existing creator and follow existing workflow, only added Render target
    image
  3. Provide path for render config ayon+settings://unreal/render_config_path and make sure that it exists in Unreal project
    image
    (expected value /Game/Ayon/DefaultMovieRenderQueueConfig.DefaultMovieRenderQueueConfig)
  4. There must be at least 2 instances to be published, publish_commit creates instance with information about change list
    image

kalisp added 13 commits March 11, 2024 11:36
Whole Unreal5 plugin copied here as it is not possible to add to custom folder only `JobPreLoad.py` and `UnrealSyncUtil.py` which is handling Perforce. Might need to be revisited as this would create dependency on official Unreal5 plugin.
Added render.farm, render.local to families to differentiate between two render targets. Must be in pyblish familes (product_type) filter to enable plugin only for particular target.
Should support local and P4 assisted rendering.
@kalisp kalisp requested a review from antirotor March 13, 2024 17:36
@ynbot ynbot added type: feature Adding something new and exciting to the product host: Maya host: UE module: Deadline size/XXL labels Mar 13, 2024
kalisp added 4 commits March 13, 2024 19:21
It seems that Python API cannot create queue itself, cannot all existing queues in folder, so for now ask for manual help.
There must be # in output names
Not path to stored configuration.
@kalisp kalisp marked this pull request as ready for review March 13, 2024 18:27
kalisp added 3 commits April 12, 2024 15:22
Syncing needs to run before opening of Unreal project. Removed from Ayon menu as would be confusing and most likely not working.
@kalisp kalisp assigned antirotor and unassigned kalisp Apr 16, 2024
@kalisp
Copy link
Member Author

kalisp commented May 27, 2024

It needs new dependency package! P4 was moved to runtimeDependencies, eg. it shouldn't get picked up.

Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

There are some issues I put together in this PR even though some of it is related to ayon_version_control (where I'll create issue)

Traceback (most recent call last):
  File "C:\Users\annat\Documents\Projects\Ayon\ayon-core\client\ayon_core\lib\python_module_tools.py", line 92, in modules_from_path
    module = import_filepath(full_path, mod_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\annat\Documents\Projects\Ayon\ayon-core\client\ayon_core\lib\python_module_tools.py", line 38, in import_filepath
    module_loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\annat\Documents\Projects\Ayon\ayon-version-control\client\version_control\plugins\create\unreal\publish_commit.py", line 4, in <module>
    from ayon_core.client import get_asset_by_name
ImportError: cannot import name 'get_asset_by_name' from 'ayon_core.client' (unknown location)

so this is happening because of changes in ayon_core.

There is some confusion about Movie Render Queue that needs to be created manually. At one point, it is taking it from the project settings (ayon+settings://unreal/render_config_path) but down the line the path is hardcoded and plugin is expecting /Game/Ayon/renderQueue)

If I understand it correctly, there is difficulity to create MovieRenderQueue configuration object from Unreal Python API (as stated in comments) but I was successful with following code:

import unreal

config_factory = unreal.MoviePipelinePrimaryConfigFactory()
asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
config = asset_tools.create_asset(asset_name="testConfig", package_path="/Game/Ayon", asset_class=unreal.MoviePipelinePrimaryConfig, factory=config_factory)

Another topic is inclusion of Unreal5 Deadline plugin in Deadline module - is it the right way? It is full of linter errors so either we need to leave it there but add it to linter ignores.

The last thing :) I understand that the one Perforce workspace per AYON project is the limitation. It is little difficult to test multilpe version of Unreal because project file are commited to workspace and when you switch Unreal version, you need to basically wipe out everything. Just mentioning this as it needs to be clearly stated in documentation.

"""Cache instances for Creators to shared data.

Create `unreal_cached_instances` key when needed in shared data and
Create `unreal_cached_subsets` key when needed in shared data and
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Create `unreal_cached_subsets` key when needed in shared data and
Create `unreal_cached_subsets` key when needed in shared data and

aren't subsets products now?

@antirotor
Copy link
Member

antirotor commented Jun 5, 2024

There are also crashes during the publishing:

collect_latest_changelist.py traceback
Traceback (most recent call last):
File "C:\Users\annat\Documents\Projects\Ayon\ayon-core\client\ayon_core\pipeline\publish\lib.py", line 257, in publish_plugins_discover
module = import_filepath(abspath, mod_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\annat\Documents\Projects\Ayon\ayon-core\client\ayon_core\lib\python_module_tools.py", line 38, in import_filepath
module_loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\annat\Documents\Projects\Ayon\ayon-version-control\client\version_control\plugins\publish\collect_latest_changelist.py", line 14, in 
from version_control.backends.perforce.api.rest_stub import (
File "C:\Users\annat\Documents\Projects\Ayon\ayon-version-control\client\version_control\backends\perforce\api\__init__.py", line 25, in 
import P4
File "C:\Users\annat\AppData\Local\Ynput\AYON\dependency_packages\ayon_2406041254_windows.zip\dependencies\P4.py", line 420, in 
import P4API
ModuleNotFoundError: No module named 'P4API'
```
and basically same for collect_version_control_login, integrate_perforce and validate_workspace

@antirotor
Copy link
Member

when #614 is merged, we need to reopen it in https://github.com/ynput/ayon-unreal

@kalisp
Copy link
Member Author

kalisp commented Jun 19, 2024

Closing this one in favor #670 which contains new location of code in server_addons

@kalisp kalisp closed this Jun 19, 2024
@kalisp kalisp deleted the feature/unreal_deadline_render branch September 10, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: UE module: Deadline size/XXL type: feature Adding something new and exciting to the product
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants