replace 'fname' with 'filepath_from_context' (#5000)

This commit is contained in:
Jakub Trllo 2023-05-22 14:11:21 +02:00 committed by Jakub Trllo
parent a627615a61
commit c9edd211af
6 changed files with 8 additions and 7 deletions

View file

@ -18,7 +18,7 @@ class ModelAbcLoader(load.LoaderPlugin):
def load(self, context, name=None, namespace=None, data=None):
from pymxs import runtime as rt
file_path = os.path.normpath(self.fname)
file_path = os.path.normpath(self.filepath_from_context(context))
abc_before = {
c

View file

@ -17,7 +17,7 @@ class FbxModelLoader(load.LoaderPlugin):
def load(self, context, name=None, namespace=None, data=None):
from pymxs import runtime as rt
filepath = os.path.normpath(self.fname)
filepath = os.path.normpath(self.filepath_from_context(context))
rt.FBXImporterSetParam("Animation", False)
rt.FBXImporterSetParam("Cameras", False)
rt.FBXImporterSetParam("Preserveinstances", True)

View file

@ -18,7 +18,7 @@ class ObjLoader(load.LoaderPlugin):
def load(self, context, name=None, namespace=None, data=None):
from pymxs import runtime as rt
filepath = os.path.normpath(self.fname)
filepath = os.path.normpath(self.filepath_from_context(context))
self.log.debug("Executing command to import..")
rt.Execute(f'importFile @"{filepath}" #noPrompt using:ObjImp')

View file

@ -20,7 +20,7 @@ class ModelUSDLoader(load.LoaderPlugin):
from pymxs import runtime as rt
# asset_filepath
filepath = os.path.normpath(self.fname)
filepath = os.path.normpath(self.filepath_from_context(context))
import_options = rt.USDImporter.CreateOptions()
base_filename = os.path.basename(filepath)
filename, ext = os.path.splitext(base_filename)

View file

@ -18,7 +18,7 @@ class PointCloudLoader(load.LoaderPlugin):
"""load point cloud by tyCache"""
from pymxs import runtime as rt
filepath = os.path.normpath(self.fname)
filepath = os.path.normpath(self.filepath_from_context(context))
obj = rt.tyCache()
obj.filename = filepath

View file

@ -47,7 +47,8 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin):
if not substance_painter.project.is_open():
# Allow to 'initialize' a new project
result = prompt_new_file_with_mesh(mesh_filepath=self.fname)
path = self.filepath_from_context(context)
result = prompt_new_file_with_mesh(mesh_filepath=path)
if not result:
self.log.info("User cancelled new project prompt.")
return
@ -65,7 +66,7 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin):
else:
raise LoadError("Reload of mesh failed")
path = self.fname
path = self.filepath_from_context(context)
substance_painter.project.reload_mesh(path,
settings,
on_mesh_reload)