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

Commit

Permalink
Merge branch 'develop' into bugfix/add_missing_houdini_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
moonyuet authored Dec 11, 2023
2 parents 69ed6f5 + 2d73f6a commit 39a00e1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 21 deletions.
22 changes: 9 additions & 13 deletions openpype/hosts/substancepainter/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,9 @@ def _setup_file_dialog():
file_dialog.setDirectory(os.path.dirname(mesh_filepath))
url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath))
file_dialog.selectUrl(url)

# Give the explorer window time to refresh to the folder and select
# the file
while not file_dialog.selectedFiles():
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 1000)
print(f"Selected: {file_dialog.selectedFiles()}")

# Set it again now we know the path is refreshed - without this
# accepting the dialog will often not trigger the correct filepath
file_dialog.setDirectory(os.path.dirname(mesh_filepath))
url = QtCore.QUrl.fromLocalFile(os.path.basename(mesh_filepath))
file_dialog.selectUrl(url)
# TODO: find a way to improve the process event to
# load more complicated mesh
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 3000)

file_dialog.done(file_dialog.Accepted)
app.processEvents(QtCore.QEventLoop.AllEvents)
Expand Down Expand Up @@ -628,7 +619,12 @@ def _setup_prompt():
mesh_filename_label = mesh_filename.findChild(QtWidgets.QLabel)
if not mesh_filename_label.text():
dialog.close()
raise RuntimeError(f"Failed to set mesh path: {mesh_filepath}")
substance_painter.logging.warning(
"Failed to set mesh path with the prompt dialog:"
f"{mesh_filepath}\n\n"
"Creating new project directly with the mesh path instead.")
else:
dialog.done(dialog.Accepted)

new_action = _get_new_project_action()
if not new_action:
Expand Down
14 changes: 11 additions & 3 deletions openpype/hosts/substancepainter/plugins/load/load_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,22 @@ def load(self, context, name, namespace, data):
# Get user inputs
import_cameras = data.get("import_cameras", True)
preserve_strokes = data.get("preserve_strokes", True)

sp_settings = substance_painter.project.Settings(
import_cameras=import_cameras
)
if not substance_painter.project.is_open():
# Allow to 'initialize' a new project
path = self.filepath_from_context(context)
# TODO: improve the prompt dialog function to not
# only works for simple polygon scene
result = prompt_new_file_with_mesh(mesh_filepath=path)
if not result:
self.log.info("User cancelled new project prompt.")
return
self.log.info("User cancelled new project prompt."
"Creating new project directly from"
" Substance Painter API Instead.")
settings = substance_painter.project.create(
mesh_file_path=path, settings=sp_settings
)

else:
# Reload the mesh
Expand Down
2 changes: 1 addition & 1 deletion openpype/lib/openpype_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def is_running_staging():
latest_version = get_latest_version(local=False, remote=True)
staging_version = latest_version

if current_version == production_version:
if current_version == staging_version:
return True

return is_staging_enabled()
Expand Down
6 changes: 3 additions & 3 deletions openpype/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from openpype import AYON_SERVER_ENABLED
from openpype.lib.openpype_version import is_running_staging
from openpype.lib.openpype_version import is_staging_enabled

RESOURCES_DIR = os.path.dirname(os.path.abspath(__file__))

Expand Down Expand Up @@ -59,7 +59,7 @@ def get_openpype_icon_filepath(staging=None):
return get_resource("icons", "AYON_icon_dev.png")

if staging is None:
staging = is_running_staging()
staging = is_staging_enabled()

if staging:
return get_openpype_staging_icon_filepath()
Expand All @@ -68,7 +68,7 @@ def get_openpype_icon_filepath(staging=None):

def get_openpype_splash_filepath(staging=None):
if staging is None:
staging = is_running_staging()
staging = is_staging_enabled()

if AYON_SERVER_ENABLED:
if os.getenv("AYON_USE_DEV") == "1":
Expand Down
57 changes: 56 additions & 1 deletion tests/lib/testing_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def publish_finished(self, dbcon, launched_app, download_test_data,
while not valid_date_finished:
time.sleep(0.5)
if time.time() - time_start > timeout:
raise ValueError("Timeout for DL finish reached")
raise ValueError("Timeout for Deadline finish reached")

response = requests.get(url, timeout=10)
if not response.ok:
Expand All @@ -491,6 +491,61 @@ def publish_finished(self, dbcon, launched_app, download_test_data,
if not response.json():
raise ValueError("Couldn't find {}".format(deadline_job_id))

job = response.json()[0]

def recursive_dependencies(job, results=None):
if results is None:
results = []

for dependency in job["Props"]["Dep"]:
dependency = requests.get(
"{}/api/jobs?JobId={}".format(
deadline_url, dependency["JobID"]
),
timeout=10
).json()[0]
results.append(dependency)
grand_dependencies = recursive_dependencies(
dependency, results=results
)
for grand_dependency in grand_dependencies:
if grand_dependency not in results:
results.append(grand_dependency)
return results

job_status = {
0: "Unknown",
1: "Active",
2: "Suspended",
3: "Completed",
4: "Failed",
6: "Pending"
}

jobs_to_validate = [job]
jobs_to_validate.extend(recursive_dependencies(job))
failed_jobs = []
errors = []
for job in jobs_to_validate:
if "Failed" == job_status[job["Stat"]]:
failed_jobs.append(str(job))

resp_error = requests.get(
"{}/api/jobreports?JobID={}&Data=allerrorcontents".format(
deadline_url, job["_id"]
),
timeout=10
)
errors.extend(resp_error.json())

msg = "Errors in Deadline:\n"
msg += "\n".join(errors)
assert not errors, msg

msg = "Failed in Deadline:\n"
msg += "\n".join(failed_jobs)
assert not failed_jobs, msg

# '0001-...' returned until job is finished
valid_date_finished = response.json()[0]["DateComp"][:4] != "0001"

Expand Down

0 comments on commit 39a00e1

Please sign in to comment.