MCPcopy
hub / github.com/donmccurdy/glTF-Transform / bind

Method bind

packages/view/src/DocumentViewImpl.ts:122–171  ·  view source on GitHub ↗
(def: PropertyDef | null)

Source from the content-addressed store, hash-verified

120 bind(def: PropertyDef): Subject<PropertyDef, any>;
121 // biome-ignore lint/suspicious/noExplicitAny: TODO
122 bind(def: PropertyDef | null): Subject<PropertyDef, any> | null {
123 if (!def) return null;
124 if (this._subjects.has(def)) return this._subjects.get(def)!;
125
126 // biome-ignore lint/suspicious/noExplicitAny: TODO
127 let subject: Subject<PropertyDef, any>;
128 switch (def.propertyType) {
129 case PropertyType.ACCESSOR:
130 subject = new AccessorSubject(this, def as AccessorDef);
131 break;
132 case 'InstancedMesh':
133 subject = new InstancedMeshSubject(this, def as InstancedMeshDef);
134 break;
135 case 'Light':
136 subject = new LightSubject(this, def as LightDef);
137 break;
138 case PropertyType.MATERIAL:
139 subject = new MaterialSubject(this, def as MaterialDef);
140 break;
141 case PropertyType.MESH:
142 subject = new MeshSubject(this, def as MeshDef);
143 break;
144 case PropertyType.NODE:
145 subject = new NodeSubject(this, def as NodeDef);
146 break;
147 case PropertyType.PRIMITIVE:
148 subject = new PrimitiveSubject(this, def as PrimitiveDef);
149 break;
150 case PropertyType.SCENE:
151 subject = new SceneSubject(this, def as SceneDef);
152 break;
153 case PropertyType.SKIN:
154 subject = new SkinSubject(this, def as SkinDef);
155 break;
156 case PropertyType.TEXTURE:
157 subject = new TextureSubject(this, def as TextureDef);
158 break;
159 default: {
160 if (def instanceof ExtensionPropertyDef) {
161 subject = new ExtensionSubject(this, def as ExtensionPropertyDef);
162 } else {
163 throw new Error(`Unimplemented type: ${def.propertyType}`);
164 }
165 }
166 }
167
168 subject.update();
169 this._addSubject(subject);
170 return subject;
171 }
172
173 recordOutputValue(def: PropertyDef, value: THREEObject) {
174 const outputValues = this._outputValues.get(def) || new Set();

Callers

nothing calls this directly

Calls 4

_addSubjectMethod · 0.95
hasMethod · 0.80
getMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected