chore: checkpoint web Blender migration source, tools and docs
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-10 11:18:01 +08:00
parent 122142c26c
commit f3e21c6b98
6887 changed files with 257154 additions and 12294 deletions

View File

@@ -0,0 +1,27 @@
import {useState} from 'react';
import {parseNativeUVUnwrapOptions,UV_UNWRAP_BOOLEANS,type NativeUVUnwrapOptions} from '../../../protocol/editor-workflow';
export function UVUnwrapControls({disabled,onApply}:{disabled:boolean;onApply:(options:NativeUVUnwrapOptions)=>Promise<void>}){
const [draft,setDraft]=useState<Record<string,string>>({}),[weightGroupOverride,setWeightGroupOverride]=useState(false),[error,setError]=useState('');
const submit=async()=>{
if(disabled)return;
const options:Record<string,unknown>={};
for(const key of ['method','margin_method'])if(draft[key])options[key]=draft[key];
for(const key of UV_UNWRAP_BOOLEANS)if(draft[key])options[key]=draft[key]==='true';
for(const key of ['margin','iterations','weight_factor'])if(draft[key]?.trim())options[key]=Number(draft[key]);
if(weightGroupOverride)options.weight_group=draft.weight_group??'';
try{const parsed=parseNativeUVUnwrapOptions(options);setError('');await onApply(parsed);}catch(reason){setError(reason instanceof Error?reason.message:String(reason));}
};
const update=(key:string,value:string)=>setDraft(current=>({...current,[key]:value}));
return <details><summary>展开 UV</summary><form onSubmit={event=>{event.preventDefault();void submit();}}><fieldset disabled={disabled}>
<legend>展开设置</legend><p>留空或选择“沿用原生设置”,采用当前工程设置或 Blender 默认值。</p>
<label>方法<select aria-label="UV 展开方法" value={draft.method??''} onChange={event=>update('method',event.target.value)}><option value="">沿用原生设置</option><option value="ANGLE_BASED">Angle Based</option><option value="CONFORMAL">Conformal</option><option value="MINIMUM_STRETCH">Minimum Stretch</option></select></label>
<label>间距方式<select aria-label="UV 展开间距方式" value={draft.margin_method??''} onChange={event=>update('margin_method',event.target.value)}><option value="">沿用原生设置</option><option value="SCALED">Scaled</option><option value="ADD">Add</option><option value="FRACTION">Fraction</option></select></label>
{([['fill_holes','填补孔洞'],['correct_aspect','校正宽高比'],['use_subsurf_data','使用细分曲面'],['use_original_bounds','保留原始边界'],['no_flip','禁止翻转(Minimum Stretch)'],['use_weights','使用顶点组权重(Minimum Stretch)']] as const).map(([key,label])=><label key={key}>{label}<select aria-label={`UV ${label}`} value={draft[key]??''} onChange={event=>update(key,event.target.value)}><option value="">沿用原生设置</option><option value="true">开启</option><option value="false">关闭</option></select></label>)}
{([['margin','间距',0,1,'0.001'],['iterations','迭代次数(Minimum Stretch)',0,10000,'1'],['weight_factor','权重影响(Minimum Stretch)',-10000,10000,'any']] as const).map(([key,label,min,max,step])=><label key={key}>{label}<input aria-label={`UV ${label}`} type="number" min={min} max={max} step={step} value={draft[key]??''} placeholder="沿用原生设置" onChange={event=>update(key,event.target.value)}/></label>)}
<label><input type="checkbox" checked={weightGroupOverride} onChange={event=>setWeightGroupOverride(event.target.checked)}/>指定权重顶点组(留空可清除)</label>
<input aria-label="UV 权重顶点组" disabled={!weightGroupOverride} maxLength={63} value={draft.weight_group??''} onChange={event=>update('weight_group',event.target.value)}/>
<button type="button" onClick={()=>{setDraft({});setWeightGroupOverride(false);setError('');}}>沿用原生设置</button>
<button type="submit">展开所选 UV</button>{error?<output role="alert">{error}</output>:null}
</fieldset></form></details>;
}