diff --git a/TheWall.ahk b/TheWall.ahk index e63e359..4eaa844 100644 --- a/TheWall.ahk +++ b/TheWall.ahk @@ -10,7 +10,7 @@ Thread, NoTimers , True SetKeyDelay, 0 SetWinDelay, 1 SetTitleMatchMode, 2 -SendLog(LOG_LEVEL_INFO, "Starting MultiResetWall v1.1.1") +SendLog(LOG_LEVEL_INFO, "Starting MultiResetWall v1.1.2") ; Yell if wrong AHK version if (SubStr(A_AhkVersion, 1, 3) != "1.1") { diff --git a/scripts/functions.ahk b/scripts/functions.ahk index 6ef27b4..b130978 100644 --- a/scripts/functions.ahk +++ b/scripts/functions.ahk @@ -39,6 +39,10 @@ GetOldestPreview() { } ReplacePreviewsInGrid() { + if (mode != "I") + return + if (GetPassiveGridInstanceCount() == 0) + return gridUsageCount := GetFocusGridInstanceCount() hasSwapped := False loop %gridUsageCount% { @@ -536,8 +540,10 @@ ResetInstance(idx, bypassLock:=true, extraProt:=0, resettingAll:=false) { spawnProt := spawnProtection + extraProt if (idx > 0 && idx <= instances && !FileExist(holdFile) && (spawnProt + previewTime) < A_TickCount && ((!bypassLock && !locked[idx]) || bypassLock)) { if (mode == "I") { - if (!locked[idx]) - SwapPositions(GetGridIndexFromInstanceNumber(idx), GetOldestInstanceIndexOutsideGrid()) + if (!locked[idx]) { + if (GetPassiveGridInstanceCount() > 0) + SwapPositions(GetGridIndexFromInstanceNumber(idx), GetOldestInstanceIndexOutsideGrid()) + } else { gridUsageCount := GetFocusGridInstanceCount() if (gridUsageCount < rxc) diff --git a/scripts/instance_moving_controller-MRW110.py b/scripts/instance_moving_controller-MRW112.py similarity index 95% rename from scripts/instance_moving_controller-MRW110.py rename to scripts/instance_moving_controller-MRW112.py index 52e7ca5..c4a635d 100644 --- a/scripts/instance_moving_controller-MRW110.py +++ b/scripts/instance_moving_controller-MRW112.py @@ -19,7 +19,7 @@ lastUpdate = 0.0 screen_width = 0 screen_height = 0 -version = "v1.1.0" +version = "v1.1.2" path = os.path.dirname(os.path.realpath(__file__)) reloadPath = os.path.abspath(os.path.realpath( os.path.join(path, '..', 'data', 'macro.reload'))) @@ -109,23 +109,24 @@ def manage_movement(): get_setting_from_ahk("pixelsBetweenInstances")) os.remove(reloadPath) + wall_scene = S.obs_get_scene_by_name(wall_scene_name) if screen_height == 0: - wall_scene = S.obs_scene_get_source( - S.obs_get_scene_by_name(wall_scene_name)) - screen_width = S.obs_source_get_width(wall_scene) - screen_height = S.obs_source_get_height(wall_scene) - S.obs_source_release(wall_scene) + wall_scene_source = S.obs_scene_get_source(wall_scene) + screen_width = S.obs_source_get_width(wall_scene_source) + screen_height = S.obs_source_get_height(wall_scene_source) - wall_scene = S.obs_get_scene_by_name(wall_scene_name) if not wall_scene: print("Can't find scene") + S.obs_scene_release(wall_scene) return if not os.path.exists(obstxtPath): print("Can't find obs.txt") + S.obs_scene_release(wall_scene) return currentTime = os.path.getmtime(obstxtPath) if currentTime == lastUpdate: + S.obs_scene_release(wall_scene) return lastUpdate = currentTime @@ -192,6 +193,7 @@ def manage_movement(): focus_cols), row * (screen_height * screen_estate_vertical / focus_rows)) scale_source(scene_item, screen_width * screen_estate_horizontal / focus_cols - pX, screen_height * screen_estate_vertical / focus_rows - pY) + S.obs_scene_release(wall_scene) prev_instances = instances prev_passive_count = passive_count prev_locked_count = locked_count diff --git a/scripts/obs_controller_MRW110.py b/scripts/obs_controller_MRW112.py similarity index 71% rename from scripts/obs_controller_MRW110.py rename to scripts/obs_controller_MRW112.py index 80903ce..70718c5 100644 --- a/scripts/obs_controller_MRW110.py +++ b/scripts/obs_controller_MRW112.py @@ -16,7 +16,9 @@ wall_scene_name = "The Wall" instance_scene_format = "Instance *" lock_format = "lock *" -version = "v1.1.0" +cover_format = "cover *" +mc_format = "mc *" +version = "v1.1.2" logging.basicConfig( @@ -48,34 +50,45 @@ def get_cmd(path): return cmd +def handle_wall(): + wall_scene = S.obs_get_scene_by_name(wall_scene_name) + wall_scene_source = S.obs_scene_get_source(wall_scene) + S.obs_scene_release(wall_scene) + S.obs_frontend_set_current_scene(wall_scene_source) + + +def handle_play(inst): + instance_name = instance_scene_format.replace("*", str(inst)) + instance_scene = S.obs_get_scene_by_name(instance_name) + instance_scene_source = S.obs_scene_get_source(instance_scene) + S.obs_scene_release(instance_scene) + if not instance_scene_source: + print( + f"Could not find instance scene '{instance_name}', make sure they are in the format 'Instance *'") + S.obs_frontend_set_current_scene(instance_scene_source) + + +def handle_lock(render, inst): + wall_scene = S.obs_get_scene_by_name(wall_scene_name) + lock_name = lock_format.replace("*", str(inst)) + lock_source = S.obs_scene_find_source_recursive( + wall_scene, lock_name) + if not lock_source: + print( + f"Could not find lock source '{lock_name}', make sure they are in the format 'lock *'") + S.obs_sceneitem_set_visible(lock_source, render) + S.obs_scene_release(wall_scene) + + def execute_cmd(cmd): try: if (cmd[0] == "ToWall"): - wall_scene = S.obs_scene_get_source( - S.obs_get_scene_by_name(wall_scene_name)) - S.obs_frontend_set_current_scene(wall_scene) - S.obs_source_release(wall_scene) + handle_wall() elif (cmd[0] == "Play"): - inst_num = cmd[1] - instance_name = instance_scene_format.replace("*", str(inst_num)) - instance_scene = S.obs_scene_get_source( - S.obs_get_scene_by_name(instance_name)) - if not instance_scene: - print( - f"Could not find instance scene '{instance_name}', make sure they are in the format 'Instance *'") - S.obs_frontend_set_current_scene(instance_scene) + handle_play(cmd[1]) elif (cmd[0] == "Lock"): - lock_num = cmd[1] - render = cmd[2] == "1" - wall_scene = S.obs_scene_get_source( - S.obs_get_scene_by_name(wall_scene_name)) - lock_name = lock_format.replace("*", str(lock_num)) - lock_source = S.obs_scene_find_source_recursive(S.obs_scene_from_source( - wall_scene), lock_name) - if not lock_source: - print( - f"Could not find lock source '{lock_name}', make sure they are in the format 'lock *'") - S.obs_sceneitem_set_visible(lock_source, render) + handle_lock(cmd[2] == "1", cmd[1]) + except Exception as e: print(f"Error: {e}") logging.error(e)