rpajo

PRBMaterial clone name, id not applied

Recommended Posts

Hey.

While working with PBR materials i have noticed that the name and id are not applied when cloning the material. Instead it uses it's parent name and id. 

For comparison here is the cloning snippet for the standard material and PBR materials, where the id and name are not reset prior to returning.

StandardMaterial.prototype.clone = function (name) {
    var _this = this;
    var result = BABYLON.SerializationHelper.Clone(function () { return new StandardMaterial(name, _this.getScene()); }, this);
    result.name = name;
    result.id = name;
    return result;
};

PBRMetallicRoughnessMaterial.prototype.clone = function (name) {
    var _this = this;
    return BABYLON.SerializationHelper.Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);
};

 

Correct me if I am missing something. 

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.