Added Rigging column in Kanban board

This commit is contained in:
Bruno Fargnoli 2026-07-15 18:20:47 +02:00
parent e6a82adb94
commit 2537913cba
9 changed files with 217 additions and 22 deletions

140
server.js
View file

@ -1576,7 +1576,7 @@ function getCustomApiConfig(settings, selectedApi, expectedType = null) {
throw new Error('Selected custom API was not found in settings');
}
const normalizedType = ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing'].includes(customApi?.type)
const normalizedType = ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing', 'mesh-rigging'].includes(customApi?.type)
? customApi.type
: 'image-generation';
@ -4795,6 +4795,144 @@ app.post('/api/meshes/texture', async (req, res) => {
}
});
// Kanban "Rigging" column custom-API runner. Mirrors the mesh texturing/edit
// flow: takes a source mesh, POSTs it to the user's configured mesh-rigging
// custom API, and saves the returned mesh as a version of the source. Distinct
// from POST /api/meshes/rig, which proxies the built-in rig micro-service.
app.post('/api/meshes/rigging', async (req, res) => {
let processingProjectId = null;
let processingCardId = null;
let processingCardName = null;
let processingStartedAt = Date.now();
try {
const { projectId, selectedApi, prompt, name, meshSource, cardId } = req.body;
const trimmedName = String(name || '').trim();
const trimmedPrompt = String(prompt || '').trim();
if (!projectId || !selectedApi || !trimmedPrompt || !trimmedName) {
return res.status(400).json({ error: 'projectId, selectedApi, prompt and name are required' });
}
if (!String(selectedApi).startsWith('custom_')) {
return res.status(400).json({ error: 'Mesh rigging currently supports custom APIs only' });
}
const resolvedSource = await resolveProjectMeshSource(Number(projectId), meshSource);
const sourceAsset = resolvedSource?.asset;
if (!resolvedSource || !sourceAsset || sourceAsset.type !== 'mesh') {
return res.status(404).json({ error: 'Source mesh not found' });
}
processingProjectId = Number(projectId);
processingCardId = cardId || sourceAsset.metadata?.cardId || randomUUID();
processingCardName = trimmedName;
processingStartedAt = Date.now();
await updateCardProcessingSnapshot(processingProjectId, processingCardId, {
columnName: 'Rigging',
name: processingCardName,
status: 'processing',
progressPercent: null,
detail: 'Submitting mesh rigging request',
currentNodeLabel: 'Waiting for API response',
source: 'API',
operationType: 'mesh-rigging',
startedAt: processingStartedAt
});
const settings = await getSettings();
const customApi = getCustomApiConfig(settings, selectedApi, 'mesh-rigging');
const sourceFilePath = toAbsoluteStoragePath(resolvedSource.inputFilePath);
const sourceBuffer = await fs.readFile(sourceFilePath);
const meshMimeType = getMimeTypeFromFilename(resolvedSource.inputFilePath || resolvedSource.inputFilename || resolvedSource.inputName);
const replacements = {
prompt: trimmedPrompt,
name: trimmedName,
projectId: String(projectId),
cardId: String(processingCardId || ''),
meshBase64: sourceBuffer.toString('base64'),
meshMimeType,
meshFilename: path.basename(resolvedSource.inputFilePath || resolvedSource.inputFilename || resolvedSource.inputName || 'mesh.glb')
};
const requestHeaders = {
'Content-Type': 'application/json',
...replaceTemplatePlaceholders(parseJsonTemplate(customApi.headers, 'Custom API headers', {}), replacements)
};
const requestPayload = replaceTemplatePlaceholders(parseJsonTemplate(customApi.body, 'Custom API body template', {}), replacements);
const response = await fetch(customApi.url, {
method: 'POST',
headers: requestHeaders,
body: JSON.stringify(requestPayload)
});
let responseBody = null;
const responseContentType = response.headers.get('content-type') || '';
if (String(responseContentType).toLowerCase().includes('application/json')) {
responseBody = await response.json().catch(() => ({}));
}
if (!response.ok) {
return res.status(response.status).json({
error: responseBody?.error?.message || responseBody?.error || 'Mesh rigging request failed'
});
}
const meshOutput = await extractMeshOutputFromApiResponse(response, responseBody);
const extension = path.extname(meshOutput.filename).replace('.', '') || getExtensionFromContentType(meshOutput.contentType, 'glb');
const filename = `${Date.now()}-${Math.round(Math.random() * 1E9)}.${extension}`;
const storedFilePath = toStoredAssetPath('mesh', filename);
const absoluteFilePath = toAbsoluteStoragePath(storedFilePath);
await fs.mkdir(path.dirname(absoluteFilePath), { recursive: true });
await fs.writeFile(absoluteFilePath, meshOutput.buffer);
// The result was produced from an existing source mesh, so save it as a
// version (child) of that mesh instead of creating a new root asset.
const savedAsset = await createAssetVersion({
assetId: sourceAsset.id,
type: 'mesh',
name: trimmedName,
filePath: storedFilePath,
metadata: {
format: extension.toUpperCase(),
source: 'API',
provider: customApi.name,
prompt: trimmedPrompt,
cardId: processingCardId
},
createdAt: Date.now(),
// The generated geometry differs from the parent, so render its own thumbnail.
inheritThumbnail: false
});
await clearCardProcessingState(processingProjectId, processingCardId, {
name: processingCardName
});
res.status(201).json(savedAsset);
} catch (err) {
console.error('Mesh rigging API execution failed:', err);
if (processingProjectId && processingCardId) {
await updateCardProcessingSnapshot(processingProjectId, processingCardId, {
columnName: 'Rigging',
name: processingCardName,
status: 'error',
progressPercent: null,
detail: err.message || 'Failed to run mesh rigging API',
currentNodeLabel: 'Mesh rigging failed',
source: 'API',
operationType: 'mesh-rigging',
startedAt: processingStartedAt
}).catch(persistErr => {
console.warn('Failed to persist mesh rigging error state:', persistErr.message);
});
}
res.status(500).json({ error: err.message || 'Failed to run mesh rigging API' });
}
});
app.post('/api/projects', async (req, res) => {
try {
res.status(201).json(await createProject(req.body));

View file

@ -7,7 +7,8 @@ const CUSTOM_API_TYPE_OPTIONS = [
{ value: 'image-edit', label: 'Image Edit' },
{ value: 'mesh-generation', label: 'Mesh Generation' },
{ value: 'mesh-edit', label: 'Mesh Edit' },
{ value: 'mesh-texturing', label: 'Mesh Texturing' }
{ value: 'mesh-texturing', label: 'Mesh Texturing' },
{ value: 'mesh-rigging', label: 'Mesh Rigging' }
]
function getCustomApiTypeLabel(type) {

View file

@ -82,7 +82,8 @@ export default function KanbanImageCard({
const isMeshGenCard = card.kanbanColumnId === 3
const isMeshEditCard = card.kanbanColumnId === 4
const isTexturingCard = card.kanbanColumnId === 5
const isMeshWorkflowCard = isMeshGenCard || isMeshEditCard || isTexturingCard
const isRiggingCard = card.kanbanColumnId === 6
const isMeshWorkflowCard = isMeshGenCard || isMeshEditCard || isTexturingCard || isRiggingCard
const carouselItems = getCardPreviewItems(card, showAttributes)
const useAssetCarousel = carouselItems.length > 0
const previewAssets = isMeshWorkflowCard && (card.meshAssets?.length || 0) > 0 && !useAssetCarousel
@ -101,8 +102,8 @@ export default function KanbanImageCard({
const availableActionApis = getApiOptionsForCard(card)
const availableActionWorkflows = getWorkflowsForCard(card)
const selectedActionWorkflow = availableActionWorkflows.find(workflow => workflow.id == imageEditDraft?.workflowId) || null
const apiSourceGroups = isMeshEditCard || isTexturingCard ? meshSourceGroups : imageSourceGroups
const apiSourceValueType = isMeshEditCard || isTexturingCard ? 'mesh' : 'image'
const apiSourceGroups = isMeshEditCard || isTexturingCard || isRiggingCard ? meshSourceGroups : imageSourceGroups
const apiSourceValueType = isMeshEditCard || isTexturingCard || isRiggingCard ? 'mesh' : 'image'
return (
<div
@ -428,7 +429,7 @@ export default function KanbanImageCard({
{imageEditDraft.mode === 'api' ? (
<>
<div className="params-card__field">
<label className="params-card__label font-label">{isMeshEditCard || isTexturingCard ? 'Mesh' : 'Image'}</label>
<label className="params-card__label font-label">{isMeshEditCard || isTexturingCard || isRiggingCard ? 'Mesh' : 'Image'}</label>
<select
className="image-card__attribute-select"
value={imageEditDraft.selectedAssetId}
@ -437,7 +438,7 @@ export default function KanbanImageCard({
{isMeshGenCard && (isTencentMeshGenerationApi(imageEditDraft.selectedApi) || isTripoMeshGenerationApi(imageEditDraft.selectedApi)) && (
<option value="">No image source (use prompt)</option>
)}
{apiSourceGroups.length === 0 && <option value="">{isMeshEditCard || isTexturingCard ? 'No meshes available' : 'No images available'}</option>}
{apiSourceGroups.length === 0 && <option value="">{isMeshEditCard || isTexturingCard || isRiggingCard ? 'No meshes available' : 'No images available'}</option>}
{apiSourceGroups.map(group => (
<optgroup key={group.asset.id} label={group.asset.name}>
{group.options.map(option => (
@ -638,6 +639,8 @@ export default function KanbanImageCard({
? 'No compatible ComfyUI workflow available for mesh edits.'
: isTexturingCard
? 'No compatible ComfyUI workflow available for mesh texturing.'
: isRiggingCard
? 'No compatible ComfyUI workflow available for mesh rigging.'
: 'No compatible ComfyUI workflow available for image edits.'}</span>
</div>
)}

View file

@ -143,6 +143,22 @@ export function ProjectProvider({ children }) {
return data
}
const runMeshRiggingApi = async (projectId, rigData) => {
const res = await fetch(`${API_BASE}/meshes/rigging`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ projectId, ...rigData })
})
const data = await res.json()
if (!res.ok) {
throw new Error(data?.error || 'Failed to run mesh rigging API')
}
return data
}
const runMeshEditApi = async (projectId, editData) => {
const res = await fetch(`${API_BASE}/meshes/edit`, {
method: 'POST',
@ -1199,6 +1215,7 @@ export function ProjectProvider({ children }) {
queryHitemMeshGenerationResult,
runMeshEditApi,
runMeshTexturingApi,
runMeshRiggingApi,
runImageEditComfy,
generateImage,
getComfyWorkflows,

View file

@ -5,7 +5,7 @@ import { API_BASE } from '../config'
const DEFAULT_CUSTOM_API_TYPE = 'image-generation'
function normalizeCustomApiType(type) {
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing'].includes(type)
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing', 'mesh-rigging'].includes(type)
? type
: DEFAULT_CUSTOM_API_TYPE
}

View file

@ -86,6 +86,7 @@ export default function KanbanPage() {
queryHitemMeshGenerationResult,
runMeshEditApi,
runMeshTexturingApi,
runMeshRiggingApi,
runImageEditComfy,
generateImage,
getComfyWorkflows,
@ -977,9 +978,15 @@ export default function KanbanPage() {
.map(api => ({ id: `custom_${api.id}`, name: api.name }))
), [customApis])
const meshRiggingApis = useMemo(() => (
customApis
.filter(api => normalizeCustomApiType(api?.type) === 'mesh-rigging')
.map(api => ({ id: `custom_${api.id}`, name: api.name }))
), [customApis])
const getWorkflowsForCard = (card) => {
if (card?.kanbanColumnId === 3) return meshGenWorkflows
if ([4, 5].includes(card?.kanbanColumnId)) return meshEditWorkflows
if ([4, 5, 6].includes(card?.kanbanColumnId)) return meshEditWorkflows
return imageEditWorkflows
}
@ -987,6 +994,7 @@ export default function KanbanPage() {
if (columnId === 3) return meshGenerationApis
if (columnId === 4) return meshEditApis
if (columnId === 5) return meshTexturingApis
if (columnId === 6) return meshRiggingApis
return imageEditApis
}
@ -1614,7 +1622,7 @@ export default function KanbanPage() {
const getCardPreviewItems = (card, showAttributes = false) => {
const hasMeshAssets = (card.meshAssets?.length || 0) > 0
const useMixedAssetCarousel = showAttributes && [3, 4, 5].includes(card.kanbanColumnId) && hasMeshAssets
const useMixedAssetCarousel = showAttributes && [3, 4, 5, 6].includes(card.kanbanColumnId) && hasMeshAssets
if (!useMixedAssetCarousel) {
return []
@ -1784,7 +1792,7 @@ export default function KanbanPage() {
name: '',
selectedApi: defaultSelectedApi,
prompt: '',
selectedAssetId: [4, 5].includes(card.kanbanColumnId)
selectedAssetId: [4, 5, 6].includes(card.kanbanColumnId)
? (card.meshAssets[0]?.id ? `asset:${card.meshAssets[0].id}` : '')
: (card.assets[0]?.id ? `asset:${card.assets[0].id}` : ''),
workflowId: initialWorkflow?.id || '',
@ -2101,9 +2109,10 @@ export default function KanbanPage() {
const isMeshGenCard = card.kanbanColumnId === 3
const isMeshEditCard = card.kanbanColumnId === 4
const isTexturingCard = card.kanbanColumnId === 5
const isMeshWorkflowCard = isMeshGenCard || isMeshEditCard || isTexturingCard
const actionLabel = isMeshGenCard ? 'mesh generation' : isMeshEditCard ? 'mesh edit' : isTexturingCard ? 'mesh texturing' : 'image edit'
const sourceAssetLabel = isMeshEditCard || isTexturingCard ? 'mesh' : 'image'
const isRiggingCard = card.kanbanColumnId === 6
const isMeshWorkflowCard = isMeshGenCard || isMeshEditCard || isTexturingCard || isRiggingCard
const actionLabel = isMeshGenCard ? 'mesh generation' : isMeshEditCard ? 'mesh edit' : isTexturingCard ? 'mesh texturing' : isRiggingCard ? 'mesh rigging' : 'image edit'
const sourceAssetLabel = isMeshEditCard || isTexturingCard || isRiggingCard ? 'mesh' : 'image'
// Track every mesh item (roots and their versions/children) so the focus
// logic can detect a newly generated child mesh, not just new root meshes.
const existingMeshAssetIds = (card.meshAssets || [])
@ -2380,6 +2389,21 @@ export default function KanbanPage() {
cardId: card.id,
existingMeshAssetIds
})
} else if (isRiggingCard) {
const riggedMesh = await runMeshRiggingApi(projectId, {
meshSource: imageEditDraft.selectedAssetId,
name,
selectedApi: imageEditDraft.selectedApi,
prompt,
cardId: card.id
})
await ensureGeneratedMeshThumbnails(riggedMesh)
queueResultFocus({
type: 'mesh-result',
cardId: card.id,
existingMeshAssetIds
})
} else {
await runImageEditApi(projectId, {
imageSource: imageEditDraft.selectedAssetId,
@ -2531,9 +2555,9 @@ export default function KanbanPage() {
inputs: inputValues,
promptId,
clientId,
// Mesh Edit / Texturing operate on an existing mesh — save the result
// as a version (child) of that source mesh.
parentAssetId: (isMeshEditCard || isTexturingCard) ? primaryMeshAssetId : null
// Mesh Edit / Texturing / Rigging operate on an existing mesh — save
// the result as a version (child) of that source mesh.
parentAssetId: (isMeshEditCard || isTexturingCard || isRiggingCard) ? primaryMeshAssetId : null
})
await ensureGeneratedMeshThumbnails(generatedMeshes)
@ -2549,8 +2573,8 @@ export default function KanbanPage() {
[card.id]: {
...prev[card.id],
progressPercent: 100,
detail: isMeshGenCard ? 'Saving generated mesh' : isTexturingCard ? 'Saving textured mesh' : 'Saving edited mesh',
currentNodeLabel: isMeshGenCard ? 'ComfyUI mesh generation completed' : isTexturingCard ? 'ComfyUI mesh texturing completed' : 'ComfyUI mesh edit completed'
detail: isMeshGenCard ? 'Saving generated mesh' : isTexturingCard ? 'Saving textured mesh' : isRiggingCard ? 'Saving rigged mesh' : 'Saving edited mesh',
currentNodeLabel: isMeshGenCard ? 'ComfyUI mesh generation completed' : isTexturingCard ? 'ComfyUI mesh texturing completed' : isRiggingCard ? 'ComfyUI mesh rigging completed' : 'ComfyUI mesh edit completed'
}
}
: prev)
@ -2599,6 +2623,8 @@ export default function KanbanPage() {
? 'Mesh edit completed successfully.'
: isTexturingCard
? 'Mesh texturing completed successfully.'
: isRiggingCard
? 'Mesh rigging completed successfully.'
: 'Image edit completed successfully.', 'success')
} catch (err) {
console.error(`Failed to run ${actionLabel}:`, err)
@ -2611,6 +2637,8 @@ export default function KanbanPage() {
? 'Failed to run mesh edit'
: isTexturingCard
? 'Failed to run mesh texturing'
: isRiggingCard
? 'Failed to run mesh rigging'
: 'Failed to run image edit')
showStatusMessage(failureMessage, 'error')
@ -2642,6 +2670,12 @@ export default function KanbanPage() {
failureMessage,
meshTexturingApis.find(api => api.id === imageEditDraft?.selectedApi)?.name || 'Mesh texturing API'
)
} else if (isRiggingCard) {
pushExternalApiFailureNotification(
'Mesh rigging failed',
failureMessage,
meshRiggingApis.find(api => api.id === imageEditDraft?.selectedApi)?.name || 'Mesh rigging API'
)
} else {
pushExternalApiFailureNotification(
'Image edit failed',

View file

@ -60,7 +60,7 @@ export const CONNECTOR_TYPE_META = {
}
export function normalizeCustomApiType(type) {
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing'].includes(type)
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing', 'mesh-rigging'].includes(type)
? type
: DEFAULT_CUSTOM_API_TYPE
}

View file

@ -49,6 +49,7 @@ export const IMAGE_CARD_COLUMNS = [
{ id: 'meshgen', dbId: 3, icon: 'deployed_code', title: 'MESH GEN', showAttributes: true, emptyLabel: 'Drag an image card here to generate a mesh' },
{ id: 'meshedit', dbId: 4, icon: 'edit_square', title: 'MESH EDIT', showAttributes: true, emptyLabel: 'Drag a mesh card here to edit it' },
{ id: 'texturing', dbId: 5, icon: 'texture', title: 'TEXTURING', showAttributes: true, emptyLabel: 'Drag a mesh card here to texture it' },
{ id: 'rigging', dbId: 6, icon: 'accessibility_new', title: 'RIGGING', showAttributes: true, emptyLabel: 'Drag a mesh card here to rig it' },
]
export const DEFAULT_ATTRIBUTE_TYPE_ID = 1
@ -71,7 +72,7 @@ export function getWorkflowFileInputIcon(valueType) {
}
export function normalizeCustomApiType(type) {
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing'].includes(type)
return ['image-generation', 'image-edit', 'mesh-generation', 'mesh-edit', 'mesh-texturing', 'mesh-rigging'].includes(type)
? type
: DEFAULT_CUSTOM_API_TYPE
}

View file

@ -21,7 +21,8 @@ const KANBAN_COLUMNS = [
{ id: 2, name: 'Image Edit', position: 1 },
{ id: 3, name: 'Mesh Gen', position: 2 },
{ id: 4, name: 'Mesh Edit', position: 3 },
{ id: 5, name: 'Texturing', position: 4 }
{ id: 5, name: 'Texturing', position: 4 },
{ id: 6, name: 'Rigging', position: 5 }
];
const ASSET_TYPES = [
{ id: 1, name: 'Image' },