Allow 0.1 step for emit speed and tempo
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.22 R196";
|
window.CHGRID_WEB_VERSION = "2026.02.22 R197";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -308,13 +308,13 @@ export function createItemPropertyEditor(deps: EditorDeps): {
|
|||||||
} else if (
|
} else if (
|
||||||
propertyKey === 'mediaVolume' ||
|
propertyKey === 'mediaVolume' ||
|
||||||
propertyKey === 'emitVolume' ||
|
propertyKey === 'emitVolume' ||
|
||||||
propertyKey === 'emitSoundSpeed' ||
|
|
||||||
propertyKey === 'emitSoundTempo' ||
|
|
||||||
propertyKey === 'emitRange' ||
|
propertyKey === 'emitRange' ||
|
||||||
propertyKey === 'sides' ||
|
propertyKey === 'sides' ||
|
||||||
propertyKey === 'number'
|
propertyKey === 'number'
|
||||||
) {
|
) {
|
||||||
if (!submitNumericParam(propertyKey, true)) return;
|
if (!submitNumericParam(propertyKey, true)) return;
|
||||||
|
} else if (propertyKey === 'emitSoundSpeed' || propertyKey === 'emitSoundTempo') {
|
||||||
|
if (!submitNumericParam(propertyKey, false)) return;
|
||||||
} else if (propertyKey === 'mediaEffect' || propertyKey === 'emitEffect') {
|
} else if (propertyKey === 'mediaEffect' || propertyKey === 'emitEffect') {
|
||||||
const normalized = value.trim().toLowerCase();
|
const normalized = value.trim().toLowerCase();
|
||||||
if (!deps.effectIds.has(normalized)) {
|
if (!deps.effectIds.has(normalized)) {
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ GLOBAL_ITEM_PROPERTY_METADATA: dict[str, dict[str, object]] = {
|
|||||||
"emitSoundSpeed": {
|
"emitSoundSpeed": {
|
||||||
"valueType": "number",
|
"valueType": "number",
|
||||||
"tooltip": "Global emitted sound speed/pitch percent. 50 is normal.",
|
"tooltip": "Global emitted sound speed/pitch percent. 50 is normal.",
|
||||||
"range": {"min": 0, "max": 100, "step": 1},
|
"range": {"min": 0, "max": 100, "step": 0.1},
|
||||||
},
|
},
|
||||||
"emitSoundTempo": {
|
"emitSoundTempo": {
|
||||||
"valueType": "number",
|
"valueType": "number",
|
||||||
"tooltip": "Global emitted sound tempo percent. 50 is normal.",
|
"tooltip": "Global emitted sound tempo percent. 50 is normal.",
|
||||||
"range": {"min": 0, "max": 100, "step": 1},
|
"range": {"min": 0, "max": 100, "step": 0.1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ PROPERTY_METADATA: dict[str, dict[str, object]] = {
|
|||||||
"emitSoundSpeed": {
|
"emitSoundSpeed": {
|
||||||
"valueType": "number",
|
"valueType": "number",
|
||||||
"tooltip": "Playback speed/pitch percent for emitted sound. 50 is normal, 0 is half, 100 is double. Using speed and tempo together may sound weird.",
|
"tooltip": "Playback speed/pitch percent for emitted sound. 50 is normal, 0 is half, 100 is double. Using speed and tempo together may sound weird.",
|
||||||
"range": {"min": 0, "max": 100, "step": 1},
|
"range": {"min": 0, "max": 100, "step": 0.1},
|
||||||
},
|
},
|
||||||
"emitSoundTempo": {
|
"emitSoundTempo": {
|
||||||
"valueType": "number",
|
"valueType": "number",
|
||||||
"tooltip": "Playback tempo percent for emitted sound. 50 is normal, 0 is half, 100 is double. Using speed and tempo together may sound weird.",
|
"tooltip": "Playback tempo percent for emitted sound. 50 is normal, 0 is half, 100 is double. Using speed and tempo together may sound weird.",
|
||||||
"range": {"min": 0, "max": 100, "step": 1},
|
"range": {"min": 0, "max": 100, "step": 0.1},
|
||||||
},
|
},
|
||||||
"emitEffect": {"valueType": "list", "tooltip": "Effect applied to emitted sound."},
|
"emitEffect": {"valueType": "list", "tooltip": "Effect applied to emitted sound."},
|
||||||
"emitEffectValue": {
|
"emitEffectValue": {
|
||||||
@@ -147,20 +147,20 @@ def validate_update(item: WorldItem, next_params: dict) -> dict:
|
|||||||
next_params["emitVolume"] = emit_volume
|
next_params["emitVolume"] = emit_volume
|
||||||
|
|
||||||
try:
|
try:
|
||||||
emit_speed = int(next_params.get("emitSoundSpeed", item.params.get("emitSoundSpeed", 50)))
|
emit_speed = float(next_params.get("emitSoundSpeed", item.params.get("emitSoundSpeed", 50)))
|
||||||
except (TypeError, ValueError) as exc:
|
except (TypeError, ValueError) as exc:
|
||||||
raise ValueError("emitSoundSpeed must be an integer between 0 and 100.") from exc
|
raise ValueError("emitSoundSpeed must be a number between 0 and 100.") from exc
|
||||||
if not (0 <= emit_speed <= 100):
|
if not (0 <= emit_speed <= 100):
|
||||||
raise ValueError("emitSoundSpeed must be between 0 and 100.")
|
raise ValueError("emitSoundSpeed must be between 0 and 100.")
|
||||||
next_params["emitSoundSpeed"] = emit_speed
|
next_params["emitSoundSpeed"] = round(emit_speed, 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
emit_tempo = int(next_params.get("emitSoundTempo", item.params.get("emitSoundTempo", 50)))
|
emit_tempo = float(next_params.get("emitSoundTempo", item.params.get("emitSoundTempo", 50)))
|
||||||
except (TypeError, ValueError) as exc:
|
except (TypeError, ValueError) as exc:
|
||||||
raise ValueError("emitSoundTempo must be an integer between 0 and 100.") from exc
|
raise ValueError("emitSoundTempo must be a number between 0 and 100.") from exc
|
||||||
if not (0 <= emit_tempo <= 100):
|
if not (0 <= emit_tempo <= 100):
|
||||||
raise ValueError("emitSoundTempo must be between 0 and 100.")
|
raise ValueError("emitSoundTempo must be between 0 and 100.")
|
||||||
next_params["emitSoundTempo"] = emit_tempo
|
next_params["emitSoundTempo"] = round(emit_tempo, 1)
|
||||||
|
|
||||||
emit_effect = str(next_params.get("emitEffect", item.params.get("emitEffect", "off"))).strip().lower()
|
emit_effect = str(next_params.get("emitEffect", item.params.get("emitEffect", "off"))).strip().lower()
|
||||||
if emit_effect not in EFFECT_OPTIONS:
|
if emit_effect not in EFFECT_OPTIONS:
|
||||||
|
|||||||
Reference in New Issue
Block a user