Skip to content

Commit

Permalink
Merge pull request #15 from quadproduction/release/4.0.8
Browse files Browse the repository at this point in the history
Release/4.0.8
  • Loading branch information
BenSouchet authored Dec 5, 2024
2 parents 01f4647 + e2b971f commit 755980d
Show file tree
Hide file tree
Showing 18 changed files with 151 additions and 109 deletions.
6 changes: 2 additions & 4 deletions src/igniter/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
settings_module = load_quadpype_module("quadpype/settings/lib.py", "quadpype.settings.lib")

should_add_certificate_path_to_mongo_url = settings_module.should_add_certificate_path_to_mongo_url

get_expected_studio_version_str = settings_module.get_expected_studio_version_str
#
# get_global_settings_and_version_no_handler = settings_module.get_global_settings_and_version_no_handler
get_quadpype_local_dir_path = settings_module.get_quadpype_local_dir_path
#
#

__all__ = [
"should_add_certificate_path_to_mongo_url",

Expand Down
22 changes: 10 additions & 12 deletions src/quadpype/hosts/blender/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ILoadHost
)
from quadpype.client import get_asset_by_name
from quadpype.lib import filter_profiles
from quadpype.pipeline import (
schema,
get_current_asset_name,
Expand All @@ -29,7 +28,8 @@
deregister_creator_plugin_path,
AVALON_CONTAINER_ID,
Anatomy,
get_current_project_name
get_current_project_name,
get_current_task_name
)

from quadpype.pipeline.context_tools import get_template_data_from_session
Expand Down Expand Up @@ -284,19 +284,17 @@ def set_frame_range(data):
fps = data.get("fps")

# Should handles be included, defined by settings
task_name = get_current_task_name()
settings = get_project_settings(get_current_project_name())
task_type = data.get("taskType")
include_handles_settings = settings["blender"]["include_handles"]
current_task = data.get("tasks").get(task_name)

include_handles = include_handles_settings["include_handles_default"]
profile = filter_profiles(
include_handles_settings["profiles"],
key_values={
"task_types": task_type,
"task_names": data["name"]
}
)
if profile:
include_handles = profile["include_handles"]
for item in include_handles_settings["profiles"]:
if current_task["type"] in item["task_type"]:
include_handles = item["include_handles"]
break

if include_handles:
frame_start -= int(data.get("handleStart", 0))
frame_end += int(data.get("handleEnd", 0))
Expand Down
4 changes: 2 additions & 2 deletions src/quadpype/hosts/blender/hooks/pre_pyside_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def inner_execute(self):

# Check if PySide2 is installed and skip if yes
if self.is_pyside_installed(python_executable, qt_binding):
self.log.debug("Blender has already installed PySide2.")
self.log.debug("Blender has already installed PySide.")
return

# Install PySide2 in blender's python
# Install PySide in blender's python
if platform == "windows":
result = self.install_pyside_windows(
python_executable,
Expand Down
5 changes: 1 addition & 4 deletions src/quadpype/hosts/blender/plugins/create/create_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import bpy

from quadpype.lib import version_up
from quadpype.pipeline.context_tools import version_up_current_workfile
from quadpype.hosts.blender.api import plugin, lib
from quadpype.hosts.blender.api.render_lib import prepare_rendering
from quadpype.hosts.blender.api.workio import save_file
Expand Down Expand Up @@ -40,9 +39,7 @@ def create(
# settings. Even the validator to check that the file is saved will
# detect the file as saved, even if it isn't. The only solution for
# now it is to force the file to be saved.
if not bpy.data.filepath:
version_up_current_workfile()
else:
if bpy.data.filepath:
filepath = version_up(bpy.data.filepath)
save_file(filepath, copy=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bpy

from quadpype.hosts.blender.api.plugin import BlenderCreator
from quadpype.pipeline import CreatedInstance, AutoCreator
from quadpype.client import get_asset_by_name
from quadpype.hosts.blender.api.pipeline import (
Expand Down
27 changes: 13 additions & 14 deletions src/quadpype/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
get_oiio_tool_args,
get_ffmpeg_tool_path,
get_ffmpeg_tool_args,
is_oiio_supported,
is_oiio_supported
)

from .attribute_definitions import (
Expand All @@ -45,15 +45,17 @@
EnumDef,
BoolDef,
FileDef,
FileDefItem,
FileDefItem
)

from .env_tools import (
env_value_to_bool,
get_paths_from_environ,
get_paths_from_environ
)

from .terminal import Terminal
from .log import Logger

from .execute import (
get_quadpype_execute_args,
get_linux_launcher_args,
Expand All @@ -66,17 +68,14 @@
path_to_subprocess_arg,
CREATE_NO_WINDOW
)
from .log import (
Logger,
)

from .path_templates import (
merge_dict,
TemplateMissingKey,
TemplateUnsolved,
StringTemplate,
TemplatesDict,
FormatObject,
FormatObject
)

from .dateutils import (
Expand All @@ -92,7 +91,7 @@
recursive_bases_from_class,
classes_from_module,
import_module_from_dirpath,
is_func_signature_supported,
is_func_signature_supported
)

from .profiles_filtering import (
Expand All @@ -111,12 +110,10 @@
get_ffmpeg_format_args,
convert_ffprobe_fps_value,
convert_ffprobe_fps_to_float,
get_rescaled_command_arguments,
get_rescaled_command_arguments
)

from .cache import (
CacheValues
)
from .cache import CacheValues

from .registry import (
IniSettingRegistry,
Expand Down Expand Up @@ -158,7 +155,7 @@

from .plugin_tools import (
prepare_template_data,
source_hash,
source_hash
)

from .path_tools import (
Expand All @@ -168,7 +165,7 @@
create_symlink,
version_up,
get_version_from_path,
get_last_version_from_path,
get_last_version_from_path
)

from .version_utils import (
Expand All @@ -178,6 +175,7 @@
is_running_from_build,
is_running_locally,
is_running_staging,
is_staging_enabled,
is_current_version_studio_latest,
is_current_version_higher_than_expected
)
Expand Down Expand Up @@ -324,6 +322,7 @@
"is_running_from_build",
"is_running_locally",
"is_running_staging",
"is_staging_enabled",
"is_current_version_studio_latest",

"get_all_current_info",
Expand Down
2 changes: 1 addition & 1 deletion src/quadpype/lib/python_module_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def import_module_from_dirpath(dirpath, folder_name, dst_module_name=None):
module = importlib.util.module_from_spec(spec)

# Store module to destination module and `sys.modules`
# WARNING this mus be done before module execution
# WARNING this must be done before module execution
if dst_module is not None:
setattr(dst_module, folder_name, module)

Expand Down
6 changes: 3 additions & 3 deletions src/quadpype/lib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,6 @@ def packages(self) -> Dict[str, PackageHandler]:

def add_package(self, package_instance):
"""Add package to manager."""
if not isinstance(package_instance, PackageHandler):
raise TypeError("Package must be a subclass of PackageHandler")
self._packages[package_instance.name] = package_instance

def remove_package(self, package_name):
Expand All @@ -785,7 +783,7 @@ def remove_package(self, package_name):
del self._packages[package_name]


def create_package_manager() -> PackageManager:
def retrieve_package_manager() -> PackageManager:
global _PACKAGE_MANAGER
if _PACKAGE_MANAGER is None:
_PACKAGE_MANAGER = PackageManager()
Expand All @@ -798,10 +796,12 @@ def get_package_manager() -> PackageManager:
raise RuntimeError("Package Manager is not initialized")
return _PACKAGE_MANAGER


def set_package_manager(package_manager: Any):
global _PACKAGE_MANAGER
_PACKAGE_MANAGER = package_manager


def get_package(package_name: str) -> PackageHandler:
global _PACKAGE_MANAGER
if _PACKAGE_MANAGER is None:
Expand Down
6 changes: 3 additions & 3 deletions src/quadpype/lib/version_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
PackageVersion,
get_package
)
from igniter.settings import (
from quadpype.settings.lib import (
get_expected_studio_version_str
)

Expand Down Expand Up @@ -147,15 +147,15 @@ def get_remote_versions():


def get_latest_version(from_local=None, from_remote=None):
"""Get latest version from repository path."""
"""Get the latest version from the repository path."""
return get_package("quadpype").get_latest_version(from_local=from_local,from_remote=from_remote)


def get_expected_version(staging=None):
expected_version_str = get_expected_studio_version_str(staging)
expected_version = PackageVersion(version=expected_version_str) if expected_version_str else None
if expected_version is None:
# Look for latest if expected version is not set in settings
# Look for the latest if the expected version is not set in settings
expected_version = get_latest_version(
from_local=False,
from_remote=True
Expand Down
51 changes: 50 additions & 1 deletion src/quadpype/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
import time
import inspect
import logging
import platform
import threading
import collections
import traceback
from enum import IntEnum

from uuid import uuid4
from pathlib import Path
from abc import ABC, abstractmethod

from appdirs import user_data_dir

from quadpype.settings import (
get_global_settings,
GLOBAL_SETTINGS_KEY,
Expand All @@ -25,15 +29,22 @@

from quadpype.settings.lib import (
load_json_file,
get_studio_global_settings_overrides
)

from quadpype.lib import (
Logger,
import_filepath,
is_staging_enabled,
import_module_from_dirpath,
)

from quadpype.lib.version import get_packages
from quadpype.lib.version import (
retrieve_package_manager,
get_package,
get_packages,
AddOnHandler
)

from .interfaces import (
QuadPypeInterface,
Expand Down Expand Up @@ -195,6 +206,44 @@ def get_dynamic_modules_dirs():
Returns:
list: Paths loaded from studio overrides.
"""
global_settings = get_studio_global_settings_overrides()
addon_settings = global_settings.get(ADDONS_SETTINGS_KEY, {}).get("custom_addons", {})
local_dir = Path(user_data_dir("quadpype", "quad")) / "addons"

if not local_dir.exists():
local_dir.mkdir(parents=True, exist_ok=True)

package_manager = retrieve_package_manager()

for addon_setting in addon_settings:
addon_package_name = addon_setting.get("package_name", "").strip()
if not addon_package_name:
# The add-on package name is empty, skip.
continue

if get_package(addon_package_name):
# The package already exists in the package manager, skip.
continue

addon_local_dir = local_dir / addon_package_name
if not addon_local_dir.exists():
local_dir.mkdir(parents=True, exist_ok=True)

version_key = "staging_version" if is_staging_enabled() else "version"

remote_dir_paths = addon_setting.get("package_remote_dirs", {}).get(platform.system().lower(), [])
remote_dir_paths = [Path(curr_path_str) for curr_path_str in remote_dir_paths]

addon_package = AddOnHandler(
pkg_name=addon_setting.get("package_name"),
local_dir_path=addon_local_dir,
remote_dir_paths=remote_dir_paths,
running_version_str=addon_setting.get(version_key, ""),
retrieve_locally=addon_setting.get("retrieve_locally", False),
)
package_manager.add_package(addon_package)

# Now retrieve the add-ons paths
dynamic_modules_dir_paths = []
for package in get_packages("add_on"):
dynamic_modules_dir_paths.append(package.running_version.path)
Expand Down
2 changes: 0 additions & 2 deletions src/quadpype/modules/sync_server/providers/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
from googleapiclient import errors
from googleapiclient.http import MediaFileUpload, MediaIoBaseDownload
except (ImportError, SyntaxError) as e:
raise e

# handle imports from Python 2 hosts - in those only basic methods are used
log.warning("Import failed, imported from Python 2, operations will fail.")

Expand Down
4 changes: 0 additions & 4 deletions src/quadpype/modules/webserver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from .server import (
WEB_API
)
from .webserver_module import (
WebServerModule
)


__all__ = (
"WEB_API",
"WebServerModule",
)
1 change: 0 additions & 1 deletion src/quadpype/modules/webserver/webserver_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import os
import socket
from time import sleep

from quadpype import resources
from quadpype.lib import get_app_registry
Expand Down
Loading

0 comments on commit 755980d

Please sign in to comment.