Skip to content

Commit

Permalink
Merge branch 'mainline' into dependabot/pip/openjd-adaptor-runtime-gt…
Browse files Browse the repository at this point in the history
…e-0.8-and-lt-0.10
  • Loading branch information
jericht authored Feb 24, 2025
2 parents 294e82f + 677137d commit 093bac1
Show file tree
Hide file tree
Showing 35 changed files with 152 additions and 66 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
Thank you for taking the time to fill out this bug report!
⚠️ If the bug that you are reporting is a security-related issue or security vulnerability,
then please do not create a report via this template. Instead please
then please do not create a report via this template. Instead please
notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/)
or directly via email to [AWS Security]([email protected]).
Expand Down Expand Up @@ -54,9 +54,9 @@ body:
description: Please provide information on the environment and software versions that you are using to reproduce the bug.
value: |
At minimum:
1. Operating system: (e.g. Windows Server 2022; Amazon Linux 2023; etc.)
2. Version of Maya:
3: Version of this package:
1. Operating system (e.g. Windows Server 2022; Amazon Linux 2023; etc.)
2. Version of Maya
3. Version of this package
4. If this is from a version installed by the Deadline Cloud Submitter installer, then what version of the submitter installer?
Please share other details about your environment that you think might be relevant to reproducing the bug.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "📕 Documentation Issue"
description: Issue in the documentation
title: "Docs: (short description of the issue)"
labels: ["documenation", "needs triage"]
labels: ["documentation", "needs triage"]
body:
- type: textarea
id: documentation_issue
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "\U0001F680 Feature Request"
description: Request a new feature
title: "Feature request: (short description of the feature)"
labels: ["feature", "needs triage"]
labels: ["enhancement", "needs triage"]
body:
- type: textarea
id: problem
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/maintenance.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "🛠️ Maintenance"
description: Some type of improvement
title: "Maintenance: (short description of the issue)"
labels: ["feature", "needs triage"]
labels: ["needs triage"]
body:
- type: textarea
id: description
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.15.1 (2025-02-03)

* This release only includes documentation updates (#227) ([`e0a3827`](https://github.com/aws-deadline/deadline-cloud-for-maya/commit/e0a38272e6cab7dac27f0af8c7c64ce3a79189ae))


## 0.15.0 (2025-01-09)

### BREAKING CHANGES
Expand Down
8 changes: 4 additions & 4 deletions install_builder/deadline-cloud-for-maya.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component>
<name>deadline_cloud_for_maya</name>
<description>Deadline Cloud for Maya 2024</description>
<detailedDescription>Maya plugin for submitting jobs to AWS Deadline Cloud. Compatible with Maya 2024.</detailedDescription>
<description>Deadline Cloud for Maya 2024 - 2025</description>
<detailedDescription>Maya plugin for submitting jobs to AWS Deadline Cloud. Compatible with Maya 2024 - 2025.</detailedDescription>
<canBeEdited>1</canBeEdited>
<selected>0</selected>
<show>1</show>
Expand Down Expand Up @@ -72,8 +72,8 @@
</readyToInstallActionList>
<parameterList>
<stringParameter name="deadline_cloud_for_maya_summary" ask="0" cliOptionShow="0">
<value>Deadline Cloud for Maya 2024
- Compatible with Maya 2024.
<value>Deadline Cloud for Maya 2024 - 2025
- Compatible with Maya 2024 - 2025.
- Install the integrated Maya submitter files to the installation directory.
- Register the plug-in with Maya by creating or updating the MAYA_MODULE_PATH environment variable.</value>
</stringParameter>
Expand Down
12 changes: 9 additions & 3 deletions src/deadline/maya_submitter/maya_render_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ def _get_parameter_values(
return parameter_values


def show_maya_render_submitter(parent, f=Qt.WindowFlags()) -> "Optional[SubmitJobToDeadlineDialog]":
def show_maya_render_submitter(
parent, f=Qt.WindowFlags(), load_sticky_setting: bool = False
) -> Optional[SubmitJobToDeadlineDialog]:
with open(Path(__file__).parent / "default_maya_job_template.yaml") as fh:
default_job_template = yaml.safe_load(fh)

Expand All @@ -457,7 +459,8 @@ def show_maya_render_submitter(parent, f=Qt.WindowFlags()) -> "Optional[SubmitJo
render_settings.output_path = Scene.output_path()

# Load the sticky settings
render_settings.load_sticky_settings(Scene.name())
if load_sticky_setting:
render_settings.load_sticky_settings(Scene.name())

# Create a dictionary for the layers, and accumulate data about each layer
render_layer_names = get_all_renderable_render_layer_names()
Expand Down Expand Up @@ -535,7 +538,10 @@ def on_create_job_bundle_callback(
scene_name = maya.cmds.file(q=True, sn=True)
button = maya.cmds.confirmDialog(
title="Warning: Scene Changes not Saved",
message=("Save scene to %s before submitting?" % scene_name),
message=(
"The scene has unsaved local changes that will not be included in the job submission.\n\nDo you want to save the scene to %s before submitting?"
% scene_name
),
button=["Yes", "No"],
defaultButton="No",
cancelButton="No",
Expand Down
12 changes: 9 additions & 3 deletions src/deadline/maya_submitter/mel_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ def doIt(_): # pylint: disable=invalid-name,
DeadlineCloudSubmitterCmd.dialog.close()
DeadlineCloudSubmitterCmd.dialog = None

# Show existing submitter dialog, or create new one if needed
# Create a new submitter dialog. If this is the first time the submitter is
# opened, load the sticky settings. If this is not the first time, close
# the existing dialog and create a new one without loading the sticky
# settings.
if DeadlineCloudSubmitterCmd.dialog:
DeadlineCloudSubmitterCmd.dialog.show()
DeadlineCloudSubmitterCmd.dialog.close()
DeadlineCloudSubmitterCmd.dialog = show_maya_render_submitter(
parent=mainwin, f=Qt.Tool, load_sticky_setting=False
)
else:
DeadlineCloudSubmitterCmd.dialog = show_maya_render_submitter(
parent=mainwin, f=Qt.Tool
parent=mainwin, f=Qt.Tool, load_sticky_setting=True
)
DeadlineCloudSubmitterCmd.dialog_scene_name = scene_name

Expand Down
8 changes: 4 additions & 4 deletions src/deadline/maya_submitter/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def frame_step() -> int:
"""
Returns the frame step of the current render.
"""
return int(maya.cmds.getAttr("defaultRenderGlobals.byFrame"))
return int(maya.cmds.getAttr("defaultRenderGlobals.byFrameStep"))

@staticmethod
def extension_padding() -> int:
Expand Down Expand Up @@ -130,7 +130,7 @@ def project_path() -> str:
"""
Returns the base path to the project the current scene is in
"""
return maya.cmds.workspace(query=True, directory=True)
return maya.cmds.workspace(query=True, rootDirectory=True)

@staticmethod
def output_path() -> str:
Expand All @@ -140,9 +140,9 @@ def output_path() -> str:
# This one didn't work translated to the maya.cmds equivalent
image_rule = maya.mel.eval('workspace -q -fileRuleEntry "images"')
if image_rule:
return os.path.join(maya.cmds.workspace(query=True, directory=True), image_rule)
return os.path.join(Scene.project_path(), image_rule)
else:
return maya.cmds.workspace(query=True, directory=True)
return Scene.project_path()

@staticmethod
def autotx() -> bool:
Expand Down

This file was deleted.

44 changes: 0 additions & 44 deletions test/deadline_submitter_for_maya/unit/scripts/test_scene.py

This file was deleted.

File renamed without changes.
File renamed without changes.
77 changes: 77 additions & 0 deletions test/unit/deadline_submitter_for_maya/scripts/test_scene.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

from typing import Optional
import pytest
import os
from unittest.mock import patch, Mock

from deadline.maya_submitter.scene import FrameRange, Scene


class TestFrameRange:
frame_range_params = [(1, 100, 7), (1, 100, None), (1, None, 7), (10, 10, 10), (1, 10, 1)]

@pytest.mark.parametrize("start, stop, step", frame_range_params)
def test_frame_range_iter(self, start: int, stop: int, step: Optional[int]) -> None:
# GIVEN
frame_range = FrameRange(start, stop, step)

# WHEN
frames = [f for f in frame_range]

# THEN
if stop is None:
stop = start
if step is None:
step = 1
assert frames == [i for i in range(start, stop + step, step)]

@pytest.mark.parametrize("start, stop, step", frame_range_params)
def test_frame_repr(self, start: int, stop: int, step: Optional[int]) -> None:
# GIVEN
frame_range = FrameRange(start, stop, step)

# WHEN
fr_repr = repr(frame_range)

# THEN
if stop is None or start == stop:
assert fr_repr == str(start)
elif step is None or step == 1:
assert fr_repr == f"{start}-{stop}"
else:
assert fr_repr == f"{start}-{stop}:{step}"


class TestScene:

@patch("deadline.maya_submitter.scene.maya.cmds")
def test_project_path(self, mock_maya_cmds: Mock) -> None:
Scene.project_path()

mock_maya_cmds.workspace.assert_called_once_with(query=True, rootDirectory=True)

@patch.object(Scene, "project_path")
@patch("deadline.maya_submitter.scene.maya")
def test_output_path_with_images_suffix(self, mock_maya: Mock, mock_project_path: Mock) -> None:
test_images_dir: str = "test_images_dir"
test_project_path: str = "test_project_path"
mock_maya.mel.eval.return_value = test_images_dir
mock_project_path.return_value = test_project_path

output_path: str = Scene.output_path()

assert output_path == os.path.join(test_project_path, test_images_dir)

@patch.object(Scene, "project_path")
@patch("deadline.maya_submitter.scene.maya")
def test_output_path_without_images_suffix(
self, mock_maya: Mock, mock_project_path: Mock
) -> None:
test_project_path: str = "test_project_path"
mock_maya.mel.eval.return_value = None
mock_project_path.return_value = test_project_path

output_path: str = Scene.output_path()

assert output_path == test_project_path
37 changes: 37 additions & 0 deletions test/unit/deadline_submitter_for_maya/test_mel_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from deadline.maya_submitter.mel_commands import DeadlineCloudSubmitterCmd
from unittest.mock import patch, Mock
import maya.api.OpenMaya as om # pylint: disable=import-error
from qtpy.QtCore import Qt # type: ignore
from qtpy.QtWidgets import ( # type: ignore
QApplication,
)


@patch("deadline.maya_submitter.mel_commands.show_maya_render_submitter")
@patch.object(QApplication, "instance")
@patch.object(om.MGlobal, "mayaState")
def test_deadline_cloud_submitter_cmd_sticky_setting_load_only_once(
mock_maya_state: Mock, mock_q_app: Mock, mock_show_maya_render_submitter: Mock
) -> None:
mock_maya_state.return_value = om.MGlobal.kInteractive
maya_widget: Mock = Mock()
maya_widget.objectName.return_value = "MayaWindow"
q_app_instance: Mock = Mock()
q_app_instance.topLevelWidgets.return_value = [maya_widget]
mock_q_app.return_value = q_app_instance
submitter_dialog: Mock = Mock()
mock_show_maya_render_submitter.return_value = submitter_dialog

DeadlineCloudSubmitterCmd.doIt(Mock())

mock_show_maya_render_submitter.assert_called_once_with(
parent=maya_widget, f=Qt.Tool, load_sticky_setting=True
)

DeadlineCloudSubmitterCmd.doIt(Mock())

mock_show_maya_render_submitter.assert_called_with(
parent=maya_widget, f=Qt.Tool, load_sticky_setting=False
)
submitter_dialog.close.assert_called_once()

0 comments on commit 093bac1

Please sign in to comment.