Merge branch 'osc_query' into develop
This commit is contained in:
@@ -1153,8 +1153,12 @@ class Controller:
|
|||||||
if model.getIsOscQueryEnabled() is True:
|
if model.getIsOscQueryEnabled() is True:
|
||||||
self.enableOscQuery()
|
self.enableOscQuery()
|
||||||
else:
|
else:
|
||||||
self.setDisableVrcMicMuteSync()
|
mute_sync_info_flag = False
|
||||||
self.disableOscQuery()
|
if config.VRC_MIC_MUTE_SYNC is True:
|
||||||
|
self.setDisableVrcMicMuteSync()
|
||||||
|
mute_sync_info_flag = True
|
||||||
|
self.disableOscQuery(mute_sync_info=mute_sync_info_flag)
|
||||||
|
|
||||||
response = {"status":200, "result":config.OSC_IP_ADDRESS}
|
response = {"status":200, "result":config.OSC_IP_ADDRESS}
|
||||||
except Exception:
|
except Exception:
|
||||||
model.setOscIpAddress(config.OSC_IP_ADDRESS)
|
model.setOscIpAddress(config.OSC_IP_ADDRESS)
|
||||||
@@ -1933,12 +1937,13 @@ class Controller:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def disableOscQuery(self):
|
def disableOscQuery(self, mute_sync_info:bool=False):
|
||||||
|
disabled_functions = []
|
||||||
|
if mute_sync_info is True:
|
||||||
|
disabled_functions.append("vrc_mic_mute_sync")
|
||||||
self.run(200, self.run_mapping["enable_osc_query"], {
|
self.run(200, self.run_mapping["enable_osc_query"], {
|
||||||
"data": False,
|
"data": False,
|
||||||
"disabled_functions": [
|
"disabled_functions": disabled_functions
|
||||||
"vrc_mic_mute_sync",
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
def init(self, *args, **kwargs) -> None:
|
def init(self, *args, **kwargs) -> None:
|
||||||
@@ -2055,13 +2060,15 @@ class Controller:
|
|||||||
osc_query_enabled = model.getIsOscQueryEnabled()
|
osc_query_enabled = model.getIsOscQueryEnabled()
|
||||||
if osc_query_enabled is True:
|
if osc_query_enabled is True:
|
||||||
self.enableOscQuery()
|
self.enableOscQuery()
|
||||||
|
if config.VRC_MIC_MUTE_SYNC is True:
|
||||||
|
self.setEnableVrcMicMuteSync()
|
||||||
else:
|
else:
|
||||||
# OSC Query is disabled, so disable VRC some features
|
# OSC Query is disabled, so disable VRC some features
|
||||||
config.VRC_MIC_MUTE_SYNC = False
|
mute_sync_info_flag = False
|
||||||
self.disableOscQuery()
|
if config.VRC_MIC_MUTE_SYNC is True:
|
||||||
|
self.setDisableVrcMicMuteSync()
|
||||||
if config.VRC_MIC_MUTE_SYNC is True:
|
mute_sync_info_flag = True
|
||||||
self.setEnableVrcMicMuteSync()
|
self.disableOscQuery(mute_sync_info=mute_sync_info_flag)
|
||||||
|
|
||||||
# init Auto device selection
|
# init Auto device selection
|
||||||
printLog("Init Device Manager")
|
printLog("Init Device Manager")
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import {
|
|||||||
|
|
||||||
useDeepLAuthKey,
|
useDeepLAuthKey,
|
||||||
|
|
||||||
|
useEnableVrcMicMuteSync,
|
||||||
|
|
||||||
useOscIpAddress,
|
useOscIpAddress,
|
||||||
useWebsocket,
|
useWebsocket,
|
||||||
} from "@logics_configs";
|
} from "@logics_configs";
|
||||||
@@ -34,6 +36,8 @@ export const _useBackendErrorHandling = () => {
|
|||||||
|
|
||||||
const { updateDeepLAuthKey } = useDeepLAuthKey();
|
const { updateDeepLAuthKey } = useDeepLAuthKey();
|
||||||
|
|
||||||
|
const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync();
|
||||||
|
|
||||||
const { updateOscIpAddress } = useOscIpAddress();
|
const { updateOscIpAddress } = useOscIpAddress();
|
||||||
const { updateEnableWebsocket, updateWebsocketHost, updateWebsocketPort } = useWebsocket();
|
const { updateEnableWebsocket, updateWebsocketHost, updateWebsocketPort } = useWebsocket();
|
||||||
|
|
||||||
@@ -130,6 +134,14 @@ export const _useBackendErrorHandling = () => {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case "/set/enable/vrc_mic_mute_sync":
|
||||||
|
// Normally, this path shouldn't happen because VRC Mic Mute Sync is disabled and can't be turned on from the UI.
|
||||||
|
if (message === "Cannot enable VRC mic mute sync while OSC query is disabled") {
|
||||||
|
updateEnableVrcMicMuteSync(data);
|
||||||
|
showNotification_Error("Cannot enable VRC Mic Mute Sync while OSC query is disabled");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
// Advanced Settings, error messages are set by Backend (EN only)
|
// Advanced Settings, error messages are set by Backend (EN only)
|
||||||
case "/set/data/osc_ip_address":
|
case "/set/data/osc_ip_address":
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNotificationStatus } from "@logics_common";
|
import { useNotificationStatus } from "@logics_common";
|
||||||
import {
|
import { useEnableVrcMicMuteSync } from "@logics_configs";
|
||||||
useEnableVrcMicMuteSync,
|
|
||||||
} from "@logics_configs";
|
|
||||||
|
|
||||||
export const useHandleOscQuery = () => {
|
export const useHandleOscQuery = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { showNotification_Warning } = useNotificationStatus();
|
const { showNotification_Warning } = useNotificationStatus();
|
||||||
const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync();
|
const { updateEnableVrcMicMuteSync } = useEnableVrcMicMuteSync();
|
||||||
|
|
||||||
const handleOscQuery = ({is_osc_query_enabled, disabled_functions}) => {
|
const handleOscQuery = ({ is_osc_query_enabled, disabled_functions }) => {
|
||||||
if (!is_osc_query_enabled && disabled_functions.length > 0) {
|
if (is_osc_query_enabled) {
|
||||||
const BASE_LABEL = t("common_warning.unable_to_use_osc_query");
|
updateEnableVrcMicMuteSync(prev => ({
|
||||||
let items_label = "";
|
...prev.data,
|
||||||
|
|
||||||
for (const disabled_function of disabled_functions) {
|
|
||||||
if (disabled_function === "vrc_mic_mute_sync") {
|
|
||||||
updateEnableVrcMicMuteSync({
|
|
||||||
is_enabled: false,
|
|
||||||
is_available: false,
|
|
||||||
});
|
|
||||||
const item = `- ${t("config_page.others.vrc_mic_mute_sync.label")}`;
|
|
||||||
items_label = `${items_label}\n${item}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const label = `${BASE_LABEL}${items_label}`;
|
|
||||||
showNotification_Warning(
|
|
||||||
label,
|
|
||||||
{ hide_duration: 10000, }
|
|
||||||
);
|
|
||||||
} else if (is_osc_query_enabled) {
|
|
||||||
updateEnableVrcMicMuteSync((old_value) => ({
|
|
||||||
...old_value.data,
|
|
||||||
is_available: true,
|
is_available: true,
|
||||||
}));
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!disabled_functions.length) {
|
||||||
|
updateEnableVrcMicMuteSync(prev => ({
|
||||||
|
...prev.data,
|
||||||
|
is_available: false,
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const items_label = disabled_functions
|
||||||
|
.filter(fn => fn === "vrc_mic_mute_sync")
|
||||||
|
.map(() => `- ${t("config_page.others.vrc_mic_mute_sync.label")}`)
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
|
updateEnableVrcMicMuteSync({
|
||||||
|
is_enabled: false,
|
||||||
|
is_available: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (items_label) {
|
||||||
|
const message = `${t("common_warning.unable_to_use_osc_query")}\n${items_label}`;
|
||||||
|
showNotification_Warning(message, { hide_duration: 10000 });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return { handleOscQuery };
|
||||||
handleOscQuery,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user