Skip to content

Advise to support auto update external file path and reference file path #6

Description

@shiqinfeng1

Someone maybe sends you zip files to render, which includes ma/mb files, also some sourceimages, or other mb files referenced. But in the filepatheditor, the configured path is absolute path,like this: e:\maya-proj\files\sourceimages... . It must be configured the correct path to work fine.

One example like this:

def repath(self, node, file, project_path):
        matches = []
        for root, dirnames, filenames in os.walk(project_path):
            for x in filenames:
                if x == file:
                    matches.append([root,os.path.join(root, x)]) 
                elif x.split(".")[0] == file.split(".")[0]: #---> this second option is used when a file is useing ##### padding, we can match by name only
                    
                    x_ext = x.split(".")[len(x.split("."))-1]
                    file_ext = file.split(".")[len(file.split("."))-1]
                    if x_ext == file_ext:
                        matches.append([root,os.path.join(root, x)])
                    
                    
        if len(matches)>0:   
            return cmds.filePathEditor(node, repath=matches[0][0])      
        
        return None 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions