def set_up(info): # set up application environment, by getting information from the info # object. This info object, contains data retrieved from some # external source # get the environment and application env = AppEnvironment.get() from maya_app import Maya, Maya85 # detect if this is Maya 8.5 or later app = None try: import maya app = Maya85() except ImportError: from pyasm.application.maya import Maya app = Maya() info.app = app env.set_app(app) env.set_info(info) # DEPRECATED: info object shouldn't know anything about # populate the info object with this information info.env = env
def _add_texture(my, current_node, path, attr=""): # if the path in the field does not exist, prepend it with the # file_rule_entry dir for textures or sourceImages if not os.path.exists(path): my.app = Maya.get() texture_dir1 = my.app.mel('workspace -q -fre "textures"') texture_dir2 = my.app.mel('workspace -q -fre "sourceImages"') exists = False if texture_dir1: path = '%s/%s' %(texture_dir1, path) exists = os.path.exists(path) if not exists: print "WARNING: texture_path '%s' does not exist" % path if not exists and texture_dir2: path = '%s/%s' %(texture_dir2, path) exists = os.path.exists(path) if not exists: print "WARNING: texture_path '%s' does not exist" % path if not exists: return # Note: Temporarily disabling until we get a change to really test # this. """ for dir in my.global_dirs: filename = path mayaman_path = "%s/%s" %(dir, filename) if os.path.exists(mayaman_path): path = mayaman_path break else: print "WARNING: texture_path '%s' does not exist" % path return """ if os.path.exists(path): my.texture_nodes.append( current_node ) my.texture_paths.append( path ) if not attr: attr = "ftn" my.texture_attrs.append( attr ) else: print "WARNING: texture_path '%s' does not exist" % path
def _add_texture(self, current_node, path, attr=""): # if the path in the field does not exist, prepend it with the # file_rule_entry dir for textures or sourceImages if not os.path.exists(path): self.app = Maya.get() texture_dir1 = self.app.mel('workspace -q -fre "textures"') texture_dir2 = self.app.mel('workspace -q -fre "sourceImages"') exists = False if texture_dir1: path = '%s/%s' % (texture_dir1, path) exists = os.path.exists(path) if not exists: print "WARNING: texture_path '%s' does not exist" % path if not exists and texture_dir2: path = '%s/%s' % (texture_dir2, path) exists = os.path.exists(path) if not exists: print "WARNING: texture_path '%s' does not exist" % path if not exists: return # Note: Temporarily disabling until we get a change to really test # this. """ for dir in self.global_dirs: filename = path mayaman_path = "%s/%s" %(dir, filename) if os.path.exists(mayaman_path): path = mayaman_path break else: print "WARNING: texture_path '%s' does not exist" % path return """ if os.path.exists(path): self.texture_nodes.append(current_node) self.texture_paths.append(path) if not attr: attr = "ftn" self.texture_attrs.append(attr) else: print "WARNING: texture_path '%s' does not exist" % path
def __init__(self): self.env = MayaEnvironment.get() self.app = Maya.get()
def __init__(my): my.env = MayaEnvironment.get() my.app = Maya.get()