Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed May 5, 2024
1 parent 37e45ff commit aea3f86
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/view/src/DocumentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class DocumentView {
public listViews(source: SceneDef): Group[];
public listViews(source: PropertyDef): object[] {
assert(this._ready);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return this._impl.findValues(source as any);
}

Expand All @@ -75,6 +76,7 @@ export class DocumentView {
public getProperty(view: Object3D): MeshDef | NodeDef | SceneDef | null;
public getProperty(view: object): PropertyDef | null {
assert(this._ready);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return this._impl.findDef(view as any);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/view/src/DocumentViewImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export interface DocumentViewSubjectAPI {
bind(def: PrimitiveDef): PrimitiveSubject;
bind(def: SceneDef): SceneSubject;
bind(def: SkinDef): SkinSubject;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bind(def: PropertyDef): Subject<PropertyDef, any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bind(def: PropertyDef | null): Subject<PropertyDef, any> | null;

recordOutputValue(def: PropertyDef, value: THREEObject): void;
Expand All @@ -71,6 +73,7 @@ export interface DocumentViewConfig {
/** @internal */
export class DocumentViewImpl implements DocumentViewSubjectAPI {
private _disposed = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _subjects = new Map<PropertyDef, Subject<PropertyDef, any>>();
private _outputValues = new WeakMap<PropertyDef, Set<object>>();
private _outputValuesInverse = new WeakMap<object, PropertyDef>();
Expand All @@ -93,6 +96,7 @@ export class DocumentViewImpl implements DocumentViewSubjectAPI {
this.imageProvider = config.imageProvider || new DefaultImageProvider();
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _addSubject(subject: Subject<PropertyDef, any>): void {
const def = subject.def;
this._subjects.set(def, subject);
Expand All @@ -111,11 +115,14 @@ export class DocumentViewImpl implements DocumentViewSubjectAPI {
bind(def: PrimitiveDef): PrimitiveSubject;
bind(def: SceneDef): SceneSubject;
bind(def: SkinDef): SkinSubject;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bind(def: PropertyDef): Subject<PropertyDef, any>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
bind(def: PropertyDef | null): Subject<PropertyDef, any> | null {
if (!def) return null;
if (this._subjects.has(def)) return this._subjects.get(def)!;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let subject: Subject<PropertyDef, any>;
switch (def.propertyType) {
case PropertyType.ACCESSOR:
Expand Down
15 changes: 7 additions & 8 deletions packages/view/src/subjects/MaterialSubject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class MaterialSubject extends Subject<MaterialDef, Material> {
observer.setParamsFn(() => TexturePool.createParams(textureInfoFn()!, colorSpace));

const applyTextureFn = (texture: Texture | null) => {
const material = this.value as any;
const material = this.value as Material;
for (const map of maps) {
if (!(map in material)) continue; // Unlit ⊂ Standard ⊂ Physical (& Points, Lines)
if (!!material[map] !== !!texture) material.needsUpdate = true; // Recompile on add/remove.
Expand Down Expand Up @@ -443,18 +443,17 @@ export class MaterialSubject extends Subject<MaterialDef, Material> {
}

// KHR_materials_anisotropy
// TODO(cleanup): Remove 'any' after https://github.com/three-types/three-ts-types/pull/472.
const anisotropy = def.getExtension<Anisotropy>('KHR_materials_anisotropy');
if (anisotropy) {
if (anisotropy.getAnisotropyStrength() !== (target as any).anisotropy) {
if ((target as any).anisotropy === 0) target.needsUpdate = true;
(target as any).anisotropy = anisotropy.getAnisotropyStrength();
if (anisotropy.getAnisotropyStrength() !== target.anisotropy) {
if (target.anisotropy === 0) target.needsUpdate = true;
target.anisotropy = anisotropy.getAnisotropyStrength();
}
if (anisotropy.getAnisotropyRotation() !== (target as any).anisotropyRotation) {
(target as any).anisotropyRotation = anisotropy.getAnisotropyRotation();
if (anisotropy.getAnisotropyRotation() !== target.anisotropyRotation) {
target.anisotropyRotation = anisotropy.getAnisotropyRotation();
}
} else {
(target as any).anisotropy = 0;
target.anisotropy = 0;
}

// KHR_materials_clearcoat
Expand Down

0 comments on commit aea3f86

Please sign in to comment.