Пример #1
0
def create_playblast(asset):

    # First read the project dictionnary
    project_dic = project.read_project()

    # Check if category, name, stage and variant exists
    if checker.check_category_existence(asset) and \
            checker.check_name_existence(asset) and \
            checker.check_stage_existence(asset) and \
            checker.check_variant_existence(asset):

        # Get the playblast folder path
        path = folder(asset).playblast()

        # Create the folder tree if it doesn't exists
        if not os.path.isdir(path):
            os.makedirs(path)

            # Log it to the user
            logger.debug('Playblast folder created')

        # Init the asset software prefs using the wizard "prefs" module
        prefs.asset(asset).playblast.write()

        # Return the path
        return path
Пример #2
0
def create_export(asset, version = None):

    # First read the project dictionnary
    project_dic = project.read_project()

    # Check if category, name, stage and variant exists
    if checker.check_category_existence(asset) and \
            checker.check_name_existence(asset) and \
            checker.check_stage_existence(asset) and \
            checker.check_variant_existence(asset):

        # Create the folder tree and get the path
        path = create_export_folder(asset, version)

        # Init the asset software prefs
        # Use the wizard "prefs" module
        if version:
            asset.export_version = version
        prefs.asset(asset).export.write()

        # If a version was specified, add it to the prefs file
        if version:
            prefs.asset(asset).export.new_version(version)

        # Log the success to user
        # And return the folder path
        logger.debug('Export folder created')
        return path
Пример #3
0
def create_export_root(asset):

    # First read the project dictionnary
    project_dic = project.read_project()

    print('current_task:Creating export_root folder')
    print('percent:78')
    sys.stdout.flush()


    # Check if category, name, stage and variant exists
    if checker.check_category_existence(asset) and \
            checker.check_name_existence(asset) and \
            checker.check_stage_existence(asset) and \
            checker.check_variant_existence(asset):

        # Create the folder tree and return the path
        path = create_export_root_folder(asset)

        # Create the prefs file with the wizard "prefs" module
        prefs.asset(asset).export_root.write()

        # Log the success to user
        # And return the path
        logger.debug('Export root folder created')
        print('current_task:export_root folder created')
        print('percent:80')
        sys.stdout.flush()
        return path
Пример #4
0
 def get_grooming_asset(self):
     self.grooming_asset = copy.deepcopy(self.rig_asset)
     self.grooming_asset.stage = defaults._hair_
     presence = None
     if checker.check_stage_existence(self.grooming_asset):
         self.grooming_asset.variant = self.rig_asset.variant
         if not checker.check_variant_existence(self.grooming_asset):
             self.grooming_asset.variant = prefs().asset(
                 self.grooming_asset).stage.default_variant
         if checker.check_variant_existence(self.grooming_asset):
             self.grooming_asset.export_asset = prefs().asset(
                 self.grooming_asset).export_root.default_export_asset
             if self.grooming_asset.export_asset:
                 self.grooming_asset.export_version = prefs().asset(
                     self.grooming_asset).export.last_version
                 presence = 1
     return presence
Пример #5
0
def create_softwares(asset):
    print('current_task:Creating software')
    print('percent:0')
    sys.stdout.flush()

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

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

    # Check if category, name, stage and variant exists
    if checker.check_category_existence(asset) and \
            checker.check_name_existence(asset) and \
            checker.check_stage_existence(asset) and \
            checker.check_variant_existence(asset):

        percent_step = 33/len(prefs.asset(asset).stage.softwares)
        percent = 33
        # Loop, add every softwares of the concerned stage
        for software in prefs.asset(asset).stage.softwares:

            # Assign the software from the loop to the "asset" object
            asset.software = software

            # Check if this software doesn't already exists
            if not checker.check_software_existence(asset):

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

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

                percent+=percent_step

                print('current_task:Creating {} folders'.format(software))
                print('percent:{}'.format(int(percent)))
                sys.stdout.flush()


                # Build the folders
                create_software_folder(asset)

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

                # Log the success to user
                logger.debug('Software {} added to asset.wd'.format(software))
Пример #6
0
    def export_shapes(self):

        cmds.select(self.shapes_list, replace = 1)
        export_variant = '{}_{}_{}'.format(self.rig_asset.name, self.rig_asset.variant, self.count)

        from_asset = copy.deepcopy(self.asset)

        if self.camera and self.asset.domain == defaults._sequences_:
            self.asset.stage = defaults._camera_
            software = self.asset.software
            self.asset.variant = prefs.asset(self.asset).stage.default_variant
            if not checker.check_stage_existence(self.asset):
                builder.create_stage(self.asset)
            if not checker.check_variant_existence(self.asset):
                builder.create_variant(self.asset)
                self.asset.software = software

        export_file = self.asset.export(export_variant, self.comment, from_asset=from_asset)

        self.export_abc(export_file, self.shapes_list)
Пример #7
0
    def create_new_scene(self):
        stage_exists = 0
        variant_exists = 0
        self.cfx_asset = copy.deepcopy(self.asset)
        self.cfx_asset.stage = defaults._cfx_
        self.cfx_asset.variant = 'auto_hair'
        if not checker.check_stage_existence(self.cfx_asset):
            self.cfx_asset.variant = None
            self.cfx_asset.software = None
            self.cfx_asset.version = None
            self.cfx_asset.export_asset = None
            self.cfx_asset.export_version = None
            if self.cfx_asset.create():
                stage_exists = 1
        else:
            stage_exists = 1

        self.cfx_asset.variant = 'auto_hair'
        if not checker.check_variant_existence(self.cfx_asset):
            logger.info('LOL')
            self.cfx_asset.software = None
            self.cfx_asset.version = None
            self.cfx_asset.export_asset = None
            self.cfx_asset.export_version = None
            if self.cfx_asset.create():
                variant_exists = 1
        else:
            variant_exists = 1

        if variant_exists and stage_exists:
            prefs().asset(
                self.cfx_asset).stage.set_default_variant('auto_hair')
            self.cfx_asset.software = prefs().asset(
                self.cfx_asset).variant.default_software
            self.cfx_asset.version = prefs().asset(
                self.cfx_asset).software.get_new_version()
            prefs().asset(self.cfx_asset).software.new_version(
                self.cfx_asset.version)
            self.cfx_scene = self.cfx_asset.file
        return (variant_exists * stage_exists)
Пример #8
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