@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.
- package/LICENSE +21 -0
- package/README.md +377 -2
- package/dist/animation.d.ts +129 -0
- package/dist/animation.js +276 -0
- package/dist/batch.d.ts +118 -0
- package/dist/batch.js +186 -0
- package/dist/bone.d.ts +50 -0
- package/dist/bone.js +66 -0
- package/dist/camera.d.ts +61 -0
- package/dist/camera.js +120 -0
- package/dist/cinematics.d.ts +188 -0
- package/dist/cinematics.js +165 -0
- package/dist/client.d.ts +399 -0
- package/dist/client.js +769 -0
- package/dist/dforce.d.ts +15 -0
- package/dist/dforce.js +36 -0
- package/dist/element.d.ts +51 -0
- package/dist/element.js +141 -0
- package/dist/exceptions.d.ts +124 -0
- package/dist/exceptions.js +173 -0
- package/dist/geometry.d.ts +81 -0
- package/dist/geometry.js +433 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +36 -0
- package/dist/light.d.ts +24 -0
- package/dist/light.js +40 -0
- package/dist/lighting.d.ts +120 -0
- package/dist/lighting.js +107 -0
- package/dist/material.d.ts +27 -0
- package/dist/material.js +63 -0
- package/dist/materials.d.ts +107 -0
- package/dist/materials.js +165 -0
- package/dist/math3.d.ts +204 -0
- package/dist/math3.js +502 -0
- package/dist/modifier.d.ts +14 -0
- package/dist/modifier.js +24 -0
- package/dist/morph.d.ts +11 -0
- package/dist/morph.js +24 -0
- package/dist/node.d.ts +196 -0
- package/dist/node.js +447 -0
- package/dist/polling.d.ts +24 -0
- package/dist/polling.js +50 -0
- package/dist/pose.d.ts +82 -0
- package/dist/pose.js +295 -0
- package/dist/poses.d.ts +54 -0
- package/dist/poses.js +40 -0
- package/dist/property.d.ts +64 -0
- package/dist/property.js +125 -0
- package/dist/render.d.ts +242 -0
- package/dist/render.js +811 -0
- package/dist/renderApi.d.ts +124 -0
- package/dist/renderApi.js +235 -0
- package/dist/result.d.ts +15 -0
- package/dist/result.js +1 -0
- package/dist/scene.d.ts +154 -0
- package/dist/scene.js +584 -0
- package/dist/sceneEvents.d.ts +63 -0
- package/dist/sceneEvents.js +102 -0
- package/dist/sceneState.d.ts +167 -0
- package/dist/sceneState.js +430 -0
- package/dist/scriptBuilder.d.ts +41 -0
- package/dist/scriptBuilder.js +72 -0
- package/dist/shotGeometry.d.ts +49 -0
- package/dist/shotGeometry.js +76 -0
- package/dist/skeleton.d.ts +120 -0
- package/dist/skeleton.js +561 -0
- package/dist/timeline.d.ts +24 -0
- package/dist/timeline.js +39 -0
- package/dist/undo.d.ts +24 -0
- package/dist/undo.js +45 -0
- package/dist/version.d.ts +31 -0
- package/dist/version.js +36 -0
- package/dist/viewport.d.ts +58 -0
- package/dist/viewport.js +239 -0
- package/package.json +52 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DazElement } from "./element.js";
|
|
2
|
+
/**
|
|
3
|
+
* Proxy for a `DzModifier` (constraint, formula, etc.) on a node, obtained
|
|
4
|
+
* via `DazNode.modifiers()`/`.findModifier()`. Morph/blendshape modifiers
|
|
5
|
+
* are returned as the more specific {@link DazMorph} automatically; dForce
|
|
6
|
+
* simulation modifiers as {@link DazDForce}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class DazModifier extends DazElement {
|
|
9
|
+
/** User-visible display label of this modifier (read-only). */
|
|
10
|
+
modifierLabel(): Promise<string | null>;
|
|
11
|
+
/** Whether this modifier is currently active (read/write). */
|
|
12
|
+
enabled(): Promise<boolean | null>;
|
|
13
|
+
setEnabled(value: boolean): Promise<void>;
|
|
14
|
+
}
|
package/dist/modifier.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DazElement } from "./element.js";
|
|
2
|
+
import { ScriptBuilder } from "./scriptBuilder.js";
|
|
3
|
+
/**
|
|
4
|
+
* Proxy for a `DzModifier` (constraint, formula, etc.) on a node, obtained
|
|
5
|
+
* via `DazNode.modifiers()`/`.findModifier()`. Morph/blendshape modifiers
|
|
6
|
+
* are returned as the more specific {@link DazMorph} automatically; dForce
|
|
7
|
+
* simulation modifiers as {@link DazDForce}.
|
|
8
|
+
*/
|
|
9
|
+
export class DazModifier extends DazElement {
|
|
10
|
+
/** User-visible display label of this modifier (read-only). */
|
|
11
|
+
async modifierLabel() {
|
|
12
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; return m ? m.getLabel() : null;`);
|
|
13
|
+
return (await this.client.execute(script)).value;
|
|
14
|
+
}
|
|
15
|
+
/** Whether this modifier is currently active (read/write). */
|
|
16
|
+
async enabled() {
|
|
17
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; return m ? m.isEnabled() : null;`);
|
|
18
|
+
return (await this.client.execute(script)).value;
|
|
19
|
+
}
|
|
20
|
+
async setEnabled(value) {
|
|
21
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; if (m) m.setEnabled(${ScriptBuilder.serializeArg(value)});`);
|
|
22
|
+
await this.client.execute(script);
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/morph.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DazModifier } from "./modifier.js";
|
|
2
|
+
/** Proxy for a `DzMorph` blendshape slider, returned by `DazNode.morphs()`/`.findModifier()`. */
|
|
3
|
+
export declare class DazMorph extends DazModifier {
|
|
4
|
+
/** Current morph strength (typically 0.0-1.0, read/write). */
|
|
5
|
+
value(): Promise<number | null>;
|
|
6
|
+
setValue(v: number): Promise<void>;
|
|
7
|
+
/** Minimum allowed value for this morph channel (read-only). */
|
|
8
|
+
min(): Promise<number | null>;
|
|
9
|
+
/** Maximum allowed value for this morph channel (read-only). */
|
|
10
|
+
max(): Promise<number | null>;
|
|
11
|
+
}
|
package/dist/morph.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DazModifier } from "./modifier.js";
|
|
2
|
+
import { ScriptBuilder } from "./scriptBuilder.js";
|
|
3
|
+
/** Proxy for a `DzMorph` blendshape slider, returned by `DazNode.morphs()`/`.findModifier()`. */
|
|
4
|
+
export class DazMorph extends DazModifier {
|
|
5
|
+
/** Current morph strength (typically 0.0-1.0, read/write). */
|
|
6
|
+
async value() {
|
|
7
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; return m ? m.getValueChannel().getValue() : null;`);
|
|
8
|
+
return (await this.client.execute(script)).value;
|
|
9
|
+
}
|
|
10
|
+
async setValue(v) {
|
|
11
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; if (m) m.getValueChannel().setValue(${ScriptBuilder.serializeArg(v)});`);
|
|
12
|
+
await this.client.execute(script);
|
|
13
|
+
}
|
|
14
|
+
/** Minimum allowed value for this morph channel (read-only). */
|
|
15
|
+
async min() {
|
|
16
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; return m ? m.getValueChannel().getMin() : null;`);
|
|
17
|
+
return (await this.client.execute(script)).value;
|
|
18
|
+
}
|
|
19
|
+
/** Maximum allowed value for this morph channel (read-only). */
|
|
20
|
+
async max() {
|
|
21
|
+
const script = ScriptBuilder.iife(`var m = ${this.locator}; return m ? m.getValueChannel().getMax() : null;`);
|
|
22
|
+
return (await this.client.execute(script)).value;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { DazClient } from "./client.js";
|
|
2
|
+
import { DazDForce } from "./dforce.js";
|
|
3
|
+
import { DazElement } from "./element.js";
|
|
4
|
+
import { DazMaterial } from "./material.js";
|
|
5
|
+
import { DazModifier } from "./modifier.js";
|
|
6
|
+
import { DazMorph } from "./morph.js";
|
|
7
|
+
import { DazProperty } from "./property.js";
|
|
8
|
+
/** Identifies a scene node by name or label. */
|
|
9
|
+
export interface NodeIdentifier {
|
|
10
|
+
/** The name or label string used to look up the node. */
|
|
11
|
+
value: string;
|
|
12
|
+
/** `"name"` uses `Scene.findNode()`; `"label"` uses `Scene.findNodeByLabel()`. */
|
|
13
|
+
kind: "name" | "label";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Proxy for a `DzNode` in the active DAZ Studio scene. Provides access to
|
|
17
|
+
* transforms, hierarchy, visibility, materials, modifiers, and geometry.
|
|
18
|
+
* Instances are typically obtained from {@link DazScene} rather than
|
|
19
|
+
* constructed directly. All reads may resolve to `null` if the node no
|
|
20
|
+
* longer exists in the scene.
|
|
21
|
+
*
|
|
22
|
+
* This class is built across two tasks: this file covers transforms,
|
|
23
|
+
* visibility, and hierarchy (Phase 2 Task 3); a later task (Task 6) adds
|
|
24
|
+
* modifiers/materials/fitting methods to this same class.
|
|
25
|
+
*/
|
|
26
|
+
export declare class DazNode extends DazElement {
|
|
27
|
+
readonly identifier: NodeIdentifier;
|
|
28
|
+
/**
|
|
29
|
+
* Construct a `DazNode` from a standard scene node lookup by identifier.
|
|
30
|
+
*/
|
|
31
|
+
constructor(client: DazClient, identifier: NodeIdentifier);
|
|
32
|
+
/**
|
|
33
|
+
* Construct a `DazNode` from a pre-built DazScript locator expression.
|
|
34
|
+
* Used by subclasses like `DazBone` that work with skeleton-relative locators.
|
|
35
|
+
*
|
|
36
|
+
* IMPORTANT: `locator` is honored only by the base-class (`DazElement`)
|
|
37
|
+
* property methods (`getProperty`/`setProperty`/`className`/`snapshot`,
|
|
38
|
+
* plus `node.ts`'s own `modifierLocator`/`materialLocator` helpers).
|
|
39
|
+
* `DazNode`'s own transform/hierarchy/modifier/material methods (e.g.
|
|
40
|
+
* `position`, `setPosition`, `setRotation`, `setScale`, `setTransform`,
|
|
41
|
+
* `label`, `select`, `parent`, `children`, `boundingBox`,
|
|
42
|
+
* `setPositionAtFrame`, `modifiers`, `materials`, ...) always resolve via
|
|
43
|
+
* {@link nodeScript}, which rebuilds its script body from `this.identifier`
|
|
44
|
+
* (a `Scene.findNode()`-style lookup) regardless of any `locator` supplied
|
|
45
|
+
* here. This matches dazpy's own `_node.py`, which has the same split.
|
|
46
|
+
* Subclasses that need full locator-scoped resolution for those methods
|
|
47
|
+
* (e.g. `DazBone`) must override the relevant methods individually — see
|
|
48
|
+
* `DazBone`'s overridden rotation/position methods in `bone.ts` for the
|
|
49
|
+
* pattern.
|
|
50
|
+
*/
|
|
51
|
+
constructor(client: DazClient, identifier: NodeIdentifier, locator: string);
|
|
52
|
+
/** Wrap `body` in the standard `_node` null-checked IIFE for this node's identifier. */
|
|
53
|
+
protected nodeScript(body: string): string;
|
|
54
|
+
/** User-visible display label shown in the Scene panel (read/write). */
|
|
55
|
+
label(): Promise<string | null>;
|
|
56
|
+
setLabel(value: string): Promise<void>;
|
|
57
|
+
/** Internal node name used to look up the node (read-only). */
|
|
58
|
+
name(): Promise<string | null>;
|
|
59
|
+
/** World-space position as `{x, y, z}` (read-only; use {@link setPosition} to change). */
|
|
60
|
+
position(): Promise<{
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
z: number;
|
|
64
|
+
} | null>;
|
|
65
|
+
setPosition(x: number, y: number, z: number): Promise<void>;
|
|
66
|
+
/** World-space rotation as `{x, y, z, w}` quaternion (read-only; use {@link setRotation} for Euler degrees). */
|
|
67
|
+
rotation(): Promise<{
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
z: number;
|
|
71
|
+
w: number;
|
|
72
|
+
} | null>;
|
|
73
|
+
/** Uniform scale factor (read-only). */
|
|
74
|
+
generalScale(): Promise<number | null>;
|
|
75
|
+
/** Per-axis and uniform scale as `{x, y, z, general}` (read-only; use {@link setScale} to change per-axis values). */
|
|
76
|
+
scale(): Promise<{
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
z: number;
|
|
80
|
+
general: number;
|
|
81
|
+
} | null>;
|
|
82
|
+
/** Set per-axis local scale (does not affect the general/uniform scale dial; see {@link generalScale}). */
|
|
83
|
+
setScale(x: number, y: number, z: number): Promise<void>;
|
|
84
|
+
/** Set any combination of local position/rotation(Euler degrees)/scale in one round trip; omitted components are left untouched. */
|
|
85
|
+
setTransform(opts: {
|
|
86
|
+
position?: [number, number, number];
|
|
87
|
+
rotation?: [number, number, number];
|
|
88
|
+
scale?: [number, number, number];
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
/** Set the world-space rotation using Euler angles in degrees. */
|
|
91
|
+
setRotation(x: number, y: number, z: number): Promise<void>;
|
|
92
|
+
/** Write a real position keyframe at timeline `frame` (converted to ticks via `Scene.getTimeStep()`). */
|
|
93
|
+
setPositionAtFrame(frame: number, x: number, y: number, z: number): Promise<void>;
|
|
94
|
+
/** Write a real Euler rotation keyframe at timeline `frame`. See {@link setPositionAtFrame} for the tick conversion. */
|
|
95
|
+
setRotationAtFrame(frame: number, x: number, y: number, z: number): Promise<void>;
|
|
96
|
+
/** Remove all keyframes from this node's X/Y/Z position controls (call before a fresh {@link setPositionAtFrame} curve). */
|
|
97
|
+
clearPositionKeys(): Promise<void>;
|
|
98
|
+
/** Remove all keyframes from this node's X/Y/Z rotation controls. See {@link clearPositionKeys}. */
|
|
99
|
+
clearRotationKeys(): Promise<void>;
|
|
100
|
+
/** Local-space position as `{x, y, z}` (read-only). */
|
|
101
|
+
localPosition(): Promise<{
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
z: number;
|
|
105
|
+
} | null>;
|
|
106
|
+
setLocalPosition(x: number, y: number, z: number): Promise<void>;
|
|
107
|
+
/** Local-space rotation as `(x, y, z)` Euler degrees; exact inverse of {@link setLocalRotation}. */
|
|
108
|
+
localEuler(): Promise<[number, number, number] | null>;
|
|
109
|
+
/** Local-space rotation as `{x, y, z, w}` quaternion (read-only). */
|
|
110
|
+
localRotation(): Promise<{
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
z: number;
|
|
114
|
+
w: number;
|
|
115
|
+
} | null>;
|
|
116
|
+
setLocalRotation(x: number, y: number, z: number): Promise<void>;
|
|
117
|
+
/** General visibility flag, affecting both viewport and render unless overridden per-channel (read/write). */
|
|
118
|
+
visible(): Promise<boolean | null>;
|
|
119
|
+
setVisible(value: boolean): Promise<void>;
|
|
120
|
+
isVisibleInRender(): Promise<boolean>;
|
|
121
|
+
setVisibleInRender(on: boolean): Promise<void>;
|
|
122
|
+
isVisibleInViewport(): Promise<boolean>;
|
|
123
|
+
setVisibleInViewport(on: boolean): Promise<void>;
|
|
124
|
+
isSelected(): Promise<boolean>;
|
|
125
|
+
select(on?: boolean): Promise<void>;
|
|
126
|
+
isInScene(): Promise<boolean>;
|
|
127
|
+
/** `true` if this node has no parent (top-level node). */
|
|
128
|
+
isRoot(): Promise<boolean>;
|
|
129
|
+
/** Parent node in the scene hierarchy, or `null` for root nodes. */
|
|
130
|
+
parent(): Promise<DazNode | null>;
|
|
131
|
+
/** Direct child nodes. */
|
|
132
|
+
children(): Promise<DazNode[]>;
|
|
133
|
+
/** Remove this node from the scene entirely. @returns `true` if found and removed. */
|
|
134
|
+
delete(): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Move this node to a new position in the scene hierarchy via the
|
|
137
|
+
* `removeNodeChild`/`addNodeChild` pattern.
|
|
138
|
+
* @param preserveWorldTransform When `true` (default), keeps world-space transform, adjusting local transform to compensate.
|
|
139
|
+
*/
|
|
140
|
+
reparent(newParent: DazNode, opts?: {
|
|
141
|
+
preserveWorldTransform?: boolean;
|
|
142
|
+
}): Promise<void>;
|
|
143
|
+
private modifierClassFor;
|
|
144
|
+
private modifierLocator;
|
|
145
|
+
/** Return all modifiers (morphs, constraints, etc.) on this node, typed via the DzMorph/DzDForceModifier dispatch table. */
|
|
146
|
+
modifiers(): Promise<DazModifier[]>;
|
|
147
|
+
/** Find a modifier by internal name. */
|
|
148
|
+
findModifier(name: string): Promise<DazModifier | null>;
|
|
149
|
+
/** Find a modifier by its user-visible label (the name shown in the DAZ UI), matching {@link findModifier}'s internal-name lookup on label instead. */
|
|
150
|
+
findModifierByLabel(label: string): Promise<DazModifier | null>;
|
|
151
|
+
private materialLocator;
|
|
152
|
+
/** Return all surface materials on this node's current shape. */
|
|
153
|
+
materials(): Promise<DazMaterial[]>;
|
|
154
|
+
/** Find a surface material by name. */
|
|
155
|
+
findMaterial(name: string): Promise<DazMaterial | null>;
|
|
156
|
+
/**
|
|
157
|
+
* Find a node-level property by internal name via `DzNode::findProperty` —
|
|
158
|
+
* covers pose controls/FACS dials that are not geometry modifiers and so
|
|
159
|
+
* are invisible to {@link findModifier}.
|
|
160
|
+
*/
|
|
161
|
+
findProperty(name: string): Promise<DazProperty | null>;
|
|
162
|
+
/** Like {@link findProperty} but matches `getLabel()` instead of `getName()`. */
|
|
163
|
+
findPropertyByLabel(label: string): Promise<DazProperty | null>;
|
|
164
|
+
/** Only the morph modifiers on this node (convenience filter over {@link modifiers}). */
|
|
165
|
+
morphs(): Promise<DazMorph[]>;
|
|
166
|
+
/** Only the dForce simulation modifiers on this node (convenience filter over {@link modifiers}). */
|
|
167
|
+
dforceModifiers(): Promise<DazDForce[]>;
|
|
168
|
+
/** World-space axis-aligned bounding box, or `null` if the node has no geometry. */
|
|
169
|
+
boundingBox(): Promise<{
|
|
170
|
+
min: {
|
|
171
|
+
x: number;
|
|
172
|
+
y: number;
|
|
173
|
+
z: number;
|
|
174
|
+
};
|
|
175
|
+
max: {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
z: number;
|
|
179
|
+
};
|
|
180
|
+
} | null>;
|
|
181
|
+
/**
|
|
182
|
+
* Fit this clothing/hair/prop node to a base figure, preferring
|
|
183
|
+
* `setFollowTarget`/`followSkeleton` (conforming items) and falling back
|
|
184
|
+
* to parenting (plain props). @returns which DazScript API was used.
|
|
185
|
+
*/
|
|
186
|
+
fitTo(figure: DazNode): Promise<string>;
|
|
187
|
+
/** Remove this node's fitting relationship with its figure (follow-target and/or skeleton parenting). */
|
|
188
|
+
unfit(): Promise<{
|
|
189
|
+
previousFigure: string | null;
|
|
190
|
+
actions: string[];
|
|
191
|
+
}>;
|
|
192
|
+
/** Every clothing/hair/prop node fitted to this figure (following it, or directly parented to it). */
|
|
193
|
+
fittedItems(): Promise<DazNode[]>;
|
|
194
|
+
/** Total vertex count of this node's current geometry, or `null`. */
|
|
195
|
+
geometryVertexCount(): Promise<number | null>;
|
|
196
|
+
}
|