def set(path): if not Project.is_project(path): Logger.error("Not a project: {0}".format(path)) return project_instance = Project(path) project_instance.update_meta() # Set enviroment variables and refresh HUD environFn.set_project_var(project_instance) Config.set(ProjectVars.previous_project, project_instance.path) project_instance.add_to_recent() LunaHud.refresh() return project_instance
def create(path): if Project.is_project(path): Logger.error("Already a project: {0}".format(path)) return new_project = Project(path) # Create missing meta and tag files fileFn.create_missing_dir(new_project.path) fileFn.create_file(path=new_project.tag_path) creation_date = datetime.now().strftime("%d/%m/%Y %H:%M:%S") new_project.meta_data = ("created", creation_date) # Set enviroment variables and refresh HUD environFn.set_project_var(new_project) Config.set(ProjectVars.previous_project, new_project.path) new_project.add_to_recent() LunaHud.refresh() return new_project
def addMenuItem(parent=None, label="", command=_null_command, icon="", divider=False, option_box=False, check_box=False, use_maya_icons=False, var_name=None, default_value=False): if icon and not use_maya_icons: icon = fileFn.get_icon_path(icon) if divider: return pm.menuItem(p=parent, dl=label, i=icon, d=divider) elif option_box: return pm.menuItem(p=parent, l=label, i=icon, ob=option_box, c=command) elif check_box: if not var_name: Logger.error( "Menuitem: {0}::{1} is not connected to config!".format( parent, label)) return checkBox_value = Config.get(var_name, default_value) checkBox = pm.menuItem(p=parent, l=label, i=icon, cb=checkBox_value, c=partial(Config.set, var_name)) return checkBox else: return pm.menuItem(p=parent, l=label, i=icon, c=command)