示例#1
0
def get_current_project():
    logger = logging.getLogger(__name__)
    run_app = sys.executable
    current_project = None
    if run_app.endswith("maya.exe"):
        context = pipeFile.PathDetails.parse_path()
        if context:
            current_project = context.project
            logger.info("Get project from scene name.")
        else:
            from miraLibs.mayaLibs import get_maya_globals
            maya_globals = get_maya_globals.get_maya_globals()
            if maya_globals.exists("currentProject"):
                current_project = maya_globals.get("currentProject").get()
                logger.info("Get project from maya globals.")
    if not current_project:
        current_project = pipeHistory.get("currentProject")
        if current_project:
            logger.info("Get project from history.")
        else:
            current_project = pipeGlobal.current_project
            logger.info("Get project from configuration.")
    if current_project and current_project not in pipeGlobal.projects:
        current_project = pipeGlobal.current_project
        logger.info("Get project from configuration.")
    return current_project
示例#2
0
def set_duration(value):
    if not isinstance(value, int):
        logging.error("Duration must a type of int")
        return
    Settings.setValue("duration", value)
    maya_globals = get_maya_globals.get_maya_globals()
    timer = maya_globals.get("scene_break_down_timer")
    # set timer duration
    timer.stop()
    timer.duration = value
    timer.start()
示例#3
0
def set_duration(value):
    if not isinstance(value, int):
        logger.warning("duration must be a int number.")
        return
    Settings.setValue("duration", value)
    # get current timer obj
    maya_globals = get_maya_globals.get_maya_globals()
    timer = maya_globals.get("save_timer")
    # set timer duration
    timer.stop()
    timer.duration = value
    timer.start()
示例#4
0
def auto_tip_update():

    scene_break_down_timer = MayaTimer.MayaTimer()
    duration_value = Settings.value("duration")
    if not duration_value:
        Settings.setValue("duration", 20)
        duration_value = 20
    scene_break_down_timer.duration = duration_value

    def tip_update():
        if has_update():
            sbd = scene_break_down.SceneBreakDown(
                get_maya_win.get_maya_win("PySide"))
            sbd.close_signal.connect(scene_break_down_timer.restart)
            sbd.show()

    scene_break_down_timer.slot = tip_update
    maya_globals = get_maya_globals.get_maya_globals()
    maya_globals.add(scene_break_down_timer=scene_break_down_timer)
    scene_break_down_timer.start()
示例#5
0
def maya_save_timer():
    save_timer = MayaSaveTimer.MayaSaveTimer()
    maya_globals = get_maya_globals.get_maya_globals()
    maya_globals.add(save_timer=save_timer)

    # set default time
    duration_value = Settings.value("duration")
    if not duration_value:
        Settings.setValue("duration", 120)
        save_timer.duration = 120
    else:
        save_timer.duration = duration_value

    def _call_save_dialog():
        save_timer.stop()
        maya_ui = get_maya_win.get_maya_win("PySide")
        dlg = MainUI.MainUI(save_timer.duration, maya_ui)
        dlg.closed.connect(save_timer.start)
        dlg.show()

    save_timer.slot = _call_save_dialog
    save_timer.start()
示例#6
0
def add_project_to_maya_globals(project_object):
    maya_globals = get_maya_globals.get_maya_globals()
    if not maya_globals.exists("currentProject"):
        maya_globals.add(currentProject=project_object)
    else:
        maya_globals.update(currentProject=project_object)
示例#7
0
def get_hud_object():
    maya_globals = get_maya_globals.get_maya_globals()
    if "hud" not in maya_globals.keys():
        hud_obj = hu.HeadsUpDisplay()
        maya_globals.add(hud=hud_obj)
    return maya_globals.get("hud")