corrigindo download de projetos no mmpCreator
Deploy / Deploy (push) Successful in 2m30s
Details
Deploy / Deploy (push) Successful in 2m30s
Details
This commit is contained in:
parent
24cb9d1e02
commit
717e1594d4
|
|
@ -742,13 +742,13 @@ export function syncPatternStateToServer() {
|
|||
const currentXml = generateXmlFromState();
|
||||
sendAction({ type: "SYNC_PATTERN_STATE", xml: currentXml });
|
||||
saveStateToSession();
|
||||
|
||||
}
|
||||
|
||||
function ensureBbTrackCount(xmlDoc, neededCount) {
|
||||
const songTc = xmlDoc.querySelector("song > trackcontainer");
|
||||
if (!songTc) return;
|
||||
|
||||
let bbTracks = Array.from(songTc.querySelectorAll(':scope > track[type="1"]'));
|
||||
const bbTracks = Array.from(songTc.querySelectorAll(':scope > track[type="1"]'));
|
||||
if (bbTracks.length === 0) return;
|
||||
|
||||
const template = bbTracks[bbTracks.length - 1];
|
||||
|
|
@ -756,21 +756,19 @@ function ensureBbTrackCount(xmlDoc, neededCount) {
|
|||
while (bbTracks.length < neededCount) {
|
||||
const clone = template.cloneNode(true);
|
||||
|
||||
// limpa blocos
|
||||
// limpa os clips (bbtco) do clone (opcional, mas bom)
|
||||
Array.from(clone.querySelectorAll(":scope > bbtco")).forEach((n) => n.remove());
|
||||
|
||||
// deixa o container interno “limpo” (opcional)
|
||||
const inner = clone.querySelector('bbtrack > trackcontainer');
|
||||
if (inner) inner.querySelectorAll('track[type="0"]').forEach((n) => n.remove());
|
||||
// ⚠️ Eu recomendo NÃO remover instrumentos internos aqui,
|
||||
// senão o bbtrack clonado pode ficar mudo no LMMS.
|
||||
// (Então NÃO faça: inner.querySelectorAll('track[type="0"]').remove())
|
||||
|
||||
// nome default
|
||||
clone.setAttribute("name", `Beat/Bassline ${bbTracks.length}`);
|
||||
clone.setAttribute("name", `Beat/Bassline ${bbTracks.length + 1}`);
|
||||
|
||||
songTc.appendChild(clone);
|
||||
bbTracks.push(clone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function applyPlaylistClipsToXml(xmlDoc) {
|
||||
const basslines = appState.pattern.tracks
|
||||
|
|
@ -781,7 +779,10 @@ function applyPlaylistClipsToXml(xmlDoc) {
|
|||
const maxIdx = Math.max(-1, ...basslines.map((b) => Number(b.patternIndex)));
|
||||
ensureBbTrackCount(xmlDoc, maxIdx + 1);
|
||||
|
||||
const bbTrackNodes = Array.from(xmlDoc.querySelectorAll('track[type="1"]'));
|
||||
const bbTrackNodes = Array.from(
|
||||
xmlDoc.querySelectorAll('song > trackcontainer > track[type="1"]')
|
||||
);
|
||||
|
||||
if (!bbTrackNodes.length) return;
|
||||
|
||||
for (const b of basslines) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue