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();
|
const currentXml = generateXmlFromState();
|
||||||
sendAction({ type: "SYNC_PATTERN_STATE", xml: currentXml });
|
sendAction({ type: "SYNC_PATTERN_STATE", xml: currentXml });
|
||||||
saveStateToSession();
|
saveStateToSession();
|
||||||
|
}
|
||||||
|
|
||||||
function ensureBbTrackCount(xmlDoc, neededCount) {
|
function ensureBbTrackCount(xmlDoc, neededCount) {
|
||||||
const songTc = xmlDoc.querySelector("song > trackcontainer");
|
const songTc = xmlDoc.querySelector("song > trackcontainer");
|
||||||
if (!songTc) return;
|
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;
|
if (bbTracks.length === 0) return;
|
||||||
|
|
||||||
const template = bbTracks[bbTracks.length - 1];
|
const template = bbTracks[bbTracks.length - 1];
|
||||||
|
|
@ -756,21 +756,19 @@ function ensureBbTrackCount(xmlDoc, neededCount) {
|
||||||
while (bbTracks.length < neededCount) {
|
while (bbTracks.length < neededCount) {
|
||||||
const clone = template.cloneNode(true);
|
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());
|
Array.from(clone.querySelectorAll(":scope > bbtco")).forEach((n) => n.remove());
|
||||||
|
|
||||||
// deixa o container interno “limpo” (opcional)
|
// ⚠️ Eu recomendo NÃO remover instrumentos internos aqui,
|
||||||
const inner = clone.querySelector('bbtrack > trackcontainer');
|
// senão o bbtrack clonado pode ficar mudo no LMMS.
|
||||||
if (inner) inner.querySelectorAll('track[type="0"]').forEach((n) => n.remove());
|
// (Então NÃO faça: inner.querySelectorAll('track[type="0"]').remove())
|
||||||
|
|
||||||
// nome default
|
clone.setAttribute("name", `Beat/Bassline ${bbTracks.length + 1}`);
|
||||||
clone.setAttribute("name", `Beat/Bassline ${bbTracks.length}`);
|
|
||||||
|
|
||||||
songTc.appendChild(clone);
|
songTc.appendChild(clone);
|
||||||
bbTracks.push(clone);
|
bbTracks.push(clone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function applyPlaylistClipsToXml(xmlDoc) {
|
function applyPlaylistClipsToXml(xmlDoc) {
|
||||||
const basslines = appState.pattern.tracks
|
const basslines = appState.pattern.tracks
|
||||||
|
|
@ -781,7 +779,10 @@ function applyPlaylistClipsToXml(xmlDoc) {
|
||||||
const maxIdx = Math.max(-1, ...basslines.map((b) => Number(b.patternIndex)));
|
const maxIdx = Math.max(-1, ...basslines.map((b) => Number(b.patternIndex)));
|
||||||
ensureBbTrackCount(xmlDoc, maxIdx + 1);
|
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;
|
if (!bbTrackNodes.length) return;
|
||||||
|
|
||||||
for (const b of basslines) {
|
for (const b of basslines) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue