Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shiqinfeng1 opened this issue Jun 27, 2019 · 0 comments

Comments

@shiqinfeng1
Copy link

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant