@bluemoonfoundry/daz-ts 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +377 -2
  3. package/dist/animation.d.ts +129 -0
  4. package/dist/animation.js +276 -0
  5. package/dist/batch.d.ts +118 -0
  6. package/dist/batch.js +186 -0
  7. package/dist/bone.d.ts +50 -0
  8. package/dist/bone.js +66 -0
  9. package/dist/camera.d.ts +61 -0
  10. package/dist/camera.js +120 -0
  11. package/dist/cinematics.d.ts +188 -0
  12. package/dist/cinematics.js +165 -0
  13. package/dist/client.d.ts +399 -0
  14. package/dist/client.js +769 -0
  15. package/dist/dforce.d.ts +15 -0
  16. package/dist/dforce.js +36 -0
  17. package/dist/element.d.ts +51 -0
  18. package/dist/element.js +141 -0
  19. package/dist/exceptions.d.ts +124 -0
  20. package/dist/exceptions.js +173 -0
  21. package/dist/geometry.d.ts +81 -0
  22. package/dist/geometry.js +433 -0
  23. package/dist/index.d.ts +50 -0
  24. package/dist/index.js +36 -0
  25. package/dist/light.d.ts +24 -0
  26. package/dist/light.js +40 -0
  27. package/dist/lighting.d.ts +120 -0
  28. package/dist/lighting.js +107 -0
  29. package/dist/material.d.ts +27 -0
  30. package/dist/material.js +63 -0
  31. package/dist/materials.d.ts +107 -0
  32. package/dist/materials.js +165 -0
  33. package/dist/math3.d.ts +204 -0
  34. package/dist/math3.js +502 -0
  35. package/dist/modifier.d.ts +14 -0
  36. package/dist/modifier.js +24 -0
  37. package/dist/morph.d.ts +11 -0
  38. package/dist/morph.js +24 -0
  39. package/dist/node.d.ts +196 -0
  40. package/dist/node.js +447 -0
  41. package/dist/polling.d.ts +24 -0
  42. package/dist/polling.js +50 -0
  43. package/dist/pose.d.ts +82 -0
  44. package/dist/pose.js +295 -0
  45. package/dist/poses.d.ts +54 -0
  46. package/dist/poses.js +40 -0
  47. package/dist/property.d.ts +64 -0
  48. package/dist/property.js +125 -0
  49. package/dist/render.d.ts +242 -0
  50. package/dist/render.js +811 -0
  51. package/dist/renderApi.d.ts +124 -0
  52. package/dist/renderApi.js +235 -0
  53. package/dist/result.d.ts +15 -0
  54. package/dist/result.js +1 -0
  55. package/dist/scene.d.ts +154 -0
  56. package/dist/scene.js +584 -0
  57. package/dist/sceneEvents.d.ts +63 -0
  58. package/dist/sceneEvents.js +102 -0
  59. package/dist/sceneState.d.ts +167 -0
  60. package/dist/sceneState.js +430 -0
  61. package/dist/scriptBuilder.d.ts +41 -0
  62. package/dist/scriptBuilder.js +72 -0
  63. package/dist/shotGeometry.d.ts +49 -0
  64. package/dist/shotGeometry.js +76 -0
  65. package/dist/skeleton.d.ts +120 -0
  66. package/dist/skeleton.js +561 -0
  67. package/dist/timeline.d.ts +24 -0
  68. package/dist/timeline.js +39 -0
  69. package/dist/undo.d.ts +24 -0
  70. package/dist/undo.js +45 -0
  71. package/dist/version.d.ts +31 -0
  72. package/dist/version.js +36 -0
  73. package/dist/viewport.d.ts +58 -0
  74. package/dist/viewport.js +239 -0
  75. package/package.json +52 -4
@@ -0,0 +1,242 @@
1
+ import type { DazClient } from "./client.js";
2
+ /** An Iray Canvas definition (extra render pass alongside the beauty image). */
3
+ export interface Canvas {
4
+ name: string;
5
+ canvasType: string;
6
+ index: number;
7
+ }
8
+ /**
9
+ * Result of a {@link DazRenderSettings.render} call.
10
+ *
11
+ * Unlike dazpy's `RenderOutcome` (which overrides `__bool__` so old
12
+ * bool-returning callers keep working), TS callers must check `.success`
13
+ * explicitly -- there is no operator-overload equivalent.
14
+ */
15
+ export interface RenderOutcome {
16
+ success: boolean;
17
+ outputPath: string | null;
18
+ }
19
+ /** Options for {@link DazRenderSettings.render}. `cameraName` and `cameraLabel` are mutually exclusive. */
20
+ export interface RenderOptions {
21
+ /**
22
+ * Internal name of the camera node to render from. Internal names are not
23
+ * guaranteed unique -- e.g. duplicating a camera node in the Scene panel
24
+ * copies its internal name too, only the display label is forced unique --
25
+ * so this can silently resolve to the wrong node when duplicates exist.
26
+ * Prefer `cameraLabel` unless you specifically need name-based lookup.
27
+ */
28
+ cameraName?: string;
29
+ /**
30
+ * User-visible label of the camera node to render from (the same value
31
+ * shown in the Scene panel, resolved via `Scene.findCameraByLabel()`).
32
+ * Labels are kept unique by DAZ Studio even when internal names collide,
33
+ * so this is the more reliable way to target a specific camera. When
34
+ * neither `cameraName` nor `cameraLabel` is given, the active viewport
35
+ * camera is used.
36
+ */
37
+ cameraLabel?: string;
38
+ }
39
+ /**
40
+ * Live control of DAZ Studio's Render Settings pane: engine selection,
41
+ * resolution, gamma, Iray quality presets, Iray Canvases, and a
42
+ * `render()` helper that drives `DzRenderMgr.doRender()` synchronously and
43
+ * waits for its `renderFinished(bool)` signal.
44
+ *
45
+ * This talks directly to the DazScript render manager (`App.getRenderMgr()`)
46
+ * via {@link DazClient.execute}, distinct from the HTTP `/render` job-queue
47
+ * endpoints exposed on {@link DazClient} itself (`renderSubmit`,
48
+ * `renderBatchSubmit`, ...) and the {@link render}/{@link renderVariants}
49
+ * helpers in `renderApi.ts` that submit to that queue.
50
+ */
51
+ export declare class DazRenderSettings {
52
+ private readonly client;
53
+ constructor(client?: DazClient);
54
+ private irayPropertyHolderExpr;
55
+ private getIrayProperty;
56
+ private setIrayProperty;
57
+ /**
58
+ * Index 3 of the 4 fixed render element groups (General Render, Iray,
59
+ * Tonemapper, Environment) -- confirmed against a live instance alongside
60
+ * index 1 (see {@link irayRenderOptionsHolderExpr}).
61
+ */
62
+ private environmentHolderExpr;
63
+ /** Read an Environment-holder property by label (e.g. `"Environment Intensity"`, `"Dome Rotation"`). Primarily for domain-helper use (see `lighting.ts`). */
64
+ getEnvironmentProperty(name: string): Promise<unknown>;
65
+ /** Set an Environment-holder property by label. Primarily for domain-helper use (see `lighting.ts`). */
66
+ setEnvironmentProperty(name: string, value: unknown): Promise<void>;
67
+ /** Set an Environment-holder property from a string value via `setValueFromString()`. Primarily for domain-helper use. */
68
+ setEnvironmentPropertyFromString(name: string, value: string): Promise<void>;
69
+ /**
70
+ * Set the "Environment Map" (HDRI) path, validating it against the local
71
+ * filesystem before sending `setMap()`.
72
+ *
73
+ * Requires an absolute path: a local existence check against a relative
74
+ * path resolves against this process's cwd, not DAZ Studio's, so a
75
+ * relative path could pass this check yet still resolve to a different
76
+ * (or unresolvable) file in DAZ Studio -- reproducing the blocking
77
+ * file-not-found dialog this validation exists to prevent (see
78
+ * `feedback_dazscript_blocking_dialogs` in project memory). The existence
79
+ * check validates against the local/client-side filesystem, which is
80
+ * correct when DAZ Studio and this client are co-located but will
81
+ * misbehave against a remote DAZ Studio server.
82
+ */
83
+ setEnvironmentMap(mapPath: string): Promise<void>;
84
+ /**
85
+ * Canvas definitions live on this holder, not on
86
+ * `getActiveRenderer().getPropertyHolder()` -- confirmed against a live
87
+ * instance; index 1 is "NVIDIA Iray Render Options" among the 4 fixed
88
+ * render element groups (General Render, Iray, Tonemapper, Environment).
89
+ */
90
+ private irayRenderOptionsHolderExpr;
91
+ private static refreshRenderSettingsPaneScript;
92
+ /** `true` if the render manager is accessible. */
93
+ isAvailable(): Promise<boolean>;
94
+ /** `true` if a render is currently in progress. */
95
+ isRendering(): Promise<boolean>;
96
+ /** DazScript body returning bounded raw selector and renderer facts. */
97
+ private static engineReadbackBody;
98
+ /**
99
+ * Return truthful Render Settings engine facts and a normalized verdict.
100
+ *
101
+ * `DzRenderOptions.renderType` is the effective render-operation selector.
102
+ * The active renderer class/name is returned as a separate fact and only
103
+ * participates in normalization when `renderType` is `Software`. In
104
+ * particular, an Iray active-renderer name cannot turn a ScreenShot or
105
+ * HardwareAssisted operation into an Iray verdict.
106
+ */
107
+ renderEngineState(): Promise<Record<string, unknown>>;
108
+ /**
109
+ * Persist `"iray"` or `"viewport"` and require exact live readback.
110
+ *
111
+ * This is an explicit persistent setter, not a transactional render
112
+ * helper. It calls `applyChanges()` so the selected render operation is
113
+ * written via DAZ's settings manager. Any lookup, mutation, apply, or
114
+ * readback failure throws {@link RenderError}; unknown engine names never
115
+ * silently continue.
116
+ */
117
+ setRenderEngine(engine: string): Promise<Record<string, unknown>>;
118
+ /**
119
+ * Return the active render engine name.
120
+ *
121
+ * The Render Settings pane's "Engine" dropdown conflates two separate
122
+ * DazScript concepts, confirmed against a live instance:
123
+ * `DzRenderOptions.renderType` is a 3-value enum (ScreenShot,
124
+ * HardwareAssisted, Software) picking *how* the scene is rendered; only
125
+ * when it's `Software` does `renderMgr.getActiveRenderer()` (the
126
+ * pluggable Iray/Filament/... renderer) apply. Returns `"viewport"` or
127
+ * `"multi_pass_opengl"` for the first two modes, otherwise the mapped
128
+ * engine name (e.g. `"iray"`, `"filament"`), falling back to the raw
129
+ * DazScript class name (e.g. `"DzIrayRenderer"`) if it isn't one of the
130
+ * known engines.
131
+ */
132
+ activeEngine(): Promise<string | null>;
133
+ /**
134
+ * Set the active render engine.
135
+ *
136
+ * @param engine `"viewport"` or `"multi_pass_opengl"` to switch
137
+ * `DzRenderOptions.renderType` to one of the two non-pluggable modes, or a
138
+ * pluggable renderer name (e.g. `"iray"`, `"filament"`, or a raw
139
+ * DazScript class name like `"DzIrayRenderer"`) to set `renderType` to
140
+ * `Software` and activate that renderer.
141
+ * @throws RenderError If a pluggable renderer name doesn't resolve to a
142
+ * renderer registered with the render manager (e.g. the Filament plugin
143
+ * isn't installed).
144
+ */
145
+ setActiveEngine(engine: string): Promise<void>;
146
+ /** Return the render image size as `{width, height}`. */
147
+ resolution(): Promise<{
148
+ width: number;
149
+ height: number;
150
+ } | null>;
151
+ /**
152
+ * Set the render image size in pixels.
153
+ *
154
+ * `QSize` is exposed as a constructor in DazScript; plain object literals
155
+ * are not coerced, so `new QSize(w, h)` is required.
156
+ */
157
+ setResolution(width: number, height: number): Promise<void>;
158
+ /** Return the filename set for rendered images. */
159
+ outputPath(): Promise<string | null>;
160
+ setOutputPath(outPath: string): Promise<void>;
161
+ /** Return the gamma correction value. */
162
+ gamma(): Promise<number | null>;
163
+ setGamma(value: number): Promise<void>;
164
+ /** Return whether polygons are rendered as double-sided. */
165
+ doubleSided(): Promise<boolean | null>;
166
+ setDoubleSided(value: boolean): Promise<void>;
167
+ /**
168
+ * Render the scene to {@link outputPath}.
169
+ *
170
+ * DAZ Studio's `doRender()` only writes to disk when `renderImgToId` is
171
+ * set to `DzRenderOptions.DirectToFile` and the camera is applied to both
172
+ * the render options and the active viewport before the call.
173
+ *
174
+ * @returns A {@link RenderOutcome} with `success` and the resolved
175
+ * `outputPath` actually written by `doRender()` (`opts.renderImgFilename`
176
+ * after the call).
177
+ * @throws Error If both `cameraName` and `cameraLabel` are given.
178
+ */
179
+ render(opts?: RenderOptions): Promise<RenderOutcome>;
180
+ /**
181
+ * Alias for {@link render} kept for parity with dazpy's backwards-compatible name.
182
+ * `doRender()` is synchronous in DAZ Studio so no polling is required.
183
+ */
184
+ renderAndWait(): Promise<RenderOutcome>;
185
+ /** `true` if there is a completed render available to save. */
186
+ hasRender(): Promise<boolean>;
187
+ /** Iray progressive rendering sample cap (`Max Samples` in the Advanced tab). */
188
+ maxSamples(): Promise<number | null>;
189
+ setMaxSamples(value: number): Promise<void>;
190
+ /** Iray progressive rendering time cap in seconds (`Max Time` in the Advanced tab). */
191
+ maxTimeSecs(): Promise<number | null>;
192
+ setMaxTimeSecs(value: number): Promise<void>;
193
+ /** Iray `Rendering Quality` convergence target (higher converges further). */
194
+ quality(): Promise<number | null>;
195
+ setQuality(value: number): Promise<void>;
196
+ /**
197
+ * Apply a named Iray quality preset, controlling sample count and render time.
198
+ *
199
+ * @param preset One of `"draft"`, `"preview"`, `"good"`, `"final"`
200
+ * (fastest/lowest quality to slowest/highest quality).
201
+ * @throws Error If `preset` is not a recognized preset name.
202
+ */
203
+ setQualityPreset(preset: string): Promise<void>;
204
+ /** Master on/off switch for all Iray Canvas output (`Render to Canvases`). */
205
+ canvasesEnabled(): Promise<boolean | null>;
206
+ setCanvasesEnabled(value: boolean): Promise<void>;
207
+ /** List the Iray Canvases currently configured on the active render. */
208
+ listCanvases(): Promise<Canvas[]>;
209
+ /**
210
+ * Add (or reconfigure) an Iray Canvas by name.
211
+ *
212
+ * @param name Canvas name. If a canvas with this name already exists it
213
+ * is reconfigured to `canvasType` rather than duplicated.
214
+ * @param canvasType One of `"Beauty"`, `"Diffuse"`, `"Specular"`,
215
+ * `"Glossy"`, `"Emission"`, `"LightGroup"`, `"EnvironmentLighting"`,
216
+ * `"LPE"`, `"Irradiance"`, `"Alpha"`, `"Shadow"`, `"AmbientOcclusion"`,
217
+ * `"Distance"`, `"Depth"`, `"MaterialTag"`, `"MaterialID"`, `"ObjectID"`,
218
+ * `"Normal"`, `"TextureCoordinate"`, `"BSDFWeight"`,
219
+ * `"ConvergenceHeatmap"`, `"PostToon"`, `"WorldPosition"`.
220
+ * @throws RenderError If the render manager or Iray property holder is unavailable.
221
+ */
222
+ addCanvas(name: string, canvasType: string): Promise<Canvas>;
223
+ /**
224
+ * Remove a configured Iray Canvas by name.
225
+ * @returns `true` if a matching canvas was found and removed, `false` if no canvas with `name` exists.
226
+ */
227
+ removeCanvas(name: string): Promise<boolean>;
228
+ /**
229
+ * Return each configured canvas's resolved output file path for a render to `outputPath`.
230
+ *
231
+ * Derived from DAZ Studio's naming convention -- canvases are written to
232
+ * `<dir>/<basename>_canvases/<basename>-<canvasName>-<canvasType>.exr`
233
+ * alongside the main render output. Confirmed empirically against a live
234
+ * render; DazScript does not expose these paths directly, so this is
235
+ * computed rather than queried.
236
+ *
237
+ * @param outputPath The path passed as the main render's `outputPath`
238
+ * (i.e. what {@link setOutputPath} would be called with).
239
+ * @returns A map from each canvas's name to its resolved output path.
240
+ */
241
+ canvasOutputPaths(outputPath: string): Promise<Record<string, string>>;
242
+ }