Git Product home page Git Product logo

Comments (2)

kungfooman avatar kungfooman commented on July 23, 2024 1

vote for clone button in every example - such a good Litmus test 😅 🙈

The lack of JSDoc makes it hard to figure out, but I got this to work anyway:

const clone = pc.app.root.children[2].clone();
pc.app.root.addChild(clone);
clone.translate(0.5, 0, 0);

image

I saw multiple issues:

  1. Using object spreading for... cloning?

Example:

class Test {
    _hi = 123;
    get hi() {
        return _hi;
    }
}
test = new Test();
const obj = {...test};
console.log("obj", obj);

Outputs: {_hi: 123}, but we need {hi: 123}!

Happens in two places:

for (let i = 0; i < stateGraph.layers.length; i++) {
const layer = stateGraph.layers[i];
this._addLayer({ ...layer });
if (layer.states.some(state => state.blendTree)) {
containsBlendTree = true;
}

this._transitions = transitions.map((transition) => {
return new AnimTransition({
...transition
});

  1. data.stateGraph lacks extra layer

if (data.stateGraph) {
component.stateGraph = data.stateGraph;
component.loadStateGraph(component.stateGraph);
}

You can hack it up like this for making it work:

        if (data.stateGraph) {
            data.stateGraph.layers[0] = data.layers[0]; // hack
            data.stateGraph.layers[1] = data.layers[1]; // hack
            component.stateGraph = data.stateGraph;
            component.loadStateGraph(component.stateGraph);
        }

And then there are even more issues, just simple type bugs basically. The component just needs more JSDoc and such issues would be automatically detectable.

I tried it in the past, but it was blocked: #2986

from engine.

willeastcott avatar willeastcott commented on July 23, 2024

vote for clone button in every example - such a good Litmus test 😅 🙈

I would suggest that the unit tests are designed exactly for checking this type of thing rather than the examples.

from engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.