import type { Material, Object3D } from "three"; import { Mesh } from "three"; /** Abstract constructor type, used for `instanceof` filtering. */ export type Constructor = abstract new (...args: never[]) => T; /** All methods use depth-first traversal. */ export declare class SceneTraversal { /** @param name - Case-sensitive. */ static getObjectByName(object: Object3D, name: string): Object3D | undefined; /** @param name - Case-sensitive. */ static getMaterialByName(object: Object3D, name: string): Material | undefined; static enumerateObjectsByType(object: Object3D, type: Constructor, callback: (instance: T) => void): void; /** Only visits materials on `Mesh` nodes. */ static enumerateMaterialsByType(object: Object3D, type: Constructor, callback: (material: T) => void): void; static enumerateObjects(object: Object3D, callback: (object: Object3D) => void): void; /** * Only visits materials on `Mesh` nodes. * Returning a material from the callback replaces the original. */ static enumerateMaterials(object: Object3D, callback: (material: Material, mesh: Mesh) => Material | undefined): void; /** * Deduplicates materials before invoking the callback. * Replacements returned by the callback are applied after all callbacks complete. */ static enumerateMaterialsUnique(object: Object3D, callback: (material: Material, owners: Mesh[]) => Material | undefined): void; /** @param filter - RegExp tested against `object.name`, or a predicate. */ static filterObjects(object: Object3D, filter: RegExp | ((object: Object3D) => boolean)): Object3D[]; /** @param filter - RegExp tested against `material.name`, or a predicate. */ static filterMaterials(object: Object3D, filter: RegExp | ((object: Material) => boolean)): Material[]; static findMaterialUsers(object: Object3D, materials: Material[]): Mesh[]; /** * Replaces all instances of the named material in the hierarchy with the clone. * * @param name - Case-sensitive. */ static cloneMaterialByName(object: Object3D, name: string): Material | undefined; private static replaceMaterial; }