melhorando a leitura de projetos no mmpCreator
Deploy / Deploy (push) Has been cancelled
Details
Deploy / Deploy (push) Has been cancelled
Details
This commit is contained in:
parent
0ff6235dba
commit
0beb9cddb5
|
|
@ -372,17 +372,9 @@ export async function parseMmpContent(xmlString) {
|
||||||
// 1. Identifica colunas de beat/patterns (usado para mapear steps)
|
// 1. Identifica colunas de beat/patterns (usado para mapear steps)
|
||||||
// Normalmente ficam dentro do primeiro container de Bassline
|
// Normalmente ficam dentro do primeiro container de Bassline
|
||||||
const bbTrackNodes = Array.from(xmlDoc.querySelectorAll('track[type="1"]'));
|
const bbTrackNodes = Array.from(xmlDoc.querySelectorAll('track[type="1"]'));
|
||||||
let sortedBBTrackNameNodes = [];
|
// Cada BBTrack do Song Editor representa uma “coluna/pattern” (pos 0, 192, 384...)
|
||||||
if (bbTrackNodes.length > 0) {
|
// então usamos o próprio array de BBTracks para nomear as patterns:
|
||||||
sortedBBTrackNameNodes = Array.from(
|
const sortedBBTrackNameNodes = bbTrackNodes;
|
||||||
bbTrackNodes[0].querySelectorAll("bbtco")
|
|
||||||
).sort((a, b) => {
|
|
||||||
return (
|
|
||||||
(parseInt(a.getAttribute("pos"), 10) || 0) -
|
|
||||||
(parseInt(b.getAttribute("pos"), 10) || 0)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// 2. EXTRAÇÃO DE INSTRUMENTOS DA RAIZ (SONG EDITOR)
|
// 2. EXTRAÇÃO DE INSTRUMENTOS DA RAIZ (SONG EDITOR)
|
||||||
|
|
|
||||||
|
|
@ -632,22 +632,23 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
// --- FUNÇÕES GLOBAIS DE FOCO NO PATTERN ---
|
// --- FUNÇÕES GLOBAIS DE FOCO NO PATTERN ---
|
||||||
|
|
||||||
window.openPatternEditor = function (basslineTrack) {
|
window.openPatternEditor = function (basslineTrack) {
|
||||||
console.log("Focando na Bassline:", basslineTrack.name);
|
console.log("Focando na Bassline:", basslineTrack.name);
|
||||||
|
|
||||||
appState.pattern.focusedBasslineId = basslineTrack.id;
|
appState.pattern.focusedBasslineId = basslineTrack.id;
|
||||||
|
|
||||||
// 🔥 chave: sincroniza a coluna/pattern com o BBTrack escolhido
|
if (Number.isInteger(basslineTrack.patternIndex)) {
|
||||||
if (Number.isInteger(basslineTrack.patternIndex)) {
|
// fonte de verdade: aplica em TODAS as tracks (samplers/plugins)
|
||||||
appState.pattern.activePatternIndex = basslineTrack.patternIndex;
|
sendAction({ type: "SET_ACTIVE_PATTERN", patternIndex: basslineTrack.patternIndex });
|
||||||
|
|
||||||
// opcional: manter o selector UI consistente (se existir)
|
// opcional: manter selector sincronizado
|
||||||
const sel = document.getElementById("global-pattern-selector");
|
const sel = document.getElementById("global-pattern-selector");
|
||||||
if (sel) sel.value = String(basslineTrack.patternIndex);
|
if (sel) sel.value = String(basslineTrack.patternIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderAll();
|
||||||
|
showToast(`Editando: ${basslineTrack.name}`, "info");
|
||||||
|
};
|
||||||
|
|
||||||
renderAll();
|
|
||||||
showToast(`Editando: ${basslineTrack.name}`, "info");
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
window.exitPatternFocus = function() {
|
window.exitPatternFocus = function() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue