Jump to content

[Solved] BJS 3.0


Recommended Posts


I'm trying out the new 3.0 Preview -- upgrading from BJS 2.5.  I have managed to work through some breaking changes and am stuck with an error:

Uncaught TypeError: Cannot set property source of [object Object] which has only a getter
    at Function.t.DeepCopy (...)
    at new r (...)
    at r.clone (...)

I tried to reproduce with a PG and was expecting it to produce the above error on line 39 where I am cloning a mesh:


So, my question is.  Is there a difference between latest github preview (31efb0f commit) (https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview release) and PG 3.0-alpha?  If they are the same then I will need to work harder to reproduce in a PG or fix!

babylon.max.js line 6518 (destination[prop] = cloneValue(sourceValue, destination);

It's happening on the property 'source'.


Link to comment
Share on other sites

I added a new name argument as Dad72 suggested, but that has had no effect.  I have updated the PG with more code, but the PG is still working: http://babylonjs-playground.com/#NQHEE#1 .  In other words, I cannot reproduce on the PG!  My code is failing with TypeError on line 58 of the PG.


I can however, easily change babylon.max.js to get it working...

My guess would be line 23645 of babylon.max.js creates a property that DeepCopy is unable to set:

Object.defineProperty(Mesh.prototype, "source", {

            get: function () {

                return this._source;


            enumerable: true,

            configurable: true


With a workaround that is obviously not usable - adding in DeepCopy this everything does work:

var propDescriptor = Object.getOwnPropertyDescriptor(destination, prop)

                  if (propDescriptor  === undefined && destination instanceof BABYLON.Mesh) {

                    propDescriptor = Object.getOwnPropertyDescriptor(BABYLON.Mesh.prototype, prop)

                    if (propDescriptor === undefined && destination instanceof BABYLON.AbstractMesh) {

                      propDescriptor = Object.getOwnPropertyDescriptor(BABYLON.AbstractMesh.prototype, prop)



                  if (propDescriptor === undefined || propDescriptor.writable === true) {

                    destination[prop] = sourceValue; // also need above guard code for destination[prop] = cloneValue(sourceValue, destination);


I will mark as solved, since I am the only one experiencing this. Chrome Version 57.0.2987.133 (64-bit)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...