Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define VRMFinder in scene #75

Open
Tracked by #104
yamayuski opened this issue Mar 22, 2022 · 1 comment
Open
Tracked by #104

define VRMFinder in scene #75

yamayuski opened this issue Mar 22, 2022 · 1 comment
Labels
enhancement New feature or request v3 BREAKING CHANGE issues
Milestone

Comments

@yamayuski
Copy link
Contributor

yamayuski commented Mar 22, 2022

/**
 * @link https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Rendering/outlineRenderer.ts
 */

declare module "@babylonjs/core/scene" {
    export interface Scene {
        _vrmFinder: VRMFinder;
        getVRMFinder(): VRMFinder;
    }
}

Scene.prototype.getVRMFinder = function (): VRMFinder {
    if (!this._vrmFinder) {
        this._vrmFinder = new VRMFinder(this);
    }
    return this._vrmFinder;
};

export class VRMFinder implements ISceneComponent {
    public name = 'VRMFinder';

    public constructor(public readonly scene: Scene) {
        this.scene._addComponent(this);
    }

    public getByTitle(title: string): Nullable<VRMManager> {
        // ...
    }

    public getAll(): VRMManager[] {
        // ...
    }

    // ...
}

恐らくこんな感じのインターフェースを想定。

// use case
const vrm = this.scene.getByTitle('Alicia Solid') ?? throw new Error(`VRM not found`);
vrm.morphing('a', 1.0);
@yamayuski yamayuski added this to the v2 milestone Mar 22, 2022
@yamayuski yamayuski added the v3 BREAKING CHANGE issues label Mar 22, 2022
@yamayuski yamayuski changed the title VRMManager の上に VRMFinder を載せて、 metadata ではなく scene に直接 prototype 定義してみたい define VRMFinder in scene Mar 22, 2022
@yamayuski
Copy link
Contributor Author

@yamayuski yamayuski added the enhancement New feature or request label Mar 22, 2022
@yamayuski yamayuski mentioned this issue Jun 12, 2023
6 tasks
yamayuski pushed a commit to yamayuski/babylon-vrm-loader that referenced this issue Oct 23, 2023
…nd_yarn/tmpl-1.0.5

build(deps): bump tmpl from 1.0.4 to 1.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v3 BREAKING CHANGE issues
Projects
None yet
Development

No branches or pull requests

1 participant