Add SAM rough mask workflow with sidebar preview and tests
- Restructure SAM rough mask workflow for sidebar preview - Add playwright tests for SAM workflow - Add ORA files for forest path and graveyard rooms - Update playwright config with trace on retry
This commit is contained in:
@@ -104,35 +104,27 @@
|
||||
<script>
|
||||
function oraEditor() {
|
||||
return {
|
||||
// File state
|
||||
filePath: '',
|
||||
oraPath: '',
|
||||
layers: [],
|
||||
|
||||
// Image dimensions
|
||||
imageWidth: 800,
|
||||
imageHeight: 600,
|
||||
|
||||
// Display scale
|
||||
scale: 25,
|
||||
|
||||
// Mode: 'review' or 'add'
|
||||
mode: 'review',
|
||||
|
||||
// Selected layer for editing
|
||||
selectedLayer: null,
|
||||
|
||||
// Add masked element mode
|
||||
entityName: '',
|
||||
|
||||
// Polygon state
|
||||
isDrawing: false,
|
||||
polygonPoints: [],
|
||||
polygonColor: '#FF0000',
|
||||
polygonWidth: 2,
|
||||
polygonPreviewUrl: null,
|
||||
|
||||
// SAM rough mask state
|
||||
isSamMode: false,
|
||||
samIncludePoints: [],
|
||||
samExcludePoints: [],
|
||||
@@ -142,7 +134,6 @@ function oraEditor() {
|
||||
denoiseStrength: 80,
|
||||
roughMaskThumbnailScale: 25,
|
||||
|
||||
// Mask extraction
|
||||
maskSubject: '',
|
||||
usePolygonHint: true,
|
||||
maskCount: 3,
|
||||
@@ -155,35 +146,30 @@ function oraEditor() {
|
||||
currentMaskIndex: 0,
|
||||
lastError: '',
|
||||
|
||||
// Settings
|
||||
showSettings: false,
|
||||
comfyUrl: localStorage.getItem('ora_comfy_url') || '127.0.0.1:8188',
|
||||
saveNotification: null,
|
||||
|
||||
// Krita modal
|
||||
showKritaModal: false,
|
||||
kritaTempPath: null,
|
||||
kritaPathCopied: false,
|
||||
|
||||
// Browse modal
|
||||
showBrowseModal: false,
|
||||
browsePath: '',
|
||||
browseDirectories: [],
|
||||
browseFiles: [],
|
||||
browseSelectedPath: null,
|
||||
|
||||
// Loading/error
|
||||
isLoading: false,
|
||||
error: '',
|
||||
|
||||
init() {
|
||||
console.log('ORA Editor initialized');
|
||||
this.setupKeyHandlers();
|
||||
this.$watch('scale', (newScale) => {
|
||||
this.roughMaskThumbnailScale = newScale;
|
||||
});
|
||||
},
|
||||
|
||||
$watch('scale', (newScale) => {
|
||||
this.roughMaskThumbnailScale = newScale;
|
||||
}),
|
||||
|
||||
setupKeyHandlers() {
|
||||
document.addEventListener('keydown', (e) => {
|
||||
@@ -192,7 +178,7 @@ function oraEditor() {
|
||||
});
|
||||
},
|
||||
|
||||
// === File Browser ===
|
||||
|
||||
async openBrowseModal() {
|
||||
this.browsePath = '';
|
||||
this.browseSelectedPath = null;
|
||||
@@ -250,7 +236,7 @@ function oraEditor() {
|
||||
}
|
||||
},
|
||||
|
||||
// === File Operations ===
|
||||
|
||||
async openFile() {
|
||||
if (!this.filePath || this.isLoading) return;
|
||||
|
||||
@@ -308,7 +294,7 @@ function oraEditor() {
|
||||
}
|
||||
},
|
||||
|
||||
// === Mode Management ===
|
||||
|
||||
enterAddMode() {
|
||||
console.log('[ORA EDITOR] Entering add masked element mode');
|
||||
this.mode = 'add';
|
||||
@@ -347,7 +333,7 @@ function oraEditor() {
|
||||
}
|
||||
},
|
||||
|
||||
// === Layer Operations ===
|
||||
|
||||
async toggleVisibility(layerName, visible) {
|
||||
const idx = this.layers.findIndex(l => l.name === layerName);
|
||||
if (idx >= 0) {
|
||||
@@ -426,7 +412,7 @@ function oraEditor() {
|
||||
});
|
||||
},
|
||||
|
||||
// === Polygon Drawing ===
|
||||
|
||||
startDrawing() {
|
||||
console.log('[ORA EDITOR] Starting polygon drawing mode');
|
||||
this.isDrawing = true;
|
||||
@@ -608,7 +594,7 @@ function oraEditor() {
|
||||
}
|
||||
},
|
||||
|
||||
// === SAM Rough Mask ===
|
||||
|
||||
startSamMode() {
|
||||
console.log('[ORA EDITOR] Starting SAM mode');
|
||||
this.isSamMode = true;
|
||||
@@ -758,7 +744,7 @@ function oraEditor() {
|
||||
win.document.close();
|
||||
},
|
||||
|
||||
// === Mask Extraction ===
|
||||
|
||||
async extractMask() {
|
||||
if (!this.maskSubject.trim()) return;
|
||||
|
||||
@@ -881,7 +867,7 @@ function oraEditor() {
|
||||
this.isSamMode = false;
|
||||
},
|
||||
|
||||
// === Krita Integration ===
|
||||
|
||||
async openInKrita() {
|
||||
if (!this.oraPath) return;
|
||||
|
||||
@@ -931,7 +917,7 @@ function oraEditor() {
|
||||
this.kritaPathCopied = false;
|
||||
},
|
||||
|
||||
// === Settings ===
|
||||
|
||||
saveSettings() {
|
||||
localStorage.setItem('ora_comfy_url', this.comfyUrl);
|
||||
this.showSettings = false;
|
||||
|
||||
Reference in New Issue
Block a user