def rtb_remove(highresListDropdown, *args, **kwargs):
    ''' remove item from the list and delete live-mesh and groups '''
    global defaultString
    high = highresListDropdown.getValue()

    if not high == defaultString:
        high = pm.PyNode(high.split("'")[0])  #get rid of unicode crap
        high.rename(high.rstrip('_high'))
        pm.parent(high, world=True)

        high.setScale([1, 1, 1])
        pm.disconnectAttr('persp.translate', high.scalePivot)

        if pm.displaySurface(high, query=True, xRay=True)[0] == True:
            pm.displaySurface(high, xRay=False)
        if not high.visibility.get():
            high.visibility.set(True)

        highShape = high.getShape()
        highShape.overrideDisplayType.set(0)  #sets to normal mode
        highShape.overrideEnabled.set(0)  #disable display overrides

        pm.delete(str(high) + '_RETOPO')

    rtb_highres_list_populate(highresListDropdown)
def rtb_remove(highresListDropdown, *args, **kwargs):
  ''' remove item from the list and delete live-mesh and groups '''
  global defaultString
  high = highresListDropdown.getValue()

  if not high == defaultString:
    high = pm.PyNode(high.split("'")[0]) #get rid of unicode crap
    high.rename(high.rstrip('_high'))
    pm.parent(high, world=True)

    high.setScale([1,1,1])
    pm.disconnectAttr('persp.translate', high.scalePivot)

    if pm.displaySurface(high, query=True, xRay=True)[0] == True:
      pm.displaySurface(high, xRay=False)
    if not high.visibility.get():
      high.visibility.set(True)

    highShape = high.getShape()
    highShape.overrideDisplayType.set(0) #sets to normal mode
    highShape.overrideEnabled.set(0) #disable display overrides

    pm.delete(str(high)+'_RETOPO')

  rtb_highres_list_populate(highresListDropdown)
def rtb_remove(highresListDropdown, *args, **kwargs):
    ''' remove item from the list and delete live-mesh and groups '''
    global defaultString
    global lct_cfg

    high = highresListDropdown.getValue()

    # restore interface selections
    highresListDropdown.setSelect(1)
    rtb_choose_active(highresListDropdown)

    if not high == defaultString:
        high = pm.PyNode(high.split("'")[0])  # get rid of unicode crap
        high.rename(re.sub(r'\_high$', '', str(high)))
        pm.parent(high, world=True)

        high.setScale([1, 1, 1])
        pm.disconnectAttr('persp.translate', high.scalePivot)

        if pm.displaySurface(high, query=True, xRay=True)[0] == True:
            pm.displaySurface(high, xRay=False)
        if not high.visibility.get():
            high.visibility.set(True)

        highShape = high.getShape()
        highShape.overrideDisplayType.set(0)  # sets to normal mode
        highShape.overrideEnabled.set(0)  # disable display overrides

        pm.delete(str(high) + '_RETOPO')

    rtb_highres_list_populate(highresListDropdown)

    lct_cfg.set('lcRetopoBasicListItem', highresListDropdown.getSelect())
    pm.select(clear=True)
def rtb_toggle_xray(highresListDropdown, *args, **kwargs):
  ''' '''
  global defaultString
  high = highresListDropdown.getValue()

  if not high == defaultString:
    if pm.displaySurface(high, query=True, xRay=True)[0] == True:
      pm.displaySurface(high, xRay=False)
    else:
      pm.displaySurface(high, xRay=True)
  else:
    pm.warning('Select a mesh from the dropdown list')
def rtb_toggle_xray(highresListDropdown, *args, **kwargs):
    ''' '''
    global defaultString
    high = highresListDropdown.getValue()

    if not high == defaultString:
        if pm.displaySurface(high, query=True, xRay=True)[0] == True:
            pm.displaySurface(high, xRay=False)
        else:
            pm.displaySurface(high, xRay=True)
    else:
        pm.warning('Select a mesh from the dropdown list')
def toggle_mesh_xray():
    objects = pm.ls(sl=True) or []

    # If users select the mesh, will turn on the mesh display X-Ray ;
    # If the mesh display X-Ray is already on, will turn off the mesh display X-Ray.
    children_transform = []
    if objects:
        for obj in objects:
            # If your selection has the child
            # pm.displaySurface query will pop out # Error : Can not query culling on multiple objects!
            # The following steps will take out the selection's children
            children = pm.listRelatives(obj, children=True) or []
            if children:
                for child in children:
                    objType = pm.objectType(child)
                    if objType == 'transform':
                        pm.parent(child, w=True)
                        children_transform.append(child)
                        pm.select(cl=True)

            # Toggle mesh display X-Ray
            pm.displaySurface(
                obj,
                xRay=(not pm.displaySurface(obj, xRay=True, query=True)[0]))

            # Parent the children back for the selection
            if children_transform:
                pm.parent(children_transform, obj)
                pm.select(cl=True)

    # If the user didn't select anything, the script will turn off all the mesh X-Ray display in your scene.
    else:
        # Get all the mesh shapes
        shapes = pm.ls(type="mesh")

        # Though the shape find its transform
        transforms = pm.listRelatives(shapes, parent=True)

        # Turn off the mesh X-Ray display
        pm.displaySurface(transforms, xRay=False)
def rtb_glow(highresListDropdown, *args, **kwargs):
    ''' highlight dropdown list red if nothing is selected '''
    global defaultString
    global lct_cfg

    rtb_update_high_res_shader(highresListDropdown)

    high = highresListDropdown.getValue()

    if high == defaultString:
        highresListDropdown.setBackgroundColor(colorWheel.darkgrey)
        pm.symbolButton(prefix + '_symbolButton_xray',
                        edit=True,
                        enableBackground=False,
                        bgc=colorWheel.maya)
        pm.symbolButton(prefix + '_symbolButton_hide',
                        edit=True,
                        enableBackground=False,
                        bgc=colorWheel.maya)
    else:
        highresListDropdown.setBackgroundColor(colorWheel.mayalight)

        high = pm.PyNode(high)
        vis = high.visibility.get()
        if not vis:
            pm.symbolButton(prefix + '_symbolButton_hide',
                            edit=True,
                            bgc=colorWheel.darkgrey)
        else:
            pm.symbolButton(prefix + '_symbolButton_hide',
                            edit=True,
                            enableBackground=False,
                            bgc=colorWheel.maya)
        xRay = pm.displaySurface(high, query=True, xRay=True)[0]
        if xRay:
            pm.symbolButton(prefix + '_symbolButton_xray',
                            edit=True,
                            bgc=colorWheel.darkgrey)
        else:
            pm.symbolButton(prefix + '_symbolButton_xray',
                            edit=True,
                            enableBackground=False,
                            bgc=colorWheel.maya)
def rtb_toggle_xray(highresListDropdown, mode='all', *args, **kwargs):
    ''' '''
    global defaultString
    global lct_cfg

    if mode == 'all':
        xRay = None

        listItems = highresListDropdown.getItemListLong()

        for item in listItems:
            high = pm.menuItem(item, query=True, l=True)
            if high != defaultString:
                if xRay == None:
                    xRay = pm.displaySurface(high, query=True, xRay=True)[0]
                pm.displaySurface(high, xRay=not xRay)
    else:
        high = highresListDropdown.getValue()
        if high != defaultString:
            high = pm.PyNode(high)
            xRay = pm.displaySurface(high, query=True, xRay=True)[0]
            pm.displaySurface(high, xRay=not xRay)

    rtb_glow(highresListDropdown)