def auto_setup(props, prop): # Todo: add BO3 and BO5 global game_item global social_item global overlay_item global bar_0_item global blue_cheer_item global orange_cheer_item global bar_1_item global blue_name_item global orange_name_item global blue_dev_name_item global orange_dev_name_item global blue_boost_item global orange_boost_item global boost_0_item global boost_1_item global goal_item global game_source global social_source global overlay_source global bar_0_source global blue_cheer_source global orange_cheer_source global bar_1_source global blue_name_source global orange_name_source global blue_boost_source global orange_boost_source global boost_0_source global boost_1_source global goal_source if not check_for_scene('RLBot - AutoLeague'): main_scene = obs.obs_scene_create('RLBot - AutoLeague') # Game Capture temp_settings = get_settings('Game Capture') game_source = obs.obs_source_create('game_capture', 'Game', temp_settings, None) game_item = obs.obs_scene_add(main_scene, game_source) obs.obs_data_release(temp_settings) obs.obs_source_release(game_source) # obs.obs_sceneitem_release(game_item) # Social temp_settings = get_settings('Social') temp_path = os.path.join(files_path, 'social.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) social_source = obs.obs_source_create('image_source', 'Social', temp_settings, None) social_item = obs.obs_scene_add(main_scene, social_source) obs.obs_data_release(temp_settings) obs.obs_source_release(social_source) # obs.obs_sceneitem_release(social_item) # RLBot Overlay temp_settings = get_settings('RLBot Overlay') temp_path = os.path.join(files_path, 'overlay.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) overlay_source = obs.obs_source_create('image_source', 'Overlay', temp_settings, None) overlay_item = obs.obs_scene_add(main_scene, overlay_source) obs.obs_data_release(temp_settings) obs.obs_source_release(overlay_source) # obs.obs_sceneitem_release(overlay_item) # Blue-Name temp_settings = get_settings('Blue Team Name') blue_name_source = obs.obs_source_create('text_gdiplus', 'Blue-Name', temp_settings, None) blue_name_item = obs.obs_scene_add(main_scene, blue_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(blue_name_source) # obs.obs_sceneitem_release(blue_name_item) # Orange-Name temp_settings = get_settings('Orange Team Name') orange_name_source = obs.obs_source_create('text_gdiplus', 'Orange-Name', temp_settings, None) orange_name_item = obs.obs_scene_add(main_scene, orange_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(orange_name_source) # obs.obs_sceneitem_release(orange_name_item) # Blue-Dev-Name temp_settings = get_settings('Blue Dev Name') blue_dev_name_source = obs.obs_source_create('text_gdiplus', 'Blue-Dev-Name', temp_settings, None) blue_dev_name_item = obs.obs_scene_add(main_scene, blue_dev_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(blue_dev_name_source) # obs.obs_sceneitem_release(blue_name_item) # Orange-Dev-Name temp_settings = get_settings('Orange Dev Name') orange_dev_name_source = obs.obs_source_create('text_gdiplus', 'Orange-Dev-Name', temp_settings, None) orange_dev_name_item = obs.obs_scene_add(main_scene, orange_dev_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(orange_dev_name_source) # obs.obs_sceneitem_release(orange_name_item) logo_pos = [300, 10] logo_scale = 0.25 # Logo-0 temp_settings = get_settings('Logo') temp_path = os.path.join(files_path, 'logo.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) logo_0_source = obs.obs_source_create('image_source', 'Logo-0', temp_settings, None) logo_0_item = obs.obs_scene_add(main_scene, logo_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(logo_0_source) vec = obs.vec2() obs.vec2_set(vec, logo_pos[0], logo_pos[1]) obs.obs_sceneitem_set_pos(logo_0_item, vec) obs.vec2_set(vec, logo_scale, logo_scale) obs.obs_sceneitem_set_scale(logo_0_item, vec) # obs.obs_sceneitem_release(social_item) # Logo-1 temp_settings = get_settings('Logo') temp_path = os.path.join(files_path, 'logo.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) logo_0_source = obs.obs_source_create('image_source', 'Logo-1', temp_settings, None) logo_0_item = obs.obs_scene_add(main_scene, logo_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(logo_0_source) vec = obs.vec2() obs.vec2_set(vec, 1920-100-logo_pos[0], logo_pos[1]) obs.obs_sceneitem_set_pos(logo_0_item, vec) obs.vec2_set(vec, logo_scale, logo_scale) obs.obs_sceneitem_set_scale(logo_0_item, vec) # obs.obs_sceneitem_release(social_item) # Goal temp_settings = get_settings('Goal') temp_path = os.path.join(files_path, 'goal.mov') obs.obs_data_set_string(temp_settings, 'local_file', temp_path) goal_source = obs.obs_source_create('ffmpeg_source', 'Goal', temp_settings, None) goal_item = obs.obs_scene_add(main_scene, goal_source) obs.obs_data_release(temp_settings) obs.obs_source_release(goal_source) # obs.obs_sceneitem_release(goal_item) obs.obs_scene_release(main_scene) set_text_pos() do_reset_bar() else: print('Scene already exists, please delete or rename RLBot scene before continuing')
def scene_create_ar(name): try: _scene = obs.obs_scene_create(name) yield _scene finally: obs.obs_scene_release(_scene)
def auto_setup(props, prop): # Todo: add BO3 and BO5 global game_item global social_item global overlay_item global bar_0_item global blue_cheer_item global orange_cheer_item global bar_1_item global blue_name_item global orange_name_item global blue_boost_item global orange_boost_item global boost_0_item global boost_1_item global goal_item global game_source global social_source global overlay_source global bar_0_source global blue_cheer_source global orange_cheer_source global bar_1_source global blue_name_source global orange_name_source global blue_boost_source global orange_boost_source global boost_0_source global boost_1_source global goal_source if not check_for_scene('RLBot - AutoLeague'): main_scene = obs.obs_scene_create('RLBot - AutoLeague') # Game Capture temp_settings = get_settings('Game Capture') game_source = obs.obs_source_create('game_capture', 'Game', temp_settings, None) game_item = obs.obs_scene_add(main_scene, game_source) obs.obs_data_release(temp_settings) obs.obs_source_release(game_source) # obs.obs_sceneitem_release(game_item) # Social temp_settings = get_settings('Social') temp_path = os.path.join(files_path, 'social.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) social_source = obs.obs_source_create('image_source', 'Social', temp_settings, None) social_item = obs.obs_scene_add(main_scene, social_source) obs.obs_data_release(temp_settings) obs.obs_source_release(social_source) # obs.obs_sceneitem_release(social_item) # RLBot Overlay temp_settings = get_settings('RLBot Overlay') temp_path = os.path.join(files_path, 'overlay.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) overlay_source = obs.obs_source_create('image_source', 'Overlay', temp_settings, None) overlay_item = obs.obs_scene_add(main_scene, overlay_source) obs.obs_data_release(temp_settings) obs.obs_source_release(overlay_source) # obs.obs_sceneitem_release(overlay_item) # Bar-0 temp_settings = get_settings('bar-0') temp_path = os.path.join(files_path, 'bar-0.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) bar_0_source = obs.obs_source_create('image_source', 'Bar-0', temp_settings, None) bar_0_item = obs.obs_scene_add(main_scene, bar_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(bar_0_source) # obs.obs_sceneitem_release(bar_0_item) # Bar-1 temp_settings = get_settings('bar-1') temp_path = os.path.join(files_path, 'bar-1.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) bar_1_source = obs.obs_source_create('image_source', 'Bar-1', temp_settings, None) bar_1_item = obs.obs_scene_add(main_scene, bar_1_source) obs.obs_data_release(temp_settings) obs.obs_source_release(bar_1_source) # obs.obs_sceneitem_release(bar_1_item) # Blue-Name temp_settings = get_settings('Blue Team Name') blue_name_source = obs.obs_source_create('text_gdiplus', 'Blue-Name', temp_settings, None) blue_name_item = obs.obs_scene_add(main_scene, blue_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(blue_name_source) # obs.obs_sceneitem_release(blue_name_item) # Orange-Name temp_settings = get_settings('Orange Team Name') orange_name_source = obs.obs_source_create('text_gdiplus', 'Orange-Name', temp_settings, None) orange_name_item = obs.obs_scene_add(main_scene, orange_name_source) obs.obs_data_release(temp_settings) obs.obs_source_release(orange_name_source) # obs.obs_sceneitem_release(orange_name_item) # Blue-Boost-0 temp_settings = get_settings('Blue Boost 0') blue_boost_0_source = obs.obs_source_create('color_source', 'Blue-Boost-0', temp_settings, None) blue_boost_0_item = obs.obs_scene_add(main_scene, blue_boost_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(blue_boost_0_source) # obs.obs_sceneitem_release(blue_boost_item) # Orange-Boost-0 temp_settings = get_settings('Orange Boost 0') orange_boost_0_source = obs.obs_source_create('color_source', 'Orange-Boost-0', temp_settings, None) orange_boost_0_item = obs.obs_scene_add(main_scene, orange_boost_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(orange_boost_0_source) # obs.obs_sceneitem_release(orange_boost_item) # Boost-0 temp_settings = get_settings('Boost-0') temp_path = os.path.join(files_path, 'Boost-0.png') obs.obs_data_set_string(temp_settings, 'file', temp_path) boost_0_source = obs.obs_source_create('image_source', 'Boost-0', temp_settings, None) boost_0_item = obs.obs_scene_add(main_scene, boost_0_source) obs.obs_data_release(temp_settings) obs.obs_source_release(boost_0_source) # obs.obs_sceneitem_release(bar_1_item) # Goal temp_settings = get_settings('Goal') temp_path = os.path.join(files_path, 'goal.mov') obs.obs_data_set_string(temp_settings, 'local_file', temp_path) goal_source = obs.obs_source_create('ffmpeg_source', 'Goal', temp_settings, None) goal_item = obs.obs_scene_add(main_scene, goal_source) obs.obs_data_release(temp_settings) obs.obs_source_release(goal_source) # obs.obs_sceneitem_release(goal_item) obs.obs_scene_release(main_scene) set_text_pos() do_reset_bar() else: print( 'Scene already exists, please delete or rename RLBot scene before continuing' )