fix viewport
This commit is contained in:
@@ -259,6 +259,80 @@ test('serializeExecutionGraph ignores group shells and resolves collapsed proxy
|
||||
assert.equal('10' in prompt, false);
|
||||
});
|
||||
|
||||
test('serializeExecutionGraph keeps only the View3D viewport snapshot, not camera pose', () => {
|
||||
const nodes = [
|
||||
{
|
||||
id: '1',
|
||||
data: {
|
||||
className: 'FieldSource',
|
||||
definition: {
|
||||
input: { required: {}, optional: {} },
|
||||
manual_trigger: false,
|
||||
},
|
||||
widgetValues: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
data: {
|
||||
className: 'View3D',
|
||||
definition: {
|
||||
input: {
|
||||
required: {
|
||||
field: ['DATA_FIELD', {}],
|
||||
camera_azimuth: ['FLOAT', {}],
|
||||
camera_polar: ['FLOAT', {}],
|
||||
camera_distance: ['FLOAT', {}],
|
||||
camera_target_x: ['FLOAT', {}],
|
||||
camera_target_y: ['FLOAT', {}],
|
||||
camera_target_z: ['FLOAT', {}],
|
||||
viewport_snapshot: ['STRING', {}],
|
||||
},
|
||||
optional: {},
|
||||
},
|
||||
manual_trigger: false,
|
||||
},
|
||||
widgetValues: {
|
||||
camera_azimuth: 0,
|
||||
camera_polar: 1.1,
|
||||
camera_distance: 1.8,
|
||||
camera_target_x: 0,
|
||||
camera_target_y: 0,
|
||||
camera_target_z: 0,
|
||||
viewport_snapshot: '',
|
||||
},
|
||||
runtimeValues: {
|
||||
camera_azimuth: 0.4,
|
||||
camera_polar: 1.3,
|
||||
camera_distance: 2.6,
|
||||
camera_target_x: 99,
|
||||
camera_target_y: 88,
|
||||
camera_target_z: 77,
|
||||
viewport_snapshot: 'data:image/png;base64,abc',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const edges = [
|
||||
{
|
||||
source: '1',
|
||||
sourceHandle: 'output::0::DATA_FIELD',
|
||||
target: '2',
|
||||
targetHandle: 'input::field::DATA_FIELD',
|
||||
},
|
||||
];
|
||||
|
||||
const prompt = serializeExecutionGraph(nodes, edges);
|
||||
|
||||
assert.deepEqual(prompt['2'], {
|
||||
class_type: 'View3D',
|
||||
inputs: {
|
||||
field: ['1', 0],
|
||||
viewport_snapshot: 'data:image/png;base64,abc',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('getAutoRunnableNodes ignores disconnected nodes when deciding what can auto-run', () => {
|
||||
const nodes = [
|
||||
{ id: '1', data: { definition: {}, widgetValues: {} } },
|
||||
|
||||
@@ -227,6 +227,40 @@ test('hydrateWorkflowState clears saved folder selections on shared workflows',
|
||||
assert.deepEqual(hydrated.nodes[0].data.definition.output_name, ['path']);
|
||||
});
|
||||
|
||||
test('View3D runtime viewport state is not persisted or rehydrated with workflows', () => {
|
||||
const nodes = [
|
||||
{
|
||||
id: '41',
|
||||
type: 'custom',
|
||||
position: { x: 10, y: 20 },
|
||||
data: {
|
||||
label: '3D View',
|
||||
className: 'View3D',
|
||||
widgetValues: { z_scale: 1 },
|
||||
runtimeValues: {
|
||||
camera_azimuth: 0.42,
|
||||
camera_polar: 1.2,
|
||||
camera_distance: 2.5,
|
||||
camera_target_x: 0.1,
|
||||
camera_target_y: 0.2,
|
||||
camera_target_z: 0.3,
|
||||
viewport_snapshot: 'data:image/png;base64,abc',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const serialized = serializeWorkflowState(nodes, []);
|
||||
|
||||
assert.equal('runtimeValues' in serialized.nodes[0].data, false);
|
||||
|
||||
const hydrated = hydrateWorkflowState(serialized, {
|
||||
View3D: { output: ['MESH_MODEL', 'IMAGE'], output_name: ['mesh', 'viewport'] },
|
||||
});
|
||||
|
||||
assert.deepEqual(hydrated.nodes[0].data.runtimeValues, {});
|
||||
});
|
||||
|
||||
test('workflow serialization preserves wrapper class names for group shells', () => {
|
||||
const nodes = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user