ugcinc 4.1.31 → 4.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/graph-controller.d.ts +10 -6
- package/dist/graph-controller.js +25 -10
- package/package.json +1 -1
|
@@ -354,18 +354,22 @@ export declare function updatePreviewMapForConnection({ nodes, media, accounts,
|
|
|
354
354
|
accounts: AccountData[];
|
|
355
355
|
}): PreviewMap;
|
|
356
356
|
/**
|
|
357
|
-
* Re-generate preview
|
|
357
|
+
* Re-generate preview values for a source node and update all connections from it.
|
|
358
358
|
* Used for "shuffle" functionality in the editor.
|
|
359
359
|
*
|
|
360
|
-
* @param
|
|
360
|
+
* @param nodes - All workflow nodes
|
|
361
|
+
* @param sourceNodeId - The node to shuffle (typically a source node with a pool)
|
|
361
362
|
* @param shuffleCount - The shuffle index (0 = first pick, 1 = second pick, etc.)
|
|
362
363
|
* @param media - Media library for source nodes
|
|
363
364
|
* @param accounts - Account list for account nodes
|
|
364
|
-
* @
|
|
365
|
+
* @param currentPreviewMap - The current preview map to update
|
|
366
|
+
* @returns Updated preview map with new values for all connections from the source node
|
|
365
367
|
*/
|
|
366
|
-
export declare function shuffleNodePreview({
|
|
367
|
-
|
|
368
|
+
export declare function shuffleNodePreview({ nodes, sourceNodeId, shuffleCount, media, accounts, currentPreviewMap, }: {
|
|
369
|
+
nodes: WorkflowNodeDefinition[];
|
|
370
|
+
sourceNodeId: string;
|
|
368
371
|
shuffleCount: number;
|
|
369
372
|
media: Media[];
|
|
370
373
|
accounts: AccountData[];
|
|
371
|
-
|
|
374
|
+
currentPreviewMap: PreviewMap;
|
|
375
|
+
}): PreviewMap;
|
package/dist/graph-controller.js
CHANGED
|
@@ -981,19 +981,24 @@ function updatePreviewMapForConnection({ nodes, media, accounts, }) {
|
|
|
981
981
|
return computePreviewMap({ nodes, media, accounts });
|
|
982
982
|
}
|
|
983
983
|
/**
|
|
984
|
-
* Re-generate preview
|
|
984
|
+
* Re-generate preview values for a source node and update all connections from it.
|
|
985
985
|
* Used for "shuffle" functionality in the editor.
|
|
986
986
|
*
|
|
987
|
-
* @param
|
|
987
|
+
* @param nodes - All workflow nodes
|
|
988
|
+
* @param sourceNodeId - The node to shuffle (typically a source node with a pool)
|
|
988
989
|
* @param shuffleCount - The shuffle index (0 = first pick, 1 = second pick, etc.)
|
|
989
990
|
* @param media - Media library for source nodes
|
|
990
991
|
* @param accounts - Account list for account nodes
|
|
991
|
-
* @
|
|
992
|
+
* @param currentPreviewMap - The current preview map to update
|
|
993
|
+
* @returns Updated preview map with new values for all connections from the source node
|
|
992
994
|
*/
|
|
993
|
-
function shuffleNodePreview({
|
|
994
|
-
const
|
|
995
|
+
function shuffleNodePreview({ nodes, sourceNodeId, shuffleCount, media, accounts, currentPreviewMap, }) {
|
|
996
|
+
const sourceNode = nodes.find(n => n.id === sourceNodeId);
|
|
997
|
+
if (!sourceNode)
|
|
998
|
+
return currentPreviewMap;
|
|
999
|
+
const definition = nodes_1.nodeDefinitions[sourceNode.type];
|
|
995
1000
|
if (!definition)
|
|
996
|
-
return
|
|
1001
|
+
return currentPreviewMap;
|
|
997
1002
|
// Build context with shuffleCount as consumedCount
|
|
998
1003
|
const ctx = {
|
|
999
1004
|
inputPreviews: {},
|
|
@@ -1001,8 +1006,18 @@ function shuffleNodePreview({ node, shuffleCount, media, accounts, }) {
|
|
|
1001
1006
|
accounts,
|
|
1002
1007
|
selectionState: { consumedCount: shuffleCount },
|
|
1003
1008
|
};
|
|
1004
|
-
//
|
|
1005
|
-
const
|
|
1006
|
-
|
|
1007
|
-
|
|
1009
|
+
// Generate new outputs for this node
|
|
1010
|
+
const newOutputs = definition.generatePreviewFromNode(sourceNode, ctx, sourceNode.preview_outputs ?? null);
|
|
1011
|
+
if (!newOutputs)
|
|
1012
|
+
return currentPreviewMap;
|
|
1013
|
+
// Find all connections from this source and update their preview values
|
|
1014
|
+
const connections = deriveConnectionsInternal(nodes);
|
|
1015
|
+
const newMap = { ...currentPreviewMap };
|
|
1016
|
+
for (const conn of connections) {
|
|
1017
|
+
if (conn.sourceNodeId === sourceNodeId) {
|
|
1018
|
+
const key = `${conn.targetNodeId}:${conn.targetInputId}`;
|
|
1019
|
+
newMap[key] = newOutputs[conn.sourceOutputId] ?? null;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return newMap;
|
|
1008
1023
|
}
|