Exemple #1
0
def add_parameters(knode):
    '''
    :description to create parameters on custom group node
    :param knode <NodegraphAPI node object>
    '''    
    parameter = knode.getParameters()
    node_category_parameter = parameter.createChildString(
        studio_nodes.STUDIO_NODE_KEY, studio_nodes.LOOKDEV_ASSET_NODE_TYPE)
    hint = {'readOnly': 'True'}
    node_category_parameter.setHintString(str(hint))    
    show_path = resources.get_show_path()    
    show_path_parameter = parameter.createChildString('show_path', show_path)
    hint = {'widget': 'fileInput'}
    show_path_parameter.setHintString(str(hint))
    model_name = parameter.createChildString('model_name', '')
    model_category = parameter.createChildString('model_category', '')
    hint = {
        'widget': 'popup',
        'options': studio_nodes.CATEGORIES
        }
    model_category.setHintString(str(hint))   
    model_category.setValue(studio_nodes.CATEGORIES[0], 1.0)    
    model_version = parameter.createChildString('model_version', '')
    camera_name = parameter.createChildString('camera_name', '')
    camera_category = parameter.createChildString('camera_category', 'camera')
    hint = {'readOnly': 'True'}
    camera_category.setHintString(str(hint))    
    camera_version = parameter.createChildString('camera_version', '')
    create_button = parameter.createChildString('create_or_update', 'create_or_update')
    update_create_button(create_button)
Exemple #2
0
def add_parameters(knode):
    '''
    :description to create parameters on custom group node
    :param knode <NodegraphAPI node object>
    '''
    parameter = knode.getParameters()
    node_category_parameter = parameter.createChildString(
        studio_nodes.STUDIO_NODE_KEY, studio_nodes.LIGHTING_ASSET_NODE_TYPE)
    hint = {'readOnly': 'True'}
    node_category_parameter.setHintString(str(hint))
    show_path = resources.get_show_path()
    show_path_parameter = parameter.createChildString('show_path', show_path)
    hint = {'widget': 'fileInput'}
    show_path_parameter.setHintString(str(hint))
    sequence = parameter.createChildString('sequence', '')
    shot = parameter.createChildString('shot', '')
    create_button = parameter.createChildString('create_or_update',
                                                'create_or_update')
    update_create_button(create_button)
    frame_range = parameter.createChildNumberArray('frame_ranage', 2)
    frame_range.getChild('i0').setValue('1001', 1.0)
    frame_range.getChild('i1').setValue('1025', 1.0)
    hint = {'readOnly': 'True'}
    frame_range.setHintString(str(hint))
    camera_group = parameter.createChildGroup('camera')
    character_group = parameter.createChildGroup('character')
    prop_group = parameter.createChildGroup('prop')
    set_group = parameter.createChildGroup('set')
Exemple #3
0
def get_lookdev_model_depnendency(category, name):
    '''
    :example
        get_lookdev_model_depnendency('character', 'batman')    
    '''
    model_depnendency = versions.get_asset_dependency_versions(
        resources.get_show_path(), category, name, 'lookdev', 'model')
    return model_depnendency
Exemple #4
0
    def set_default(self):
        if 'RMANTREE' in os.environ:
            rmantree = os.environ['RMANTREE']
        else:
            rmantree = '/opt/pixar/RenderManProServer-21.6'
        txmake_path = os.path.join(rmantree, 'bin', 'txmake')
        self.lineedit_txmake.setText(txmake_path)
        show_path = resources.get_show_path()
        self.browse_directory = show_path

        print show_path
Exemple #5
0
 def get_publish_path(self):
     pipe, inputs = self.get_inputs()
     show_path = resources.get_show_path()
     if pipe == 'asset':
         publish_path = os.path.join(show_path, 'asset', inputs['category'],
                                     inputs['name'])
         return publish_path, inputs['type']
     if pipe == 'scene':
         category = str(self.combobox_category.currentText())
         sequence = str(self.lineedit_sequence.text())
         shot = str(self.lineedit_shot.text())
         scene = str(self.combobox_scene.currentText())
         publish_path = os.path.join(show_path, 'scene', inputs['sequence'],
                                     inputs['shot'])
         return publish_path, inputs['scene']
     return None, None
Exemple #6
0
    def get_inputs(self):
        pipe = str(self.combobox_pipe.currentText())
        show_path = resources.get_show_path()
        next_version = str(self.lineedit_nextversion.text())
        model = str(self.lineedit_model.text())
        lookdev = str(self.lineedit_lookdev.text())
        inputs = {'version': next_version, 'model': model, 'lookdev': lookdev}
        if pipe == 'asset':
            inputs['category'] = str(self.combobox_category.currentText())
            inputs['type'] = str(self.combobox_type.currentText())
            inputs['name'] = str(self.lineedit_name.text())

        elif pipe == 'scene':
            inputs['scene'] = str(self.combobox_scene.currentText())
            inputs['sequence'] = str(self.lineedit_sequence.text())
            inputs['shot'] = str(self.lineedit_shot.text())
        return pipe, inputs
Exemple #7
0
def add_parameters(knode):
    '''
    :description to create parameters on custom group node
    :param knode <NodegraphAPI node object>
    '''
    parameter = knode.getParameters()
    node_category_parameter = parameter.createChildString(
        studio_nodes.STUDIO_NODE_KEY, studio_nodes.GENERIC_ASSET_NODE_TYPE)
    hint = {'readOnly': 'True'}
    node_category_parameter.setHintString(str(hint))
    show_path = resources.get_show_path()
    show_path_parameter = parameter.createChildString('show_path', show_path)
    hint = {'widget': 'fileInput'}
    show_path_parameter.setHintString(str(hint))
    add_parameter = parameter.createChildString('add', 'add')
    # add bitton hint string button signal
    update_add_button(add_parameter)
    assets_parameter = parameter.createChildGroup('assets')
    update_parameter = parameter.createChildString('create_or_update',
                                                   'create_or_update')
    # create bitton hint string button signal
    update_create_button(update_parameter)
Exemple #8
0
def asset_publish(name, category, type, version, model, lookdev):
    '''
    :example
        name = 'jasmin'
        category = 'character'
        type = 'model'
        version = '1.0.0'
        model = 'None'
        lookdev = 'None'
        from tools.maya_publish import publish
        asset_publish(name, category, type, version, model, lookdev)
    '''
    from pymel import core
    print '#info asset publish(%s)' % type
    py_node = core.PyNode(name)
    attributes = {
        'name': name,
        'category': category,
        'type': type,
        'model': model,
        'version': version,
        'lookdev': lookdev
    }
    orders = ['name', 'category', 'type', 'version', 'model', 'lookdev']
    for order in orders:
        current_attribute = '%s.%s' % (py_node.name(), order)
        if core.objExists(current_attribute):
            core.deleteAttr(current_attribute)
        py_node.addAttr(order, dt='string')
        py_node.setAttr(order, attributes[order])
    dirname = os.path.join(
        resources.get_show_path(),
        # '/venture/shows/katana_tutorials/asset',
        category,
        name,
        type,
        version)
    if os.path.isdir(dirname):
        try:
            shutil.rmtree(dirname)
        except Exception:
            pass
    if not os.path.isdir(dirname):
        os.makedirs(dirname)
    maya_path = os.path.join(dirname, '%s.ma' % name)
    abc_path = os.path.join(dirname, '%s.abc' % name)
    manifest_path = os.path.join(dirname, 'manifest.json')
    py_node.select(r=True)
    core.exportSelected(maya_path, f=True)
    asset_attributes = '-attr ' + ' -attr '.join(orders)
    command = '-frameRange 1001 1002 %s -uvWrite -attrPrefix xgen -worldSpace -root %s -stripNamespaces -file %s ' % (
        asset_attributes, name, abc_path)
    py_node.select(r=True)
    core.AbcExport(j=command)
    manifest_data = {'pipe': 'asset', 'data': attributes}
    with open(manifest_path, 'w') as manifest:
        manifest.write(json.dumps(manifest_data, indent=4))
    os.system('xdg-open \"%s\"' % dirname)
    print '\t', maya_path
    print '\t', abc_path
    print '\t', manifest_path
Exemple #9
0
def scene_publish(sequence, shot, scene, version, puppets=None):
    '''
    :example
        sequence = 'sequence_101'
        shot = 'shot_1001'        
        scene = 'animation'
        version = '0.0.0'
        assets = ['batman:batman', 'jasmin:jasmin', 'scene:scene']
        # assets = ['batman:batman', 'jasmin:jasmin', 'scene:scene', 'motorcycle:motorcycle']    
        from tools.maya_publish import publish
        scene_publish(sequence, shot, scene, version)
    '''
    from pymel import core
    print '#info scene publish(%s)' % scene
    model_panels = core.getPanel(type='modelPanel')
    for model_panel in model_panels:
        core.modelEditor(model_panel,
                         edit=True,
                         displayAppearance='boundingBox')
        core.modelEditor(model_panel, edit=True, allObjects=False)
        core.modelEditor(model_panel, edit=True, nurbsCurves=True)
        core.modelEditor(model_panel, edit=True, polymeshes=True)
    if not puppets:
        puppets = get_valid_puppets()
    dirname = os.path.join(
        resources.get_show_path(),
        # '/venture/shows/katana_tutorials/scene',
        sequence,
        shot,
        scene,
        version)
    if os.path.isdir(dirname):
        try:
            shutil.rmtree(dirname)
        except Exception:
            pass
    if not os.path.isdir(dirname):
        os.makedirs(dirname)
    min = int(core.playbackOptions(q=True, min=True))
    max = int(core.playbackOptions(q=True, max=True))
    puppet_attributes = [
        'name', 'category', 'type', 'version', 'model', 'lookdev'
    ]
    amination_attributes = ['min', 'max', 'latest_lookdev']
    puppet_contents = {}
    for puppet in puppets:
        py_node = core.PyNode(puppet)
        for each in amination_attributes:
            attribute = '%s.%s' % (py_node.name(), each)
            if core.objExists(attribute):
                core.deleteAttr(attribute)
            py_node.addAttr(each, dt='string')
        py_node.setAttr('min', str(min))
        py_node.setAttr('max', str(max))
        puppet_name = puppet.split(':')[0]
        for puppet_attribute in puppet_attributes:
            value = py_node.getAttr(puppet_attribute)
            name = puppet.split(':')[0]
            if puppet_name not in puppet_contents:
                puppet_contents.setdefault(puppet_name, {})
            puppet_contents[puppet_name].setdefault(puppet_attribute, value)
        category = py_node.getAttr('category')
        name = py_node.getAttr('name')
        model = py_node.getAttr('model')
        model_depnendency = get_lookdev_model_depnendency(category, name)
        latest_lookdev = 'None'
        if model_depnendency:
            if model_depnendency[model]:
                latest_lookdev = model_depnendency[model][0]
        py_node.setAttr('latest_lookdev', latest_lookdev)
        abc_path = os.path.join(dirname, '%s.abc' % puppet_name)
        ud_attrubutes = []
        for attrubute in py_node.listAttr(ud=True):
            ud_attrubutes.append(attrubute.attrName())
        asset_attributes = '-attr ' + ' -attr '.join(ud_attrubutes)
        command = '-frameRange %s %s %s -uvWrite -attrPrefix xgen -worldSpace -root %s -stripNamespaces -file %s ' % (
            min, max, asset_attributes, puppet, abc_path)
        py_node.select(r=True)
        core.AbcExport(j=command)
        print '\t', abc_path
    core.select(puppets, r=True)
    maya_path = os.path.join(dirname, '%s.ma' % shot)
    manifest_path = os.path.join(dirname, 'manifest.json')
    core.exportSelected(maya_path, preserveReferences=True, f=True)
    manifest_data = {
        'pipe': 'scene',
        'data': {
            'frame_range': [min, max],
            'sequence': sequence,
            'scene': scene,
            'puppets': puppet_contents,
            'version': version
        }
    }
    with open(manifest_path, 'w') as manifest:
        manifest.write(json.dumps(manifest_data, indent=4))
    os.system('xdg-open \"%s\"' % dirname)
    print '\t', manifest_path
    print '\t', maya_path