Пример #1
0
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """

        items = []
        # get the main scene:
        scene_name = cmds.file(query=True, sn=True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")
        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)
        # create the primary item - this will match the primary output 'scene_item_type':
        items.append({"type": "work_file", "name": name})

        ### CLEANUP ################################################################################
        ### NOW DO SCENE CRITICAL CHECKS LIKE DUPLICATE OBJECT NAMES ETC AND FAIL HARD IF THESE FAIL!
        ############################################################################################
        #############################
        ## INITAL HARD FAILS
        ## Do a quick check for geo_hrc and rig_hrc
        ## geo_hrc
        ##  if not cmds.objExists('geo_hrc'):
        ##     raise TankError("Please Group all your geo under a geo_hrc group under the root node.")
        ## rig_hrc
        ## UNCOMMENT FOR MDL STEP
        ##  if cleanup.rigGroupCheck():
        ##      raise TankError('Rig group found!! Please use the RIG menus to publish rigs...')
        ## UNCOMMENT FOR RIG STEP
        #  if not cleanup.rigGroupCheck():
        #      raise TankError('No rig group found!! Please make sure your animation controls are under rig_hrc.')
        ## Now check it's the right KIND of asset eg CHAR or PROP
        #cleanup.assetCheckAndTag(type = 'LIB', customTag = 'staticLIB')

        #############################
        ## SECONDARIES FOR PUBLISHING
        ## WE NEED TO FIND THE MAIN GROUP THAT HAS MESHES IN IT NOW AND PUSH THIS INTO THE ITEMS LIST FOR SECONDARY PUBLISHING
        ## Look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies=True, long=True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
                ### UNCOMMENT FOR PROP CHAR LND ASSETS
                items.append({"type": "mesh_group", "name": grp})
        ### UNCOMMENT FOR BLD MLD STEP
        #          if cleanup.BLDTransformCheck(grp): ## Check for BLD step only to make sure the transforms are not frozen on the BLD grps
        #              items.append({"type":"mesh_group", "name":grp})
        #              cleanup.assetCheckAndTag(type = 'BLD', customTag = 'staticBLD')

        #############################
        ## HARD FAILS
        ## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError(
                "Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set."
            )
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError(
                "Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set."
            )
        #############################
        ## NOW PREP THE GEO FOR EXPORT!!!
        ## THESE CLEANUPS SHOULD NOT FAIL THEY SHOULD JUST BE PERFORMED
        ## UNCOMMENT FOR MDL STEP
        ## PEFORM MDL CLEANUP
        cleanup.cleanUp(items=items,
                        checkShapes=True,
                        history=True,
                        pivots=True,
                        freezeXFRM=True,
                        smoothLvl=True,
                        tagSmoothed=True,
                        checkVerts=True,
                        renderflags=True,
                        deleteIntermediate=True,
                        turnOffOpposite=True,
                        instanceCheck=True,
                        shaders=False)
        ## UNCOMMENT FOR RIG STEP
        ## PEFORM RIG CLEANUP
        #  cleanup.cleanUp(items = items, checkShapes = False, history = False, pivots = False, freezeXFRM = False, smoothLvl = True, tagSmoothed = True, checkVerts = False,
        #                  renderflags = True, deleteIntermediate = False, turnOffOpposite = True, instanceCheck = False, shaders = True)
        ############################################################################################
        ## NOW MOVE ON TO PUBLISHING Pop out the last item in the list as we are not dealing with secondaries for this step
        items.pop()
        return items
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """   
                
        items = []
        # get the main scene:
        scene_name = cmds.file(query=True, sn= True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")
        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)
        # create the primary item - this will match the primary output 'scene_item_type':            
        items.append({"type": "work_file", "name": name})

        ### CLEANUP ################################################################################
        ### NOW DO SCENE CRITICAL CHECKS LIKE DUPLICATE OBJECT NAMES ETC AND FAIL HARD IF THESE FAIL!
        ############################################################################################
        #############################
        ## INITAL HARD FAILS
        ## Do a quick check for geo_hrc and rig_hrc
        ## geo_hrc
        if not cmds.objExists('geo_hrc'):
            raise TankError("Please Group all your geo under a geo_hrc group under the root node.")
        ## rig_hrc
        ## UNCOMMENT FOR MDL STEP
        if cleanup.rigGroupCheck():
            raise TankError('Rig group found!! Please use the RIG menus to publish rigs...')
        ## UNCOMMENT FOR RIG STEP
        #  if not cleanup.rigGroupCheck():
        #      raise TankError('No rig group found!! Please make sure your animation controls are under rig_hrc.')
        ## Now check it's the right KIND of asset eg CHAR or PROP
        cleanup.assetCheckAndTag(type = 'LIB', customTag = 'staticLIB')
        
        #############################
        ## SECONDARIES FOR PUBLISHING
        ## WE NEED TO FIND THE MAIN GROUP THAT HAS MESHES IN IT NOW AND PUSH THIS INTO THE ITEMS LIST FOR SECONDARY PUBLISHING
        ## Look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies = True, long = True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
        ### UNCOMMENT FOR PROP CHAR LND ASSETS
                items.append({"type":"mesh_group", "name":grp})                                  
        ### UNCOMMENT FOR BLD MLD STEP
        #          if cleanup.BLDTransformCheck(grp): ## Check for BLD step only to make sure the transforms are not frozen on the BLD grps
        #              items.append({"type":"mesh_group", "name":grp})
            if cmds.objExists('dgSHD'):
                  cleanup.tag_SHD_LIB_Geo()
        
        #############################
        ## HARD FAILS
        ## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError("Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set.")
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError("Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set.")
        #############################        
        ## NOW PREP THE GEO FOR EXPORT!!!
        ## THESE CLEANUPS SHOULD NOT FAIL THEY SHOULD JUST BE PERFORMED
        ## UNCOMMENT FOR MDL STEP
        ## PEFORM MDL CLEANUP
        cleanup.cleanUp(items = items, checkShapes = True, history = True, pivots = True, freezeXFRM = True, smoothLvl = True, tagSmoothed = True, checkVerts = True, 
                        renderflags = True, deleteIntermediate = True, turnOffOpposite = True, instanceCheck = True, shaders = True)
        ## UNCOMMENT FOR RIG STEP
        ## PEFORM RIG CLEANUP
        #  cleanup.cleanUp(items = items, checkShapes = False, history = False, pivots = False, freezeXFRM = False, smoothLvl = True, tagSmoothed = True, checkVerts = False, 
        #                  renderflags = True, deleteIntermediate = False, turnOffOpposite = True, instanceCheck = False, shaders = True)
        ############################################################################################   
        ## NOW MOVE ON TO PUBLISHING Pop out the last item in the list as we are not dealing with secondaries for this step
        items.pop()
        return items
Пример #3
0
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """

        items = []
        errors = False
        errorList = []
        # get the main scene:
        scene_name = cmds.file(query=True, sn=True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")

        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)

        # create the primary item - this will match the primary output 'scene_item_type':
        items.append({"type": "work_file", "name": name})

        if not cmds.objExists('NurbsHullRight'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE IS MISSING THE NURBS HULLS!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: NurbsHullRight')

        if not cmds.objExists('NurbsHullLeft'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE IS MISSING THE NURBS HULLS!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: NurbsHullRight')

        if not cmds.objExists('blendshapes_hrc'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE HAS NO BLENDSHAPES IN IT!!!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: blendshapes_hrc')

        ### CLEANUP ################################################################################
        ### NOW DO SCENE CRITICAL CHECKS LIKE DUPLICATE OBJECT NAMES ETC AND FAIL HARD IF THESE FAIL!
        ############################################################################################
        #############################
        ## INITAL HARD FAILS
        ## Do a quick check for geo_hrc and rig_hrc
        ## geo_hrc
        if not cmds.objExists('geo_hrc'):
            raise TankError(
                "Please Group all your geo under a geo_hrc group under the root node."
            )
        ## rig_hrc
## UNCOMMENT FOR MDL STEP
#         if cleanup.rigGroupCheck():
#             raise TankError('Rig group found!! Please use the RIG menus to publish rigs...')
## UNCOMMENT FOR RIG STEP
        if not cleanup.rigGroupCheck():
            raise TankError(
                'No rig group found!! Please make sure your animation controls are under rig_hrc.'
            )

        ## Now check it's the right KIND of asset eg CHAR or PROP
        cleanup.assetCheckAndTag(type='CHAR', customTag='animCHAR')

        #############################
        ## SECONDARIES FOR PUBLISHING
        ## WE NEED TO FIND THE MAIN GROUP THAT HAS MESHES IN IT NOW AND PUSH THIS INTO THE ITEMS LIST FOR SECONDARY PUBLISHING
        ## Look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies=True, long=True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
                ### UNCOMMENT FOR PROP CHAR LND ASSETS
                items.append({"type": "mesh_group", "name": grp})
### UNCOMMENT FOR BLD MLD STEP
#                 if cleanup.BLDTransformCheck(grp): ## Check for BLD step only to make sure the transforms are not frozen on the BLD grps
#                     items.append({"type":"mesh_group", "name":grp})
#                     cleanup.assetCheckAndTag(type = 'BLD', customTag = 'staticBLD')

#############################
## HARD FAILS
## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError(
                "Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set."
            )
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError(
                "Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set."
            )
        ## Incorrect root name
        if not utils.checkRoot_hrc_Naming(items):
            assetName = cmds.file(query=True, sn=True).split('/')[4]
            raise TankError(
                "YOUR ASSET IS NAMED INCORRECTLY! Remember it is CASE SENSITIVE!\nIt should be %s_hrc"
                % assetName)
        #############################
        ##RIG SPECIALS
        ## Set the smooth previews from MDL back on
        cleanup.setRiggedSmoothPreviews()
        ## NOW PREP THE GEO FOR EXPORT!!!
        ## THESE CLEANUPS SHOULD NOT FAIL THEY SHOULD JUST BE PERFORMED

        ## UNCOMMENT FOR MDL STEP
        ## PEFORM MDL CLEANUP
        #         cleanup.cleanUp(items = items, checkShapes = True, history = True, pivots = True, freezeXFRM = True, smoothLvl = True, tagSmoothed = True, checkVerts = True,
        #                         renderflags = True, deleteIntermediate = True, turnOffOpposite = True, instanceCheck = True)
        ## UNCOMMENT FOR RIG STEP
        ## PEFORM RIG CLEANUP
        cleanup.cleanUp(items=items,
                        checkShapes=False,
                        history=False,
                        pivots=False,
                        freezeXFRM=False,
                        smoothLvl=True,
                        tagSmoothed=True,
                        checkVerts=False,
                        renderflags=True,
                        deleteIntermediate=False,
                        turnOffOpposite=True,
                        instanceCheck=False)

        ## Check for artist shader assignments.
        ## If they have imported shaders don't clean up the downgraded shaders in the scene for exporting.
        ## NOTE THESE SHOULD BE THE DOWNGRADED SHADERS!!! NOT THE HIGH RES!!
        if not cmds.objExists('dgSHD'):
            cleanup.cleanUpShaders()
        else:
            try:
                cmds.delete(cmds.ls(type='core_material'))
                mel.eval("MLdeleteUnused();")
            except:
                pass
        ############################################################################################
        ## NOW MOVE ON TO PUBLISHING Pop out the last item in the list as we are not dealing with secondaries for this step
        if errors:
            cmds.headsUpMessage(
                "THIS RIG SCENE MAY HAVE ERRORS IN IT CHECK THE SCRIPT EDITOR FOR DETAILS NOW!!! %s"
                % errorList,
                time=30)
        items.pop()
        return items
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """

        items = []

        # get the main scene:
        scene_name = cmds.file(query=True, sn=True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")

        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)

        # create the primary item - this will match the primary output 'scene_item_type':
        items.append({"type": "work_file", "name": name})

        # look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies=True, long=True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
                if '_hrc' in grp and 'SRF' not in grp:  ###SRF is used for rebuilding of archives etc and sits outside the main asset Group
                    items.append({"type": "mesh_group", "name": grp})

        ## DO MAIN CHECKING NOW
        #############################
        ## HARD FAILS
        ## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError(
                "Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set."
            )
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError(
                "Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set."
            )
        #############################
        if shd.sceneCheck():  ## note this returns TRUE if there ARE errors
            raise TankError(
                "You have errors in your scene, please fix.. check the script editor for details."
            )

        cleanup.cleanUp(items=items,
                        checkShapes=True,
                        history=False,
                        pivots=False,
                        freezeXFRM=False,
                        smoothLvl=False,
                        tagSmoothed=False,
                        checkVerts=False,
                        renderflags=False,
                        deleteIntermediate=False,
                        turnOffOpposite=False,
                        instanceCheck=False,
                        shaders=False,
                        removeNS=False,
                        defaultRG=False,
                        lightingCleanup=True)

        ## CORES
        start = time.time()
        coreLib.cleanPaintedArchives()
        print 'Total time to %s: %s' % ('coreLib.cleanPaintedArchives()',
                                        time.time() - start)

        start = time.time()
        coreLib._tagDuplicateCoreArchives()
        print 'Total time to %s: %s' % ('coreLib._tagDuplicateCoreArchives()',
                                        time.time() - start)

        start = time.time()
        coreLib.prepArchivesForPublish()
        print 'Total time to %s: %s' % ('coreLib.prepArchivesForPublish()',
                                        time.time() - start)

        start = time.time()
        coreLib.deleteAllCores()
        print 'Total time to %s: %s' % ('coreLib.deleteAllCores()',
                                        time.time() - start)

        start = time.time()
        shd.deleteDeadFileInNodes()
        print 'Total time to %s: %s' % ('shd.deleteDeadFileInNodes()',
                                        time.time() - start)

        ## Fix pathing from work to publish for export
        start = time.time()
        shd.repathFileNodesForPublish()
        print 'Total time to %s: %s' % ('shd.repathFileNodesForPublish()',
                                        time.time() - start)

        ## Now do the smartConn
        start = time.time()
        shd.smartConn()
        print 'Total time to %s: %s' % ('shd.smartConn()', time.time() - start)

        ## Fix remap and ramps color entry plugs and any incorrect ordering
        ## Leads to bad plugs being inserted when the XML recreates all the values. Querying also creates which makes black colour entry plugs.
        start = time.time()
        shd.fixRamps(cmds.ls(type='remapValue'))
        shd.fixRamps(cmds.ls(type='ramp'))
        print 'Total time to %s: %s' % ('shd.fixRamps()', time.time() - start)

        ## Removed duplicate dgSHD nodes...
        shd.deleteDGSHD()

        ## Delete empty UV Sets
        start = time.time()
        cleanup.deleteEmptyUVSets()
        print 'Total time to %s: %s' % ('cleanup.deleteEmptyUVSets()',
                                        time.time() - start)
        ## NOW MOVE ON TO PUBLISHING
        return items
Пример #5
0
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """   
                
        items = []
        
        # get the main scene:
        scene_name = cmds.file(query=True, sn= True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")
      
        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)

        # create the primary item - this will match the primary output 'scene_item_type':            
        items.append({"type": "work_file", "name": name})
      
        ## DO MAIN CHECKING NOW
        #############################
        ## HARD FAILS
        ## Duplicate name check
        ## geo_hrc
        if not cmds.objExists('geo_hrc'):
             raise TankError("Please Group all your geo under a geo_hrc group under the root node.")
        # rig_hrc
        # UNCOMMENT FOR MDL STEP
        if cleanup.rigGroupCheck():
            raise TankError('Rig group found!! Please use the RIG menus to publish rigs...')
        # UNCOMMENT FOR RIG STEP
        #  if not cleanup.rigGroupCheck():
        #      raise TankError('No rig group found!! Please make sure your animation controls are under rig_hrc.')
        
        ## Now check it's the right KIND of asset eg CHAR or PROP
        #cleanup.assetCheckAndTag(type = 'LIB', customTag = 'staticLIB')
        
        #############################
        ## SECONDARIES FOR PUBLISHING
        ## WE NEED TO FIND THE MAIN GROUP THAT HAS MESHES IN IT NOW AND PUSH THIS INTO THE ITEMS LIST FOR SECONDARY PUBLISHING
        ## Look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies = True, long = True):
            if cmds.ls(grp, dag=True, type="mesh"):
        ### UNCOMMENT FOR PROP CHAR LND ASSETS
        # include this group as a 'mesh_group' type
                if '_hrc' in grp and 'SRF' not in grp:
                    items.append({"type":"mesh_group", "name":grp})                                  
        ### UNCOMMENT FOR BLD MLD STEP
        #          if cleanup.BLDTransformCheck(grp): ## Check for BLD step only to make sure the transforms are not frozen on the BLD grps
        #              items.append({"type":"mesh_group", "name":grp})
        #              cleanup.assetCheckAndTag(type = 'BLD', customTag = 'staticBLD')
        if not cleanup.duplicateNameCheck():
            raise TankError("Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set.")
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError("Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set.")
        #############################
        if shd.sceneCheck():
            raise TankError("You have errors in your scene, please fix.. check the script editor for details.")

        cleanup.cleanUp(items = items, checkShapes = True, history = False, pivots = False, freezeXFRM = False, smoothLvl = False, tagSmoothed = False, checkVerts = False, 
        renderflags = False, deleteIntermediate = False, turnOffOpposite = False, instanceCheck = False, shaders = False, removeNS = False)

        mel.eval("MLdeleteUnused();")

        ## Fix pathing from work to publish for export
        shd.repathFileNodesForPublish()
        
        ## Now do the smartConn
        shd.smartConn()
        
        ## Fix remap and ramps color entry plugs and any incorrect ordering
        ## Leads to bad plugs being inserted when the XML recreates all the values. Querying also creates which makes black colour entry plugs.
        shd.fixRamps(cmds.ls(type = 'remapValue'))
        shd.fixRamps(cmds.ls(type = 'ramp'))
        
        ## NOW MOVE ON TO PUBLISHING
        return items
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """   
                
        items = []
        
        # get the main scene:
        scene_name = cmds.file(query=True, sn= True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")
      
        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)

        # create the primary item - this will match the primary output 'scene_item_type':            
        items.append({"type": "work_file", "name": name})
      
        # look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies=True, long= True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
                if '_hrc' in grp and 'SRF' not in grp:###SRF is used for rebuilding of archives etc and sits outside the main asset Group
                    items.append({"type":"mesh_group", "name":grp})
                    

        ## DO MAIN CHECKING NOW
        #############################
        ## HARD FAILS
        ## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError("Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set.")
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError("Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set.")
        #############################
        if shd.sceneCheck():## note this returns TRUE if there ARE errors
            raise TankError("You have errors in your scene, please fix.. check the script editor for details.")

        cleanup.cleanUp(items = items, checkShapes = True, history = False, pivots = False, freezeXFRM = False, smoothLvl = False, tagSmoothed = False, checkVerts = False, 
        renderflags = False, deleteIntermediate = False, turnOffOpposite = False, instanceCheck = False, shaders = False, removeNS = False, defaultRG = False, lightingCleanup = True)

        ## CORES
        start = time.time()
        coreLib.cleanPaintedArchives()
        print 'Total time to %s: %s' % ('coreLib.cleanPaintedArchives()', time.time()-start)
        
        start = time.time()
        coreLib._tagDuplicateCoreArchives()
        print 'Total time to %s: %s' % ('coreLib._tagDuplicateCoreArchives()', time.time()-start)
        
        start = time.time()
        coreLib.prepArchivesForPublish()
        print 'Total time to %s: %s' % ('coreLib.prepArchivesForPublish()', time.time()-start)
        
        start = time.time()
        coreLib.deleteAllCores()
        print 'Total time to %s: %s' % ('coreLib.deleteAllCores()', time.time()-start)

        start = time.time()
        shd.deleteDeadFileInNodes()
        print 'Total time to %s: %s' % ('shd.deleteDeadFileInNodes()', time.time()-start)

        ## Fix pathing from work to publish for export
        start = time.time()
        shd.repathFileNodesForPublish()
        print 'Total time to %s: %s' % ('shd.repathFileNodesForPublish()', time.time()-start)
        
        ## Now do the smartConn
        start = time.time()
        shd.smartConn()
        print 'Total time to %s: %s' % ('shd.smartConn()', time.time()-start)
        
        ## Fix remap and ramps color entry plugs and any incorrect ordering
        ## Leads to bad plugs being inserted when the XML recreates all the values. Querying also creates which makes black colour entry plugs.
        start = time.time()
        shd.fixRamps(cmds.ls(type = 'remapValue'))
        shd.fixRamps(cmds.ls(type = 'ramp'))
        print 'Total time to %s: %s' % ('shd.fixRamps()', time.time()-start)

        ## Removed duplicate dgSHD nodes...
        shd.deleteDGSHD()

        ## Delete empty UV Sets
        start = time.time()
        cleanup.deleteEmptyUVSets()
        print 'Total time to %s: %s' % ('cleanup.deleteEmptyUVSets()', time.time() - start)
        ## NOW MOVE ON TO PUBLISHING
        return items    
    def execute(self, **kwargs):
        """
        Main hook entry point
        :returns:       A list of any items that were found to be published.  
                        Each item in the list should be a dictionary containing 
                        the following keys:
                        {
                            type:   String
                                    This should match a scene_item_type defined in
                                    one of the outputs in the configuration and is 
                                    used to determine the outputs that should be 
                                    published for the item
                                    
                            name:   String
                                    Name to use for the item in the UI
                            
                            description:    String
                                            Description of the item to use in the UI
                                            
                            selected:       Bool
                                            Initial selected state of item in the UI.  
                                            Items are selected by default.
                                            
                            required:       Bool
                                            Required state of item in the UI.  If True then
                                            item will not be deselectable.  Items are not
                                            required by default.
                                            
                            other_params:   Dictionary
                                            Optional dictionary that will be passed to the
                                            pre-publish and publish hooks
                        }
        """   
                
        items = []
        errors = False
        errorList = []
        # get the main scene:
        scene_name = cmds.file(query=True, sn= True)
        if not scene_name:
            raise TankError("Please Save your file before Publishing")
      
        scene_path = os.path.abspath(scene_name)
        name = os.path.basename(scene_path)

        # create the primary item - this will match the primary output 'scene_item_type':            
        items.append({"type": "work_file", "name": name})
        
        if not cmds.objExists('NurbsHullRight'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE IS MISSING THE NURBS HULLS!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: NurbsHullRight')

        if not cmds.objExists('NurbsHullLeft'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE IS MISSING THE NURBS HULLS!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: NurbsHullRight')

        if not cmds.objExists('blendshapes_hrc'):
            cmds.warning("===================ERROR FOUND===============")
            cmds.warning("YOUR SCENE HAS NO BLENDSHAPES IN IT!!!!")
            cmds.warning("=============================================")
            errors = True
            errorList.append('MISSING: blendshapes_hrc')
            
        ### CLEANUP ################################################################################
        ### NOW DO SCENE CRITICAL CHECKS LIKE DUPLICATE OBJECT NAMES ETC AND FAIL HARD IF THESE FAIL!
        ############################################################################################
        #############################
        ## INITAL HARD FAILS
        ## Do a quick check for geo_hrc and rig_hrc
        ## geo_hrc
        if not cmds.objExists('geo_hrc'):
            raise TankError("Please Group all your geo under a geo_hrc group under the root node.")
        ## rig_hrc
## UNCOMMENT FOR MDL STEP
#         if cleanup.rigGroupCheck():
#             raise TankError('Rig group found!! Please use the RIG menus to publish rigs...')
## UNCOMMENT FOR RIG STEP
        if not cleanup.rigGroupCheck():
            raise TankError('No rig group found!! Please make sure your animation controls are under rig_hrc.')

        ## Now check it's the right KIND of asset eg CHAR or PROP
        cleanup.assetCheckAndTag(type = 'CHAR', customTag = 'animCHAR')
        
        #############################
        ## SECONDARIES FOR PUBLISHING
        ## WE NEED TO FIND THE MAIN GROUP THAT HAS MESHES IN IT NOW AND PUSH THIS INTO THE ITEMS LIST FOR SECONDARY PUBLISHING
        ## Look for root level groups that have meshes as children:
        for grp in cmds.ls(assemblies = True, long = True):
            if cmds.ls(grp, dag=True, type="mesh"):
                # include this group as a 'mesh_group' type
### UNCOMMENT FOR PROP CHAR LND ASSETS
                items.append({"type":"mesh_group", "name":grp})                                  
### UNCOMMENT FOR BLD MLD STEP
#                 if cleanup.BLDTransformCheck(grp): ## Check for BLD step only to make sure the transforms are not frozen on the BLD grps
#                     items.append({"type":"mesh_group", "name":grp})
#                     cleanup.assetCheckAndTag(type = 'BLD', customTag = 'staticBLD')
        
        #############################
        ## HARD FAILS
        ## Duplicate name check
        if not cleanup.duplicateNameCheck():
            raise TankError("Duplicate names found please fix before publishing.\nCheck the outliner for the duplicate name set.")
        ## Incorrect Suffix check
        checkSceneGeo = cleanup._geoSuffixCheck(items)
        if not checkSceneGeo:
            raise TankError("Incorrect Suffixes found! Fix suffixes before publishing.\nCheck the outliner for the duplicate name set.")
        ## Incorrect root name
        if not utils.checkRoot_hrc_Naming(items):
            assetName = cmds.file(query=True, sn= True).split('/')[4]
            raise TankError("YOUR ASSET IS NAMED INCORRECTLY! Remember it is CASE SENSITIVE!\nIt should be %s_hrc" % assetName)
        #############################
        ##RIG SPECIALS
        ## Set the smooth previews from MDL back on
        cleanup.setRiggedSmoothPreviews()
        ## NOW PREP THE GEO FOR EXPORT!!!
        ## THESE CLEANUPS SHOULD NOT FAIL THEY SHOULD JUST BE PERFORMED
        
## UNCOMMENT FOR MDL STEP
        ## PEFORM MDL CLEANUP
#         cleanup.cleanUp(items = items, checkShapes = True, history = True, pivots = True, freezeXFRM = True, smoothLvl = True, tagSmoothed = True, checkVerts = True, 
#                         renderflags = True, deleteIntermediate = True, turnOffOpposite = True, instanceCheck = True)
## UNCOMMENT FOR RIG STEP
        ## PEFORM RIG CLEANUP
        cleanup.cleanUp(items = items, checkShapes = False, history = False, pivots = False, freezeXFRM = False, smoothLvl = True, tagSmoothed = True, checkVerts = False, 
                        renderflags = True, deleteIntermediate = False, turnOffOpposite = True, instanceCheck = False)
        
        
        ## Check for artist shader assignments.
        ## If they have imported shaders don't clean up the downgraded shaders in the scene for exporting.
        ## NOTE THESE SHOULD BE THE DOWNGRADED SHADERS!!! NOT THE HIGH RES!!
        if not cmds.objExists('dgSHD'):
            cleanup.cleanUpShaders()
        else:
            try:
                cmds.delete(cmds.ls(type = 'core_material'))
                mel.eval("MLdeleteUnused();")
            except:
                pass
        ############################################################################################   
        ## NOW MOVE ON TO PUBLISHING Pop out the last item in the list as we are not dealing with secondaries for this step
        if errors:
            cmds.headsUpMessage("THIS RIG SCENE MAY HAVE ERRORS IN IT CHECK THE SCRIPT EDITOR FOR DETAILS NOW!!! %s" % errorList, time = 30)
        items.pop()
        return items