def fill_meta(self): self.wgPreview.lblTitle.setText(self.file_name) self.wgPreview.lblDate.setText( str( datetime.datetime.fromtimestamp( os.path.getmtime(self.load_file))).split(".")[0]) self.wgPreview.lblSize.setText( str("{0:.2f}".format( os.path.getsize(self.load_file) / (1024 * 1024.0)) + " MB")) self.extension = self.wgLoad.lstFiles.currentItem().text().split( '.')[-1] if self.extension in self.data['script'][TITLE].get('img'): software_img = "software/img" else: software_img = "software/" + self.software_format[self.extension] if self.file_data and self.file_data.has_key( self.wgLoad.lstFiles.currentItem().text()): current_file = self.file_data[ self.wgLoad.lstFiles.currentItem().text()] comment = current_file.get('comment') user_id = current_file.get('user') else: comment = '' user_id = 'unknown' self.wgPreview.edtComment.setPlainText(comment) self.wgPreview.lblUser.setText(user_id) self.wgPreview.lblSoftwareIcon.setPixmap( QtGui.QPixmap(QtGui.QImage(Tank().get_img_path(software_img)))) self.wgPreview.lblUserIcon.setPixmap( QtGui.QPixmap(QtGui.QImage(Tank().get_img_path('user/' + user_id))))
def change_lstFiles(self): self.extension = self.wgLoad.lstFiles.currentItem().text().split( '.')[-1] self.file_name = self.wgLoad.lstFiles.currentItem().text().split( '.')[0] if self.extension in self.data['script'][TITLE]['img']: self.preview_img_path = self.file_dir + '/' + self.wgLoad.lstFiles.currentItem( ).text() else: self.preview_img_path = self.file_dir + '/' + Tank().data_project[ 'META']['dir'] + '/' + self.file_name + '.' + self.data[ 'project']['EXTENSION']['thumbnail'] self.load_file = self.file_dir + '/' + self.wgLoad.lstFiles.currentItem( ).text() if os.path.exists(self.preview_img_path): self.wgPreview.btnPreviewImg.setIcon( QtGui.QPixmap(QtGui.QImage(self.preview_img_path))) else: self.wgPreview.btnPreviewImg.setIcon( QtGui.QPixmap(QtGui.QImage( Tank().get_img_path("lbl/default")))) self.set_open_folder(self.file_dir) if os.path.exists(self.load_file): self.fill_meta() else: self.clear_meta()
def create_default_notice(script_string, msg=""): root, script_name = script_string.split(":") notice_data = Tank().data_notice if root in notice_data and script_name in notice_data[root]: notice_data = notice_data[root][script_name] notice_msg = [lambda: notice_data["msg"], lambda: msg][msg != ""]() else: notice_data['title'] = root notice_msg = script_name # LOG.warning("notice.yml data doesnt exist: {}".format(script_name)) # return if "quote" in notice_data: notice_quote = notice_data["quote"] else: notice_quote = "" img_name = [lambda: script_name, lambda: notice_data["img"]]["img" in notice_data]() img_link = [lambda: "", lambda: notice_data["img_link"]]["img_link" in notice_data]() img_path = Tank().get_img_path("lbl/notice_" + img_name) img_path = [ lambda: "{}/notice_default.png".format(img_notice_path), lambda: img_path ][os.path.exists(img_path)]() note = Notice(title=notice_data["title"], msg=notice_msg, quote=notice_quote, img=img_path, img_link=img_link) classVar = ArNotice(note)
def initGameBoard(self): self.num_of_all_enemies = 3 self.num_of_enemies_per_level = 4 self.current_level = 1 self.force_x = None self.force_y = None self.enemies_increaser = 0 self.chosen_enemy = None self.bullet_list = [] self.enemy_list = [] self.random_values = [] self.random_values = sample(range(1, 32), self.num_of_enemies_per_level) self.player_1 = Tank(PlayerType.PLAYER_1) self.player_1_starting_position = () self.player_2 = Tank(PlayerType.PLAYER_2) self.player_2_starting_position = () self.clearBoard() self.loadLevel(self.current_level) for i in range(self.num_of_enemies_per_level): self.enemy_list.append(EnemyTank(self.random_values[i])) self.setShapeAt(self.enemy_list[i].x, self.enemy_list[i].y, ElementType.ENEMY) self.sendBoard(True)
def change_lstStatus(self): if self.scene_steps < 5: part_path = '' else: part_path = self.wgLoad.lstAsset.currentItem().text() + '/' if not self.wgLoad.lstStatus.currentItem( ) or not self.wgLoad.lstTask.currentItem(): return self.file_dir = self.load_dir + '/' + self.wgLoad.lstSet.currentItem( ).text() + '/' + part_path + self.wgLoad.lstTask.currentItem().text( ) + '/' + self.wgLoad.lstStatus.currentItem().text() tmp_content = pipefunc.get_file_list(self.file_dir, extension=True) self.wgLoad.lstFiles.clear() if not tmp_content: return file_list = [] for file in tmp_content: if os.path.splitext(file)[1][1:] in self.software_keys: file_list.append(file) if file_list: if os.path.exists(self.file_dir + Tank().data_project['META']['file']): self.file_data = Tank().get_yml_file( self.file_dir + Tank().data_project['META']['file']) else: self.file_data = '' self.wgLoad.lstFiles.addItems(sorted(file_list, reverse=True)) self.wgLoad.lstFiles.setCurrentRow(0)
def setup_env(self): LOG.debug('- {} -----------------------------------------------------'. format(self._NAME.upper())) sub_path = [] software_path = [] for each_path in os.environ['SOFTWARE_SRC_PATH'].split(';'): # if not each_path.endswith('software'): each_path = os.path.dirname(each_path) tmp_paths = ('/').join([each_path, self._NAME]) software_path.append(tmp_paths) tmp_folder = pipefunc.get_file_list(path=tmp_paths, exclude='.py', add_path=True) if not tmp_folder: continue sub_path.extend(tmp_folder) os.environ['SOFTWARE_PATH'] = (';').join(software_path) os.environ['SOFTWARE_SUB_PATH'] = (';').join(sub_path) LOG.debug("SOFTWARE_PATH: {}".format(os.environ['SOFTWARE_PATH'])) # GET data self._software_data = Tank().data_software self._env = self._software_data.get('ENV', '') # ADD software ENV if (self._env): for env, content in self._env.iteritems(): if isinstance(content, list): for each in content: Tank().add_env(env, each) else: Tank().add_env(env, content) LOG.debug('{}_ENV: {}'.format(self._NAME.upper(), self._env))
def __init__(self, new_file=True): super(ArSaveAs, self).__init__() path_ui = ("/").join([os.path.dirname(__file__), "ui", TITLE + ".ui"]) self.wgSaveAs = QtCompat.loadUi(path_ui) self.all_task = '<all tasks>' self.new_file = new_file self.save_file = '' self.save_dir = Tank().data_project['path'] self.software = Tank().software.software self.inputs = [ self.wgSaveAs.cbxScene, self.wgSaveAs.cbxSet, self.wgSaveAs.cbxAsset, self.wgSaveAs.cbxTask ] self.wgHeader.btnOption.hide() self.wgHeader.cbxAdd.hide() self.wgHeader.setWindowIcon( QtGui.QIcon(Tank().get_img_path("btn/btn_save"))) btn_title = TITLE if self.new_file else 'Create New Folder' self.wgHeader.setWindowTitle(btn_title) btn_title = 'Save As' if self.new_file else 'Create' self.wgHeader.btnAccept.setText(btn_title) self.wgHeader.layMain.addWidget(self.wgSaveAs, 0, 0) self.resize_widget(self.wgSaveAs) # self.wgSaveAs : always on top self.wgSaveAs.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.setup() self.wgSaveAs.show() LOG.info('START : arSaveAs')
def __call__(self): from tank import Tank TITLE = os.path.splitext(os.path.basename(__file__))[0] LOG = Tank().log.init(script=TITLE) LOG.debug( '____________________________________________________________') LOG.debug('PIPELINE: {} [{}, {}, {}] {}'.format( self.pipeline_data['PIPELINE']['name'], self.pipeline_data['PIPELINE']['version'], os.environ['PIPELINE_STATUS'], 'user overwrite' if os.environ['DATA_USER_PATH'] else 'NO user overwrite', self.data_pipeline_path)) LOG.debug('PROJECT: {} [{}, {}] [{}{}]'.format( self.project_data['name'], '{} x {}'.format(Tank().data_project['resolution'][0], Tank().data_project['resolution'][1]), Tank().data_project['fps'], '' if os.path.exists(self.project_data['path']) else 'NOT existing: ', os.path.normpath(self.project_data['path']))) LOG.debug( '------------------------------------------------------------') LOG.debug('SYS_PATH: {}'.format('[%s]' % ', '.join(map(str, sys.path)))) LOG.debug('ADD_ENV: {}'.format(self.pipeline_env))
def press_btnAccept(self): if not os.path.exists(self.load_file): self.set_status('FAILED LOADING : Path doesnt exists: {}'.format(self.load_file), msg_type=3) return False open_software = self.software_format[os.path.splitext(self.load_file)[1][1:]].upper() # OPEN in current software try: if open_software.lower() == Tank().software.software.lower(): Tank().software.scene_open(self.load_file) self.wgHeader.close() elif open_software in self.data['software'].keys(): try: Tank().software.start(open_software, self.load_file) except: LOG.error('FAILED to open software', exc_info=True) else: subprocess.Popen(self.load_file, shell=True) except: LOG.warning("No Software setup") note = arNotice.Notice(title = os.path.basename(self.load_file).split('.')[0], msg = self.wgPreview.edtComment.toPlainText(), user = self.wgPreview.lblUser.text(), func = 'LOAD', img = self.preview_img_path if os.path.exists(self.preview_img_path) else 'lbl/lbl{}131'.format(Tank().software.software.lower().title()), img_link = os.path.dirname(self.load_file)) arNotice.ArNotice(note)
def __init__(self, width, height, title): # Window initializing code self.win_size = width, height self.win = pygame.display.set_mode((width, height)) pygame.display.set_caption(title) self.running = True self.background = (0, 0, 0) # Pymunk initializing code pymunk.pygame_util.positive_y_is_up = False self.space = pymunk.Space() self.space.gravity = 0, 700 # Create game objects self.ground = Ground(self.win_size[0], 150, self.win_size) self.player1 = Tank("red") self.player2 = Tank("blue") self.bullets = [] # Setup code self.current_player = self.player1 self.other_player = self.player2 self.moves_left = 100 self.shoot_wait = 380 self.shooting = False self.player1.body._set_position((100, 250)) self.player2.body._set_position((width-136, 250)) # Add game objects to space self.ground.add_to_space(self.space) self.player1.add_to_space(self.space) self.player2.add_to_space(self.space)
def add_preview(self, layout): path_ui = ("/").join( [os.path.dirname(__file__), "ui", TITLE + "_preview.ui"]) self.wgPreview = QtCompat.loadUi(path_ui) layout.addWidget(self.wgPreview, 0, 0) self.wgPreview.btnPreviewImg.clicked.connect(self.press_btnPreviewImg) self.wgPreview.btnScreenshot.clicked.connect(self.press_btnScreenshot) self.wgPreview.btnSnapshotRender.clicked.connect( self.press_btnSnapshotRender) self.wgPreview.btnSnapshotViewport.clicked.connect( self.press_btnSnapshotViewport) self.wgPreview.btnPreviewImg.setIcon( QtGui.QPixmap(QtGui.QImage(Tank().get_img_path("lbl/default")))) self.wgPreview.btnScreenshot.setIcon( QtGui.QPixmap(QtGui.QImage(Tank().get_img_path("btn/btn_camera")))) self.wgPreview.btnSnapshotViewport.setIcon( QtGui.QPixmap( QtGui.QImage(Tank().get_img_path( "software/maya/shelf/shelf_render_low")))) self.wgPreview.btnSnapshotRender.setIcon( QtGui.QPixmap( QtGui.QImage(Tank().get_img_path( "software/maya/shelf/shelf_render_high"))))
def __init__(self): self.screen = pg.display.get_surface() self.screen_rect = self.screen.get_rect() self.clock = pg.time.Clock() self.fps = 60 self.done = False self.keys = pg.key.get_pressed() p1keys = { pg.K_LEFT: 1, pg.K_RIGHT: -1, pg.K_UP: 1, pg.K_DOWN: 1, pg.K_k: 1 } p1controls = [pg.K_LEFT, pg.K_RIGHT, pg.K_UP, pg.K_DOWN, pg.K_k] p2keys = {pg.K_a: 1, pg.K_d: -1, pg.K_w: 1, pg.K_s: 1, pg.K_g: 1} p2controls = [pg.K_a, pg.K_d, pg.K_w, pg.K_s, pg.K_g] self.tanks = [] tank = Tank([100, 100], p1keys, p1controls, 1) tank2 = Tank([900, 700], p2keys, p2controls, 2) self.tanks.append(tank) self.tanks.append(tank2) self.walls = [] self.make_walls()
def __init__(self): self.screen = pygame.display.set_mode((WIDTH, HEIGHT)) self.tank1 = Tank(300, 300, TANK_SPEED, GREEN) self.tank2 = Tank(100, 100, TANK_SPEED, RED, pygame.K_d, pygame.K_a, pygame.K_w, pygame.K_s) self.tanks = [self.tank1, self.tank2] self.bullets = [] self.font = pygame.font.Font(None, FONT_MIN) self.game_over = False self.background = BACKGROUND
def initMultiplayerOffline(self): self.random_values = [] self.random_values = sample(range(1, 32), self.num_of_enemies_per_level) self.board = [] self.bullet_dictionary = {} self.enemy_dictionary = {} for i in range(self.num_of_enemies_per_level): self.enemy_dictionary[EnemyTank( self.random_values[i])] = QLabel(self) self.player_1 = Tank(PlayerType.PLAYER_1) self.player_1_label = QLabel(self) self.player_1_starting_position = () self.player_2 = Tank(PlayerType.PLAYER_2) self.player_2_label = QLabel(self) self.player_2_starting_position = () self.clearBoard() self.setFocusPolicy(Qt.StrongFocus) self.setInitialMap() # region THREADS self.move_player_1_thread = MovePlayerThread(self.commands_1, self.player_1, self) self.move_player_1_thread.player_moved_signal.connect(self.playerMoved) self.move_player_1_thread.bullet_fired_signal.connect(self.bulletFired) self.move_player_1_thread.bullet_impact_signal.connect( self.bulletMoved) self.move_player_2_thread = MovePlayerThread(self.commands_2, self.player_2, self) self.move_player_2_thread.player_moved_signal.connect(self.playerMoved) self.move_player_2_thread.bullet_fired_signal.connect(self.bulletFired) self.move_player_2_thread.bullet_impact_signal.connect( self.bulletMoved) self.move_enemy_thread = MoveEnemyThread(self) self.move_enemy_thread.bullet_fired_signal.connect(self.bulletFired) self.move_enemy_thread.bullet_impact_signal.connect(self.bulletMoved) self.move_enemy_thread.enemy_move_signal.connect(self.enemyCallback) self.move_enemy_thread.dead_player_signal.connect( self.removeDeadPlayer) self.move_bullets_thread = MoveBulletsThread(self) self.move_bullets_thread.bullets_move_signal.connect(self.bulletMoved) self.move_bullets_thread.dead_player_signal.connect( self.removeDeadPlayer) self.ex_pipe, self.in_pipe = Pipe() self.deux_ex_machina_process = DeuxExMachina( pipe=self.ex_pipe, boardWidth=self.BoardWidth, boardHeight=self.BoardHeight) self.deux_ex_machina_thread = DeuxExMachinaThread(self)
def set_meta_data(self, save_path=''): if not save_path: save_path = self.save_file meta_path = os.path.dirname( save_path) + Tank().data_project['META']['file'] # LOG.info(meta_path) comment_dict = { 'user': User().id, 'comment': str(self.wgSave.edtComment.text()) } Tank().set_data(meta_path, os.path.basename(save_path), comment_dict)
def copy_splash(): splash_path = Tank().get_img_path("software/max/splash.bmp") max_path = os.path.dirname(Tank().software.data['path']) if not os.path.exists(max_path + '/splash.bmp'): try: shutil.copy(splash_path, max_path) except: LOG.error('FAILED to copy splash: '.format(max_path), exc_info=True)
def start(): app = QtWidgets.QApplication(sys.argv) app.setQuitOnLastWindowClosed(False) trayIcon = SystemTrayIcon(app) trayIcon.show() trayIcon.setToolTip(Tank().data_project['name'] + ' [right click]') trayIcon.showMessage(Tank().data_project['name'], '[right click]', QtWidgets.QSystemTrayIcon.Information , 20000) app.exec_()
def setup_level(self, map_source="res/level.tmx"): self.tank_list = arcade.SpriteList() self.tank = Tank(self.tank_list) self.tank.set_position(100, 100) self.bullet_list = arcade.SpriteList() level_map = arcade.tilemap.read_tmx(map_source) self.level_boundary = ((0, 0), (level_map.map_size.width * level_map.tile_size.width, level_map.map_size.height * level_map.tile_size.height)) enemies_position = self.get_enemies_position(level_map) self.layers = { key: None for key in ("boundary", "background", "terrain", "box") } if level_map.background_color: arcade.set_background_color(level_map.background_color) for layer_name in self.layers.keys(): self.layers[layer_name] = arcade.tilemap.process_layer( map_object=level_map, layer_name=layer_name) for sprite in self.layers["box"]: sprite.health = 20 self.physics_engines = [] self.physics_engines.append( arcade.PhysicsEngineSimple(self.tank.wheel_sprite, self.layers["boundary"])) self.physics_engines.append( arcade.PhysicsEngineSimple(self.tank.wheel_sprite, self.layers["box"])) self.ai_sprite_list = arcade.SpriteList() self.ai_objects = [] for position in enemies_position: ai_obj = Tank(self.ai_sprite_list, "res/ai.png") ai_obj.set_position(*position) self.ai_objects.append(ai_obj) self.physics_engines.append( arcade.PhysicsEngineSimple(ai_obj.wheel_sprite, self.tank_list)) self.physics_engines.append( arcade.PhysicsEngineSimple(self.tank.wheel_sprite, self.ai_sprite_list)) self.physics_engines.append( arcade.PhysicsEngineSimple(ai_obj.wheel_sprite, self.layers["boundary"])) self.physics_engines.append( arcade.PhysicsEngineSimple(ai_obj.wheel_sprite, self.layers["box"])) self.path = None self.create_barriers()
def save_snapshot(rlt_path, src_path=DEFAULT_PATH): img = QtGui.QImage() img.load(src_path) thumbnail_extension = '.' + Tank().data_project['EXTENSION']['thumbnail'] tmpDir = os.path.dirname( rlt_path) + '/' + Tank().data_project['META']['dir'] rlt_path = tmpDir + "/" + os.path.basename(rlt_path).split( ".")[0] + thumbnail_extension pipefunc.create_folder(rlt_path) img.save(rlt_path, format=thumbnail_extension) remove_tmp_img(src_path) return rlt_path
def prep_lives(self): """Creating two sprite groups for both players to show lives""" self.p1_lives = Group() self.p2_lives = Group() for tank_number in range(self.game_set.p1_lives): tank1 = Tank(self.game_set, self.screen, 'lives', 'p1') tank1.rect.x = 30 + tank_number * (tank1.rect.width + 5) tank1.rect.y = 60 self.p1_lives.add(tank1) for tank_number in range(self.game_set.p2_lives): tank2 = Tank(self.game_set, self.screen, 'lives', 'p2') tank2.rect.x = 884 + tank_number * (tank2.rect.width + 5) tank2.rect.y = 60 self.p2_lives.add(tank2)
def test_fire_consumes_ammo(): mytank = Tank(0, 0) assert mytank.ammo == 50, 'Initial ammo should be 50' mytank.fire() assert mytank.ammo == 49, 'Ammo should have decreased of one'
def main(): pygame.init() globals.pygame = pygame update_display_mode() clock = pygame.time.Clock() entities = [] entities.append(Tank(100, 100)) loop = True while (loop): clock.tick(60) # 60 FPS globals.window.fill((255, 255, 255)) # Fill window white globals.events = pygame.event.get() for entitiy in entities: entitiy.update() for entitiy in entities: entitiy.draw() if isKeyJustPressed(pygame.K_RETURN): toggle_fullscreen() if isKeyJustPressed(pygame.K_ESCAPE): globals.pygame.quit() loop = False # Flip the buffer pygame.display.flip()
def nuke_viewerSnapshot(img_path=DEFAULT_PATH): LOG.info("nuke_viewerSnapshot") import nuke viewer = nuke.activeViewer() viewNode = nuke.activeViewer().node() actInput = nuke.ViewerWindow.activeInput(viewer) if actInput < 0: return False selInput = nuke.Node.input(viewNode, actInput) # look up filename based on top read node topName = "[file tail [knob [topnode].file]]" # create writes and define render format write1 = nuke.nodes.Write( file=img_path.replace("\\", "/"), name='writeNode1', file_type=Tank().data_project['EXTENSION']['thumnail']) write1.setInput(0, selInput) # look up current frame curFrame = int(nuke.knob("frame")) # start the render nuke.execute(write1.name(), curFrame, curFrame) # clean up for n in [write1]: nuke.delete(n)
def _add_tile_to_tank(self, tank_id, tile, x, y): if tank_id not in self.tanks: # Add new tank! self.tanks[tank_id] = Tank(tank_id, y) tank = self.tanks[tank_id] tank.add_horizontal_line(x, y, tile)
def make_github_issue(title, body=None, assignee='', milestone=None, labels=None): import requests from tank import Tank REPO_DATA = Tank().user.data_user_path if not assignee: assignee = REPO_DATA['username'] # Our url to create issues via POST url = 'https://api.github.com/repos/%s/%s/issues' % (REPO_DATA['owner'], REPO_DATA['repository']) # Create an authenticated session to create the issue session = requests.Session() session.auth = (REPO_DATA['username'], REPO_DATA['password']) issue = {'title': title, 'body': body, 'assignee': assignee, 'milestone': milestone, 'labels': labels} # Add the issue to our repository repo = session.post(url, json.dumps(issue)) if repo.status_code == 201: LOG.info('Successfully created Issue {}'.format(title)) else: LOG.warning('Could not create Issue {}.\nResponse:{}'.format(title, repo.content))
def __init__(self, parent=None): super(ArSave, self).__init__() path_ui = ("/").join([os.path.dirname(__file__), "ui", TITLE + ".ui"]) self.wgSave = QtCompat.loadUi(path_ui) self.save_dir = os.getenv('PROJECT_PATH') self.save_file = '' self.comment = "Comment" self.img_path = libSnapshot.default_tmp_path self.software = Tank().software.software self.wgSave.btnVersionUp.clicked.connect(self.update_version) self.wgSave.btnVersionDown.clicked.connect( lambda: self.update_version(add=-1)) # self.wgSave.btnPreviewImg.clicked.connect(self.press_btnPreviewImg) self.wgSave.btnScreenshot.clicked.connect(self.press_btnScreenshot) self.wgSave.btnSnapshotViewport.clicked.connect( self.press_btnSnapshotViewport) self.wgSave.btnSnapshotRender.clicked.connect( self.press_btnSnapshotRender) self.wgSave.btnPreviewImg.setIcon( QtGui.QPixmap(QtGui.QImage(libData.get_img_path("lbl/default")))) self.wgSave.btnScreenshot.setIcon( QtGui.QPixmap(QtGui.QImage( libData.get_img_path("btn/btnCamera48")))) self.wgSave.btnSnapshotRender.setIcon( QtGui.QPixmap( QtGui.QImage( libData.get_img_path( "software/maya/shelf/shelf_renderHigh35")))) self.wgSave.btnSnapshotViewport.setIcon( QtGui.QPixmap( QtGui.QImage( libData.get_img_path( "software/maya/shelf/shelf_viewport35")))) self.resize_widget(self.wgSave) if not self.set_path(): self.press_btnOption() return # self.wgSave : always on top # self.wgHeader.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.wgHeader.setWindowTitle(TITLE) self.wgHeader.setWindowIcon( QtGui.QIcon(libData.get_img_path("btn/btnSave48"))) self.wgHeader.btnOption.setText('SaveAs') self.wgSave.btnSnapshotRender.hide() if self.software == 'nuke': self.wgSave.btnSnapshotRender.hide() self.wgHeader.layMain.addWidget(self.wgSave, 0, 0) self.wgSave.show() LOG.info('START : arSave')
def load_menus(): if cmds.menu(os.getenv('PROJECT_NAME').replace(' ', ''), query=True, exists=True): cmds.deleteUI(os.getenv('PROJECT_NAME').replace(' ', ''), menu=True) menu = cmds.menu( os.getenv('PROJECT_NAME').replace(' ', ''), hm=1, p='MayaWindow', l=os.getenv('PROJECT_NAME').replace(' ', ''), to=1, ) Tank().software.add_menu(menu) Tank().software.add_shelf()
def load_menus(): project_path = os.getenv('PROJECT_NAME').replace(' ', '') if cmds.menu(project_path, query=True, exists=True): cmds.deleteUI(project_path, menu=True) menu = cmds.menu( project_path, hm=True, parent='MayaWindow', l=project_path, to=True, ) Tank().software.add_menu(menu) Tank().software.add_shelf()
def run_game(): # Initialize pygame, settings, and screen object. pygame.init() tw_settings = Settings() screen = pygame.display.set_mode( (tw_settings.screen_width, tw_settings.screen_height)) pygame.display.set_caption("Alien Invasion") # Make a tank. tank = Tank(screen) enemy_tank = EnemyTank(screen) enemy_dedector = EnemyDedector(screen, enemy_tank) # Make a group to store bullets in. bullets = Group() enemy_bullets = Group() ########################################################### # Threads for each function. t1 = threading.Thread(target=thread_1_, args=(tw_settings, screen, tank, enemy_tank, enemy_dedector, bullets, enemy_bullets)) t2 = threading.Thread(target=thread_2_, args=(tw_settings, screen, tank, enemy_tank, enemy_dedector, bullets, enemy_bullets)) t3 = threading.Thread(target=thread_3_, args=(tw_settings, screen, tank, enemy_tank, enemy_dedector, bullets, enemy_bullets)) ########################################################### t1.start() t2.start() t3.start() """
def scene_setup(self, setup_type, status='', default=True): import maya.cmds as cmds data_setup = Tank().data_software[setup_type] new_setup = [] if default: new_setup += data_setup['DEFAULT'] if status in data_setup: new_setup += data_setup[status] LOG.debug(new_setup) for setting in new_setup: for key, item in setting.items(): # TODO: Maybe needs optVar option - will see render = "cmds.setAttr('{}', {})".format(key, item) try: eval(render) except: LOG.error( 'Scene Setup is not executable: {}'.format(render), exc_info=True)