mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
add loadError for loaders which uses external plugins
This commit is contained in:
parent
78ec30cb39
commit
bdaeb3c92f
4 changed files with 30 additions and 6 deletions
|
|
@ -407,3 +407,19 @@ def object_transform_set(container_children):
|
|||
name = f"{node.name}.scale"
|
||||
transform_set[name] = node.scale
|
||||
return transform_set
|
||||
|
||||
|
||||
def get_plugins() -> list:
|
||||
"""Get all loaded plugins in 3dsMax
|
||||
|
||||
Returns:
|
||||
plugin_info_list: a list of loaded plugins
|
||||
"""
|
||||
manager = rt.PluginManager
|
||||
count = manager.pluginDllCount
|
||||
plugin_info_list = []
|
||||
for p in range(1, count + 1):
|
||||
plugin_info = manager.pluginDllName(p)
|
||||
plugin_info_list.append(plugin_info)
|
||||
|
||||
return plugin_info_list
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import os
|
||||
|
||||
from pymxs import runtime as rt
|
||||
|
||||
from openpype.pipeline.load import LoadError
|
||||
from openpype.hosts.max.api import lib
|
||||
from openpype.hosts.max.api.lib import (
|
||||
unique_namespace,
|
||||
get_namespace,
|
||||
object_transform_set
|
||||
object_transform_set,
|
||||
get_plugins
|
||||
)
|
||||
from openpype.hosts.max.api.lib import maintained_selection
|
||||
from openpype.hosts.max.api.pipeline import (
|
||||
|
|
@ -29,6 +30,9 @@ class ModelUSDLoader(load.LoaderPlugin):
|
|||
|
||||
def load(self, context, name=None, namespace=None, data=None):
|
||||
# asset_filepath
|
||||
plugin_info = get_plugins()
|
||||
if "usdimport.dli" not in plugin_info:
|
||||
raise LoadError("No USDImporter loaded/installed in Max..")
|
||||
filepath = os.path.normpath(self.filepath_from_context(context))
|
||||
import_options = rt.USDImporter.CreateOptions()
|
||||
base_filename = os.path.basename(filepath)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import os
|
|||
|
||||
from openpype.hosts.max.api import lib, maintained_selection
|
||||
from openpype.hosts.max.api.lib import (
|
||||
unique_namespace
|
||||
unique_namespace,
|
||||
|
||||
)
|
||||
from openpype.hosts.max.api.pipeline import (
|
||||
containerise,
|
||||
|
|
@ -25,7 +26,6 @@ class PointCloudLoader(load.LoaderPlugin):
|
|||
def load(self, context, name=None, namespace=None, data=None):
|
||||
"""load point cloud by tyCache"""
|
||||
from pymxs import runtime as rt
|
||||
|
||||
filepath = os.path.normpath(self.filepath_from_context(context))
|
||||
obj = rt.tyCache()
|
||||
obj.filename = filepath
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from openpype.pipeline import (
|
|||
load,
|
||||
get_representation_path
|
||||
)
|
||||
from openpype.pipeline.load import LoadError
|
||||
from openpype.hosts.max.api.pipeline import (
|
||||
containerise,
|
||||
update_custom_attribute_data,
|
||||
|
|
@ -12,7 +13,8 @@ from openpype.hosts.max.api.pipeline import (
|
|||
)
|
||||
from openpype.hosts.max.api import lib
|
||||
from openpype.hosts.max.api.lib import (
|
||||
unique_namespace
|
||||
unique_namespace,
|
||||
get_plugins
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -28,7 +30,9 @@ class RedshiftProxyLoader(load.LoaderPlugin):
|
|||
|
||||
def load(self, context, name=None, namespace=None, data=None):
|
||||
from pymxs import runtime as rt
|
||||
|
||||
plugin_info = get_plugins()
|
||||
if "redshift4max.dlr" not in plugin_info:
|
||||
raise LoadError("Redshift not loaded/installed in Max..")
|
||||
filepath = self.filepath_from_context(context)
|
||||
rs_proxy = rt.RedshiftProxy()
|
||||
rs_proxy.file = filepath
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue