Ejemplo n.º 1
0
    def init_wall(self):
        if self.asset and self.asset.name:
            keys_list = prefs.asset(self.asset).events
            environment = f'{self.asset.domain} - {self.asset.category} - {self.asset.name}'
        elif self.user:
            keys_list = prefs.events
            environment = prefs.user
        else:
            keys_list = wall().get_all_keys()
            environment = prefs.project_name
        settings = wall().open_wall_file()
        keys_list = keys_list[-self.count:]

        if len(keys_list) >= 1:
            for key in keys_list:
                if key in settings.keys():
                    event = settings[key]
                    self.build_wall_event(event, 0, 0)
                else:
                    pass
Ejemplo n.º 2
0
def export_cyclo():
    if sanity(defaults._stage_export_grp_dic_[defaults._cyclo_]):

        save()

        for mesh in cmds.listRelatives(defaults._stage_export_grp_dic_[defaults._cyclo_], ad=1):
            cmds.select(clear=1)
            cmds.select(mesh)
            relatives = cmds.listRelatives(mesh)
            if relatives:
                if cmds.objectType(relatives[0]) == 'mesh':
                    auto_tag.tagGuerillaAuto()

        cmds.select(clear=1)
        cmds.select(defaults._stage_export_grp_dic_[defaults._cyclo_])

        asset = asset_core.string_to_asset(os.environ[defaults._asset_var_])
        file = asset.export('{}_{}'.format(asset.name, asset.variant), from_asset=asset)
        export_abc([0, 1], file, defaults._stage_export_grp_dic_[defaults._cyclo_])
        wall.wall().publish_event(asset)
Ejemplo n.º 3
0
def export_blend(grp):
    if bpy.data.collections.get(grp) is not None:
        asset = asset_core.string_to_asset(os.environ[defaults._asset_var_])
        file = asset.export(f'{asset.name}_{asset.variant}', from_asset=asset)

        if grp == defaults._stage_export_grp_dic_[defaults._rig_]:
            export_list = [grp, defaults._rig_export_set_]
        else:
            export_list = [grp]

        save()
        export_grp(export_list, file)
        # reload Blender file to retrieve collection hierarchy
        bpy.ops.wm.open_mainfile(filepath=asset.file)
        # send notif to wall
        wall().publish_event(asset)
        return file
    else:
        logger.warning(f'{grp} missing')
        return None
Ejemplo n.º 4
0
    def export(self, files_list=None):
        if not files_list:
            files_list = self.ui.manual_export_listView.all_items()

        if files_list != [] and files_list and len(files_list) == 1:

            export_file = self.asset.export('{}_{}'.format(
                self.asset.name, self.asset.variant))
            shutil.copyfile(files_list[0], export_file)
            wall.wall().publish_event(self.asset)
            self.accept()

        elif files_list != [] and files_list and len(files_list) > 1:

            export_files = self.asset.export_multiple(
                '{}_{}'.format(self.asset.name, self.asset.variant),
                files_list)
            exported_files_list = []

            for file in files_list:

                index = files_list.index(file)
                shutil.copyfile(file, export_files[index])
                exported_files_list.append(export_files[index])

            if self.asset.stage == defaults._texturing_:

                tex_creation = self.ui.create_tex_comboBox.currentText()

                if tex_creation != 'Nothing':

                    tx_from_files(exported_files_list, tex_creation)

            self.accept()

            wall.wall().publish_event(self.asset)

        else:
            logger.warning('No files to export...')
Ejemplo n.º 5
0
    def export_anim(self):

        percent_step = 100.0/len(self.nspace_list)
        percent = 0.0
        logging.info('status:Starting...')
        logging.info('percent:'+str(percent))
        file = None

        for nspace in self.nspace_list:

            logging.info('status:Working...')

            logging.info('current_task:Exporting {}'.format(nspace))
            cmds.file(self.file, o=True, f=True)

            if self.refresh_assets:
                reference_asset.refresh_all()

            percent += percent_step

            self.rig_asset = asset_core.string_to_asset(self.references_list[nspace][defaults._asset_key_])
            self.count = nspace.split('_')[-1]

            if self.camera:
                self.shapes_list = self.get_cam_shapes_from_namespace(nspace)
            else:
                self.shapes_list = self.get_shapes_from_namespace(nspace)
            logging.info(self.shapes_list)

            if self.shapes_list != []:
                self.export_shapes()

            logging.info('percent:'+str(percent))

        wall.wall().publish_event(self.asset)

        if self.set_done:
            logging.info('status:Done !')
Ejemplo n.º 6
0
def remove_name(asset):

    # Creates a new name with an "asset" object in arg
    # First read the project dictionnary
    project_dic = project.read_project()

    # Check if category exists
    # Check if name doesn't exists
    if checker.check_category_existence(asset) and \
            checker.check_name_existence(asset):

        # Add the name to the project dictionnary
        del project_dic \
            [asset.domain] \
            [asset.category] \
            [asset.name]

        # Write the project dictionnary to the tree.wd
        # Only if the folder suppression succeed
        if delete_folder(asset):
            project.write_project(project_dic)

            # Create the "wall" event using the wizard "wall" module
            wall().remove_event(asset)
            send_signal.refresh_signal()

            # Return the success to the user
            return 1

        else:

            # Return the fail
            return 0
    else:

        # Return the fail and log it to the user
        logger.warning('{} already exists'.format(asset.name))
        return 0
Ejemplo n.º 7
0
    def export_fur(self):

        percent_step = 100.0 / len(self.nspace_list)
        percent = 0.0
        print('status:Starting...')
        print('percent:' + str(percent))

        for nspace in self.nspace_list:

            print('status:Working...')

            print('current_task:Exporting {}'.format(nspace))
            cmds.file(self.file, o=True, f=True)

            if self.refresh_assets:
                reference_asset.refresh_all()

            self.fur_asset = asset_core.string_to_asset(
                self.references_list[nspace][defaults._asset_key_])
            self.count = nspace.split('_')[-1]

            self.yeti_nodes_list = self.get_yeti_nodes(nspace)

            if self.yeti_nodes_list != []:
                try:
                    self.export_yeti_nodes(len(self.nspace_list), percent)
                except:
                    print(str(traceback.format_exc()))

            percent += percent_step
            print('percent:' + str(percent))

        wall.wall().publish_event(self.asset)

        if self.set_done:
            print('status:Done !')
Ejemplo n.º 8
0
    def __init__(self, parent, asset=None, user=None):
        super(Main, self).__init__()
        # Build the ui from ui converted file
        self.ui = Ui_Form()
        self.ui.setupUi(self)

        self.asset = asset
        self.user = user
        self.parent = parent
        self.count = 20
        self.wall = wall()
        self.continuity = None
        self.previous_widget = None
        self.previous_event = None
        self.first_widget = None
        self.all_widgets = []
        self.creation_widgets = []
        self.publish_widgets = []
        self.remove_widgets = []
        self.new_widgets = []
        self.new_notif_widget = None
        self.init_wall()
        self.start_wall()
        self.connect_functions()
Ejemplo n.º 9
0
def export_template():
    asset = asset_core.string_to_asset(os.environ[defaults._asset_var_])
    file = asset.export('{}_{}'.format(asset.name, asset.variant))
    substance_painter.project.save_as_template(file, substance_painter.textureset.get_active_stack().material().name())
    wall.wall().publish_event(asset)
Ejemplo n.º 10
0
def export_vdb(batch=None, prepare=None, frange=None):
    asset = asset_core.string_to_asset(os.environ[defaults._asset_var_])

    if not batch:
        vdb_export_null = create_export_null_on_last_node('vdb')
    else:
        vdb_export_null = look_for_export_null('vdb')

    if vdb_export_null:

        wizard_exports_node = get_wizard_export_node()
        vdb_object_merge_node = create_node_without_duplicate(
            'object_merge', 'vdb_exports_object_merge', wizard_exports_node)

        vdb_object_merge_node.parm('objpath1').set(vdb_export_null.path())

        rop_geometry_node = create_node_without_duplicate(
            'rop_geometry', 'exports_vdb', wizard_exports_node)
        rop_geometry_node.setInput(0, vdb_object_merge_node)

        wizard_exports_node.layoutChildren()

        temp_dir = utils.temp_dir()
        export_path = os.path.join(temp_dir, "file.$F4.vdb")

        if batch:
            rop_geometry_node.parm('lpostframe').set("python")
            rop_geometry_node.parm('postframe').set(
                by_frame_script_to_file(80))

        rop_geometry_node.parm('sopoutput').set(export_path)
        rop_geometry_node.parm("trange").set('normal')

        if frange:
            hou.playbar.setFrameRange(frange[0], frange[1])

        rop_geometry_node.parm("f1").setExpression('$FSTART')
        rop_geometry_node.parm("f2").setExpression('$FEND')

        if not prepare:
            rop_geometry_node.parm("execute").pressButton()

            files_list = []

            for file in os.listdir(temp_dir):
                files_list.append(os.path.join(temp_dir, file))

            publish_files_name = asset.export_multiple(
                '{}_{}'.format(asset.name, asset.variant), files_list)

            if batch:
                print("current_task:copying output files")
                sys.stdout.flush()

            for file in files_list:
                shutil.copyfile(file,
                                publish_files_name[files_list.index(file)])

            wall.wall().publish_event(asset)

    else:
        logger.warning("No vdb out node")
Ejemplo n.º 11
0
def export_cyclo(asset):
    file = asset.export('{}_{}'.format(asset.name, asset.variant),
                        from_asset=asset)
    Document().save(file)
    save()
    wall.wall().publish_event(asset)
Ejemplo n.º 12
0
    def playblast(self, cam_namespace, ornaments, show_playblast):

        self.temp_directory = utils.temp_dir()

        if self.asset.software == defaults._maya_:
            pb_command = 'from softwares.maya_wizard.do_playblast import do_playblast\n'
            pb_command += 'do_playblast("{}", "{}", "{}", {}, {}).do_playblast("{}")'.format(
                self.string_asset, self.asset.file.replace('\\', '/'),
                self.temp_directory.replace('\\', '/'), self.frange,
                self.refresh_assets, cam_namespace)

            file = utils.temp_file_from_command(pb_command)
            print('status:Starting...')
            print('status:Working...')
            print('current_task:Playblasting...')
            sys.stdout.flush()
            mayapy = prefs.software(defaults._mayapy_).path
            env = software.get_env(defaults._mayapy_, 1)
            self.process = subprocess.Popen([mayapy, "-u", file], env=env)
            self.process.wait()

        elif self.asset.software == defaults._houdini_:
            pb_command = "from softwares.houdini_wizard import flipbook\n"
            pb_command += 'flipbook.do_flipbook("{}", "{}", {}, "{}", "{}", {})'.format(
                self.string_asset, cam_namespace, self.frange,
                self.temp_directory.replace('\\', '/'),
                self.asset.file.replace('\\', '/'), self.refresh_assets)

            file = utils.temp_file_from_command(pb_command)

            print('status:Starting...')
            print('status:Working...')
            print('current_task:Playblasting...')
            sys.stdout.flush()

            hython = prefs.software(defaults._hython_).path
            env = software.get_env(defaults._hython_, 1)
            self.process = subprocess.Popen([hython, "-u", file], env=env)
            self.process.wait()

        print('percent:33')

        print('current_task:Conforming frames...')
        sys.stdout.flush()

        focal_file = os.path.join(self.temp_directory, 'focal.txt')
        self.focal = 'none'
        if os.path.isfile(focal_file):
            with open(focal_file, 'r') as f:
                self.focal = f.readlines()[0]
            os.remove(focal_file)

        if ornaments:
            self.conform_playblast()

        print('percent:66')
        print('current_task:Creating movie file...')
        sys.stdout.flush()

        pbfile = self.create_video()
        wall().playblast_event(self.asset)

        print('percent:100')
        print('status:Done !')
        sys.stdout.flush()

        if show_playblast:
            os.startfile(pbfile)
Ejemplo n.º 13
0
def create_variant(asset):
    print('current_task:Creating {}'.format(asset.variant))
    print('percent:0')
    sys.stdout.flush()

    print('current_task:Updating project')
    print('percent:33')
    sys.stdout.flush()

    # Creates a new variant with an "asset" object in arg
    # First read the project dictionnary
    project_dic = project.read_project()

    # Check special characters
    if not util.check_illegal(asset.variant) or asset.variant == "None" or asset.variant == "none":

        # Return the fail and log the problem to the user
        logger.warning('{} contains illegal characters'.format(asset.variant))
        return 0

    else:
        # Check if category, name, stage exists
        # Check if variant doesn't exists
        if checker.check_category_existence(asset):
            if checker.check_name_existence(asset):
                if checker.check_stage_existence(asset):
                    if not checker.check_variant_existence(asset):

                        # Add the variant to the project dictionnary
                        project_dic[asset.domain] \
                            [asset.category] \
                            [asset.name] \
                            [asset.stage] \
                            [asset.variant] = {}

                        # Add an ID for the variant
                        id = nodes.asset_to_id(asset)
                        project_dic[asset.domain] \
                            [asset.category] \
                            [asset.name] \
                            [asset.stage] \
                            [asset.variant] \
                            [defaults._asset_id_key_] = id

                        # Write the project dictionnary to the tree.wd
                        project.write_project(project_dic)

                        print('current_task:Creating folders')
                        print('percent:66')
                        sys.stdout.flush()

                        # Build the folders
                        create_folders(asset)

                        # Init the asset variant prefs
                        prefs.asset(asset).variant.write()

                        # Add the variant to the stage prefs
                        prefs.asset(asset).stage.add_variant()

                        # Create the softwares prefs and folders, childs of variant
                        create_softwares(asset)
                        create_export_root(asset)
                        create_sandbox(asset)
                        create_playblast(asset)

                        # Log the success to user
                        logger.info('{} - {} - {} created'.format(asset.name,
                                                                  asset.stage,
                                                                  asset.variant))

                        print('current_task:Variant created')
                        print('percent:100')
                        sys.stdout.flush()

                        # Create the wall event with the "wall" wizard module
                        wall().create_event(asset)
                        send_signal.refresh_signal()
                        
                        # Return the success
                        return 1
                    else:

                        # Return the fail and log it to the user
                        logger.warning('{} - {} - {} already exists'.format(asset.name,
                                                                            asset.stage,
                                                                            asset.variant))
                        return 0
                else:
                    logger.warning("{} doesn't exists".format(asset.stage))
                    return 0
            else:
                logger.warning("{} doesn't exists".format(asset.name))
                return 0
        else:
            logger.warning("{} doesn't exists".format(asset.category))
            return 0
Ejemplo n.º 14
0
def create_category(asset):

    # Creates a new category with an "asset" object in arg
    # First read the project dictionnary
    project_dic = project.read_project()

    print('current_task:Creating category')
    print('percent:0')
    sys.stdout.flush()

    if not util.check_illegal(asset.category) or asset.category == "None" or asset.category == "none":

        # Return the fail and log the problem to the user
        logger.warning('{} contains illegal characters'.format(asset.category))
        return 0

    else:

        # Check if category doesn't exists
        # Using the wizard "checker" module

        print('current_task:Updating project')
        print('percent:33')
        sys.stdout.flush()

        if not checker.check_category_existence(asset):

            # Add the category to the project dictionnary
            project_dic \
                [asset.domain] \
                [asset.category] = {}

            # Write the project dictionnary to the tree.wd
            project.write_project(project_dic)

            print('current_task:Creating folders')
            print('percent:66')
            sys.stdout.flush()

            # Build the folders
            create_folders(asset)

            # Init the asset category prefs
            prefs.asset(asset).category.write()

            # Log the success to user
            logger.debug('Sequence {} added to asset.wd'.format(asset.category))
            logger.info('{} created'.format(asset.category))
            print('current_task:Category created')
            print('percent:100')
            sys.stdout.flush()

            # Emit the event with the "wall" module ( from wizard )
            wall().create_event(asset)
            send_signal.refresh_signal()
            
            # Return the success
            return 1
        else:

            # Return the fail and log it to the user
            logger.warning('{} already exists'.format(asset.category))
            return 0
Ejemplo n.º 15
0
def create_name(asset, in_out=None):

    print('current_task:Creating name')
    print('percent:0')
    sys.stdout.flush()

    print('current_task:Updating project')
    print('percent:33')
    sys.stdout.flush()

    # Creates a new name with an "asset" object in arg
    # First read the project dictionnary
    project_dic = project.read_project()
    
    # Check special characters
    if not util.check_illegal(asset.name) or asset.name == "None" or asset.name == "none":

        # Return the fail and log the problem to the user
        logger.warning('{} contains illegal characters'.format(asset.name))
        return 0

    else:

        # Check if category exists
        # Check if name doesn't exists
        if checker.check_category_existence(asset):
            if not checker.check_name_existence(asset):

                # Add the name to the project dictionnary
                project_dic \
                    [asset.domain] \
                    [asset.category] \
                    [asset.name] = {}

                # Write the project dictionnary to the tree.wd
                project.write_project(project_dic)

                print('current_task:Creating folders')
                print('percent:66')
                sys.stdout.flush()

                # Build the folders
                create_folders(asset)

                # Init the asset name prefs
                prefs.asset(asset).name.write(in_out)

                # Log the success to user
                logger.debug('Asset {} added to asset.wd'.format(asset.name))
                logger.info('{} created'.format(asset.name))

                print('current_task:Name created')
                print('percent:100')
                sys.stdout.flush()

                # Create the wall event
                wall().create_event(asset)
                send_signal.refresh_signal()

                # Return the success
                return 1
            else:

                # Return the fail and log it to the user
                logger.warning('{} already exists'.format(asset.name))
                return 0
        else:
            logger.warning("{} doesn't exists".format(asset.category))
            return 0
Ejemplo n.º 16
0
 def set_HD(self):
     init_scene.set_format()
     f_range = '{}-{}'.format(self.shot_range[0], self.shot_range[1])
     self.setup_export('HD', f_range)
     wall.wall().publish_event(self.asset)