* Render environment editor: rotation, intensity, backdrop colour and ground through render.environment.set * Render environment editor: rotation ring in the view with one undo step per drag * Render environment: Source, orientation, backdrop, ground and atmosphere sections * Keep segmented controls inside their allocated rows * fix: compile legacy environment controls only for tests
This commit is contained in:
@@ -0,0 +1,466 @@
|
||||
{
|
||||
"en": {
|
||||
"render.environment.orientation": "Orientation and strength",
|
||||
"render.environment.hdr_file": "HDR file",
|
||||
"render.environment.builtin": "Built-in HDR",
|
||||
"render.environment.constant": "Constant",
|
||||
"render.environment.embedded": "Saved inside this design",
|
||||
"render.environment.source_raytrace": "Environment sources need CPU or GPU ray tracing.",
|
||||
"render.environment.zenith": "Zenith",
|
||||
"render.environment.horizon": "Horizon",
|
||||
"render.environment.sky_ground": "Ground",
|
||||
"render.environment.primaries_gpu": "Interpreting unspecified primaries needs GPU path tracing.",
|
||||
"render.environment.lighting_samples": "Lighting samples",
|
||||
"render.environment.samples_cpu": "Lighting samples are set by the GPU path tracing budget; this setting needs CPU ray tracing.",
|
||||
"render.environment.world": "World",
|
||||
"render.environment.gradient": "Gradient",
|
||||
"render.environment.mode": "Mode",
|
||||
"render.environment.start": "Start",
|
||||
"render.environment.end": "End",
|
||||
"render.environment.world_pending": "World backdrop is unavailable: camera visibility of the environment has no saved setting yet.",
|
||||
"render.environment.blur_pending": "Blur is unavailable: the renderer has no backdrop blur setting.",
|
||||
"render.environment.backdrop_note": "A backdrop is seen by the camera only. It never lights, casts shadows or reflects, and is refused with transparent output.",
|
||||
"render.environment.gradient_gpu": "Gradient backdrop needs GPU path tracing.",
|
||||
"render.environment.radial_only": "Centre and radius apply to Radial mode.",
|
||||
"render.environment.ground": "Ground and stage",
|
||||
"render.environment.margin": "Extent margin",
|
||||
"render.environment.gap": "Clearance gap",
|
||||
"render.environment.reflectance": "Reflectance",
|
||||
"render.environment.replace": "Confirm replacing the existing stage",
|
||||
"render.environment.fit": "Fit and save ground",
|
||||
"render.environment.floor_wall": "Floor and wall",
|
||||
"render.environment.cyclorama": "Cyclorama",
|
||||
"render.environment.saved_panels": "Saved panels {count}",
|
||||
"render.environment.remove": "Remove stage",
|
||||
"render.environment.remove_confirm": "Remove the saved stage?",
|
||||
"render.environment.remove_note": "Removes the {count} passive panels from this shot. The camera backdrop stays.",
|
||||
"render.environment.stage_raytrace": "Physical stages need CPU or GPU ray tracing.",
|
||||
"render.environment.atmosphere": "Atmosphere",
|
||||
"render.environment.medium": "Participating medium",
|
||||
"render.environment.min": "Min bounds",
|
||||
"render.environment.max": "Max bounds",
|
||||
"render.environment.extinction": "Extinction",
|
||||
"render.environment.albedo": "Albedo",
|
||||
"render.environment.phase": "Phase",
|
||||
"render.environment.needs_gpu": "Needs GPU path tracing.",
|
||||
"render.environment.choose": "Choose HDR…",
|
||||
"render.environment.check": "Check file",
|
||||
"render.environment.checked": "HDR file checked. Saving embeds these bytes.",
|
||||
"render.environment.file": "File",
|
||||
"render.environment.rotation_hdr": "Rotation needs an HDR source for CPU ray tracing.",
|
||||
"render.environment.none": "None",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "Treat unspecified primaries as linear sRGB",
|
||||
"render.environment.vertical": "Vertical",
|
||||
"render.environment.horizontal": "Horizontal",
|
||||
"render.environment.radial": "Radial",
|
||||
"render.environment.sky_note": "Original sky gradient for lighting; not a calibrated atmosphere.",
|
||||
"render.environment.keep": "Keep"
|
||||
},
|
||||
"de": {
|
||||
"render.environment.orientation": "Ausrichtung und Stärke",
|
||||
"render.environment.hdr_file": "HDR-Datei",
|
||||
"render.environment.builtin": "Integriertes HDR",
|
||||
"render.environment.constant": "Konstant",
|
||||
"render.environment.embedded": "In diesem Design gespeichert",
|
||||
"render.environment.source_raytrace": "Umgebungsquellen benötigen CPU- oder GPU-Raytracing.",
|
||||
"render.environment.zenith": "Zenit",
|
||||
"render.environment.horizon": "Horizont",
|
||||
"render.environment.sky_ground": "Boden",
|
||||
"render.environment.primaries_gpu": "Die Interpretation nicht angegebener Primärfarben benötigt GPU-Pfadverfolgung.",
|
||||
"render.environment.lighting_samples": "Beleuchtungssamples",
|
||||
"render.environment.samples_cpu": "GPU-Samples bestimmt das Pfadbudget; diese Einstellung benötigt CPU-Raytracing.",
|
||||
"render.environment.world": "Welt",
|
||||
"render.environment.gradient": "Verlauf",
|
||||
"render.environment.mode": "Modus",
|
||||
"render.environment.start": "Anfang",
|
||||
"render.environment.end": "Ende",
|
||||
"render.environment.world_pending": "Welt-Hintergrund nicht verfügbar: Die Kamerasichtbarkeit der Umgebung ist noch nicht speicherbar.",
|
||||
"render.environment.blur_pending": "Unschärfe nicht verfügbar: Der Renderer hat keine Hintergrund-Unschärfeeinstellung.",
|
||||
"render.environment.backdrop_note": "Ein Hintergrund ist nur für die Kamera sichtbar. Er beleuchtet nicht, wirft keine Schatten, reflektiert nicht und ist bei transparenter Ausgabe unzulässig.",
|
||||
"render.environment.gradient_gpu": "Ein Verlaufshintergrund benötigt GPU-Pfadverfolgung.",
|
||||
"render.environment.radial_only": "Mittelpunkt und Radius gelten für den radialen Modus.",
|
||||
"render.environment.ground": "Boden und Bühne",
|
||||
"render.environment.margin": "Ausdehnungsrand",
|
||||
"render.environment.gap": "Abstand",
|
||||
"render.environment.reflectance": "Reflexionsgrad",
|
||||
"render.environment.replace": "Ersetzen der vorhandenen Bühne bestätigen",
|
||||
"render.environment.fit": "Boden anpassen und speichern",
|
||||
"render.environment.floor_wall": "Boden und Wand",
|
||||
"render.environment.cyclorama": "Hohlkehle",
|
||||
"render.environment.saved_panels": "Gespeicherte Flächen {count}",
|
||||
"render.environment.remove": "Bühne entfernen",
|
||||
"render.environment.remove_confirm": "Gespeicherte Bühne entfernen?",
|
||||
"render.environment.remove_note": "Entfernt die {count} passiven Flächen aus dieser Aufnahme. Der Kamerahintergrund bleibt erhalten.",
|
||||
"render.environment.stage_raytrace": "Physische Bühnen benötigen CPU- oder GPU-Raytracing.",
|
||||
"render.environment.atmosphere": "Atmosphäre",
|
||||
"render.environment.medium": "Teilnehmendes Medium",
|
||||
"render.environment.min": "Min. Grenzen",
|
||||
"render.environment.max": "Max. Grenzen",
|
||||
"render.environment.extinction": "Extinktion",
|
||||
"render.environment.albedo": "Albedo",
|
||||
"render.environment.phase": "Phase",
|
||||
"render.environment.needs_gpu": "Benötigt GPU-Pfadverfolgung.",
|
||||
"render.environment.choose": "HDR wählen…",
|
||||
"render.environment.check": "Datei prüfen",
|
||||
"render.environment.checked": "HDR-Datei geprüft. Beim Speichern werden diese Bytes eingebettet.",
|
||||
"render.environment.file": "Datei",
|
||||
"render.environment.rotation_hdr": "Die Drehung benötigt beim CPU-Raytracing eine HDR-Quelle.",
|
||||
"render.environment.none": "Keine",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "Nicht angegebene Primärfarben als lineares sRGB behandeln",
|
||||
"render.environment.vertical": "Vertikal",
|
||||
"render.environment.horizontal": "Horizontal",
|
||||
"render.environment.radial": "Radial",
|
||||
"render.environment.sky_note": "Originaler Himmelsverlauf für die Beleuchtung; keine kalibrierte Atmosphäre.",
|
||||
"render.environment.keep": "Behalten"
|
||||
},
|
||||
"ja": {
|
||||
"render.environment.orientation": "向きと強さ",
|
||||
"render.environment.hdr_file": "HDR ファイル",
|
||||
"render.environment.builtin": "内蔵 HDR",
|
||||
"render.environment.constant": "一定色",
|
||||
"render.environment.embedded": "このデザイン内に保存済み",
|
||||
"render.environment.source_raytrace": "環境光源には CPU または GPU レイトレーシングが必要です。",
|
||||
"render.environment.zenith": "天頂",
|
||||
"render.environment.horizon": "地平線",
|
||||
"render.environment.sky_ground": "地面",
|
||||
"render.environment.primaries_gpu": "未指定の原色の解釈には GPU パストレーシングが必要です。",
|
||||
"render.environment.lighting_samples": "照明サンプル",
|
||||
"render.environment.samples_cpu": "GPU の照明サンプル数はパス予算で決まります。この設定は CPU レイトレーシング用です。",
|
||||
"render.environment.world": "ワールド",
|
||||
"render.environment.gradient": "グラデーション",
|
||||
"render.environment.mode": "モード",
|
||||
"render.environment.start": "開始色",
|
||||
"render.environment.end": "終了色",
|
||||
"render.environment.world_pending": "ワールド背景は未対応です。環境のカメラ表示を保存する設定がまだありません。",
|
||||
"render.environment.blur_pending": "ぼかしは未対応です。レンダラーに背景のぼかし設定がありません。",
|
||||
"render.environment.backdrop_note": "背景はカメラにだけ見えます。照明、影、反射には寄与せず、透明出力とは併用できません。",
|
||||
"render.environment.gradient_gpu": "グラデーション背景には GPU パストレーシングが必要です。",
|
||||
"render.environment.radial_only": "中心と半径は放射状モードに適用されます。",
|
||||
"render.environment.ground": "地面とステージ",
|
||||
"render.environment.margin": "範囲の余白",
|
||||
"render.environment.gap": "クリアランス",
|
||||
"render.environment.reflectance": "反射率",
|
||||
"render.environment.replace": "既存のステージの置換を確認",
|
||||
"render.environment.fit": "地面を合わせて保存",
|
||||
"render.environment.floor_wall": "床と壁",
|
||||
"render.environment.cyclorama": "ホリゾント",
|
||||
"render.environment.saved_panels": "保存済みパネル {count}",
|
||||
"render.environment.remove": "ステージを削除",
|
||||
"render.environment.remove_confirm": "保存したステージを削除しますか?",
|
||||
"render.environment.remove_note": "このショットから {count} 枚のパッシブパネルを削除します。カメラの背景は保持されます。",
|
||||
"render.environment.stage_raytrace": "物理ステージには CPU または GPU レイトレーシングが必要です。",
|
||||
"render.environment.atmosphere": "大気",
|
||||
"render.environment.medium": "散乱媒質",
|
||||
"render.environment.min": "最小境界",
|
||||
"render.environment.max": "最大境界",
|
||||
"render.environment.extinction": "消散係数",
|
||||
"render.environment.albedo": "アルベド",
|
||||
"render.environment.phase": "位相",
|
||||
"render.environment.needs_gpu": "GPU パストレーシングが必要です。",
|
||||
"render.environment.choose": "HDR を選択…",
|
||||
"render.environment.check": "ファイルを確認",
|
||||
"render.environment.checked": "HDR ファイルを確認済みです。保存時にこのデータを埋め込みます。",
|
||||
"render.environment.file": "ファイル",
|
||||
"render.environment.rotation_hdr": "CPU レイトレーシングの回転には HDR 光源が必要です。",
|
||||
"render.environment.none": "なし",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "未指定の原色をリニア sRGB として扱う",
|
||||
"render.environment.vertical": "垂直",
|
||||
"render.environment.horizontal": "水平",
|
||||
"render.environment.radial": "放射状",
|
||||
"render.environment.sky_note": "照明用のオリジナルの空のグラデーションです。較正された大気モデルではありません。",
|
||||
"render.environment.keep": "保持"
|
||||
},
|
||||
"zh": {
|
||||
"render.environment.orientation": "方向和强度",
|
||||
"render.environment.hdr_file": "HDR 文件",
|
||||
"render.environment.builtin": "内置 HDR",
|
||||
"render.environment.constant": "恒定",
|
||||
"render.environment.embedded": "已保存在此设计中",
|
||||
"render.environment.source_raytrace": "环境光源需要 CPU 或 GPU 光线追踪。",
|
||||
"render.environment.zenith": "天顶",
|
||||
"render.environment.horizon": "地平线",
|
||||
"render.environment.sky_ground": "地面",
|
||||
"render.environment.primaries_gpu": "解释未指定原色需要 GPU 路径追踪。",
|
||||
"render.environment.lighting_samples": "光照采样",
|
||||
"render.environment.samples_cpu": "GPU 光照采样由路径预算决定;此设置需要 CPU 光线追踪。",
|
||||
"render.environment.world": "世界",
|
||||
"render.environment.gradient": "渐变",
|
||||
"render.environment.mode": "模式",
|
||||
"render.environment.start": "起始",
|
||||
"render.environment.end": "结束",
|
||||
"render.environment.world_pending": "世界背景不可用:尚无保存环境相机可见性的设置。",
|
||||
"render.environment.blur_pending": "模糊不可用:渲染器没有背景模糊设置。",
|
||||
"render.environment.backdrop_note": "背景仅对相机可见,不参与照明、投影或反射,且不允许与透明输出同时使用。",
|
||||
"render.environment.gradient_gpu": "渐变背景需要 GPU 路径追踪。",
|
||||
"render.environment.radial_only": "中心和半径适用于径向模式。",
|
||||
"render.environment.ground": "地面与舞台",
|
||||
"render.environment.margin": "范围边距",
|
||||
"render.environment.gap": "间隙",
|
||||
"render.environment.reflectance": "反射率",
|
||||
"render.environment.replace": "确认替换现有舞台",
|
||||
"render.environment.fit": "适配并保存地面",
|
||||
"render.environment.floor_wall": "地板和墙壁",
|
||||
"render.environment.cyclorama": "无缝背景",
|
||||
"render.environment.saved_panels": "已保存面板 {count}",
|
||||
"render.environment.remove": "移除舞台",
|
||||
"render.environment.remove_confirm": "移除已保存的舞台?",
|
||||
"render.environment.remove_note": "从此镜头中移除 {count} 个被动面板。相机背景保持不变。",
|
||||
"render.environment.stage_raytrace": "物理舞台需要 CPU 或 GPU 光线追踪。",
|
||||
"render.environment.atmosphere": "大气",
|
||||
"render.environment.medium": "参与介质",
|
||||
"render.environment.min": "最小边界",
|
||||
"render.environment.max": "最大边界",
|
||||
"render.environment.extinction": "消光系数",
|
||||
"render.environment.albedo": "反照率",
|
||||
"render.environment.phase": "相位",
|
||||
"render.environment.needs_gpu": "需要 GPU 路径追踪。",
|
||||
"render.environment.choose": "选择 HDR…",
|
||||
"render.environment.check": "检查文件",
|
||||
"render.environment.checked": "HDR 文件已检查。保存时将嵌入这些字节。",
|
||||
"render.environment.file": "文件",
|
||||
"render.environment.rotation_hdr": "CPU 光线追踪的旋转需要 HDR 光源。",
|
||||
"render.environment.none": "无",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "将未指定原色视为线性 sRGB",
|
||||
"render.environment.vertical": "垂直",
|
||||
"render.environment.horizontal": "水平",
|
||||
"render.environment.radial": "径向",
|
||||
"render.environment.sky_note": "用于照明的原创天空渐变;并非经过校准的大气模型。",
|
||||
"render.environment.keep": "保留"
|
||||
},
|
||||
"ko": {
|
||||
"render.environment.orientation": "방향과 강도",
|
||||
"render.environment.hdr_file": "HDR 파일",
|
||||
"render.environment.builtin": "내장 HDR",
|
||||
"render.environment.constant": "상수",
|
||||
"render.environment.embedded": "이 디자인 안에 저장됨",
|
||||
"render.environment.source_raytrace": "환경 광원에는 CPU 또는 GPU 광선 추적이 필요합니다.",
|
||||
"render.environment.zenith": "천정",
|
||||
"render.environment.horizon": "수평선",
|
||||
"render.environment.sky_ground": "지면",
|
||||
"render.environment.primaries_gpu": "지정되지 않은 원색 해석에는 GPU 경로 추적이 필요합니다.",
|
||||
"render.environment.lighting_samples": "조명 샘플",
|
||||
"render.environment.samples_cpu": "GPU 조명 샘플은 경로 예산으로 정해집니다. 이 설정에는 CPU 광선 추적이 필요합니다.",
|
||||
"render.environment.world": "월드",
|
||||
"render.environment.gradient": "그라데이션",
|
||||
"render.environment.mode": "모드",
|
||||
"render.environment.start": "시작",
|
||||
"render.environment.end": "끝",
|
||||
"render.environment.world_pending": "월드 배경을 사용할 수 없습니다. 환경의 카메라 표시를 저장하는 설정이 아직 없습니다.",
|
||||
"render.environment.blur_pending": "흐림을 사용할 수 없습니다. 렌더러에 배경 흐림 설정이 없습니다.",
|
||||
"render.environment.backdrop_note": "배경은 카메라에만 보이며 조명, 그림자, 반사에 영향을 주지 않습니다. 투명 출력과 함께 사용할 수 없습니다.",
|
||||
"render.environment.gradient_gpu": "그라데이션 배경에는 GPU 경로 추적이 필요합니다.",
|
||||
"render.environment.radial_only": "중심과 반경은 방사형 모드에 적용됩니다.",
|
||||
"render.environment.ground": "지면과 스테이지",
|
||||
"render.environment.margin": "범위 여백",
|
||||
"render.environment.gap": "간격",
|
||||
"render.environment.reflectance": "반사율",
|
||||
"render.environment.replace": "기존 스테이지 교체 확인",
|
||||
"render.environment.fit": "지면 맞춤 및 저장",
|
||||
"render.environment.floor_wall": "바닥과 벽",
|
||||
"render.environment.cyclorama": "사이클로라마",
|
||||
"render.environment.saved_panels": "저장된 패널 {count}",
|
||||
"render.environment.remove": "스테이지 제거",
|
||||
"render.environment.remove_confirm": "저장된 스테이지를 제거할까요?",
|
||||
"render.environment.remove_note": "이 샷에서 패시브 패널 {count}개를 제거합니다. 카메라 배경은 유지됩니다.",
|
||||
"render.environment.stage_raytrace": "물리 스테이지에는 CPU 또는 GPU 광선 추적이 필요합니다.",
|
||||
"render.environment.atmosphere": "대기",
|
||||
"render.environment.medium": "참여 매질",
|
||||
"render.environment.min": "최소 경계",
|
||||
"render.environment.max": "최대 경계",
|
||||
"render.environment.extinction": "소광 계수",
|
||||
"render.environment.albedo": "알베도",
|
||||
"render.environment.phase": "위상",
|
||||
"render.environment.needs_gpu": "GPU 경로 추적이 필요합니다.",
|
||||
"render.environment.choose": "HDR 선택…",
|
||||
"render.environment.check": "파일 확인",
|
||||
"render.environment.checked": "HDR 파일을 확인했습니다. 저장하면 이 데이터가 포함됩니다.",
|
||||
"render.environment.file": "파일",
|
||||
"render.environment.rotation_hdr": "CPU 광선 추적의 회전에는 HDR 광원이 필요합니다.",
|
||||
"render.environment.none": "없음",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "지정되지 않은 원색을 선형 sRGB로 처리",
|
||||
"render.environment.vertical": "수직",
|
||||
"render.environment.horizontal": "수평",
|
||||
"render.environment.radial": "방사형",
|
||||
"render.environment.sky_note": "조명용 오리지널 하늘 그라데이션이며 보정된 대기 모델은 아닙니다.",
|
||||
"render.environment.keep": "유지"
|
||||
},
|
||||
"ar": {
|
||||
"render.environment.orientation": "الاتجاه والشدة",
|
||||
"render.environment.hdr_file": "ملف HDR",
|
||||
"render.environment.builtin": "HDR مدمج",
|
||||
"render.environment.constant": "ثابت",
|
||||
"render.environment.embedded": "محفوظ داخل هذا التصميم",
|
||||
"render.environment.source_raytrace": "مصادر البيئة تتطلب تتبّع الأشعة على المعالج أو بطاقة الرسومات.",
|
||||
"render.environment.zenith": "السمت",
|
||||
"render.environment.horizon": "الأفق",
|
||||
"render.environment.sky_ground": "الأرضية",
|
||||
"render.environment.primaries_gpu": "تفسير الألوان الأساسية غير المحددة يتطلب تتبّع المسار على بطاقة الرسومات.",
|
||||
"render.environment.lighting_samples": "عينات الإضاءة",
|
||||
"render.environment.samples_cpu": "تُحدَّد عينات الإضاءة بميزانية تتبّع المسار على بطاقة الرسومات؛ هذا الإعداد يتطلب تتبّع الأشعة على المعالج.",
|
||||
"render.environment.world": "العالم",
|
||||
"render.environment.gradient": "تدرّج",
|
||||
"render.environment.mode": "النمط",
|
||||
"render.environment.start": "البداية",
|
||||
"render.environment.end": "النهاية",
|
||||
"render.environment.world_pending": "خلفية العالم غير متاحة: ليس لظهور البيئة للكاميرا إعداد محفوظ بعد.",
|
||||
"render.environment.blur_pending": "التمويه غير متاح: لا يملك المصيّر إعداد تمويه للخلفية.",
|
||||
"render.environment.backdrop_note": "الخلفية ترى بها الكاميرا فقط. لا تضيء ولا تُلقي ظلالًا ولا تعكس، وتُرفض مع المخرجات الشفافة.",
|
||||
"render.environment.gradient_gpu": "خلفية متدرجة تتطلب تتبّع المسار على بطاقة الرسومات.",
|
||||
"render.environment.radial_only": "المركز ونصف القطر ينطبقان على النمط الشعاعي.",
|
||||
"render.environment.ground": "الأرضية والمنصة",
|
||||
"render.environment.margin": "هامش الامتداد",
|
||||
"render.environment.gap": "فجوة الخلوص",
|
||||
"render.environment.reflectance": "الانعكاسية",
|
||||
"render.environment.replace": "أكّد استبدال المنصة الحالية",
|
||||
"render.environment.fit": "ملاءمة الأرضية وحفظها",
|
||||
"render.environment.floor_wall": "أرضية وجدار",
|
||||
"render.environment.cyclorama": "سيكلوراما",
|
||||
"render.environment.saved_panels": "الألواح المحفوظة {count}",
|
||||
"render.environment.remove": "إزالة المنصة",
|
||||
"render.environment.remove_confirm": "إزالة المنصة المحفوظة؟",
|
||||
"render.environment.remove_note": "يزيل {count} من الألواح الخاملة من هذه اللقطة. تبقى خلفية الكاميرا.",
|
||||
"render.environment.stage_raytrace": "المنصات الفيزيائية تتطلب تتبّع الأشعة على المعالج أو بطاقة الرسومات.",
|
||||
"render.environment.atmosphere": "الغلاف الجوي",
|
||||
"render.environment.medium": "وسط مشارك",
|
||||
"render.environment.min": "الحدود الدنيا",
|
||||
"render.environment.max": "الحدود القصوى",
|
||||
"render.environment.extinction": "الانقراض",
|
||||
"render.environment.albedo": "الألبيدو",
|
||||
"render.environment.phase": "الطور",
|
||||
"render.environment.needs_gpu": "يتطلب تتبّع المسار على بطاقة الرسومات.",
|
||||
"render.environment.choose": "اختر HDR…",
|
||||
"render.environment.check": "فحص الملف",
|
||||
"render.environment.checked": "تم فحص ملف HDR. الحفظ يضمّن هذه البايتات.",
|
||||
"render.environment.file": "الملف",
|
||||
"render.environment.rotation_hdr": "التدوير يتطلب مصدر HDR لتتبّع الأشعة على المعالج.",
|
||||
"render.environment.none": "بلا",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "عامل الألوان الأساسية غير المحددة كـ sRGB خطي",
|
||||
"render.environment.vertical": "رأسي",
|
||||
"render.environment.horizontal": "أفقي",
|
||||
"render.environment.radial": "شعاعي",
|
||||
"render.environment.sky_note": "تدرّج سماء أصلي للإضاءة؛ وليس غلافًا جويًا معايَرًا.",
|
||||
"render.environment.keep": "إبقاء"
|
||||
},
|
||||
"he": {
|
||||
"render.environment.orientation": "כיוון ועוצמה",
|
||||
"render.environment.hdr_file": "קובץ HDR",
|
||||
"render.environment.builtin": "HDR מובנה",
|
||||
"render.environment.constant": "קבוע",
|
||||
"render.environment.embedded": "נשמר בתוך התכנון הזה",
|
||||
"render.environment.source_raytrace": "מקורות סביבה דורשים מעקב קרניים במעבד או בכרטיס המסך.",
|
||||
"render.environment.zenith": "זנית",
|
||||
"render.environment.horizon": "אופק",
|
||||
"render.environment.sky_ground": "קרקע",
|
||||
"render.environment.primaries_gpu": "פירוש צבעי יסוד לא מוגדרים דורש מעקב נתיב ב-GPU.",
|
||||
"render.environment.lighting_samples": "דגימות תאורה",
|
||||
"render.environment.samples_cpu": "דגימות התאורה נקבעות לפי תקציב מעקב הנתיב ב-GPU; הגדרה זו דורשת מעקב קרניים במעבד.",
|
||||
"render.environment.world": "עולם",
|
||||
"render.environment.gradient": "מעבר צבעים",
|
||||
"render.environment.mode": "מצב",
|
||||
"render.environment.start": "התחלה",
|
||||
"render.environment.end": "סוף",
|
||||
"render.environment.world_pending": "רקע העולם אינו זמין: לנראות הסביבה למצלמה אין עדיין הגדרה שמורה.",
|
||||
"render.environment.blur_pending": "טשטוש אינו זמין: למעבד הרינדור אין הגדרת טשטוש רקע.",
|
||||
"render.environment.backdrop_note": "רקע נראה למצלמה בלבד. הוא אינו מאיר, אינו מטיל צל ואינו משקף, ונדחה בפלט שקוף.",
|
||||
"render.environment.gradient_gpu": "רקע מדורג דורש מעקב נתיב ב-GPU.",
|
||||
"render.environment.radial_only": "מרכז ורדיוס חלים על מצב רדיאלי.",
|
||||
"render.environment.ground": "קרקע ובמה",
|
||||
"render.environment.margin": "שולי טווח",
|
||||
"render.environment.gap": "מרווח פינוי",
|
||||
"render.environment.reflectance": "החזרתיות",
|
||||
"render.environment.replace": "אשר החלפת הבמה הקיימת",
|
||||
"render.environment.fit": "התאם ושמור קרקע",
|
||||
"render.environment.floor_wall": "רצפה וקיר",
|
||||
"render.environment.cyclorama": "ציקלורמה",
|
||||
"render.environment.saved_panels": "לוחות שמורים {count}",
|
||||
"render.environment.remove": "הסר במה",
|
||||
"render.environment.remove_confirm": "להסיר את הבמה השמורה?",
|
||||
"render.environment.remove_note": "מסיר את {count} הלוחות הפסיביים מהצילום הזה. רקע המצלמה נשאר.",
|
||||
"render.environment.stage_raytrace": "במות פיזיקליות דורשות מעקב קרניים במעבד או בכרטיס המסך.",
|
||||
"render.environment.atmosphere": "אטמוספרה",
|
||||
"render.environment.medium": "תווך משתתף",
|
||||
"render.environment.min": "גבולות מינימום",
|
||||
"render.environment.max": "גבולות מקסימום",
|
||||
"render.environment.extinction": "הכחדה",
|
||||
"render.environment.albedo": "אלבדו",
|
||||
"render.environment.phase": "פאזה",
|
||||
"render.environment.needs_gpu": "דורש מעקב נתיב ב-GPU.",
|
||||
"render.environment.choose": "בחר HDR…",
|
||||
"render.environment.check": "בדוק קובץ",
|
||||
"render.environment.checked": "קובץ HDR נבדק. השמירה מטמיעה את הבתים האלה.",
|
||||
"render.environment.file": "קובץ",
|
||||
"render.environment.rotation_hdr": "סיבוב דורש מקור HDR למעקב קרניים במעבד.",
|
||||
"render.environment.none": "ללא",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "התייחס לצבעי יסוד לא מוגדרים כ-sRGB לינארי",
|
||||
"render.environment.vertical": "אנכי",
|
||||
"render.environment.horizontal": "אופקי",
|
||||
"render.environment.radial": "רדיאלי",
|
||||
"render.environment.sky_note": "מעבר שמיים מקורי לתאורה; אינו אטמוספרה מכוילת.",
|
||||
"render.environment.keep": "שמור"
|
||||
},
|
||||
"vi": {
|
||||
"render.environment.orientation": "Hướng và cường độ",
|
||||
"render.environment.hdr_file": "Tệp HDR",
|
||||
"render.environment.builtin": "HDR có sẵn",
|
||||
"render.environment.constant": "Hằng",
|
||||
"render.environment.embedded": "Lưu trong thiết kế này",
|
||||
"render.environment.source_raytrace": "Nguồn môi trường cần dò tia trên CPU hoặc GPU.",
|
||||
"render.environment.zenith": "Thiên đỉnh",
|
||||
"render.environment.horizon": "Đường chân trời",
|
||||
"render.environment.sky_ground": "Mặt đất",
|
||||
"render.environment.primaries_gpu": "Diễn giải màu cơ sở không xác định cần dò đường đi của tia bằng GPU.",
|
||||
"render.environment.lighting_samples": "Mẫu chiếu sáng",
|
||||
"render.environment.samples_cpu": "Số mẫu chiếu sáng do ngân sách dò đường đi của tia bằng GPU quyết định; cài đặt này cần dò tia bằng CPU.",
|
||||
"render.environment.world": "Thế giới",
|
||||
"render.environment.gradient": "Chuyển sắc",
|
||||
"render.environment.mode": "Chế độ",
|
||||
"render.environment.start": "Bắt đầu",
|
||||
"render.environment.end": "Kết thúc",
|
||||
"render.environment.world_pending": "Phông nền thế giới không khả dụng: khả năng nhìn thấy môi trường của máy ảnh chưa có cài đặt đã lưu.",
|
||||
"render.environment.blur_pending": "Làm mờ không khả dụng: bộ kết xuất chưa có cài đặt làm mờ phông nền.",
|
||||
"render.environment.backdrop_note": "Phông nền chỉ máy ảnh nhìn thấy. Nó không chiếu sáng, không đổ bóng, không phản chiếu, và bị từ chối với đầu ra trong suốt.",
|
||||
"render.environment.gradient_gpu": "Phông nền chuyển sắc cần dò đường đi của tia bằng GPU.",
|
||||
"render.environment.radial_only": "Tâm và bán kính chỉ áp dụng cho chế độ Tỏa tròn.",
|
||||
"render.environment.ground": "Mặt đất và sân khấu",
|
||||
"render.environment.margin": "Lề phạm vi",
|
||||
"render.environment.gap": "Khe hở",
|
||||
"render.environment.reflectance": "Độ phản xạ",
|
||||
"render.environment.replace": "Xác nhận thay sân khấu hiện có",
|
||||
"render.environment.fit": "Khớp và lưu mặt đất",
|
||||
"render.environment.floor_wall": "Sàn và tường",
|
||||
"render.environment.cyclorama": "Cyclorama",
|
||||
"render.environment.saved_panels": "Tấm đã lưu {count}",
|
||||
"render.environment.remove": "Gỡ sân khấu",
|
||||
"render.environment.remove_confirm": "Gỡ sân khấu đã lưu?",
|
||||
"render.environment.remove_note": "Gỡ {count} tấm thụ động khỏi cảnh chụp này. Phông nền máy ảnh vẫn giữ.",
|
||||
"render.environment.stage_raytrace": "Sân khấu vật lý cần dò tia trên CPU hoặc GPU.",
|
||||
"render.environment.atmosphere": "Khí quyển",
|
||||
"render.environment.medium": "Môi trường tham gia",
|
||||
"render.environment.min": "Biên nhỏ nhất",
|
||||
"render.environment.max": "Biên lớn nhất",
|
||||
"render.environment.extinction": "Tắt dần",
|
||||
"render.environment.albedo": "Albedo",
|
||||
"render.environment.phase": "Pha",
|
||||
"render.environment.needs_gpu": "Cần dò đường đi của tia bằng GPU.",
|
||||
"render.environment.choose": "Chọn HDR…",
|
||||
"render.environment.check": "Kiểm tra tệp",
|
||||
"render.environment.checked": "Đã kiểm tra tệp HDR. Khi lưu sẽ nhúng các byte này.",
|
||||
"render.environment.file": "Tệp",
|
||||
"render.environment.rotation_hdr": "Xoay cần nguồn HDR để dò tia trên CPU.",
|
||||
"render.environment.none": "Không",
|
||||
"render.environment.hdr": "HDR",
|
||||
"render.environment.primaries": "Coi màu cơ sở không xác định là sRGB tuyến tính",
|
||||
"render.environment.vertical": "Dọc",
|
||||
"render.environment.horizontal": "Ngang",
|
||||
"render.environment.radial": "Tỏa tròn",
|
||||
"render.environment.sky_note": "Chuyển sắc bầu trời gốc để chiếu sáng; không phải khí quyển đã hiệu chuẩn.",
|
||||
"render.environment.keep": "Giữ"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"en": {
|
||||
"render.env_ring_help": "Drag the ring to rotate the lighting. Hold Shift to snap to 15°."
|
||||
},
|
||||
"de": {
|
||||
"render.env_ring_help": "Den Ring ziehen, um die Beleuchtung zu drehen. Mit Umschalt in 15°-Schritten einrasten."
|
||||
},
|
||||
"ja": {
|
||||
"render.env_ring_help": "リングをドラッグして照明を回転します。Shift を押すと15°刻みにスナップします。"
|
||||
},
|
||||
"ko": {
|
||||
"render.env_ring_help": "링을 드래그하여 조명을 회전하세요. Shift를 누르면 15° 간격으로 스냅합니다."
|
||||
},
|
||||
"zh": {
|
||||
"render.env_ring_help": "拖动圆环旋转照明。按住 Shift 以15°为增量吸附。"
|
||||
},
|
||||
"ar": {
|
||||
"render.env_ring_help": "اسحب الحلقة لتدوير الإضاءة. اضغط Shift للمحاذاة كل 15°."
|
||||
},
|
||||
"he": {
|
||||
"render.env_ring_help": "גרור את הטבעת כדי לסובב את התאורה. החזק Shift להצמדה ל-15°."
|
||||
},
|
||||
"vi": {
|
||||
"render.env_ring_help": "Kéo vòng để xoay ánh sáng. Giữ Shift để bám theo bước 15°."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
{
|
||||
"en": {
|
||||
"render.env_set": "Set Render Environment",
|
||||
"render.env_invalid_edit": "Invalid environment edit.",
|
||||
"render.env_stage_details": "Ground edits require raytracing and a single ground panel. Use Scene to edit other stage panels.",
|
||||
"render.env_source": "Source",
|
||||
"render.env_change": "Change",
|
||||
"render.env_rotate": "Rotate",
|
||||
"render.env_intensity": "Intensity",
|
||||
"render.env_backdrop": "Backdrop",
|
||||
"render.env_show_environment": "Show Environment",
|
||||
"render.env_colour": "Colour",
|
||||
"render.env_clear": "Clear",
|
||||
"render.env_blur": "Blur",
|
||||
"render.env_ground": "Ground",
|
||||
"render.env_shadow_catcher": "Shadow catcher",
|
||||
"render.env_reflection": "Reflection",
|
||||
"render.env_physical_ground": "Physical ground",
|
||||
"render.env_advanced": "Advanced",
|
||||
"render.env_studios": "Studios",
|
||||
"render.env_environments": "Environments",
|
||||
"render.env_choose_source": "Choose an environment in Studios and Environments before editing the lighting.",
|
||||
"render.env_preview_help": "Illustrative sphere sample; not a preview of the selected environment.",
|
||||
"render.env_backdrop_pending": "Environment visibility and background blur are not supported by the renderer yet.",
|
||||
"render.env_ground_pending": "Physical ground receives shadows as a finite diffuse surface. Shadow-only catching and ground reflections are not supported yet."
|
||||
},
|
||||
"de": {
|
||||
"render.env_set": "Renderumgebung einstellen",
|
||||
"render.env_invalid_edit": "Ungültige Umgebungsänderung.",
|
||||
"render.env_stage_details": "Bodenänderungen erfordern Raytracing und eine einzelne Bodenfläche. Andere Bühnenflächen unter Szene bearbeiten.",
|
||||
"render.env_source": "Quelle",
|
||||
"render.env_change": "Ändern",
|
||||
"render.env_rotate": "Drehen",
|
||||
"render.env_intensity": "Intensität",
|
||||
"render.env_backdrop": "Hintergrund",
|
||||
"render.env_show_environment": "Umgebung anzeigen",
|
||||
"render.env_colour": "Farbe",
|
||||
"render.env_clear": "Transparent",
|
||||
"render.env_blur": "Unschärfe",
|
||||
"render.env_ground": "Boden",
|
||||
"render.env_shadow_catcher": "Schattenfänger",
|
||||
"render.env_reflection": "Spiegelung",
|
||||
"render.env_physical_ground": "Physischer Boden",
|
||||
"render.env_advanced": "Erweitert",
|
||||
"render.env_studios": "Studios",
|
||||
"render.env_environments": "Umgebungen",
|
||||
"render.env_choose_source": "Vor dem Bearbeiten eine Umgebung unter Studios und Umgebungen wählen.",
|
||||
"render.env_preview_help": "Illustrative Kugel, keine Vorschau der gewählten Umgebung.",
|
||||
"render.env_backdrop_pending": "Umgebungssichtbarkeit und Hintergrundunschärfe werden noch nicht unterstützt.",
|
||||
"render.env_ground_pending": "Der endliche diffuse Boden empfängt Schatten. Reiner Schattenfang und Bodenspiegelungen werden noch nicht unterstützt."
|
||||
},
|
||||
"ja": {
|
||||
"render.env_set": "レンダー環境を設定",
|
||||
"render.env_invalid_edit": "環境の編集内容が無効です。",
|
||||
"render.env_stage_details": "地面の編集にはレイトレーシングと単一の地面パネルが必要です。他のステージパネルはシーンで編集してください。",
|
||||
"render.env_source": "ソース",
|
||||
"render.env_change": "変更",
|
||||
"render.env_rotate": "回転",
|
||||
"render.env_intensity": "強度",
|
||||
"render.env_backdrop": "背景",
|
||||
"render.env_show_environment": "環境を表示",
|
||||
"render.env_colour": "色",
|
||||
"render.env_clear": "透明",
|
||||
"render.env_blur": "ぼかし",
|
||||
"render.env_ground": "地面",
|
||||
"render.env_shadow_catcher": "シャドウキャッチャー",
|
||||
"render.env_reflection": "反射",
|
||||
"render.env_physical_ground": "物理的な地面",
|
||||
"render.env_advanced": "詳細",
|
||||
"render.env_studios": "スタジオ",
|
||||
"render.env_environments": "環境",
|
||||
"render.env_choose_source": "照明を編集する前に、スタジオと環境で環境を選択してください。",
|
||||
"render.env_preview_help": "球の見本です。選択した環境のプレビューではありません。",
|
||||
"render.env_backdrop_pending": "環境の背景表示とぼかしは、まだレンダラーでサポートされていません。",
|
||||
"render.env_ground_pending": "物理的な地面は有限の拡散面として影を受けます。影のみの捕捉と地面の反射は未対応です。"
|
||||
},
|
||||
"ko": {
|
||||
"render.env_set": "렌더 환경 설정",
|
||||
"render.env_invalid_edit": "환경 편집 내용이 올바르지 않습니다.",
|
||||
"render.env_stage_details": "지면 편집에는 레이 트레이싱과 단일 지면 패널이 필요합니다. 다른 무대 패널은 장면에서 편집하세요.",
|
||||
"render.env_source": "소스",
|
||||
"render.env_change": "변경",
|
||||
"render.env_rotate": "회전",
|
||||
"render.env_intensity": "강도",
|
||||
"render.env_backdrop": "배경",
|
||||
"render.env_show_environment": "환경 표시",
|
||||
"render.env_colour": "색상",
|
||||
"render.env_clear": "투명",
|
||||
"render.env_blur": "흐림",
|
||||
"render.env_ground": "지면",
|
||||
"render.env_shadow_catcher": "그림자 포착",
|
||||
"render.env_reflection": "반사",
|
||||
"render.env_physical_ground": "물리적 지면",
|
||||
"render.env_advanced": "고급",
|
||||
"render.env_studios": "스튜디오",
|
||||
"render.env_environments": "환경",
|
||||
"render.env_choose_source": "조명을 편집하기 전에 스튜디오 및 환경에서 환경을 선택하세요.",
|
||||
"render.env_preview_help": "구 예시이며 선택한 환경의 미리보기가 아닙니다.",
|
||||
"render.env_backdrop_pending": "렌더러가 환경 배경 표시와 흐림을 아직 지원하지 않습니다.",
|
||||
"render.env_ground_pending": "물리적 지면은 유한한 확산 표면으로 그림자를 받습니다. 그림자만 포착하거나 지면에 반사하는 기능은 아직 지원하지 않습니다."
|
||||
},
|
||||
"zh": {
|
||||
"render.env_set": "设置渲染环境",
|
||||
"render.env_invalid_edit": "环境编辑无效。",
|
||||
"render.env_stage_details": "地面编辑需要光线追踪和单个地面面板。其他舞台面板请在场景中编辑。",
|
||||
"render.env_source": "来源",
|
||||
"render.env_change": "更改",
|
||||
"render.env_rotate": "旋转",
|
||||
"render.env_intensity": "强度",
|
||||
"render.env_backdrop": "背景",
|
||||
"render.env_show_environment": "显示环境",
|
||||
"render.env_colour": "颜色",
|
||||
"render.env_clear": "透明",
|
||||
"render.env_blur": "模糊",
|
||||
"render.env_ground": "地面",
|
||||
"render.env_shadow_catcher": "阴影捕捉",
|
||||
"render.env_reflection": "反射",
|
||||
"render.env_physical_ground": "实体地面",
|
||||
"render.env_advanced": "高级",
|
||||
"render.env_studios": "摄影棚",
|
||||
"render.env_environments": "环境",
|
||||
"render.env_choose_source": "编辑照明前,请在摄影棚与环境中选择环境。",
|
||||
"render.env_preview_help": "球体示例,并非所选环境的预览。",
|
||||
"render.env_backdrop_pending": "渲染器尚不支持环境背景显示和模糊。",
|
||||
"render.env_ground_pending": "实体地面作为有限漫反射表面接收阴影。尚不支持仅捕捉阴影和地面反射。"
|
||||
},
|
||||
"ar": {
|
||||
"render.env_set": "ضبط بيئة التصيير",
|
||||
"render.env_invalid_edit": "تعديل بيئة غير صالح.",
|
||||
"render.env_stage_details": "تعديلات الأرضية تتطلب تتبّع الأشعة ولوحًا أرضيًا واحدًا. استخدم المشهد لتعديل ألواح المنصة الأخرى.",
|
||||
"render.env_source": "المصدر",
|
||||
"render.env_change": "تغيير",
|
||||
"render.env_rotate": "تدوير",
|
||||
"render.env_intensity": "الشدة",
|
||||
"render.env_backdrop": "الخلفية",
|
||||
"render.env_show_environment": "إظهار البيئة",
|
||||
"render.env_colour": "اللون",
|
||||
"render.env_clear": "مسح",
|
||||
"render.env_blur": "تمويه",
|
||||
"render.env_ground": "الأرضية",
|
||||
"render.env_shadow_catcher": "ماسك الظلال",
|
||||
"render.env_reflection": "الانعكاس",
|
||||
"render.env_physical_ground": "أرضية فيزيائية",
|
||||
"render.env_advanced": "متقدم",
|
||||
"render.env_studios": "الاستوديوهات",
|
||||
"render.env_environments": "البيئات",
|
||||
"render.env_choose_source": "اختر بيئة في الاستوديوهات والبيئات قبل تعديل الإضاءة.",
|
||||
"render.env_preview_help": "عيّنة كروية توضيحية؛ وليست معاينة للبيئة المحددة.",
|
||||
"render.env_backdrop_pending": "ظهور البيئة وتمويه الخلفية غير مدعومين من المصيّر بعد.",
|
||||
"render.env_ground_pending": "تستقبل الأرضية الفيزيائية الظلال كسطح مشتت منتهٍ. التقاط الظلال فقط وانعكاسات الأرضية غير مدعومين بعد."
|
||||
},
|
||||
"he": {
|
||||
"render.env_set": "הגדר סביבת רינדור",
|
||||
"render.env_invalid_edit": "עריכת סביבה לא תקינה.",
|
||||
"render.env_stage_details": "עריכת קרקע דורשת מעקב קרניים ולוח קרקע יחיד. השתמש בסצנה לעריכת שאר לוחות הבמה.",
|
||||
"render.env_source": "מקור",
|
||||
"render.env_change": "שנה",
|
||||
"render.env_rotate": "סובב",
|
||||
"render.env_intensity": "עוצמה",
|
||||
"render.env_backdrop": "רקע",
|
||||
"render.env_show_environment": "הצג סביבה",
|
||||
"render.env_colour": "צבע",
|
||||
"render.env_clear": "נקה",
|
||||
"render.env_blur": "טשטוש",
|
||||
"render.env_ground": "קרקע",
|
||||
"render.env_shadow_catcher": "לוכד צללים",
|
||||
"render.env_reflection": "השתקפות",
|
||||
"render.env_physical_ground": "קרקע פיזיקלית",
|
||||
"render.env_advanced": "מתקדם",
|
||||
"render.env_studios": "סטודיו",
|
||||
"render.env_environments": "סביבות",
|
||||
"render.env_choose_source": "בחר סביבה בסטודיו וסביבות לפני עריכת התאורה.",
|
||||
"render.env_preview_help": "דגימת כדור להמחשה; אינה תצוגה מקדימה של הסביבה שנבחרה.",
|
||||
"render.env_backdrop_pending": "נראות סביבה וטשטוש רקע אינם נתמכים עדיין במעבד הרינדור.",
|
||||
"render.env_ground_pending": "קרקע פיזיקלית מקבלת צללים כמשטח מפזר סופי. לכידת צללים בלבד והשתקפויות קרקע אינן נתמכות עדיין."
|
||||
},
|
||||
"vi": {
|
||||
"render.env_set": "Đặt môi trường kết xuất",
|
||||
"render.env_invalid_edit": "Chỉnh môi trường không hợp lệ.",
|
||||
"render.env_stage_details": "Chỉnh mặt đất cần dò tia và một tấm mặt đất duy nhất. Dùng Cảnh để chỉnh các tấm sân khấu khác.",
|
||||
"render.env_source": "Nguồn",
|
||||
"render.env_change": "Đổi",
|
||||
"render.env_rotate": "Xoay",
|
||||
"render.env_intensity": "Cường độ",
|
||||
"render.env_backdrop": "Phông nền",
|
||||
"render.env_show_environment": "Hiện môi trường",
|
||||
"render.env_colour": "Màu",
|
||||
"render.env_clear": "Xóa",
|
||||
"render.env_blur": "Làm mờ",
|
||||
"render.env_ground": "Mặt đất",
|
||||
"render.env_shadow_catcher": "Bắt bóng",
|
||||
"render.env_reflection": "Phản chiếu",
|
||||
"render.env_physical_ground": "Mặt đất vật lý",
|
||||
"render.env_advanced": "Nâng cao",
|
||||
"render.env_studios": "Studio",
|
||||
"render.env_environments": "Môi trường",
|
||||
"render.env_choose_source": "Hãy chọn môi trường trong Studio và môi trường trước khi chỉnh ánh sáng.",
|
||||
"render.env_preview_help": "Mẫu hình cầu minh họa; không phải bản xem trước của môi trường đã chọn.",
|
||||
"render.env_backdrop_pending": "Bộ kết xuất chưa hỗ trợ hiển thị môi trường và làm mờ phông nền.",
|
||||
"render.env_ground_pending": "Mặt đất vật lý nhận bóng như một bề mặt khuếch tán hữu hạn. Chưa hỗ trợ chỉ bắt bóng và phản chiếu mặt đất."
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,10 @@ mod textures;
|
||||
mod transmission;
|
||||
|
||||
pub static COMMANDS: &[CommandSpec] = &[
|
||||
CommandSpec::new("render.environment.set", "Set Render Environment", crate::checked!("render.environment.set", environment::set)).icon("settings").doc_only()
|
||||
.contract(&environment::CONTRACT)
|
||||
.output(crate::schema::output_schema_for::<crate::schema::render::EnvironmentResult>)
|
||||
.params("name; set?: numerical setup patch; rotation_deg?: finite degrees within +/-1000000, wrapped to [-180,180); intensity?: finite linear intensity 0..64 CPU or 0..100 GPU. Edits the existing HDR, sky or constant environment in one undo, without selecting a source, moving the camera or starting a render. Absent environments and raster refuse."),
|
||||
CommandSpec::new("render.aging.describe","Layered Surface Aging",effects::aging).icon("appearance").noundo().doc_only()
|
||||
.params("Empty object. Read-only original Rust/patina/dust/grime/scratch/chip/fading presets and exact GPU aging contract. UI activation opens the shared Aging tab; edits remain a saved render draft, never engineering geometry or material-property mutation."),
|
||||
CommandSpec::new("render.effects.describe","Lens and Creative Effects",effects::presentation).icon("camera").noundo().doc_only()
|
||||
|
||||
@@ -7,6 +7,59 @@ use solidcraft_render::lighting::{
|
||||
environment::{EnvironmentResource, EnvironmentSource, SkyGradient},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub(super) const CONTRACT: crate::schema::TypedContract<crate::schema::render::EnvironmentParams> = crate::schema::TypedContract::new();
|
||||
|
||||
pub(super) fn set(s: &mut crate::Session, params: &serde_json::Value) -> Result<serde_json::Value> {
|
||||
use solidcraft_doc::render_settings::{RenderJob, SkyEnvironment};
|
||||
let command = "render.environment.set";
|
||||
let input: crate::schema::render::EnvironmentParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
|
||||
if input.rotation_deg.is_none() && input.intensity.is_none() {
|
||||
return Err(bad(command, "rotation_deg or intensity is required"));
|
||||
}
|
||||
let rotation = input
|
||||
.rotation_deg
|
||||
.map(|degrees| {
|
||||
if !degrees.is_finite() || degrees.abs() > 1e6 {
|
||||
Err(bad(command, "rotation must be finite degrees within +/-1000000"))
|
||||
} else {
|
||||
Ok(((degrees + 180.0).rem_euclid(360.0) - 180.0).to_radians())
|
||||
}
|
||||
})
|
||||
.transpose()?;
|
||||
let mut setup = super::patched_settings(s, &input.name, &input.set, command)?;
|
||||
let (angle, intensity, maximum) = match &mut setup.job {
|
||||
Some(RenderJob::CpuRaytrace { options }) => {
|
||||
if let Some(hdr) = &mut options.hdr {
|
||||
(Some(&mut hdr.rotation_rad), &mut hdr.intensity, 64.0)
|
||||
} else if let Some(environment) = &mut options.environment {
|
||||
(None, &mut environment.intensity, 64.0)
|
||||
} else {
|
||||
return Err(bad(command, "choose an environment before editing it"));
|
||||
}
|
||||
}
|
||||
Some(RenderJob::GpuPath { options, .. }) => {
|
||||
if let Some(hdr) = &mut options.hdr {
|
||||
(Some(&mut hdr.rotation_rad), &mut hdr.intensity, 100.0)
|
||||
} else if let Some(SkyEnvironment::Sky { rotation_rad, intensity, .. }) = &mut options.environment {
|
||||
(Some(rotation_rad), intensity, 100.0)
|
||||
} else {
|
||||
return Err(bad(command, "choose an environment before editing it"));
|
||||
}
|
||||
}
|
||||
_ => return Err(bad(command, "environment editing requires a typed raytrace setup")),
|
||||
};
|
||||
if let Some(value) = input.intensity {
|
||||
if !value.is_finite() || !(0.0..=maximum).contains(&value) {
|
||||
return Err(bad(command, format!("intensity must be finite and within 0..{maximum}")));
|
||||
}
|
||||
*intensity = value;
|
||||
}
|
||||
if let Some(value) = rotation {
|
||||
*angle.ok_or_else(|| bad(command, "a constant environment has no rotation"))? = value;
|
||||
}
|
||||
super::set_settings(s, &serde_json::json!({"name":input.name,"set":setup}))
|
||||
}
|
||||
fn unit() -> f64 {
|
||||
1.0
|
||||
}
|
||||
|
||||
@@ -4,6 +4,89 @@ fn save(s: &mut Session, patch: Value) {
|
||||
s.execute("render.settings.set", &json!({"name":"Studio", "set":patch})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_rotation_wraps_and_each_edit_is_one_undo() {
|
||||
let mut s = Session::default();
|
||||
save(&mut s, json!({"job":{"method":"gpu_path","options":{"environment":{"kind":"sky"}}}}));
|
||||
for (degrees, expected) in [(215.0, -145.0), (540.0, -180.0), (-541.0, 179.0), (1e6, -80.0), (-1e6, 80.0)] {
|
||||
let before = s.doc.clone();
|
||||
let undo = s.undo.len();
|
||||
let result = s.execute("render.environment.set", &json!({"name":"Studio","rotation_deg":degrees})).unwrap();
|
||||
let angle = result["setup"]["job"]["options"]["environment"]["rotation_rad"].as_f64().unwrap().to_degrees();
|
||||
assert!((-180.0..180.0).contains(&angle));
|
||||
assert!((angle - expected).abs() < 1e-9);
|
||||
assert_eq!(s.undo.len(), undo + 1);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(s.doc, before);
|
||||
s.execute("edit.redo", &json!({})).unwrap();
|
||||
}
|
||||
let undo = s.undo.len();
|
||||
s.execute("render.environment.set", &json!({"name":"Studio","intensity":2.5})).unwrap();
|
||||
assert_eq!(s.undo.len(), undo + 1);
|
||||
s.execute("render.environment.set", &json!({"name":"Studio","intensity":2.5})).unwrap();
|
||||
assert_eq!(s.undo.len(), undo + 1, "unchanged values do not add history");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_hostile_inputs_refuse_atomically() {
|
||||
let mut s = Session::default();
|
||||
save(&mut s, json!({"job":{"method":"gpu_path","options":{"environment":{"kind":"sky"}}}}));
|
||||
let before = s.doc.clone();
|
||||
let history = (s.revision, s.undo.len(), s.redo.len());
|
||||
for extra in [
|
||||
json!({"rotation_deg":1e6+1.0}),
|
||||
json!({"rotation_deg":-1e6-1.0}),
|
||||
json!({"rotation_deg":1e300}),
|
||||
json!({"rotation_deg":"NaN"}),
|
||||
json!({"rotation_deg":null}),
|
||||
json!({"intensity":-0.01}),
|
||||
json!({"intensity":100.01}),
|
||||
json!({"intensity":1e300}),
|
||||
json!({"intensity":"Infinity"}),
|
||||
json!({"rotation_deg":30,"intensity":101}),
|
||||
json!({"unexpected":true}),
|
||||
json!({}),
|
||||
] {
|
||||
let mut request = json!({"name":"Studio"});
|
||||
request.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone());
|
||||
assert!(s.execute("render.environment.set", &request).is_err(), "{request}");
|
||||
assert!(Arc::ptr_eq(&before, &s.doc));
|
||||
assert_eq!(history, (s.revision, s.undo.len(), s.redo.len()));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_preserves_source_and_refuses_absent_or_incompatible_environment() {
|
||||
let mut s = Session::default();
|
||||
save(&mut s, json!({"job":{"method":"cpu_raytrace","options":{"environment":{"color":[0.2,0.3,0.4],"intensity":1}}}}));
|
||||
let before = s.doc.clone();
|
||||
for request in [json!({"rotation_deg":30}), json!({"intensity":64.01})] {
|
||||
let mut params = json!({"name":"Studio"});
|
||||
params.as_object_mut().unwrap().extend(request.as_object().unwrap().clone());
|
||||
assert!(s.execute("render.environment.set", ¶ms).is_err());
|
||||
assert!(Arc::ptr_eq(&before, &s.doc));
|
||||
}
|
||||
let reply = s.execute("render.environment.set", &json!({"name":"Studio","intensity":64})).unwrap();
|
||||
assert_eq!(reply["setup"]["job"]["options"]["environment"]["color"], json!([0.2, 0.3, 0.4]));
|
||||
for job in [json!({"method":"raster"}), json!({"method":"gpu_path"}), json!({"method":"cpu_raytrace"})] {
|
||||
let before = s.doc.clone();
|
||||
assert!(s.execute("render.environment.set", &json!({"name":"Studio","set":{"job":job},"intensity":2})).is_err());
|
||||
assert!(Arc::ptr_eq(&before, &s.doc));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_command_has_schemas_and_strict_validation() {
|
||||
let command = crate::find_command("render.environment.set").unwrap();
|
||||
assert!(command.contract.is_some());
|
||||
assert!(command.output.is_some());
|
||||
let mut s = Session { param_check: crate::schema::ParamCheck::Strict, ..Default::default() };
|
||||
save(&mut s, json!({"job":{"method":"gpu_path","options":{"environment":{"kind":"sky"}}}}));
|
||||
let reply = s.execute("render.environment.set", &json!({"name":"Studio","intensity":2})).unwrap();
|
||||
assert_eq!(reply["setup"]["job"]["options"]["environment"]["intensity"], 2.0);
|
||||
assert!(s.execute("render.environment.set", &json!({"name":"Studio","intensity":2,"unknown":true})).is_err());
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn embedded_hdr_capture_is_offline_atomic_deduplicated_and_undoable_after_source_removal() {
|
||||
|
||||
@@ -58,6 +58,7 @@ pub mod component;
|
||||
pub mod edit;
|
||||
pub mod features;
|
||||
pub mod inspect;
|
||||
pub mod render;
|
||||
pub mod sheet;
|
||||
pub mod sketch_constraints;
|
||||
pub mod sketch_create;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
//! Environment editor commands; saved values retain the existing render setup format.
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct EnvironmentParams {
|
||||
pub name: String,
|
||||
/// Complete numerical draft, validated before applying the requested edit.
|
||||
#[serde(default = "empty_patch")]
|
||||
pub set: Value,
|
||||
/// Finite degrees within +/- one million; wrapped to [-180, 180).
|
||||
pub rotation_deg: Option<f64>,
|
||||
/// Linear intensity: 0..64 for CPU and 0..100 for GPU.
|
||||
pub intensity: Option<f64>,
|
||||
}
|
||||
|
||||
fn empty_patch() -> Value {
|
||||
serde_json::json!({})
|
||||
}
|
||||
|
||||
#[derive(Serialize, JsonSchema)]
|
||||
pub struct EnvironmentResult {
|
||||
pub name: String,
|
||||
pub setup: Value,
|
||||
}
|
||||
@@ -189,6 +189,7 @@ pub(crate) fn overlays(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
} else {
|
||||
crate::shell::register_panel(app, "render:progress-pill", None, None);
|
||||
}
|
||||
crate::render_workspace::environment_overlay(app, ui, viewport);
|
||||
crate::navigation_bar_view::show(app, ui, viewport);
|
||||
if !focused(app) {
|
||||
shots_pill(app, ui, free);
|
||||
|
||||
@@ -31,6 +31,8 @@ mod hdr;
|
||||
|
||||
#[path = "render_workspace_effects.rs"]
|
||||
mod effects;
|
||||
#[path = "render_workspace_environment.rs"]
|
||||
mod environment;
|
||||
#[path = "render_workspace_inspector.rs"]
|
||||
mod inspector;
|
||||
|
||||
@@ -291,6 +293,7 @@ pub struct ViewState {
|
||||
materials: materials::View,
|
||||
library: library::View,
|
||||
inspector: inspector::View,
|
||||
environment_ring: environment::RingView,
|
||||
|
||||
cpu: cpu::View,
|
||||
overwrite: bool,
|
||||
@@ -352,6 +355,7 @@ impl Default for ViewState {
|
||||
materials: materials::View::default(),
|
||||
library: library::View::default(),
|
||||
inspector: inspector::View::default(),
|
||||
environment_ring: environment::RingView::default(),
|
||||
|
||||
cpu: cpu::View::default(),
|
||||
overwrite: false,
|
||||
@@ -954,6 +958,7 @@ fn image_edit_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
crate::ui_kit::number_field(ui, &mut app.render_workspace.view.draft.exposure_ev, -32.0..=32.0, 0.1, " EV");
|
||||
ui.small(app.tr("render.gpu_options_help"));
|
||||
studio::controls(app, ui);
|
||||
studio::backdrop_controls(app, ui);
|
||||
});
|
||||
}
|
||||
library::controls(app, ui);
|
||||
@@ -1774,6 +1779,7 @@ pub fn preview_size(executor: Option<&ExecutorDescriptor>, full: (u64, u64)) ->
|
||||
|
||||
pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
if app.render_workspace.view.result {
|
||||
app.render_workspace.view.environment_ring = environment::RingView::default();
|
||||
show_result(app, ui);
|
||||
return;
|
||||
}
|
||||
@@ -1781,28 +1787,34 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
app.viewport.rect = Some(rect);
|
||||
crate::viewport::refresh_layout(app, ui.ctx());
|
||||
let response = ui.interact(rect, ui.id().with("render_preview"), Sense::click_and_drag());
|
||||
let input = crate::navigation::handle(app, ui, rect, &response, crate::navigation::NavCaps::RENDER);
|
||||
let navigating = input.scroll != 0.0
|
||||
|| input.pinch != 1.0
|
||||
|| input.pan != egui::Vec2::ZERO
|
||||
|| input.middle
|
||||
|| input.secondary_down
|
||||
|| (input.primary_nav.is_some() && input.primary_down)
|
||||
|| input.mode.is_some()
|
||||
|| app.viewport.axis_drag.is_some()
|
||||
|| app.viewport.spin
|
||||
|| app.cam_anim.is_some();
|
||||
let hits = input
|
||||
.hover
|
||||
.filter(|_| input.inside && !navigating)
|
||||
.map(|p| crate::viewport::pick_cached(app, &crate::viewport::projection(app, rect), p))
|
||||
.unwrap_or_default();
|
||||
let candidate = crate::viewport::candidate(app, &hits);
|
||||
app.viewport.hover = candidate.as_ref().map(|(hit, _)| hit.clone());
|
||||
if response.clicked_by(egui::PointerButton::Primary) && input.inside && !navigating {
|
||||
let (add, toggle) =
|
||||
crate::tool_modifiers::selection_click(crate::tool_modifiers::Held::from_modifiers(input.mods), app.preferences.selection_shift_add_only);
|
||||
crate::viewport::select(app, candidate.map(|(_, sel)| sel), add, toggle);
|
||||
if !environment::ring_input(app, ui, rect, &response) {
|
||||
let input = crate::navigation::handle(app, ui, rect, &response, crate::navigation::NavCaps::RENDER);
|
||||
let navigating = input.scroll != 0.0
|
||||
|| input.pinch != 1.0
|
||||
|| input.pan != egui::Vec2::ZERO
|
||||
|| input.middle
|
||||
|| input.secondary_down
|
||||
|| (input.primary_nav.is_some() && input.primary_down)
|
||||
|| input.mode.is_some()
|
||||
|| app.viewport.axis_drag.is_some()
|
||||
|| app.viewport.spin
|
||||
|| app.cam_anim.is_some();
|
||||
let hits = input
|
||||
.hover
|
||||
.filter(|_| input.inside && !navigating)
|
||||
.map(|p| crate::viewport::pick_cached(app, &crate::viewport::projection(app, rect), p))
|
||||
.unwrap_or_default();
|
||||
let candidate = crate::viewport::candidate(app, &hits);
|
||||
app.viewport.hover = candidate.as_ref().map(|(hit, _)| hit.clone());
|
||||
if response.clicked_by(egui::PointerButton::Primary) && input.inside && !navigating {
|
||||
let (add, toggle) = crate::tool_modifiers::selection_click(
|
||||
crate::tool_modifiers::Held::from_modifiers(input.mods),
|
||||
app.preferences.selection_shift_add_only,
|
||||
);
|
||||
crate::viewport::select(app, candidate.map(|(_, sel)| sel), add, toggle);
|
||||
}
|
||||
} else {
|
||||
app.viewport.hover = None;
|
||||
}
|
||||
let bg = app.render_workspace.view.draft.background;
|
||||
ui.painter().rect_filled(rect, 0.0, Color32::from_rgb(bg[0], bg[1], bg[2]));
|
||||
@@ -1976,6 +1988,10 @@ pub(crate) fn progress_pill(app: &mut SolveApp, ui: &mut egui::Ui) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) fn environment_overlay(app: &mut SolveApp, ui: &mut egui::Ui, viewport: egui::Rect) {
|
||||
environment::ring_overlay(app, ui, viewport);
|
||||
}
|
||||
|
||||
pub(crate) fn interactive_command_info(app: &SolveApp, command: &solidcraft_engine::CommandSpec) -> solidcraft_engine::CommandInfo {
|
||||
let mut info = ribbon::command_info(app, command);
|
||||
// A drawing tool on the SKETCH tab kept shown outside a sketch starts one (#7904).
|
||||
|
||||
@@ -434,6 +434,7 @@ pub(super) fn reflection_sampling_controls(app: &mut SolveApp, ui: &mut egui::Ui
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) fn environment_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let selected = app.render_workspace.view.cpu.environment;
|
||||
let key = match selected {
|
||||
|
||||
@@ -188,7 +188,7 @@ pub(super) fn aging_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.aging_airborne").to_string();
|
||||
ui_kit::section(ui, "render_aging_atmosphere", &title, false, |ui| {
|
||||
note(app, ui, "render.aging_airborne_help");
|
||||
super::transport::volume_controls(app, ui);
|
||||
super::environment::atmosphere(app, ui);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,928 @@
|
||||
//! Standalone Environment inspector body. Drawing and source browsing never save a setup.
|
||||
use super::{ImageMethod, Stage, cpu, hdr, setups, studio};
|
||||
use crate::{SolveApp, theme::Tokens, ui_kit};
|
||||
use serde_json::{Value, json};
|
||||
use solidcraft_engine::doc::render_settings::{RenderJob, RenderSetup};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub(super) struct RingView {
|
||||
pub geometry: Option<Ring>,
|
||||
drag: Option<RingDrag>,
|
||||
suppress_primary: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(super) struct Ring {
|
||||
pub center: egui::Pos2,
|
||||
pub radius: f32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct RingDrag {
|
||||
ring: Ring,
|
||||
viewport: egui::Rect,
|
||||
document: Weak<solidcraft_engine::doc::Document>,
|
||||
revision: u64,
|
||||
name: String,
|
||||
start: f64,
|
||||
initial: f64,
|
||||
current: f64,
|
||||
moved: bool,
|
||||
}
|
||||
|
||||
/// Clockwise screen-space angle. An undefined centre or collapsed ring is not a gesture.
|
||||
pub(super) fn pointer_angle(pointer: egui::Pos2, center: egui::Pos2, radius: f32) -> Option<f64> {
|
||||
if !pointer.is_finite() || !center.is_finite() || !radius.is_finite() || !(1.0..=1e6).contains(&radius) {
|
||||
return None;
|
||||
}
|
||||
let x = f64::from(pointer.x) - f64::from(center.x);
|
||||
let y = f64::from(pointer.y) - f64::from(center.y);
|
||||
(x.hypot(y) >= 1e-6).then(|| y.atan2(x).to_degrees())
|
||||
}
|
||||
|
||||
pub(super) fn drag_rotation(initial: f64, start: f64, angle: f64, snap: bool) -> Option<f64> {
|
||||
if [initial, start, angle].iter().any(|value| !value.is_finite() || value.abs() > 1e6) {
|
||||
return None;
|
||||
}
|
||||
let delta = (angle - start + 180.0).rem_euclid(360.0) - 180.0;
|
||||
let value = initial + delta;
|
||||
let value = if snap { (value / 15.0).round() * 15.0 } else { value };
|
||||
Some((value + 180.0).rem_euclid(360.0) - 180.0)
|
||||
}
|
||||
|
||||
fn ring_target(app: &SolveApp) -> bool {
|
||||
let view = &app.render_workspace.view;
|
||||
super::active(app)
|
||||
&& !view.result
|
||||
&& (view.selection == super::RenderSelection::Environment
|
||||
|| matches!(view.inspector.page, super::inspector::Page::Environment | super::inspector::Page::Background))
|
||||
&& environment_values(app).is_some_and(|(_, _, _, rotates)| rotates)
|
||||
&& !app.session.model.is_stale()
|
||||
}
|
||||
|
||||
fn ring_geometry(app: &SolveApp, viewport: egui::Rect) -> Option<Ring> {
|
||||
let free = crate::render_ui::canvas(app, viewport);
|
||||
if !viewport.is_finite() || !viewport.is_positive() || !free.is_finite() || !free.is_positive() {
|
||||
return None;
|
||||
}
|
||||
let world = crate::open_meshing::shown_world(app);
|
||||
let bounds = crate::viewport::body_bounds(app, &world)
|
||||
.iter()
|
||||
.filter(|(name, _)| app.session.body_visible(name))
|
||||
.fold(solidcraft_engine::geom::Aabb3::EMPTY, |a, (_, b)| a.union(b));
|
||||
if bounds.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let subject = crate::viewport::screen_box(&crate::viewport::projection(app, viewport), &bounds, 0.0)?;
|
||||
let center = subject.center();
|
||||
if !subject.is_finite() || !center.is_finite() || !free.contains(center) {
|
||||
return None;
|
||||
}
|
||||
let t = Tokens::get();
|
||||
let maximum = (center.x - free.left()).min(free.right() - center.x).min(center.y - free.top()).min(free.bottom() - center.y) - t.space_12;
|
||||
let minimum = t.control_height * 2.0;
|
||||
if !maximum.is_finite() || maximum < minimum {
|
||||
return None;
|
||||
}
|
||||
let radius = (subject.size().length() * 0.5 + t.space_24).clamp(minimum, maximum.min(1e6));
|
||||
Some(Ring { center, radius })
|
||||
}
|
||||
|
||||
/// Own the complete primary gesture before shared camera navigation or product picking sees it.
|
||||
pub(super) fn ring_input(app: &mut SolveApp, ui: &mut egui::Ui, viewport: egui::Rect, response: &egui::Response) -> bool {
|
||||
if app.render_workspace.view.environment_ring.suppress_primary {
|
||||
app.render_workspace.view.environment_ring.suppress_primary = ui.input(|i| i.pointer.primary_down());
|
||||
return true;
|
||||
}
|
||||
let mut drag = app.render_workspace.view.environment_ring.drag.take();
|
||||
let captured = drag.is_some();
|
||||
let valid = ring_target(app) && setups::snapshot(app).is_ok();
|
||||
let fresh = drag.as_ref().is_none_or(|d| {
|
||||
d.revision == app.session.revision
|
||||
&& d.name == app.render_workspace.view.name
|
||||
&& d.viewport == viewport
|
||||
&& Weak::ptr_eq(&d.document, &Arc::downgrade(&app.session.doc))
|
||||
&& environment_values(app).is_some_and(|(rotation, _, _, _)| rotation == d.initial)
|
||||
});
|
||||
if !valid || !fresh {
|
||||
app.render_workspace.view.environment_ring.geometry = None;
|
||||
app.render_workspace.view.environment_ring.suppress_primary = captured && ui.input(|i| i.pointer.primary_down());
|
||||
return captured;
|
||||
}
|
||||
let geometry = drag.as_ref().map(|d| d.ring).or_else(|| ring_geometry(app, viewport));
|
||||
app.render_workspace.view.environment_ring.geometry = geometry;
|
||||
let Some(ring) = geometry else { return captured };
|
||||
let (pointer, origin, pressed, down, released, shift, escape) = ui.input(|i| {
|
||||
(
|
||||
i.pointer.latest_pos(),
|
||||
i.pointer.press_origin(),
|
||||
i.pointer.button_pressed(egui::PointerButton::Primary),
|
||||
i.pointer.primary_down(),
|
||||
i.pointer.button_released(egui::PointerButton::Primary),
|
||||
i.modifiers.shift,
|
||||
i.key_pressed(egui::Key::Escape),
|
||||
)
|
||||
});
|
||||
let hit = |p: egui::Pos2| p.is_finite() && (p.distance(ring.center) - ring.radius).abs() <= Tokens::get().space_8;
|
||||
if drag.is_none()
|
||||
&& pressed
|
||||
&& ui.is_enabled()
|
||||
&& response.contains_pointer()
|
||||
&& !egui::Popup::is_any_open(ui.ctx())
|
||||
&& app.dialog.is_none()
|
||||
&& let Some(origin) = origin.filter(|p| !crate::shell::covered(app, *p) && hit(*p))
|
||||
&& let Some(start) = pointer_angle(origin, ring.center, ring.radius)
|
||||
&& let Some((initial, _, _, _)) = environment_values(app)
|
||||
{
|
||||
drag = Some(RingDrag {
|
||||
ring,
|
||||
viewport,
|
||||
document: Arc::downgrade(&app.session.doc),
|
||||
revision: app.session.revision,
|
||||
name: app.render_workspace.view.name.clone(),
|
||||
start,
|
||||
initial,
|
||||
current: initial,
|
||||
moved: false,
|
||||
});
|
||||
}
|
||||
if let Some(mut drag) = drag {
|
||||
app.begin_external_navigation();
|
||||
app.viewport.orbit_from = None;
|
||||
app.viewport.primary_nav = None;
|
||||
app.viewport.modifier_nav = None;
|
||||
app.viewport.key_hold = None;
|
||||
app.viewport.device_motion = None;
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing);
|
||||
let angle = pointer.and_then(|p| pointer_angle(p, ring.center, ring.radius)).and_then(|angle| {
|
||||
drag.moved |= drag_rotation(0.0, drag.start, angle, false).is_some_and(|delta| delta.abs() > 1e-6);
|
||||
drag_rotation(drag.initial, drag.start, angle, shift && drag.moved)
|
||||
});
|
||||
if escape || angle.is_none() || (!down && !released) {
|
||||
app.render_workspace.view.environment_ring.suppress_primary = down;
|
||||
return true;
|
||||
}
|
||||
if let Some(angle) = angle {
|
||||
drag.current = angle;
|
||||
}
|
||||
if released {
|
||||
if drag.moved
|
||||
&& (drag.current - drag.initial).abs() > 1e-9
|
||||
&& let Err(error) = commit_environment(app, json!({"rotation_deg":drag.current}))
|
||||
{
|
||||
app.set_status(error, true);
|
||||
}
|
||||
} else {
|
||||
app.render_workspace.view.environment_ring.drag = Some(drag);
|
||||
}
|
||||
ui.ctx().request_repaint();
|
||||
return true;
|
||||
}
|
||||
if ui.is_enabled() && pointer.is_some_and(hit) && response.contains_pointer() {
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Grab);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub(super) fn ring_overlay(app: &mut SolveApp, ui: &mut egui::Ui, viewport: egui::Rect) {
|
||||
if !ring_target(app) {
|
||||
return;
|
||||
}
|
||||
let view = &app.render_workspace.view.environment_ring;
|
||||
let Some(ring) = view.geometry else { return };
|
||||
let angle = view.drag.as_ref().map(|drag| drag.current).or_else(|| environment_values(app).map(|v| v.0)).unwrap_or(0.0);
|
||||
let t = Tokens::get();
|
||||
let free = crate::render_ui::canvas(app, viewport);
|
||||
let painter = ui.painter().with_clip_rect(free.intersect(viewport));
|
||||
painter.circle_stroke(ring.center, ring.radius, egui::Stroke::new(t.space_2, t.form_primary));
|
||||
let radians = angle.to_radians();
|
||||
let handle = ring.center + egui::vec2(radians.cos() as f32, radians.sin() as f32) * ring.radius;
|
||||
painter.circle_filled(handle, t.space_6, t.form_primary);
|
||||
painter.circle_stroke(handle, t.space_6, t.control_border_stroke(t.on_accent));
|
||||
crate::scenario::publish_target("render:environment:ring", egui::Rect::from_center_size(ring.center, egui::Vec2::splat(ring.radius * 2.0)));
|
||||
crate::scenario::publish_target("render:environment:ring-handle", egui::Rect::from_center_size(handle, egui::Vec2::splat(t.space_16)));
|
||||
let chip = ui_kit::Container::navigation_card(
|
||||
ui.ctx(),
|
||||
egui::Id::new("render_environment_rotation"),
|
||||
ring.center + egui::vec2(0.0, ring.radius - t.control_height - t.space_8),
|
||||
egui::Align2::CENTER_BOTTOM,
|
||||
|ui| ui_kit::text(ui, &format!("{angle:.0}°"), ui_kit::Text::Inline).on_hover_text(app.tr("render.env_ring_help")),
|
||||
);
|
||||
crate::scenario::publish_target("render:environment:ring-degrees", chip.response.rect);
|
||||
}
|
||||
|
||||
pub(super) fn editor(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
ui_kit::scope(ui, |ui| {
|
||||
source(app, ui);
|
||||
let title = app.tr("render.environment.orientation").to_string();
|
||||
ui_kit::section(ui, "render_environment_orientation", &title, true, |ui| {
|
||||
let snapshot = setups::snapshot(app);
|
||||
let controls = environment_values(app);
|
||||
let valid = snapshot.is_ok() && controls.is_some();
|
||||
let (rotation, intensity, maximum, rotates) = controls.unwrap_or((0.0, 1.0, 100.0, false));
|
||||
ui.add_enabled_ui(valid, |ui| {
|
||||
let mut request = None;
|
||||
ui_kit::row(ui, app.tr("render.env_rotate"), |ui| {
|
||||
ui.add_enabled_ui(rotates, |ui| {
|
||||
if let Some(value) = edit(app, ui, "rotation-slider", rotation, |ui, value| {
|
||||
let response =
|
||||
ui_kit::slider(ui, value, -180.0..=180.0, ui_kit::Slider { format: |v| format!("{v:.0}°"), ..Default::default() });
|
||||
crate::scenario::publish_target("render:environment:rotation-slider", response.rect);
|
||||
crate::scenario::publish_target("render:environment:rotation", response.rect);
|
||||
response
|
||||
}) {
|
||||
request = Some(json!({"rotation_deg":value}));
|
||||
}
|
||||
});
|
||||
});
|
||||
ui_kit::row(ui, app.tr("render.env_intensity"), |ui| {
|
||||
if let Some(value) = edit(app, ui, "intensity", intensity, |ui, value| {
|
||||
let response =
|
||||
ui_kit::slider(ui, value, 0.0..=maximum, ui_kit::Slider { format: |v| format!("{v:.2}"), ..Default::default() });
|
||||
crate::scenario::publish_target("render:environment:intensity", response.rect);
|
||||
response
|
||||
}) {
|
||||
request = Some(json!({"intensity":value}));
|
||||
}
|
||||
});
|
||||
if let Some(request) = request
|
||||
&& let Err(error) = commit_environment(app, request)
|
||||
{
|
||||
app.set_status(error, true);
|
||||
}
|
||||
});
|
||||
if valid && !rotates {
|
||||
note(app, ui, "render.environment.rotation_hdr");
|
||||
}
|
||||
if !valid {
|
||||
let reason = snapshot.err().unwrap_or_else(|| app.tr("render.env_choose_source").into());
|
||||
ui_kit::text(ui, &reason, ui_kit::Text::Note("render:environment:unavailable"));
|
||||
}
|
||||
});
|
||||
backdrop(app, ui);
|
||||
ground(app, ui);
|
||||
atmosphere(app, ui);
|
||||
});
|
||||
stage_confirmation(app, ui.ctx());
|
||||
}
|
||||
|
||||
pub(super) fn open_sources(app: &mut SolveApp) {
|
||||
let page = app.render_workspace.view.inspector.page;
|
||||
super::library::open_category(app, "hdr");
|
||||
if let Err(error) = app.run("view.render_stage", json!({"stage":Stage::Light.key()})) {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
app.render_workspace.view.inspector.page = page;
|
||||
}
|
||||
|
||||
fn note(app: &SolveApp, ui: &mut egui::Ui, key: &str) {
|
||||
ui_kit::text(ui, app.tr(key), ui_kit::Text::Note(key));
|
||||
}
|
||||
|
||||
pub(super) fn persist(app: &mut SolveApp) {
|
||||
let file = hdr::active(app).and_then(|target| match hdr::input(app, target) {
|
||||
input @ hdr::Input::FileCaptured { .. } => Some((target, input.clone())),
|
||||
_ => None,
|
||||
});
|
||||
app.render_workspace.view.dirty = true;
|
||||
if let Err(error) = setups::save(app) {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
// Keep the checked path available for rechecking; the engine has captured its bytes.
|
||||
if let Some((target, input)) = file {
|
||||
match target {
|
||||
hdr::Target::Gpu => app.render_workspace.view.studio.hdr = input,
|
||||
hdr::Target::Cpu => app.render_workspace.view.cpu.hdr = input,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn source(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.env_source").to_string();
|
||||
ui_kit::section(ui, "render_environment_source", &title, true, |ui| {
|
||||
let method = app.render_workspace.view.method;
|
||||
let gpu = method == ImageMethod::GpuRaytrace;
|
||||
let target = if gpu { hdr::Target::Gpu } else { hdr::Target::Cpu };
|
||||
let selected = match method {
|
||||
ImageMethod::GpuRaytrace => match app.render_workspace.view.studio.environment {
|
||||
studio::Environment::None => 0,
|
||||
studio::Environment::Sky => 1,
|
||||
studio::Environment::Hdr => {
|
||||
if hdr::input(app, target).embedded() {
|
||||
3
|
||||
} else {
|
||||
2
|
||||
}
|
||||
}
|
||||
},
|
||||
ImageMethod::CpuRaytrace => match app.render_workspace.view.cpu.environment {
|
||||
cpu::Environment::None => 0,
|
||||
cpu::Environment::Constant => 1,
|
||||
cpu::Environment::Hdr => 2,
|
||||
},
|
||||
ImageMethod::Raster => 0,
|
||||
};
|
||||
let keys = if gpu {
|
||||
["render.environment.none", "render.studio_sky", "render.environment.hdr_file", "render.environment.builtin"]
|
||||
} else {
|
||||
["render.environment.none", "render.environment.constant", "render.environment.hdr", "render.environment.builtin"]
|
||||
};
|
||||
if selected >= 2 && hdr::input(app, target).embedded() {
|
||||
let name = source_name(app, ui.ctx());
|
||||
ui_kit::banner(ui, ui_kit::AssistantTone::Neutral, |ui| {
|
||||
ui_kit::text(ui, &name, ui_kit::Text::NameCell(true));
|
||||
let kind = app.tr(if gpu { "render.environment.builtin" } else { "render.environment.hdr_file" });
|
||||
let detail = hdr::metadata(app, target).map_or_else(|| kind.to_string(), |info| format!("{kind} · {} × {}", info.width, info.height));
|
||||
ui_kit::text(ui, &detail, ui_kit::Text::Inline);
|
||||
note(app, ui, "render.environment.embedded");
|
||||
});
|
||||
}
|
||||
let mut changed = false;
|
||||
ui_kit::row(ui, app.tr("render.env_source"), |ui| {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
let change = ui_kit::button(ui, app.tr("render.env_change"), ui_kit::Button::Normal);
|
||||
crate::scenario::publish_target("render:environment:change", change.rect);
|
||||
if change.clicked() {
|
||||
open_sources(app);
|
||||
}
|
||||
|
||||
ui.add_enabled_ui(method != ImageMethod::Raster, |ui| {
|
||||
ui_kit::dropdown_menu(ui, "render_environment_source_kind", app.tr(keys.get(selected).copied().unwrap_or(keys[0])), |ui| {
|
||||
for (index, key) in keys.iter().enumerate().take(if gpu { 4 } else { 3 }) {
|
||||
if ui_kit::list_picker(ui, key, app.tr(key), index == selected).clicked() {
|
||||
if index == 3 {
|
||||
open_sources(app);
|
||||
} else if index != selected {
|
||||
if gpu {
|
||||
app.render_workspace.view.studio.environment = match index {
|
||||
1 => studio::Environment::Sky,
|
||||
2 => studio::Environment::Hdr,
|
||||
_ => studio::Environment::None,
|
||||
};
|
||||
if index == 2 {
|
||||
app.render_workspace.view.studio.hdr = hdr::Input::Empty;
|
||||
}
|
||||
} else {
|
||||
app.render_workspace.view.cpu.environment = match index {
|
||||
1 => cpu::Environment::Constant,
|
||||
2 => cpu::Environment::Hdr,
|
||||
_ => cpu::Environment::None,
|
||||
};
|
||||
if index == 0 {
|
||||
app.render_workspace.view.raytrace.environment = None;
|
||||
}
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
if method == ImageMethod::Raster {
|
||||
note(app, ui, "render.environment.source_raytrace");
|
||||
}
|
||||
if selected == 1 && gpu {
|
||||
for (key, index) in [("render.environment.zenith", 0), ("render.environment.horizon", 1), ("render.environment.sky_ground", 2)] {
|
||||
let gradient = app.render_workspace.view.studio.gradient;
|
||||
let mut value = match index {
|
||||
0 => gradient.zenith,
|
||||
1 => gradient.horizon,
|
||||
_ => gradient.ground,
|
||||
}
|
||||
.map(f64::from);
|
||||
if ui_kit::row(ui, app.tr(key), |ui| ui_kit::linear_color_field(ui, &mut value, 1e6)).changed() {
|
||||
let gradient = &mut app.render_workspace.view.studio.gradient;
|
||||
let field = match index {
|
||||
0 => &mut gradient.zenith,
|
||||
1 => &mut gradient.horizon,
|
||||
_ => &mut gradient.ground,
|
||||
};
|
||||
*field = value.map(|v| v as f32);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
note(app, ui, "render.environment.sky_note");
|
||||
} else if selected == 1 {
|
||||
let mut color = app.render_workspace.view.cpu.color;
|
||||
if ui_kit::row(ui, app.tr("render.env_colour"), |ui| ui_kit::linear_color_field(ui, &mut color, 1.0)).changed() {
|
||||
app.render_workspace.view.cpu.color = color;
|
||||
changed = true;
|
||||
}
|
||||
} else if selected >= 2 {
|
||||
let before = hdr::input(app, target).clone();
|
||||
hdr::controls(app, ui, target);
|
||||
changed |= &before != hdr::input(app, target);
|
||||
let label = app.tr("render.environment.primaries").to_string();
|
||||
ui.add_enabled_ui(gpu, |ui| {
|
||||
changed |= ui_kit::checkbox(ui, &label, &mut app.render_workspace.view.studio.assume_linear_srgb).changed();
|
||||
});
|
||||
if !gpu {
|
||||
note(app, ui, "render.environment.primaries_gpu");
|
||||
}
|
||||
ui.add_enabled_ui(!gpu, |ui| {
|
||||
let samples = app.render_workspace.view.cpu.samples;
|
||||
ui_kit::row(ui, app.tr("render.environment.lighting_samples"), |ui| {
|
||||
ui_kit::dropdown_menu(ui, "render_environment_lighting_samples", &samples.to_string(), |ui| {
|
||||
for count in [1, 4, 16, 64] {
|
||||
if ui_kit::list_picker(ui, &count.to_string(), &count.to_string(), count == samples).clicked() {
|
||||
app.render_workspace.view.cpu.samples = count;
|
||||
changed = true;
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
if gpu {
|
||||
note(app, ui, "render.environment.samples_cpu");
|
||||
}
|
||||
}
|
||||
if changed {
|
||||
app.render_workspace.view.dirty = true;
|
||||
// An unchecked path stays in the existing draft until the user checks it.
|
||||
if hdr::active(app).is_none_or(|target| hdr::input(app, target).resource().is_some()) {
|
||||
persist(app);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn source_name(app: &mut SolveApp, ctx: &egui::Context) -> String {
|
||||
let source = match app.render_workspace.view.method {
|
||||
ImageMethod::CpuRaytrace => {
|
||||
app.render_workspace.view.cpu.hdr.resource().filter(|_| app.render_workspace.view.cpu.environment == cpu::Environment::Hdr)
|
||||
}
|
||||
ImageMethod::GpuRaytrace => {
|
||||
app.render_workspace.view.studio.hdr.resource().filter(|_| app.render_workspace.view.studio.environment == studio::Environment::Hdr)
|
||||
}
|
||||
ImageMethod::Raster => None,
|
||||
};
|
||||
if let Some(source) = source {
|
||||
type Names = std::sync::Arc<std::collections::BTreeMap<String, String>>;
|
||||
let cache = egui::Id::new("render_environment_catalog_names");
|
||||
let names = ctx.data_mut(|data| data.get_temp::<Names>(cache)).unwrap_or_else(|| {
|
||||
let mut names = std::collections::BTreeMap::new();
|
||||
if let Ok(reply) = app.run("render.library.list", json!({"kind":"hdr","limit":128})) {
|
||||
for entry in reply["items"].as_array().into_iter().flatten().take(128) {
|
||||
if let Some(id) = entry["id"].as_str()
|
||||
&& let Ok(detail) = app.run("render.library.describe", json!({"kind":"hdr","id":id}))
|
||||
&& let (Some(digest), Some(name)) = (detail["resource"]["sha256"].as_str(), detail["resource"]["name"].as_str())
|
||||
{
|
||||
names.insert(digest.to_string(), name.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
let names = std::sync::Arc::new(names);
|
||||
ctx.data_mut(|data| data.insert_temp(cache, names.clone()));
|
||||
names
|
||||
});
|
||||
if let Some(name) = names.get(&source.to_string()) {
|
||||
return name.clone();
|
||||
}
|
||||
}
|
||||
super::scene::environment(app).0
|
||||
}
|
||||
|
||||
fn environment_values(app: &SolveApp) -> Option<(f64, f64, f64, bool)> {
|
||||
let v = &app.render_workspace.view;
|
||||
match v.method {
|
||||
ImageMethod::GpuRaytrace if v.studio.environment != studio::Environment::None => {
|
||||
Some((wrapped_degrees(v.studio.rotation_rad), v.studio.intensity, 100.0, true))
|
||||
}
|
||||
ImageMethod::CpuRaytrace if v.cpu.environment != cpu::Environment::None => {
|
||||
Some((wrapped_degrees(v.cpu.rotation_rad), v.cpu.intensity, 64.0, v.cpu.environment == cpu::Environment::Hdr))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn wrapped_degrees(radians: f64) -> f64 {
|
||||
let degrees = radians.to_degrees();
|
||||
if degrees.is_finite() { (degrees + 180.0).rem_euclid(360.0) - 180.0 } else { 0.0 }
|
||||
}
|
||||
|
||||
pub(super) fn commit_environment(app: &mut SolveApp, mut request: Value) -> Result<(), String> {
|
||||
let fields = request.as_object_mut().ok_or_else(|| app.tr("render.env_invalid_edit").to_string())?;
|
||||
fields.insert("name".into(), json!(app.render_workspace.view.name));
|
||||
fields.insert("set".into(), json!(setups::snapshot(app)?));
|
||||
app.run("render.environment.set", request)?;
|
||||
setups::load(app);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn save(app: &mut SolveApp, setup: RenderSetup) -> Result<(), String> {
|
||||
app.run("render.settings.set", json!({"name":app.render_workspace.view.name,"set":setup}))?;
|
||||
setups::load(app);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn commit_backdrop(app: &mut SolveApp, color: [u8; 3], transparent: bool) -> Result<(), String> {
|
||||
let mut setup = setups::snapshot(app)?;
|
||||
setup.background = color;
|
||||
match &mut setup.job {
|
||||
Some(RenderJob::Raster { transparent_background }) => *transparent_background = transparent,
|
||||
Some(RenderJob::GpuPath { transparent_background, options }) => {
|
||||
*transparent_background = transparent;
|
||||
options.backdrop = None;
|
||||
}
|
||||
_ if transparent => return Err(app.tr("render.cpu_opaque_required").into()),
|
||||
_ => {}
|
||||
}
|
||||
save(app, setup)
|
||||
}
|
||||
|
||||
// Keep an in-progress gesture outside the design. Release/Enter commits once;
|
||||
// external commands, undo and document switches invalidate its temporary identity.
|
||||
fn edit<T: Clone + PartialEq + Send + Sync + 'static>(
|
||||
app: &SolveApp,
|
||||
ui: &mut egui::Ui,
|
||||
key: &str,
|
||||
current: T,
|
||||
draw: impl FnOnce(&mut egui::Ui, &mut T) -> egui::Response,
|
||||
) -> Option<T> {
|
||||
let id =
|
||||
ui.id().with(("render-environment", key, &app.render_workspace.view.name, std::sync::Arc::as_ptr(&app.session.doc), app.session.revision));
|
||||
let (_, mut value, mut pending) = ui
|
||||
.data_mut(|data| data.get_temp::<(T, T, bool)>(id))
|
||||
.filter(|(original, _, _)| original == ¤t)
|
||||
.unwrap_or((current.clone(), current.clone(), false));
|
||||
let response = draw(ui, &mut value);
|
||||
pending |= response.changed();
|
||||
let escape = ui.input(|input| input.key_pressed(egui::Key::Escape));
|
||||
let finished =
|
||||
response.drag_stopped() || response.lost_focus() || (!ui.input(|input| input.pointer.any_down()) && !ui.ctx().egui_wants_keyboard_input());
|
||||
if escape || (pending && finished) {
|
||||
ui.data_mut(|data| data.remove::<(T, T, bool)>(id));
|
||||
return (!escape).then_some(value);
|
||||
}
|
||||
ui.data_mut(|data| data.insert_temp(id, (current, value, pending)));
|
||||
None
|
||||
}
|
||||
|
||||
fn backdrop(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
use solidcraft_engine::render::job::finishing::BackdropMode;
|
||||
let title = app.tr("render.env_backdrop").to_string();
|
||||
ui_kit::section(ui, "render_environment_backdrop", &title, true, |ui| {
|
||||
let gpu = app.render_workspace.view.method == ImageMethod::GpuRaytrace;
|
||||
let mut mode = if app.render_workspace.view.transparent {
|
||||
3
|
||||
} else if app.render_workspace.view.studio.backdrop_enabled && gpu {
|
||||
2
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let before_mode = mode;
|
||||
ui_kit::segmented(
|
||||
ui,
|
||||
&mut mode,
|
||||
&[app.tr("render.environment.world"), app.tr("render.env_colour"), app.tr("render.environment.gradient"), app.tr("render.env_clear")],
|
||||
ui_kit::Segments {
|
||||
enabled: &[false, true, gpu && !app.render_workspace.view.transparent, app.render_workspace.view.method != ImageMethod::CpuRaytrace],
|
||||
targets: &["render:environment:world", "render:environment:colour", "render:environment:gradient", "render:environment:clear"],
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
if mode == 2 && !gpu {
|
||||
app.set_status(app.tr("render.environment.needs_gpu").to_string(), true);
|
||||
mode = before_mode;
|
||||
}
|
||||
if mode != before_mode {
|
||||
let result = if mode == 2 {
|
||||
commit_gradient(app, true, app.render_workspace.view.studio.backdrop)
|
||||
} else {
|
||||
commit_backdrop(app, app.render_workspace.view.draft.background, mode == 3)
|
||||
};
|
||||
if let Err(error) = result {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
}
|
||||
if mode == 1 {
|
||||
let color = edit(app, ui, "backdrop-colour", app.render_workspace.view.draft.background, |ui, value| {
|
||||
ui_kit::row(ui, app.tr("render.env_colour"), |ui| {
|
||||
let response = ui_kit::color_field(ui, value);
|
||||
crate::scenario::publish_target("render:environment:backdrop-colour", response.rect);
|
||||
response
|
||||
})
|
||||
});
|
||||
if let Some(color) = color
|
||||
&& let Err(error) = commit_backdrop(app, color, false)
|
||||
{
|
||||
app.set_status(error, true);
|
||||
}
|
||||
}
|
||||
if mode == 2 || !gpu {
|
||||
let mut gradient = app.render_workspace.view.studio.backdrop;
|
||||
let mut changed = false;
|
||||
ui.add_enabled_ui(gpu && !app.render_workspace.view.transparent, |ui| {
|
||||
let mut mode = match gradient.mode {
|
||||
BackdropMode::Vertical => 0,
|
||||
BackdropMode::Horizontal => 1,
|
||||
BackdropMode::Radial => 2,
|
||||
};
|
||||
changed |= ui_kit::row(ui, app.tr("render.environment.mode"), |ui| {
|
||||
ui_kit::segmented(
|
||||
ui,
|
||||
&mut mode,
|
||||
&[app.tr("render.environment.vertical"), app.tr("render.environment.horizontal"), app.tr("render.environment.radial")],
|
||||
Default::default(),
|
||||
)
|
||||
});
|
||||
gradient.mode = match mode {
|
||||
1 => BackdropMode::Horizontal,
|
||||
2 => BackdropMode::Radial,
|
||||
_ => BackdropMode::Vertical,
|
||||
};
|
||||
for (key, value) in [("render.environment.start", &mut gradient.first_srgb), ("render.environment.end", &mut gradient.second_srgb)] {
|
||||
if let Some(color) = edit(app, ui, key, *value, |ui, value| ui_kit::row(ui, app.tr(key), |ui| ui_kit::color_field(ui, value))) {
|
||||
*value = color;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
ui.add_enabled_ui(gradient.mode == BackdropMode::Radial, |ui| {
|
||||
for (index, key) in [(0, "render.backdrop_x"), (1, "render.backdrop_y")] {
|
||||
if let Some(value) = gradient.center.get_mut(index)
|
||||
&& let Some(number) = edit(app, ui, key, *value, |ui, value| {
|
||||
ui_kit::row(ui, app.tr(key), |ui| ui_kit::number_field(ui, value, 0.0..=1.0, 0.01, ""))
|
||||
})
|
||||
{
|
||||
*value = number;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if let Some(number) = edit(app, ui, "gradient-radius", gradient.radius, |ui, value| {
|
||||
ui_kit::row(ui, app.tr("render.backdrop_radius"), |ui| ui_kit::number_field(ui, value, 0.05..=4.0, 0.01, ""))
|
||||
}) {
|
||||
gradient.radius = number;
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
if gradient.mode != BackdropMode::Radial {
|
||||
note(app, ui, "render.environment.radial_only");
|
||||
}
|
||||
});
|
||||
if changed && let Err(error) = commit_gradient(app, true, gradient) {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
}
|
||||
ui.add_enabled_ui(false, |ui| {
|
||||
ui_kit::row(ui, app.tr("render.env_blur"), |ui| {
|
||||
ui_kit::slider(ui, &mut 0.0, 0.0..=100.0, ui_kit::Slider { format: |v| format!("{v:.0} %"), ..Default::default() })
|
||||
});
|
||||
});
|
||||
note(app, ui, "render.environment.blur_pending");
|
||||
note(app, ui, "render.environment.backdrop_note");
|
||||
note(app, ui, "render.environment.world_pending");
|
||||
if !gpu {
|
||||
note(app, ui, "render.environment.gradient_gpu");
|
||||
}
|
||||
if app.render_workspace.view.method == ImageMethod::CpuRaytrace {
|
||||
note(app, ui, "render.cpu_opaque_required");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn commit_gradient(
|
||||
app: &mut SolveApp,
|
||||
enabled: bool,
|
||||
gradient: solidcraft_engine::render::job::finishing::Backdrop,
|
||||
) -> Result<(), String> {
|
||||
let mut setup = setups::snapshot(app)?;
|
||||
match &mut setup.job {
|
||||
Some(RenderJob::GpuPath { options, .. }) => options.backdrop = enabled.then_some(gradient),
|
||||
_ => return Err(app.tr("render.environment.needs_gpu").into()),
|
||||
}
|
||||
save(app, setup)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct Ground {
|
||||
pub margin: f64,
|
||||
pub gap: f64,
|
||||
pub color: [f64; 3],
|
||||
}
|
||||
|
||||
fn ground_values(app: &SolveApp, setup: &RenderSetup) -> Ground {
|
||||
let mut value = Ground { margin: 0.25, gap: 0.1, color: [0.18; 3] };
|
||||
if let Some(panel) = setup.stage.iter().find(|panel| matches!(panel.id.as_str(), "ground" | "studio_ground")) {
|
||||
value.color = panel.reflectance_linear;
|
||||
if let Ok(scene) = solidcraft_engine::product_scene::extract(&app.session)
|
||||
&& !scene.bounds.is_empty()
|
||||
{
|
||||
let bounds = scene.bounds;
|
||||
let size = bounds.max - bounds.min;
|
||||
let extent = size.x.max(size.y).max(size.z).max(0.001);
|
||||
value.margin = ((panel.half_u_mm.first().copied().unwrap_or(0.0).abs() - (size.x * 0.5).max(0.001)) / extent).clamp(0.0, 10.0);
|
||||
value.gap = (bounds.min.z - panel.center_mm.get(2).copied().unwrap_or(bounds.min.z)).clamp(0.0001, 1000.0);
|
||||
}
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
pub(super) fn commit_ground(app: &mut SolveApp, enabled: bool, value: Ground) -> Result<(), String> {
|
||||
let set = setups::snapshot(app)?;
|
||||
let request = if enabled {
|
||||
json!({"name":app.render_workspace.view.name,"set":set,"margin_fraction":value.margin,"gap_mm":value.gap,"reflectance_linear":value.color,"replace_stage":true})
|
||||
} else {
|
||||
json!({"name":app.render_workspace.view.name,"set":set})
|
||||
};
|
||||
app.run(if enabled { "render.stage.ground" } else { "render.stage.clear" }, request)?;
|
||||
setups::load(app);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct GroundForm {
|
||||
value: Ground,
|
||||
replace: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct StageRemoval {
|
||||
document: Weak<solidcraft_engine::doc::Document>,
|
||||
revision: u64,
|
||||
name: String,
|
||||
set: RenderSetup,
|
||||
}
|
||||
|
||||
pub(super) fn request_stage_removal(app: &SolveApp, ctx: &egui::Context) {
|
||||
if let Ok(set) = setups::snapshot(app) {
|
||||
ctx.data_mut(|data| {
|
||||
data.insert_temp(
|
||||
egui::Id::new("render_remove_stage"),
|
||||
StageRemoval {
|
||||
document: Arc::downgrade(&app.session.doc),
|
||||
revision: app.session.revision,
|
||||
name: app.render_workspace.view.name.clone(),
|
||||
set,
|
||||
},
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn stage_confirmation(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
let id = egui::Id::new("render_remove_stage");
|
||||
let Some(pending) = ctx.data_mut(|data| data.get_temp::<StageRemoval>(id)) else { return };
|
||||
if pending.revision != app.session.revision
|
||||
|| pending.name != app.render_workspace.view.name
|
||||
|| !Weak::ptr_eq(&pending.document, &Arc::downgrade(&app.session.doc))
|
||||
|| setups::snapshot(app).as_ref() != Ok(&pending.set)
|
||||
{
|
||||
ctx.data_mut(|data| data.remove::<StageRemoval>(id));
|
||||
return;
|
||||
}
|
||||
let title = app.tr("render.environment.remove_confirm").to_string();
|
||||
let remove = app.tr("render.environment.remove").to_string();
|
||||
let cancel = app.tr("render.environment.keep").to_string();
|
||||
let detail = crate::i18n::Locale::for_language(&app.preferences.language)
|
||||
.format("render.environment.remove_note", &[("count", &pending.set.stage.len().to_string())]);
|
||||
let (closed, action) =
|
||||
ui_kit::Confirm::new(id, "delete", &title).tone(ui_kit::Tone::Danger).actions(&remove, &cancel, None).show(ctx, true, |ui| {
|
||||
ui_kit::text(ui, &detail, ui_kit::Text::Note("render.environment.remove_note"));
|
||||
});
|
||||
if closed || matches!(action, ui_kit::Action::Cancel | ui_kit::Action::Ok) {
|
||||
ctx.data_mut(|data| data.remove::<StageRemoval>(id));
|
||||
}
|
||||
if !closed && action == ui_kit::Action::Ok {
|
||||
match app.run("render.stage.clear", json!({"name":pending.name,"set":pending.set})) {
|
||||
Ok(_) => setups::load(app),
|
||||
Err(error) => app.set_status(error, true),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn ground(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.environment.ground").to_string();
|
||||
ui_kit::section(ui, "render_environment_ground", &title, true, |ui| {
|
||||
let snapshot = setups::snapshot(app);
|
||||
let id = ui.id().with(("ground-form", Arc::as_ptr(&app.session.doc), app.session.revision, &app.render_workspace.view.name));
|
||||
let mut form = ui.data_mut(|data| data.get_temp::<GroundForm>(id)).unwrap_or_else(|| GroundForm {
|
||||
value: snapshot.as_ref().map(|set| ground_values(app, set)).unwrap_or(Ground { margin: 1.0, gap: 0.1, color: [0.18; 3] }),
|
||||
replace: false,
|
||||
});
|
||||
let supported = app.render_workspace.view.method != ImageMethod::Raster;
|
||||
ui.add_enabled_ui(supported, |ui| {
|
||||
for (key, value, range, speed, unit) in [
|
||||
("render.environment.margin", &mut form.value.margin, 0.0..=10.0, 0.05, "×"),
|
||||
("render.environment.gap", &mut form.value.gap, 0.0001..=1000.0, 0.01, " mm"),
|
||||
] {
|
||||
ui_kit::row(ui, app.tr(key), |ui| ui_kit::number_field(ui, value, range, speed, unit));
|
||||
}
|
||||
vector_row(ui, app.tr("render.environment.reflectance"), &mut form.value.color, 0.0..=1.0, 0.01, "");
|
||||
ui_kit::checkbox(ui, app.tr("render.environment.replace"), &mut form.replace);
|
||||
let ready = snapshot.as_ref().is_ok_and(|set| set.stage.is_empty() || form.replace);
|
||||
let fit = ui
|
||||
.add_enabled_ui(ready, |ui| {
|
||||
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| {
|
||||
ui_kit::button(ui, app.tr("render.environment.fit"), ui_kit::Button::Primary)
|
||||
})
|
||||
.inner
|
||||
})
|
||||
.inner;
|
||||
crate::scenario::publish_target("render:environment:fit-ground", fit.rect);
|
||||
if fit.clicked()
|
||||
&& let Err(error) = commit_ground(app, true, form.value.clone())
|
||||
{
|
||||
app.set_status(error, true);
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
for (kind, key) in [("floor_wall", "render.environment.floor_wall"), ("cyclorama", "render.environment.cyclorama")] {
|
||||
if ui_kit::button(ui, app.tr(key), ui_kit::Button::Enabled(ready)).clicked()
|
||||
&& let Ok(set) = &snapshot
|
||||
{
|
||||
let request = json!({"name":app.render_workspace.view.name,"set":set,"kind":kind,"expected_revision":app.session.revision,
|
||||
"replace_stage":form.replace,"reflectance_linear":form.value.color});
|
||||
match app.run("render.stage.backdrop", request) {
|
||||
Ok(_) => setups::load(app),
|
||||
Err(error) => app.set_status(error, true),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if !supported {
|
||||
note(app, ui, "render.environment.stage_raytrace");
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
let count = app.render_workspace.view.draft.stage.len();
|
||||
ui_kit::text(
|
||||
ui,
|
||||
&crate::i18n::Locale::for_language(&app.preferences.language)
|
||||
.format("render.environment.saved_panels", &[("count", &count.to_string())]),
|
||||
ui_kit::Text::Inline,
|
||||
);
|
||||
let remove = ui_kit::icon_label_button(ui, app.tr("render.environment.remove"), "delete", count > 0 && snapshot.is_ok(), true);
|
||||
crate::scenario::publish_target("render:stage-clear", remove.rect);
|
||||
if remove.clicked() {
|
||||
request_stage_removal(app, ui.ctx());
|
||||
}
|
||||
});
|
||||
ui.data_mut(|data| data.insert_temp(id, form));
|
||||
if let Err(error) = snapshot {
|
||||
ui_kit::text(ui, &error, ui_kit::Text::Note("render:environment:ground-unavailable"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Compact vector row; the shared row and number fields own spacing and interaction.
|
||||
fn vector_row(ui: &mut egui::Ui, label: &str, value: &mut [f64; 3], range: std::ops::RangeInclusive<f64>, speed: f64, unit: &str) -> bool {
|
||||
ui_kit::row(ui, label, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
let mut changed = false;
|
||||
let width = ((ui.available_width() - Tokens::get().space_8) / 3.0).max(Tokens::get().space_16);
|
||||
for (index, component) in value.iter_mut().enumerate() {
|
||||
ui.push_id(index, |ui| {
|
||||
ui.set_width(width);
|
||||
changed |= ui_kit::number_field(ui, component, range.clone(), speed, unit).changed();
|
||||
});
|
||||
}
|
||||
changed
|
||||
})
|
||||
.inner
|
||||
})
|
||||
}
|
||||
|
||||
/// One home for airborne controls, also used by the transitional Aging page.
|
||||
pub(super) fn atmosphere(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.environment.atmosphere").to_string();
|
||||
ui_kit::section_method(ui, "render_environment_atmosphere", &title, true, "GPU", |ui| {
|
||||
let gpu = app.render_workspace.view.method == ImageMethod::GpuRaytrace;
|
||||
let before = app.render_workspace.view.studio.volume;
|
||||
let mut volume = before.unwrap_or_default();
|
||||
let mut enabled = before.is_some();
|
||||
let mut changed = false;
|
||||
ui.add_enabled_ui(gpu, |ui| {
|
||||
let toggle = ui_kit::checkbox(ui, app.tr("render.environment.medium"), &mut enabled);
|
||||
crate::scenario::publish_target("render:volume-enable", toggle.rect);
|
||||
changed |= toggle.changed();
|
||||
ui.add_enabled_ui(enabled, |ui| {
|
||||
changed |= vector_row(ui, app.tr("render.environment.min"), &mut volume.min_mm, -1e9..=1e9, 1.0, "");
|
||||
changed |= vector_row(ui, app.tr("render.environment.max"), &mut volume.max_mm, -1e9..=1e9, 1.0, "");
|
||||
changed |= ui_kit::row(ui, app.tr("render.environment.extinction"), |ui| {
|
||||
ui_kit::number_field(ui, &mut volume.extinction_per_mm, 0.0..=1000.0, 0.0001, " /mm")
|
||||
})
|
||||
.changed();
|
||||
changed |= vector_row(ui, app.tr("render.environment.albedo"), &mut volume.scattering_albedo, 0.0..=1.0, 0.01, "");
|
||||
changed |= ui_kit::row(ui, app.tr("render.environment.phase"), |ui| {
|
||||
ui_kit::slider(ui, &mut volume.anisotropy, -0.95..=0.95, Default::default())
|
||||
})
|
||||
.changed();
|
||||
});
|
||||
});
|
||||
if !gpu {
|
||||
note(app, ui, "render.environment.needs_gpu");
|
||||
}
|
||||
if changed {
|
||||
app.render_workspace.view.studio.volume = enabled.then_some(volume);
|
||||
app.render_workspace.view.dirty = true;
|
||||
if let Err(error) = setups::save(app) {
|
||||
app.render_workspace.view.studio.volume = before;
|
||||
app.set_status(error, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -122,6 +122,10 @@ pub(super) fn pick(app: &mut SolveApp, target: Target) {
|
||||
}
|
||||
if let Err(error) = inspect(app, target, path) {
|
||||
app.set_status(error, true);
|
||||
} else if app.render_workspace.view.selection == super::RenderSelection::Environment
|
||||
|| matches!(app.render_workspace.view.inspector.page, super::inspector::Page::Environment | super::inspector::Page::Background)
|
||||
{
|
||||
super::environment::persist(app);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -151,7 +155,7 @@ pub(super) fn request(app: &SolveApp, target: Target) -> Result<Value, String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn metadata(app: &SolveApp, target: Target) -> Option<Metadata> {
|
||||
pub(super) fn metadata(app: &SolveApp, target: Target) -> Option<Metadata> {
|
||||
match input(app, target) {
|
||||
Input::FileCaptured { metadata, .. } => Some(*metadata),
|
||||
Input::EmbeddedResource { resource } => {
|
||||
@@ -165,29 +169,50 @@ fn metadata(app: &SolveApp, target: Target) -> Option<Metadata> {
|
||||
|
||||
pub(super) fn controls(app: &mut SolveApp, ui: &mut egui::Ui, target: Target) {
|
||||
if input(app, target).embedded() {
|
||||
ui.label(app.tr("render.hdr_embedded"));
|
||||
ui.small(app.tr("render.hdr_embedded_help"));
|
||||
ui_kit::text(ui, app.tr("render.hdr_embedded_help"), ui_kit::Text::Note("render.hdr_embedded_help"));
|
||||
if ui_kit::button(ui, app.tr("render.environment.choose"), ui_kit::Button::Normal).clicked() {
|
||||
pick(app, target);
|
||||
}
|
||||
} else {
|
||||
let mut path = input(app, target).path().to_string();
|
||||
let hint = app.tr("render.studio_hdr_required").to_string();
|
||||
let field = ui_kit::bounded_cell_editor(ui, ui.id().with("hdr_source_path"), &mut path, &hint, false, 4096);
|
||||
let field = ui_kit::row(ui, app.tr("render.environment.file"), |ui| {
|
||||
ui_kit::bounded_cell_editor(ui, ui.id().with("hdr_source_path"), &mut path, &hint, false, 4096)
|
||||
});
|
||||
if field.changed() {
|
||||
set_input(app, target, Input::FilePending { path });
|
||||
}
|
||||
let captured = matches!(input(app, target), Input::FileCaptured { .. });
|
||||
ui.small(app.tr(if captured { "render.hdr_file_captured" } else { "render.hdr_inspect_required" }));
|
||||
if ui_kit::button(ui, app.tr("render.hdr_inspect"), ui_kit::Button::Enabled(valid_path(input(app, target).path()))).clicked() {
|
||||
let path = input(app, target).path().to_string();
|
||||
if let Err(error) = inspect(app, target, path) {
|
||||
app.set_status(error, true);
|
||||
ui.horizontal(|ui| {
|
||||
if ui_kit::button(ui, app.tr("render.environment.choose"), ui_kit::Button::Normal).clicked() {
|
||||
pick(app, target);
|
||||
}
|
||||
if ui
|
||||
.add_enabled_ui(valid_path(input(app, target).path()), |ui| {
|
||||
ui_kit::button(ui, app.tr("render.environment.check"), ui_kit::Button::Primary)
|
||||
})
|
||||
.inner
|
||||
.clicked()
|
||||
{
|
||||
let path = input(app, target).path().to_string();
|
||||
if let Err(error) = inspect(app, target, path) {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
if matches!(input(app, target), Input::FileCaptured { .. }) {
|
||||
ui_kit::banner(ui, ui_kit::AssistantTone::Working, |ui| {
|
||||
ui_kit::text(ui, app.tr("render.environment.checked"), ui_kit::Text::Note("render.environment.checked"));
|
||||
});
|
||||
} else {
|
||||
ui_kit::text(ui, app.tr("render.hdr_inspect_required"), ui_kit::Text::Note("render.hdr_inspect_required"));
|
||||
}
|
||||
}
|
||||
if ui_kit::button(ui, app.tr("render.studio_hdr_browse"), ui_kit::Button::Normal).clicked() {
|
||||
pick(app, target);
|
||||
}
|
||||
if let Some(metadata) = metadata(app, target) {
|
||||
ui.label(format!("{} × {} px · {:.2} MiB", metadata.width, metadata.height, metadata.encoded_bytes as f64 / 1_048_576.0));
|
||||
ui_kit::text(
|
||||
ui,
|
||||
&format!("{} × {} px · {:.2} MiB", metadata.width, metadata.height, metadata.encoded_bytes as f64 / 1_048_576.0),
|
||||
ui_kit::Text::Inline,
|
||||
);
|
||||
let primaries = if metadata.primaries == Some(solidcraft_engine::doc::render_resources::SRGB_D65_PRIMARIES) {
|
||||
"render.hdr_primaries_srgb"
|
||||
} else if metadata.primaries.is_some() {
|
||||
@@ -195,13 +220,13 @@ pub(super) fn controls(app: &mut SolveApp, ui: &mut egui::Ui, target: Target) {
|
||||
} else {
|
||||
"render.hdr_primaries_undeclared"
|
||||
};
|
||||
ui.small(app.tr(primaries));
|
||||
ui_kit::text(ui, app.tr(primaries), ui_kit::Text::Note(primaries));
|
||||
let title = app.tr("render.hdr_details").to_string();
|
||||
ui_kit::section(ui, "hdr_source_details", &title, false, |ui| {
|
||||
ui.label(format!("SHA-256: {}", metadata.sha256));
|
||||
ui_kit::text(ui, &format!("SHA-256: {}", metadata.sha256), ui_kit::Text::Inline);
|
||||
if let Some([rx, ry, gx, gy, bx, by, wx, wy]) = metadata.primaries {
|
||||
ui.label(format!("CIE xy · R ({rx:.6}, {ry:.6}) · G ({gx:.6}, {gy:.6})"));
|
||||
ui.label(format!("CIE xy · B ({bx:.6}, {by:.6}) · W ({wx:.6}, {wy:.6})"));
|
||||
ui_kit::text(ui, &format!("CIE xy · R ({rx:.6}, {ry:.6}) · G ({gx:.6}, {gy:.6})"), ui_kit::Text::Inline);
|
||||
ui_kit::text(ui, &format!("CIE xy · B ({bx:.6}, {by:.6}) · W ({wx:.6}, {wy:.6})"), ui_kit::Text::Inline);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -288,8 +288,7 @@ pub(super) fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
Page::Appearance => appearance_controls(app, ui),
|
||||
Page::Effects => super::effects::presentation_controls(app, ui),
|
||||
Page::Lighting => lighting_controls(app, ui),
|
||||
Page::Environment => environment_controls(app, ui),
|
||||
Page::Background => background_controls(app, ui),
|
||||
Page::Environment | Page::Background => super::environment::editor(app, ui),
|
||||
Page::Camera => camera_controls(app, ui),
|
||||
Page::Output => output_editor(app, ui),
|
||||
Page::Diagnostics => diagnostics(app, ui),
|
||||
@@ -516,45 +515,6 @@ fn physical_stage_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
fn background_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
ui_kit::text(ui, app.tr("render.background_workflow"), ui_kit::Text::Note("render.background_workflow"));
|
||||
let title = app.tr("render.background_camera_section").to_string();
|
||||
ui_kit::section(ui, "render_camera_background_section", &title, true, |ui| {
|
||||
ui.label(app.tr("render.background"));
|
||||
let color = ui_kit::color_field(ui, &mut app.render_workspace.view.draft.background);
|
||||
crate::scenario::publish_target("render:background-color", color.rect);
|
||||
app.render_workspace.view.dirty |= color.changed();
|
||||
if app.render_workspace.view.method == ImageMethod::GpuRaytrace {
|
||||
studio::backdrop_controls(app, ui);
|
||||
}
|
||||
if !app.render_workspace.view.draft.stage.is_empty() {
|
||||
ui_kit::text(ui, app.tr("render.background_stage_occlusion"), ui_kit::Text::Note("render.background_stage_occlusion"));
|
||||
}
|
||||
if app.render_workspace.view.result {
|
||||
ui_kit::text(ui, app.tr("render.background_completed_frozen"), ui_kit::Text::Note("render.background_completed_frozen"));
|
||||
}
|
||||
let enabled = super::ribbon::action_ready(app, "render.result.regrade").is_ok();
|
||||
let apply = ui_kit::button(ui, app.tr("render.background_regrade"), ui_kit::Button::Enabled(enabled));
|
||||
crate::scenario::publish_target("render:background-regrade", apply.rect);
|
||||
if apply.clicked() {
|
||||
if let Err(error) = super::ribbon::perform_job(app, "render.result.regrade") {
|
||||
app.set_status(error, true);
|
||||
}
|
||||
ui.ctx().request_repaint();
|
||||
}
|
||||
ui_kit::text(ui, app.tr("render.background_no_alpha_override"), ui_kit::Text::Note("render.background_no_alpha_override"));
|
||||
});
|
||||
physical_stage_controls(app, ui);
|
||||
let title = app.tr("render.background_lighting_section").to_string();
|
||||
ui_kit::section(ui, "render_background_hdr_section", &title, false, |ui| {
|
||||
ui_kit::text(ui, app.tr("render.background_hdr_separate"), ui_kit::Text::Note("render.background_hdr_separate"));
|
||||
if ui_kit::button(ui, app.tr("render.browse_environments"), ui_kit::Button::Normal).clicked() {
|
||||
app.render_workspace.view.inspector.page = Page::Environment;
|
||||
library::open_category(app, "hdr");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn shot_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.shot_manager").to_string();
|
||||
reveal_section(app, ui, "render_shot_manager");
|
||||
@@ -620,26 +580,6 @@ fn lighting_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
fn environment_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
ui.label(app.tr("render.background"));
|
||||
let r = ui_kit::color_field(ui, &mut app.render_workspace.view.draft.background);
|
||||
if r.changed() {
|
||||
app.render_workspace.view.dirty = true;
|
||||
}
|
||||
ui_kit::text(ui, app.tr("render.background_not_light"), ui_kit::Text::Note("render.background_not_light"));
|
||||
if app.render_workspace.view.method == ImageMethod::GpuRaytrace {
|
||||
studio::backdrop_controls(app, ui);
|
||||
}
|
||||
browse_button(app, ui, "hdr", "render.browse_environments");
|
||||
|
||||
match app.render_workspace.view.method {
|
||||
ImageMethod::GpuRaytrace => studio::environment_controls(app, ui),
|
||||
ImageMethod::CpuRaytrace => cpu::environment_controls(app, ui),
|
||||
ImageMethod::Raster => {
|
||||
ui_kit::text(ui, app.tr("render.method_limit_raster"), ui_kit::Text::Note("render.method_limit_raster"));
|
||||
}
|
||||
}
|
||||
}
|
||||
fn vector(ui: &mut egui::Ui, label: &str, value: &mut [f64; 3], range: std::ops::RangeInclusive<f64>, speed: f64) {
|
||||
ui.label(label);
|
||||
ui.horizontal(|ui| {
|
||||
|
||||
@@ -634,6 +634,7 @@ fn ribbon_navigation_reuses_inspector_and_preserves_exact_unsaved_intent() {
|
||||
("render.stage.ground", Page::Background),
|
||||
("render.stage.clear", Page::Background),
|
||||
("render.hdr.inspect", Page::Environment),
|
||||
("render.environment.set", Page::Environment),
|
||||
("render.settings.capture_hdr", Page::Environment),
|
||||
("render.aging.describe", Page::Appearance),
|
||||
("render.effects.describe", Page::Output),
|
||||
@@ -932,9 +933,9 @@ fn backgrounds_ribbon_exposes_camera_and_physical_options_without_mutating_draft
|
||||
assert_eq!(setups::snapshot(&h.app).unwrap(), draft);
|
||||
assert_eq!(h.app.session.doc.to_json(), doc);
|
||||
assert_eq!(h.app.session.revision, revision);
|
||||
assert!(crate::scenario::rect_of("render:background-color").is_some());
|
||||
assert!(crate::scenario::rect_of("render:backdrop-enabled").is_some());
|
||||
assert!(crate::scenario::rect_of("render:background-regrade").is_some());
|
||||
assert!(crate::scenario::rect_of("dialog:section:Backdrop").is_some());
|
||||
assert!(crate::scenario::rect_of("dialog:section:Ground and stage").is_some());
|
||||
assert!(crate::scenario::rect_of("dialog:section:Atmosphere").is_some());
|
||||
assert!(h.app.render_workspace.view.job.is_none());
|
||||
assert!(
|
||||
super::super::ribbon::action_ready(&h.app, "render.result.regrade").is_err(),
|
||||
@@ -969,7 +970,7 @@ fn clearing_physical_stage_preserves_unsaved_camera_background_and_output_intent
|
||||
assert_eq!(h.app.render_workspace.view.inspector.page, Page::Background);
|
||||
h.step(&json!({"click":{"handle":"render:stage-clear"}})).unwrap();
|
||||
h.frames(3);
|
||||
assert_eq!(h.app.render_workspace.view.draft.stage.len(), 1);
|
||||
assert_eq!(h.app.render_workspace.view.draft.stage.len(), 1, "removal needs consent");
|
||||
h.step(&json!({"click":{"handle":"dialog:ok"}})).unwrap();
|
||||
h.frames(3);
|
||||
assert_eq!(setups::snapshot(&h.app).unwrap(), expected, "clearing stage must keep the unsaved numerical draft, not reload an older one");
|
||||
|
||||
@@ -15,6 +15,7 @@ fn handled(id: &str) -> bool {
|
||||
id,
|
||||
"render.aging.describe"
|
||||
| "render.effects.describe"
|
||||
| "render.environment.set"
|
||||
| "render.preset.resolve"
|
||||
| "render.preset.apply"
|
||||
| "render.settings.get"
|
||||
@@ -250,7 +251,7 @@ fn navigate(app: &mut SolveApp, id: &str) -> Result<(), String> {
|
||||
"render.library.studio.prepare" => focus(app, Page::Lighting, Some("rigs")),
|
||||
"render.library.studio.apply" => focus(app, Page::Lighting, None),
|
||||
"render.library.environment.apply" => focus(app, Page::Environment, Some("hdr")),
|
||||
"render.hdr.inspect" | "render.settings.capture_hdr" => focus(app, Page::Environment, None),
|
||||
"render.environment.set" | "render.hdr.inspect" | "render.settings.capture_hdr" => focus(app, Page::Environment, None),
|
||||
"render.stage.backdrop" => focus(app, Page::Background, None),
|
||||
"render.stage.ground" | "render.stage.clear" => {
|
||||
focus(app, Page::Background, None);
|
||||
|
||||
@@ -184,8 +184,9 @@ pub(super) fn controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
ui.small(app.tr("render.studio_runtime_help"));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) fn environment_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
super::transport::volume_controls(app, ui);
|
||||
super::environment::atmosphere(app, ui);
|
||||
let variants =
|
||||
[(Environment::None, "render.studio_environment_none"), (Environment::Sky, "render.studio_sky"), (Environment::Hdr, "render.studio_hdr")];
|
||||
let selected = app.render_workspace.view.studio.environment;
|
||||
@@ -390,6 +391,7 @@ pub(super) fn post_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) fn backdrop_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
use solidcraft_engine::render::job::finishing::BackdropMode;
|
||||
let label = app.tr("render.backdrop_enable").to_string();
|
||||
|
||||
@@ -2,6 +2,503 @@ use super::*;
|
||||
use crate::scenario::Harness;
|
||||
use solidcraft_engine::Session;
|
||||
|
||||
fn environment_editor_frame(h: &mut Harness, events: Vec<egui::Event>) {
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 1800.0))), events, ..Default::default() },
|
||||
|ui| {
|
||||
ui.set_width(308.0);
|
||||
environment::editor(&mut h.app, ui);
|
||||
},
|
||||
);
|
||||
output.textures_delta.clear();
|
||||
}
|
||||
|
||||
fn environment_editor_fixture() -> Harness {
|
||||
let mut h = Harness::new();
|
||||
h.app.run("solid.box", json!({"length":10,"width":20,"height":5})).unwrap();
|
||||
let name = h.app.render_workspace.view.name.clone();
|
||||
h.app.run("render.settings.set", json!({"name":name,"set":{"job":{"method":"gpu_path","options":{"environment":{"kind":"sky"}}}}})).unwrap();
|
||||
setups::load(&mut h.app);
|
||||
h
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_e4_variants_keep_all_five_sections_in_order() {
|
||||
for variant in ["embedded", "sky", "file"] {
|
||||
let mut h = environment_editor_fixture();
|
||||
if variant == "embedded" {
|
||||
let name = h.app.render_workspace.view.name.clone();
|
||||
h.app.run("render.library.environment.apply", json!({"id":"HDR-001","name":name,"replace_environment":true})).unwrap();
|
||||
setups::load(&mut h.app);
|
||||
} else if variant == "file" {
|
||||
h.app.render_workspace.view.studio.environment = studio::Environment::Hdr;
|
||||
h.app.render_workspace.view.studio.hdr = hdr::Input::FilePending { path: "C:/hdr/studio.hdr".into() };
|
||||
} else {
|
||||
h.app.render_workspace.view.studio.backdrop_enabled = true;
|
||||
}
|
||||
let before = h.app.session.doc.clone();
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(308.0, 3000.0))), ..Default::default() },
|
||||
|ui| environment::editor(&mut h.app, ui),
|
||||
);
|
||||
let mut previous = -1.0;
|
||||
let source_row = crate::scenario::rect_of("dialog:control:Source").unwrap();
|
||||
let change = crate::scenario::rect_of("render:environment:change").unwrap();
|
||||
assert!(source_row.contains_rect(change), "{variant}: Change must fit beside Source");
|
||||
for key in [
|
||||
"render.env_source",
|
||||
"render.environment.orientation",
|
||||
"render.env_backdrop",
|
||||
"render.environment.ground",
|
||||
"render.environment.atmosphere",
|
||||
] {
|
||||
let rect = crate::scenario::rect_of(&format!("dialog:section:{}", h.app.tr(key))).unwrap();
|
||||
assert!(rect.top() > previous, "{variant}: {key} out of order");
|
||||
previous = rect.top();
|
||||
}
|
||||
let text = crate::test_support::text_shapes(&output).map(|shape| shape.galley.job.text.clone()).collect::<Vec<_>>().join("\n");
|
||||
for key in [
|
||||
"render.environment.replace",
|
||||
"render.environment.fit",
|
||||
"render.environment.floor_wall",
|
||||
"render.environment.cyclorama",
|
||||
"render.environment.medium",
|
||||
"render.environment.phase",
|
||||
] {
|
||||
assert!(text.contains(h.app.tr(key)), "{variant}: missing {key}: {text}");
|
||||
}
|
||||
for key in match variant {
|
||||
"embedded" => &["render.environment.embedded", "render.environment.builtin"][..],
|
||||
"file" => &["render.environment.choose", "render.environment.check"][..],
|
||||
_ => &[
|
||||
"render.environment.zenith",
|
||||
"render.environment.horizon",
|
||||
"render.environment.sky_ground",
|
||||
"render.environment.start",
|
||||
"render.environment.end",
|
||||
][..],
|
||||
} {
|
||||
assert!(text.contains(h.app.tr(key)), "{variant}: missing {key}");
|
||||
}
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc), "opening {variant} must never save");
|
||||
output.textures_delta.clear();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_unsupported_methods_keep_controls_and_reasons_without_switching() {
|
||||
for method in [ImageMethod::Raster, ImageMethod::CpuRaytrace] {
|
||||
let mut h = environment_editor_fixture();
|
||||
h.app.render_workspace.view.method = method;
|
||||
let before = h.app.session.doc.clone();
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(308.0, 3000.0))), ..Default::default() },
|
||||
|ui| environment::editor(&mut h.app, ui),
|
||||
);
|
||||
let text = crate::test_support::text_shapes(&output).map(|shape| shape.galley.job.text.clone()).collect::<Vec<_>>().join("\n");
|
||||
for key in [
|
||||
"render.environment.needs_gpu",
|
||||
"render.environment.gradient_gpu",
|
||||
"render.environment.blur_pending",
|
||||
"render.environment.world_pending",
|
||||
"render.environment.medium",
|
||||
"render.environment.min",
|
||||
"render.environment.max",
|
||||
] {
|
||||
assert!(text.contains(h.app.tr(key)), "missing {key}: {text}");
|
||||
}
|
||||
output.textures_delta.clear();
|
||||
let at = crate::scenario::rect_of("render:volume-enable").unwrap().center();
|
||||
for pressed in [true, false] {
|
||||
environment_editor_frame(
|
||||
&mut h,
|
||||
vec![
|
||||
egui::Event::PointerMoved(at),
|
||||
egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() },
|
||||
],
|
||||
);
|
||||
}
|
||||
assert!(h.app.render_workspace.view.studio.volume.is_none());
|
||||
assert_eq!(h.app.render_workspace.view.method, method);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_gradient_and_atmosphere_refuse_hostile_values_atomically() {
|
||||
let mut h = environment_editor_fixture();
|
||||
let before = h.app.session.doc.clone();
|
||||
let undo = h.app.session.undo.len();
|
||||
for value in [f64::NAN, f64::INFINITY, -1.0, 1e300] {
|
||||
let mut gradient = h.app.render_workspace.view.studio.backdrop;
|
||||
gradient.radius = value;
|
||||
assert!(environment::commit_gradient(&mut h.app, true, gradient).is_err());
|
||||
h.app.render_workspace.view.studio.volume =
|
||||
Some(solidcraft_engine::render::job::volume::HomogeneousVolume { extinction_per_mm: value, ..Default::default() });
|
||||
assert!(setups::save(&mut h.app).is_err());
|
||||
h.app.render_workspace.view.studio.volume = None;
|
||||
}
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert_eq!(h.app.session.undo.len(), undo);
|
||||
environment::commit_gradient(&mut h.app, true, Default::default()).unwrap();
|
||||
assert!(h.app.render_workspace.view.studio.backdrop_enabled);
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(h.app.session.doc, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_stage_removal_requires_confirm_and_rejects_stale_answers() {
|
||||
for stale in [false, true] {
|
||||
let mut h = environment_editor_fixture();
|
||||
environment::commit_ground(&mut h.app, true, environment::Ground { margin: 1.0, gap: 0.1, color: [0.18; 3] }).unwrap();
|
||||
let before = h.app.session.doc.clone();
|
||||
environment::request_stage_removal(&h.app, &h.ctx);
|
||||
for _ in 0..3 {
|
||||
environment_editor_frame(&mut h, vec![]);
|
||||
}
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert!(crate::scenario::rect_of("dialog:ok").is_some());
|
||||
if stale {
|
||||
h.app.run("render.settings.set", json!({"name":"Other","set":{"width":42}})).unwrap();
|
||||
}
|
||||
let undo = h.app.session.undo.len();
|
||||
let at = crate::scenario::rect_of("dialog:ok").unwrap().center();
|
||||
for pressed in [true, false] {
|
||||
environment_editor_frame(
|
||||
&mut h,
|
||||
vec![
|
||||
egui::Event::PointerMoved(at),
|
||||
egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() },
|
||||
],
|
||||
);
|
||||
}
|
||||
assert_eq!(h.app.session.undo.len(), undo + usize::from(!stale));
|
||||
assert_eq!(h.app.render_workspace.view.draft.stage.is_empty(), !stale);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_checked_file_embeds_bytes_and_keeps_the_recheck_banner() {
|
||||
let mut h = environment_editor_fixture();
|
||||
let path = h.dir.join("environment-editor.hdr");
|
||||
let bytes = original_hdr_bytes(128, true);
|
||||
std::fs::write(&path, &bytes).unwrap();
|
||||
h.app.render_workspace.view.studio.environment = studio::Environment::Hdr;
|
||||
hdr::inspect(&mut h.app, hdr::Target::Gpu, path.to_string_lossy().into_owned()).unwrap();
|
||||
let undo = h.app.session.undo.len();
|
||||
environment::persist(&mut h.app);
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
assert_eq!(h.app.session.doc.render.resources.len(), 1);
|
||||
assert!(matches!(h.app.render_workspace.view.studio.hdr, hdr::Input::FileCaptured { .. }));
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(308.0, 3000.0))), ..Default::default() },
|
||||
|ui| environment::editor(&mut h.app, ui),
|
||||
);
|
||||
assert!(crate::test_support::text_shapes(&output).any(|shape| shape.galley.job.text.contains(h.app.tr("render.environment.checked"))));
|
||||
output.textures_delta.clear();
|
||||
let before = h.app.session.doc.clone();
|
||||
std::fs::write(&path, original_hdr_bytes(64, true)).unwrap();
|
||||
environment::persist(&mut h.app);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc), "changed bytes require rechecking");
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_medium_toggle_saves_one_command_without_a_gpu_host() {
|
||||
let mut h = environment_editor_fixture();
|
||||
environment_editor_frame(&mut h, vec![]);
|
||||
let at = crate::scenario::rect_of("render:volume-enable").unwrap().center();
|
||||
let undo = h.app.session.undo.len();
|
||||
for pressed in [true, false] {
|
||||
environment_editor_frame(
|
||||
&mut h,
|
||||
vec![
|
||||
egui::Event::PointerMoved(at),
|
||||
egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() },
|
||||
],
|
||||
);
|
||||
}
|
||||
assert!(h.app.render_workspace.view.studio.volume.is_some());
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
let expected = setups::snapshot(&h.app).unwrap();
|
||||
assert_eq!(h.app.session.doc.render.setups[&h.app.render_workspace.view.name], expected);
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
setups::load(&mut h.app);
|
||||
assert!(h.app.render_workspace.view.studio.volume.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_ring_angles_snap_wrap_and_refuse_hostile_geometry() {
|
||||
let center = egui::pos2(100.0, 200.0);
|
||||
for (point, expected) in
|
||||
[(egui::pos2(150.0, 200.0), 0.0), (egui::pos2(100.0, 250.0), 90.0), (egui::pos2(50.0, 200.0), 180.0), (egui::pos2(100.0, 150.0), -90.0)]
|
||||
{
|
||||
assert_eq!(environment::pointer_angle(point, center, 50.0), Some(expected));
|
||||
}
|
||||
assert_eq!(environment::drag_rotation(170.0, 170.0, -170.0, false), Some(-170.0));
|
||||
assert_eq!(environment::drag_rotation(170.0, 0.0, 30.0, true), Some(-165.0));
|
||||
assert_eq!(environment::drag_rotation(-170.0, 0.0, -30.0, true), Some(165.0));
|
||||
assert_eq!(environment::drag_rotation(0.0, 0.0, 180.0, false), Some(-180.0));
|
||||
assert_eq!(environment::pointer_angle(center, center, 50.0), None);
|
||||
for radius in [0.0, -1.0, f32::NAN, f32::INFINITY, 1e9] {
|
||||
assert_eq!(environment::pointer_angle(egui::pos2(150.0, 200.0), center, radius), None);
|
||||
}
|
||||
for value in [f32::NAN, f32::INFINITY, f32::NEG_INFINITY] {
|
||||
assert_eq!(environment::pointer_angle(egui::pos2(value, 200.0), center, 50.0), None);
|
||||
assert_eq!(environment::pointer_angle(center, egui::pos2(100.0, value), 50.0), None);
|
||||
}
|
||||
for value in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, 1e300] {
|
||||
assert_eq!(environment::drag_rotation(value, 0.0, 20.0, false), None);
|
||||
assert_eq!(environment::drag_rotation(0.0, value, 20.0, true), None);
|
||||
assert_eq!(environment::drag_rotation(0.0, 0.0, value, false), None);
|
||||
}
|
||||
}
|
||||
|
||||
fn environment_ring_frame(h: &mut Harness, mods: egui::Modifiers, events: Vec<egui::Event>) {
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput {
|
||||
screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))),
|
||||
focused: true,
|
||||
events: std::iter::once(egui::Event::ModifiersChanged(mods)).chain(events).collect(),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
let viewport = ui.max_rect();
|
||||
show(&mut h.app, ui);
|
||||
environment_overlay(&mut h.app, ui, viewport);
|
||||
},
|
||||
);
|
||||
output.textures_delta.clear();
|
||||
}
|
||||
|
||||
fn environment_ring_fixture() -> Harness {
|
||||
let mut h = environment_editor_fixture();
|
||||
enter(&mut h.app, true).unwrap();
|
||||
h.app.render_workspace.view.inspector.page = inspector::Page::Environment;
|
||||
h.app.preferences.nav = crate::prefs::OPENSCAD_NAV.into();
|
||||
h.app.cam.fit(&solidcraft_engine::product_scene::extract(&h.app.session).unwrap().bounds);
|
||||
environment_ring_frame(&mut h, egui::Modifiers::NONE, vec![]);
|
||||
h
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_ring_drag_is_one_undo_snaps_and_never_navigates_the_camera() {
|
||||
use egui::{Event, Modifiers, PointerButton};
|
||||
let mut h = environment_ring_fixture();
|
||||
environment::commit_environment(&mut h.app, json!({"rotation_deg":170})).unwrap();
|
||||
environment_ring_frame(&mut h, Modifiers::NONE, vec![]);
|
||||
let ring = h.app.render_workspace.view.environment_ring.geometry.unwrap();
|
||||
let at = |degrees: f32| ring.center + egui::vec2(degrees.to_radians().cos(), degrees.to_radians().sin()) * ring.radius;
|
||||
let press = at(0.0);
|
||||
let before = h.app.session.doc.clone();
|
||||
let camera = h.app.cam;
|
||||
let undo = h.app.session.undo.len();
|
||||
let selection = h.app.session.selection.clone();
|
||||
for pressed in [true, false] {
|
||||
environment_ring_frame(
|
||||
&mut h,
|
||||
Modifiers::SHIFT,
|
||||
vec![
|
||||
Event::PointerMoved(press),
|
||||
Event::PointerButton { pos: press, button: PointerButton::Primary, pressed, modifiers: Modifiers::SHIFT },
|
||||
],
|
||||
);
|
||||
}
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc), "a Shift click without a drag does not snap or save");
|
||||
environment_ring_frame(
|
||||
&mut h,
|
||||
Modifiers::NONE,
|
||||
vec![
|
||||
Event::PointerMoved(press),
|
||||
Event::PointerButton { pos: press, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },
|
||||
],
|
||||
);
|
||||
for angle in [10.0, 20.0, 30.0] {
|
||||
environment_ring_frame(&mut h, Modifiers::SHIFT, vec![Event::PointerMoved(at(angle))]);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc), "drag is temporary");
|
||||
assert_eq!(h.app.session.undo.len(), undo);
|
||||
assert_eq!(h.app.cam, camera, "OpenSCAD left-drag must not orbit through the ring");
|
||||
}
|
||||
let end = at(30.0);
|
||||
environment_ring_frame(
|
||||
&mut h,
|
||||
Modifiers::SHIFT,
|
||||
vec![Event::PointerButton { pos: end, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::SHIFT }],
|
||||
);
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
assert!((h.app.render_workspace.view.studio.rotation_rad.to_degrees() + 165.0).abs() < 1e-6);
|
||||
assert_eq!(h.app.cam, camera);
|
||||
assert_eq!(h.app.session.selection, selection);
|
||||
assert!(crate::scenario::rect_of("render:environment:ring-degrees").is_some());
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(h.app.session.doc, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_ring_cancel_or_stale_revision_discards_the_drag() {
|
||||
use egui::{Event, Modifiers, PointerButton};
|
||||
for stale in [false, true] {
|
||||
let mut h = environment_ring_fixture();
|
||||
let ring = h.app.render_workspace.view.environment_ring.geometry.unwrap();
|
||||
let start = ring.center + egui::vec2(ring.radius, 0.0);
|
||||
let end = ring.center + egui::vec2(0.0, ring.radius);
|
||||
environment_ring_frame(
|
||||
&mut h,
|
||||
Modifiers::NONE,
|
||||
vec![
|
||||
Event::PointerMoved(start),
|
||||
Event::PointerButton { pos: start, button: PointerButton::Primary, pressed: true, modifiers: Modifiers::NONE },
|
||||
],
|
||||
);
|
||||
environment_ring_frame(&mut h, Modifiers::NONE, vec![Event::PointerMoved(end)]);
|
||||
if stale {
|
||||
h.app.run("render.settings.set", json!({"name":"Studio","set":{"width":640}})).unwrap();
|
||||
}
|
||||
let before = h.app.session.doc.clone();
|
||||
let undo = h.app.session.undo.len();
|
||||
let camera = h.app.cam;
|
||||
let cancel = if stale {
|
||||
vec![]
|
||||
} else {
|
||||
vec![Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }]
|
||||
};
|
||||
environment_ring_frame(&mut h, Modifiers::NONE, cancel);
|
||||
environment_ring_frame(&mut h, Modifiers::NONE, vec![Event::PointerMoved(start)]);
|
||||
environment_ring_frame(
|
||||
&mut h,
|
||||
Modifiers::NONE,
|
||||
vec![Event::PointerButton { pos: start, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE }],
|
||||
);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert_eq!(h.app.session.undo.len(), undo);
|
||||
assert_eq!(h.app.cam, camera);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_ring_visibility_follows_editor_target_and_live_canvas() {
|
||||
let mut h = environment_ring_fixture();
|
||||
h.app.render_workspace.view.inspector.page = inspector::Page::Lighting;
|
||||
h.app.render_workspace.view.selection = RenderSelection::Environment;
|
||||
environment_ring_frame(&mut h, egui::Modifiers::NONE, vec![]);
|
||||
assert!(h.app.render_workspace.view.environment_ring.geometry.is_some());
|
||||
h.app.render_workspace.view.selection = RenderSelection::Nothing;
|
||||
environment_ring_frame(&mut h, egui::Modifiers::NONE, vec![]);
|
||||
assert!(h.app.render_workspace.view.environment_ring.geometry.is_none());
|
||||
h.app.render_workspace.view.inspector.page = inspector::Page::Environment;
|
||||
h.app.render_workspace.view.result = true;
|
||||
environment_ring_frame(&mut h, egui::Modifiers::NONE, vec![]);
|
||||
assert!(h.app.render_workspace.view.environment_ring.geometry.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_opening_pages_and_sources_preserves_design_and_history() {
|
||||
let mut h = environment_editor_fixture();
|
||||
let before = h.app.session.doc.clone();
|
||||
let history = (h.app.session.revision, h.app.session.undo.len(), h.app.session.redo.len());
|
||||
for page in [inspector::Page::Environment, inspector::Page::Background] {
|
||||
h.app.render_workspace.view.inspector.page = page;
|
||||
environment_editor_frame(&mut h, vec![]);
|
||||
assert!(crate::scenario::rect_of("render:environment:rotation-slider").is_some());
|
||||
h.app.ui.show_browser = false;
|
||||
environment::open_sources(&mut h.app);
|
||||
assert!(h.app.ui.show_browser);
|
||||
assert_eq!(h.app.render_workspace.view.stage, Stage::Light);
|
||||
assert_eq!(h.app.render_workspace.view.inspector.page, page);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert_eq!(history, (h.app.session.revision, h.app.session.undo.len(), h.app.session.redo.len()));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_controls_commit_one_undo_each_and_refuse_hostile_edits() {
|
||||
let mut h = environment_editor_fixture();
|
||||
for request in [json!({"rotation_deg":215}), json!({"intensity":2.5})] {
|
||||
let before = h.app.session.doc.clone();
|
||||
let undo = h.app.session.undo.len();
|
||||
environment::commit_environment(&mut h.app, request).unwrap();
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
h.app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(h.app.session.doc, before);
|
||||
h.app.run("edit.redo", json!({})).unwrap();
|
||||
}
|
||||
for (color, transparent) in [([40, 80, 120], false), ([40, 80, 120], true), ([40, 80, 120], false)] {
|
||||
let undo = h.app.session.undo.len();
|
||||
environment::commit_backdrop(&mut h.app, color, transparent).unwrap();
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
}
|
||||
let mut ground = environment::Ground { margin: 0.25, gap: 0.1, color: [0.18; 3] };
|
||||
for edit in 0..5 {
|
||||
match edit {
|
||||
1 => ground.margin = 1.0,
|
||||
2 => ground.gap = 0.25,
|
||||
3 => ground.color = [0.1, 0.3, 0.5],
|
||||
_ => {}
|
||||
}
|
||||
let undo = h.app.session.undo.len();
|
||||
environment::commit_ground(&mut h.app, edit != 4, ground.clone()).unwrap();
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
}
|
||||
let before = h.app.session.doc.clone();
|
||||
let undo = h.app.session.undo.len();
|
||||
for request in [json!({"rotation_deg":1e300}), json!({"intensity":-1}), json!({"rotation_deg":"NaN"}), json!(null), json!([])] {
|
||||
assert!(environment::commit_environment(&mut h.app, request).is_err());
|
||||
}
|
||||
assert!(environment::commit_ground(&mut h.app, true, environment::Ground { gap: f64::NAN, ..ground }).is_err());
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert_eq!(h.app.session.undo.len(), undo);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_slider_drag_commits_only_on_release() {
|
||||
let mut h = environment_editor_fixture();
|
||||
environment_editor_frame(&mut h, vec![]);
|
||||
let rect = crate::scenario::rect_of("render:environment:rotation-slider").unwrap();
|
||||
let start = rect.center();
|
||||
let end = egui::pos2(rect.right() - 20.0, start.y);
|
||||
let undo = h.app.session.undo.len();
|
||||
environment_editor_frame(
|
||||
&mut h,
|
||||
vec![
|
||||
egui::Event::PointerMoved(start),
|
||||
egui::Event::PointerButton { pos: start, button: egui::PointerButton::Primary, pressed: true, modifiers: Default::default() },
|
||||
],
|
||||
);
|
||||
environment_editor_frame(&mut h, vec![egui::Event::PointerMoved(end)]);
|
||||
assert_eq!(h.app.session.undo.len(), undo, "dragging is temporary");
|
||||
environment_editor_frame(
|
||||
&mut h,
|
||||
vec![egui::Event::PointerButton { pos: end, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() }],
|
||||
);
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1, "release saves one edit");
|
||||
environment_editor_frame(&mut h, vec![]);
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn environment_editor_hdr_header_reads_catalog_without_applying_or_saving() {
|
||||
let mut h = environment_editor_fixture();
|
||||
let name = h.app.render_workspace.view.name.clone();
|
||||
h.app.run("render.library.environment.apply", json!({"id":"HDR-001","name":name,"replace_environment":true})).unwrap();
|
||||
setups::load(&mut h.app);
|
||||
let before = h.app.session.doc.clone();
|
||||
let undo = h.app.session.undo.len();
|
||||
let mut output = h.ctx.run_ui(
|
||||
egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(305.0, 1600.0))), ..Default::default() },
|
||||
|ui| environment::editor(&mut h.app, ui),
|
||||
);
|
||||
let named = crate::test_support::text_shapes(&output).any(|text| text.galley.job.text.contains("Neutral side softbox"));
|
||||
output.textures_delta.clear();
|
||||
assert!(named);
|
||||
assert!(Arc::ptr_eq(&before, &h.app.session.doc));
|
||||
assert_eq!(h.app.session.undo.len(), undo);
|
||||
for request in [json!({"rotation_deg":540}), json!({"intensity":0})] {
|
||||
let undo = h.app.session.undo.len();
|
||||
environment::commit_environment(&mut h.app, request).unwrap();
|
||||
assert_eq!(h.app.session.undo.len(), undo + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod async_path_host {
|
||||
use super::*;
|
||||
@@ -4012,6 +4509,8 @@ fn render_workspace_browser_focus_covers_each_kind_without_design_edits() {
|
||||
assert_eq!(h.app.render_workspace.view.selection, RenderSelection::Object(vec![Sel::Body { name: "Object".into() }]));
|
||||
h.step(&json!({"click":{"handle":"render:tree:environment"}})).unwrap();
|
||||
assert_eq!(h.app.render_workspace.view.selection, RenderSelection::Environment);
|
||||
assert_eq!(h.app.render_workspace.view.inspector.page, inspector::Page::Environment);
|
||||
assert!(crate::scenario::rect_of("dialog:section:Source").is_some());
|
||||
assert!(h.app.session.selection.is_empty());
|
||||
let focused_revision = h.app.session.revision;
|
||||
h.step(&json!({"click":{"handle":"render:tree:light:0"}})).unwrap();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//! Shared numerical editors for bounded GPU transport extensions.
|
||||
use super::studio::vector;
|
||||
use crate::{SolveApp, ui_kit};
|
||||
|
||||
/// Pilot allocation and conditional transmission sampling share portable intent.
|
||||
@@ -62,43 +61,3 @@ pub(super) fn sampling_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn volume_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let title = app.tr("render.volume_title").to_string();
|
||||
ui_kit::section(ui, "render_homogeneous_volume", &title, false, |ui| {
|
||||
let before = app.render_workspace.view.studio.volume;
|
||||
let mut enabled = before.is_some();
|
||||
let toggle = ui_kit::checkbox(ui, app.tr("render.volume_enable"), &mut enabled);
|
||||
crate::scenario::publish_target("render:volume-enable", toggle.rect);
|
||||
if toggle.changed() {
|
||||
app.render_workspace.view.studio.volume = enabled.then(Default::default);
|
||||
}
|
||||
if enabled {
|
||||
for key in ["render.volume_min", "render.volume_max", "render.volume_albedo"] {
|
||||
let label = app.tr(key).to_string();
|
||||
if let Some(volume) = &mut app.render_workspace.view.studio.volume {
|
||||
let (value, range, speed) = match key {
|
||||
"render.volume_min" => (&mut volume.min_mm, -1e9..=1e9, 1.0),
|
||||
"render.volume_max" => (&mut volume.max_mm, -1e9..=1e9, 1.0),
|
||||
_ => (&mut volume.scattering_albedo, 0.0..=1.0, 0.01),
|
||||
};
|
||||
vector(ui, &label, value, range, speed);
|
||||
}
|
||||
}
|
||||
for key in ["render.volume_extinction", "render.volume_anisotropy"] {
|
||||
let label = app.tr(key).to_string();
|
||||
if let Some(volume) = &mut app.render_workspace.view.studio.volume {
|
||||
let response = ui_kit::row(ui, &label, |ui| match key {
|
||||
"render.volume_extinction" => ui_kit::number_field(ui, &mut volume.extinction_per_mm, 0.0..=1000.0, 0.0001, " /mm"),
|
||||
_ => ui_kit::number_field(ui, &mut volume.anisotropy, -0.95..=0.95, 0.01, ""),
|
||||
});
|
||||
crate::scenario::publish_target(key, response.rect);
|
||||
}
|
||||
}
|
||||
ui_kit::text(ui, app.tr("render.volume_help"), ui_kit::Text::Note("render.volume_help"));
|
||||
}
|
||||
if before != app.render_workspace.view.studio.volume {
|
||||
app.render_workspace.view.dirty = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ use egui::{Ui, vec2};
|
||||
/// Text segments retain mixed states and optional compact clipping instead of dropdown fallback.
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Segments<'a> {
|
||||
/// Per-option availability; omitted entries are enabled. Unavailable options stay faded.
|
||||
pub enabled: &'a [bool],
|
||||
/// Optional stable scenario targets, independent of translated option labels.
|
||||
pub targets: &'a [&'a str],
|
||||
/// Optional leading icons retain the same text-segment geometry and accessibility.
|
||||
@@ -35,7 +37,8 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
if crate::prefs_search::querying(ui) && !crate::prefs_search::shows_all(ui) {
|
||||
crate::prefs_search::reveal(ui);
|
||||
}
|
||||
let Segments { targets, icons, workspace_accent, dense, small, states, disabled_reasons, compact, primary, intrinsic, proportional } = config;
|
||||
let Segments { enabled, targets, icons, workspace_accent, dense, small, states, disabled_reasons, compact, primary, intrinsic, proportional } =
|
||||
config;
|
||||
let accent = crate::theme::TabAccent::current(ui.ctx());
|
||||
let t = Tokens::get();
|
||||
let catalog = super::layout::in_catalog(ui);
|
||||
@@ -57,7 +60,12 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
.fold(0.0, f32::max);
|
||||
// Judged on the whole row, which is what a scrollbar narrows, not on one segment.
|
||||
let need = if intrinsic { total } else { (widest + 2.0 * t.space_8) * options.len() as f32 };
|
||||
if disabled_reasons.is_empty() && !proportional && !compact && !super::fits_steadily(ui, label(ui), need, segment_width * options.len() as f32) {
|
||||
if enabled.is_empty()
|
||||
&& disabled_reasons.is_empty()
|
||||
&& !proportional
|
||||
&& !compact
|
||||
&& !super::fits_steadily(ui, label(ui), need, segment_width * options.len() as f32)
|
||||
{
|
||||
let before = *selected;
|
||||
let id = format!("segments_fallback_{}", label(ui));
|
||||
dropdown(ui, &id, selected, options);
|
||||
@@ -89,13 +97,16 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
let segment = egui::Rect::from_min_size(egui::pos2(x, rect.top()), vec2(width, rect.height()));
|
||||
x += width;
|
||||
let reason = disabled_reasons.get(index).copied().flatten();
|
||||
let enabled = ui.is_enabled() && reason.is_none();
|
||||
let id = ui.make_persistent_id(("segment", index));
|
||||
let response = if reason.is_some() {
|
||||
ui.add_enabled_ui(false, |ui| ui.interact(segment, id, egui::Sense::click())).inner
|
||||
} else {
|
||||
ui.interact(segment, id, egui::Sense::click())
|
||||
};
|
||||
// The row is already allocated: a child scopes disabled painting and interaction
|
||||
// without advancing the parent's cursor once per segment.
|
||||
let mut segment_ui = ui.new_child(egui::UiBuilder::new().max_rect(segment));
|
||||
if !enabled.get(index).copied().unwrap_or(true) || reason.is_some() {
|
||||
segment_ui.disable();
|
||||
}
|
||||
let ui = &mut segment_ui;
|
||||
let segment_enabled = ui.is_enabled();
|
||||
let response = ui.interact(segment, id, egui::Sense::click());
|
||||
let on = states.get(index).copied().unwrap_or(*selected == index);
|
||||
let rounding = egui::CornerRadius {
|
||||
nw: if index == 0 { t.control_radius } else { 0 },
|
||||
@@ -141,7 +152,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
text_rect,
|
||||
option,
|
||||
font,
|
||||
if reason.is_some() {
|
||||
if !segment_enabled {
|
||||
t.form_dim
|
||||
} else if on && primary {
|
||||
t.on_accent
|
||||
@@ -155,7 +166,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
false,
|
||||
);
|
||||
t.button_bevel_with_radius(ui, &response, on, rounding);
|
||||
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, enabled, on, *option));
|
||||
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, segment_enabled, on, *option));
|
||||
scenario::publish_target(&format!("dialog:{}:{option}", label(ui)), segment);
|
||||
if let Some(target) = targets.get(index) {
|
||||
let visible = segment.intersect(ui.clip_rect());
|
||||
@@ -164,7 +175,7 @@ pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], con
|
||||
}
|
||||
}
|
||||
let response = if let Some(reason) = reason { response.on_disabled_hover_text(reason) } else { response.on_hover_text(*option) };
|
||||
if response.clicked() && enabled {
|
||||
if response.clicked() && segment_enabled {
|
||||
*selected = index;
|
||||
clicked = true;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,85 @@ use crate::ui_kit::*;
|
||||
use crate::scenario;
|
||||
use egui::Ui;
|
||||
|
||||
#[test]
|
||||
fn segmented_allocates_only_its_reserved_row() {
|
||||
for layout in [egui::Layout::top_down(egui::Align::Min), egui::Layout::left_to_right(egui::Align::Center)] {
|
||||
for width in [160.0, 320.0, 640.0] {
|
||||
for enabled in [&[][..], &[true, false, true, false][..], &[false; 4][..]] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
frame(&ctx, vec![], |ui| {
|
||||
let bounds = egui::Rect::from_min_size(ui.cursor().min, egui::vec2(width, 120.0));
|
||||
let builder = || egui::UiBuilder::new().max_rect(bounds).layout(layout);
|
||||
let mut expected = ui.new_child(builder());
|
||||
let mut actual = ui.new_child(builder());
|
||||
expected.allocate_exact_size(egui::vec2(width, row_height()), egui::Sense::hover());
|
||||
let mut selected = 0;
|
||||
assert!(!segmented(&mut actual, &mut selected, &["A", "B", "C", "D"], Segments { enabled, ..Default::default() }));
|
||||
assert_eq!(actual.min_rect(), expected.min_rect(), "segments must not expand the parent bounds");
|
||||
assert_eq!(actual.cursor(), expected.cursor(), "segments must not advance the parent beyond the row");
|
||||
let next = egui::vec2(24.0, 20.0);
|
||||
assert_eq!(
|
||||
actual.allocate_exact_size(next, egui::Sense::hover()).0,
|
||||
expected.allocate_exact_size(next, egui::Sense::hover()).0,
|
||||
"the following control must retain its allocation"
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn segmented_click_respects_parent_and_option_availability() {
|
||||
for parent_enabled in [false, true] {
|
||||
// Missing availability entries retain the enabled default.
|
||||
for enabled in [&[][..], &[true][..], &[true, true][..], &[true, false][..]] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
scenario::clear_handles();
|
||||
let mut selected = 0;
|
||||
let mut changed = false;
|
||||
let mut draw = |ui: &mut Ui| {
|
||||
if !parent_enabled {
|
||||
ui.disable();
|
||||
}
|
||||
row(ui, "Availability", |ui| {
|
||||
changed |= segmented(ui, &mut selected, &["A", "B"], Segments { enabled, ..Default::default() });
|
||||
});
|
||||
};
|
||||
frame(&ctx, vec![], &mut draw);
|
||||
let pos = scenario::handle_at("dialog:Availability:B").expect("disabled segments still publish targets");
|
||||
frame(&ctx, pointer(pos, true), &mut draw);
|
||||
frame(&ctx, pointer(pos, false), &mut draw);
|
||||
let should_change = parent_enabled && enabled.get(1).copied().unwrap_or(true);
|
||||
assert_eq!(selected, usize::from(should_change));
|
||||
assert_eq!(changed, should_change);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn segmented_availability_keeps_unsupported_options_visible_and_inert() {
|
||||
let ctx = crate::fonts::test_context();
|
||||
let mut selected = 1;
|
||||
let mut draw = |ui: &mut Ui| {
|
||||
row(ui, "Backdrop availability", |ui| {
|
||||
segmented(
|
||||
ui,
|
||||
&mut selected,
|
||||
&["World", "Colour", "Gradient", "Clear"],
|
||||
Segments { enabled: &[false, true, false, true], ..Default::default() },
|
||||
);
|
||||
});
|
||||
};
|
||||
frame(&ctx, vec![], &mut draw);
|
||||
for option in ["World", "Gradient"] {
|
||||
let pos = scenario::handle_at(&format!("dialog:Backdrop availability:{option}")).unwrap();
|
||||
frame(&ctx, pointer(pos, true), &mut draw);
|
||||
frame(&ctx, pointer(pos, false), &mut draw);
|
||||
}
|
||||
assert_eq!(selected, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn segmented_click_changes_selection_and_keeps_all_choices_visible() {
|
||||
let ctx = crate::fonts::test_context();
|
||||
|
||||
@@ -9,6 +9,38 @@ fn publish(key: &str, response: &Response) {
|
||||
scenario::publish_handle(key, response.rect.center());
|
||||
}
|
||||
|
||||
/// Linear RGB swatch and precise channel fields. The preview is clipped to display gamut;
|
||||
/// HDR values and sub-byte precision stay intact until a control is edited.
|
||||
/// Tokens: control_height, space_4, control_fill/border and the shared colour popover.
|
||||
pub(crate) fn linear_color_field(ui: &mut Ui, rgb: &mut [f64; 3], maximum: f64) -> Response {
|
||||
let maximum = if maximum.is_finite() { maximum.clamp(1.0, 1e6) } else { 1e6 };
|
||||
let mut changed = false;
|
||||
let output = ui.horizontal(|ui| {
|
||||
let preview = rgb.map(|v| if v.is_finite() { v.clamp(0.0, 1.0) as f32 } else { 0.0 });
|
||||
let color = Color32::from(egui::Rgba::from_rgb(preview[0], preview[1], preview[2]));
|
||||
let mut bytes = [color.r(), color.g(), color.b()];
|
||||
if color_field(ui, &mut bytes).changed() {
|
||||
let linear = egui::Rgba::from(crate::theme::srgb(bytes.map(|c| f32::from(c) / 255.0))).to_array();
|
||||
for (channel, value) in rgb.iter_mut().zip(linear) {
|
||||
*channel = f64::from(value);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
let width = ((ui.available_width() - Tokens::get().space_4 * 2.0) / 3.0).max(Tokens::get().space_16);
|
||||
for (index, value) in rgb.iter_mut().enumerate() {
|
||||
ui.push_id(index, |ui| {
|
||||
ui.set_width(width);
|
||||
changed |= super::number_field(ui, value, 0.0..=maximum, 0.01, "").changed();
|
||||
});
|
||||
}
|
||||
});
|
||||
let mut response = output.response;
|
||||
if changed {
|
||||
response.mark_changed();
|
||||
}
|
||||
response
|
||||
}
|
||||
|
||||
/// Shared colour button and outside-click-dismissed popover. Retains the enclosing row handle.
|
||||
pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
|
||||
let t = Tokens::get();
|
||||
|
||||
@@ -13,6 +13,17 @@ fn click(ctx: &egui::Context, key: &str, rgb: &mut [u8; 3]) {
|
||||
frame(ctx, pointer(at, false), |ui| color_popover(ui, rgb));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linear_field_preserves_hdr_precision_without_edits_and_bounds_hostile_limits() {
|
||||
let ctx = crate::fonts::test_context();
|
||||
let original = [0.123456789, 18.0, 0.9];
|
||||
let mut rgb = original;
|
||||
for maximum in [1e6, f64::NAN, f64::INFINITY] {
|
||||
frame(&ctx, vec![], |ui| linear_color_field(ui, &mut rgb, maximum));
|
||||
assert_eq!(rgb, original);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_toggle_is_global_and_does_not_change_colour() {
|
||||
let ctx = crate::fonts::test_context();
|
||||
|
||||
@@ -118,6 +118,22 @@ const ELEMENTS: &[Element] = &[
|
||||
button(ui, "Reset to default", Button::Normal);
|
||||
});
|
||||
}),
|
||||
element!("linear_color_field", |ui, _| {
|
||||
row(ui, "Zenith", |ui| linear_color_field(ui, &mut [0.5, 0.64, 0.81], 1e6));
|
||||
}),
|
||||
element!("section_method", |ui, _| {
|
||||
section_method(ui, "gallery_method", "Atmosphere", true, "GPU", |ui| {
|
||||
text(ui, "Participating medium", Text::Inline);
|
||||
});
|
||||
}),
|
||||
element!("segments_availability", |ui, state| {
|
||||
segmented(
|
||||
ui,
|
||||
&mut state.selected,
|
||||
&["World", "Colour", "Gradient", "Clear"],
|
||||
Segments { enabled: &[false, true, false, true], compact: true, ..Default::default() },
|
||||
);
|
||||
}),
|
||||
element!("tree_row_rect", |ui, _| {
|
||||
for (index, row) in [
|
||||
Row { label: "Objects", ..Default::default() },
|
||||
|
||||
@@ -364,6 +364,18 @@ pub(crate) fn section<R>(ui: &mut Ui, id: impl egui::AsIdSalt, title: &str, defa
|
||||
section_count(ui, id, title, default_open, None::<usize>, add)
|
||||
}
|
||||
|
||||
/// Section with a renderer/method tag. Shares disclosure, typography and badge tokens with section_count.
|
||||
pub(crate) fn section_method<R>(
|
||||
ui: &mut Ui,
|
||||
id: impl egui::AsIdSalt,
|
||||
title: &str,
|
||||
default_open: bool,
|
||||
method: &str,
|
||||
add: impl FnOnce(&mut Ui) -> R,
|
||||
) -> Option<R> {
|
||||
section_count(ui, id, title, default_open, Some(method), add)
|
||||
}
|
||||
|
||||
/// Section heading with an optional count badge; disclosure state uses the same identity.
|
||||
pub(crate) fn section_count<R>(
|
||||
ui: &mut Ui,
|
||||
|
||||
@@ -132,8 +132,14 @@ final edge-aware denoising, and a thin-lens depth-of-field control. Positive ape
|
||||
requires a perspective product camera. Denoising preserves raw accumulation but can
|
||||
soften detail; glass and sharp specular first hits bypass its final spatial filter.
|
||||
|
||||
The Environment section selects no map, an original artistic sky gradient, or a local
|
||||
Radiance `.hdr` panorama. HDR input is bounded to 16 MiB, 2048 × 1024, 2:1, and linear
|
||||
The Environment Browser row opens the Environment editor. The legacy Environment
|
||||
and Background pages use that same editor, with five sections in order: Source,
|
||||
Orientation and strength, Backdrop, Ground and stage, and Atmosphere (GPU).
|
||||
Source offers None, Artistic sky, HDR file and embedded HDR for GPU, or None,
|
||||
Constant and HDR for CPU. Change opens the Environments scope of Studios and
|
||||
environments. Embedded HDR shows its name, kind and saved-in-design status; sky
|
||||
exposes zenith, horizon and ground linear colours. CPU HDR has lighting samples.
|
||||
Radiance `.hdr` input is bounded to 16 MiB, 2048 × 1024, 2:1, and linear
|
||||
sRGB/D65 primaries; unspecified primaries require the explicit interpretation checkbox.
|
||||
EXR is not supported. Rotation and intensity affect illumination, while the saved
|
||||
background remains the camera backplate. Selecting a file runs the bounded public
|
||||
@@ -141,6 +147,23 @@ background remains the camera backplate. Selecting a file runs the bounded publi
|
||||
The picker belongs to the originating document revision, setup, method and input
|
||||
selection. A cancelled or stale answer never replaces a newer selection.
|
||||
|
||||
Rotate and Intensity use the existing environment command; the rotation ring is
|
||||
their shortcut. Backdrop offers World, Colour, Gradient and Clear. Gradient uses
|
||||
the existing GPU camera backdrop (vertical, horizontal or radial, two colours,
|
||||
centre and radius). It never lights, casts shadows or reflects, and is refused
|
||||
with transparent output. World visibility and blur remain faded because no saved
|
||||
renderer setting backs them. Unsupported method choices stay faded with a reason.
|
||||
|
||||
Ground and stage fits a saved ground, floor and wall, or polygonal cyclorama.
|
||||
Replacing a stage requires the explicit consent checkbox; removing it uses the
|
||||
shared **Remove the saved stage?** confirmation. The fields expose extent margin,
|
||||
clearance gap and linear reflectance, followed by the saved panel count.
|
||||
Atmosphere edits the bounded participating medium: enable, world bounds in mm,
|
||||
extinction, scattering albedo and phase. The transitional Aging page's airborne
|
||||
section calls this same function. CPU and raster show the controls faded with
|
||||
the GPU requirement. These controls use existing render state and commands;
|
||||
opening the editor never changes the design or renderer.
|
||||
|
||||
The panel distinguishes a pending file, a checked file and **HDR saved inside this
|
||||
design**. It shows dimensions, declared colour primaries and intensity; the source
|
||||
digest is available in a collapsed details section. Check, Start and Save use the
|
||||
@@ -429,8 +452,9 @@ current numerical image setup, without inventing a saved rig.
|
||||
engine selection), Environment, Light, Shot and Output. It belongs to each document
|
||||
view and is never saved in a design. `view.render_select` validates semantic focus
|
||||
requests without opening dialogs or editing/evaluating a design. Object picks and
|
||||
Browser selections keep the existing selection commands. Selecting Output opens the Output editor. Other focus types retain their existing
|
||||
Inspector routing for subsequent selection-following editor changes.
|
||||
Browser selections keep the existing selection commands. Selecting Output opens
|
||||
the Output editor; selecting Environment opens its editor. The legacy Environment
|
||||
and Background entry points share the Environment editor.
|
||||
|
||||
Look expands Objects, Light expands Lights and Environment, and Frame expands
|
||||
Shots. Output leaves expansion unchanged. Stages preserve selection and never
|
||||
@@ -448,7 +472,8 @@ marked Soon. The shared footer exports the design library through `library.expor
|
||||
and resets the current target's override through `appearance.assign`.
|
||||
`view.render_inspector {visible}` controls transient per-document visibility;
|
||||
selecting a stage reopens the editor. Output selection routes to its dedicated editor;
|
||||
other semantic selection focus routing remains deferred.
|
||||
Environment selection routes to its editor. Other semantic selection focus routing
|
||||
remains deferred.
|
||||
|
||||
## Output editor
|
||||
|
||||
|
||||
+3
-2
@@ -138,7 +138,8 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera
|
||||
| `status_line`, `StatusTone` | Full-width, wrapping status or refusal text in dim, warning or error ink. Translates source labels; already translated messages also work. Place directly in the form, outside `row`, so its height grows with the whole message. Rect: `dialog:status:TEXT`. | `font_label`, `text_dim`, `warning`, `error` |
|
||||
| `caption` | Dim caption aligned beneath a control | `font_small`, `text_dim`, label-column tokens |
|
||||
| `figure_rows`, `FigureSlot` | A caller-painted figure in the label column beside a stack of captioned expression fields (the Hole dialog's section); the caller gets each field's rect and hover/focus state to draw leaders and light the part it sizes. Fields keep their `dialog:<label>` handles; the block publishes `dialog:figure:<id>` and its picture `dialog:figure_picture:<id>` | `control_height`, `form_label_width`, `font_small`, `form_dim`, `space_2/4`, label gap |
|
||||
| `section`, `section_count`, `search_fold`, `divider` | Persisted small-caps disclosure with chevron, optional count badge and trailing hairline; `search_fold` is that row for shortcut matches during Preferences search, closed until opened; full-width rule | `control_height`, `dialog_rule`, `font_caption`, tracking, spacing |
|
||||
| `linear_color_field` | Linear RGB swatch with precise channel fields; clips only the preview to display gamut and preserves HDR values until edited | `control_height`, `space_4`, shared colour popover |
|
||||
| `section`, `section_count`, `section_method`, `search_fold`, `divider` | Persisted small-caps disclosure with chevron, optional count or method tag and trailing hairline; `search_fold` is that row for shortcut matches during Preferences search, closed until opened; full-width rule | `control_height`, `dialog_rule`, `font_caption`, tracking, spacing |
|
||||
| `list_row` | Picked item with a remove target | `control_height`, `font_label`, icon/spacing tokens |
|
||||
| `text`, `Text` | Hint, note, report, inline or cell text; see variants below | `font_small/label`, `text/dim/error`, `control_height`, `space_4` |
|
||||
| `text_lines` | Virtualized read-only licence/report lines, horizontal overflow | `font_small`, `text`, `control_height` |
|
||||
@@ -160,7 +161,7 @@ table. Panel/Window/Confirm compositions also have dedicated geometry and intera
|
||||
| `slider` + `Slider` options | One token-painted track/thumb over native slider/value interaction; optional step, caller formatting, whole-step manipulation and hidden value editor | `control_height`, `space_24/8/4/2`, form control/font tokens |
|
||||
| `placement_field` | Stable focus ID; drawing tool owns Enter/Tab validation and completion | `control_fill`, `font_body`, `text`, `control_height`, spacing |
|
||||
| `color_field`, `color_popover` | Opaque document RGB swatch and kit popover; global U8/F segments, copy, gamma-byte or linear RGB fields, painter-drawn HSV square/hue and current strip; outside click dismisses | `control_*`, `form_*`, `border`, `on_accent`, `space_*` |
|
||||
| choice: `segmented`, `Segments` | Equal text choices; `states` supplies mixed selection, `disabled_reasons` keeps unavailable choices visible with an explanation, `compact` clips instead of falling back to a dropdown, `primary` uses accent/on-accent for the selected segment | `control_*`, `selected_bg/ink`, `font_label`, `space_4/8` |
|
||||
| choice: `segmented`, `Segments` | Equal text choices; `states` supplies mixed selection, `enabled` keeps unsupported choices faded and inert, `disabled_reasons` also disables choices and supplies hover explanations, `compact` clips instead of falling back to a dropdown, `primary` uses accent/on-accent for the selected segment | `control_*`, `selected_bg/ink`, `font_label`, `space_4/8` |
|
||||
| `segmented_icons`, `IconSegment` | Equal icon choices and mixed states | segment tokens, icon palette |
|
||||
| `checkbox`, `checkbox_indeterminate`, `checkbox_row`, `checkbox_grid`, `options` | One box/tick painter for inline, mixed, full-row, grid and menu choices | `space_14/3/2`, `radius_sm`, `control_fill/border`, `form_primary/ink`, `hover`, `on_accent` |
|
||||
| `text_emphasis` | Bold/italic with translated accessible names | form control/font tokens |
|
||||
|
||||
Reference in New Issue
Block a user