# scene.debugLayer : Copy last command to Clipboard

**URL:** <https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796>\
**Category:** Feature requests\
**Tags:** ui, debug\
**Created:** [April 18, 2024, 9:35am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796 "2024-04-18T09:35:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 18, 2024, 9:35am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/1 "2024-04-18T09:35:13Z")

</div>

Hello all,

When it comes to debuging a scene, using

```javascript
scene.debugLayer.show();

```

Is very helpfull, for sure.

But something which would be nice would be a button on each param, which would copy the last command to the clipboard. For example :  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/5/557bf684725a7bd42a8ddbd1ef62f0deb83125bf.png)  
Let’s say I just tweeked Environment param, in the Levels panel of a Material.  
The arborescence in the debugLayer : `Material --> Levels --> Environment`  
Is in fact quite different from the actual attribute path : `material.environmentIntensity;`

Something great would be to edit the way the UI is built by adding some copy buttons. And when you hit the copy button :  
 ![idea](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/3/830b1924ea11192a8d75ffc2e41c0cfd20ec47c7.png)

It would be sooooo great, when you are tunning stuffs, (particles settings, colors, levels, etc, etc…)

Who is in ? 😃

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [April 18, 2024, 1:02pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/2 "2024-04-18T13:02:57Z")

</div>

I love the idea! This makes total sense when developping on the playrgound and less when tweaking a scene in the sandbox. So, make it optional if you want to start a PR 🙂

---

<div class="post-metadata">

**Author:** ![dennemark](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dennemark/32/10745_2.png) [@dennemark](https://forum.babylonjs.com/u/dennemark)\
**Post date:** [April 18, 2024, 1:26pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/3 "2024-04-18T13:26:32Z")

</div>

+1 !

Was also missing this recently! Naming is not always consistent with code, so this would be super beneficial!

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [April 19, 2024, 1:11am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/4 "2024-04-19T01:11:13Z")

</div>

cc @Deltakosh 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 19, 2024, 3:33am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/5 "2024-04-19T03:33:20Z")

</div>

Love it!! who wants to try to do a PR??

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 19, 2024, 4:11pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/7 "2024-04-19T16:11:01Z")

</div>

of course!

---

<div class="post-metadata">

**Author:** ![j-te](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/j-te/32/37194_2.png) [@j-te](https://forum.babylonjs.com/u/j-te)\
**Post date:** [April 22, 2024, 7:36am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/9 "2024-04-22T07:36:27Z")

</div>

Please consider responsiveness, for the narrow-sized UI 🙂

Plus what would be good is zero-ing (or defaulting) the value with a right-click on the control.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 22, 2024, 11:43am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/10 "2024-04-22T11:43:56Z")

</div>

Hello guys !

> [@Deltakosh](#):
>
> Love it!! who wants to try to do a PR??

Glad you love the idea ! 🙂  
I would very interested in starting my contribution to Babylon.JS with this idea, but maybe it’s a bit too early considering my knowledge of the repo which is quite new.

> [@Heaust-ops](#):
>
> I’ll work on it

Ah ! Did you already started ? Yesterday night I gave it a try. I would be interested in knowing from you guys, how far am I to being validated a PR. If you already worked on it no worries, I’ll consider my work as a training 🙂

* * *

Here is what I did so far :

- I forked + cloned
- I edited some files in order to achieve the new features
- Running `npm run build:dev` gives no error
- Running `npm run serve -w @tools/babylon-server` Allows me to try and it works great 🙂
- I pushed back to [my branch tricotou-feature](https://github.com/BabylonJS/Babylon.js/compare/master...Tricotou:Babylon.js:tricotou-feature) on my Babylon.js fork.

Here is a screenshot of the new inspector :

 ![Screenshot from 2024-04-22 13-30-06](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/9/79b95ae12c36c9039df7e13ce17b28c41d129c14.png)

And here is a live screencast of the result :

* * *

About my work, here is what I did :  
I edited some files such as  
`dev/sharedUiComponents/src/lines/sliderLineComponent.tsx` to add the copy button :

```html
<div className="copy hoverIcon" onClick={() => this.onCopyClick()} title="Copy to clipboard">
    <img src={copyIcon} alt="Copy" />
</div>

```

I have done it for Sliders, Checkboxes, Color3&4, Vector3, List … (5 files edited)  
As well I had to edit some CSS in :  
`dev/inspector/src/components/actionTabs/actionTabs.scss`  
In order to include the structure change.

I inspired from the copy button which was already available for color pickers. (And that I modified by adding the command to the hex code retreived)

* * *

Now, what I would like to understand :

- Why is there no comments in the source file I’ve cloned ? 🤔
- Should I add some comments and push again ?
- What are exactly the next steps ? (From going to “it works on my machine” to having my code being released ? 🙂 )

See you  
++ Tricotou

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 24, 2024, 11:08am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/12 "2024-04-24T11:08:06Z")

</div>

> [@Heaust-ops](#):
>
> Oh that’s awesome!

Thanks 🥰

@Deltakosh did you have a look at the video ? What do you think ? 🙂

Also, maybe I did not understand well the point about comments.  
Having a look at the [docs about contribution comments](https://doc.babylonjs.com/contribute/toBabylon/contributeToAPI) it seems that I need to comment indeed. I’m just surprised that the files I’ve worked on ([example here](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/sharedUiComponents/src/lines/sliderLineComponent.tsx)) are absolutely free of any comments. Is it because there is some kind of CI/CD which gets rids of the comments at master merge, or something ? Should I comment my stuffs before doing a PR ?

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 24, 2024, 2:09pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/13 "2024-04-24T14:09:53Z")

</div>

Man! This is HUGE!! Let me ping @PatrickRyan just for the UI aspect but man! I love it

Regarding comments: we are enforcing them on the main core library but tools (for now) are in a grace period where we do not yet enforce it. THAT BEING SAID, for new PR we expect comments 😉

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 24, 2024, 9:09pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/14 "2024-04-24T21:09:07Z")

</div>

Thanks !  
Ok for the comments, got it. I’ll comment, for sure 😉

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 25, 2024, 8:27am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/15 "2024-04-25T08:27:39Z")

</div>

@Tricotou may I be so bold and kindly ask for a feature request to the feature request 🤪

**Copy last node to Console**

Like you do in DevTools of Chrome (Firefox too?):

 ![featureRequest$0](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/7/17169b3ffa4ec37bf2e44a588dc98009d3ef0e80.jpeg)

That would be cool in the Inspector.

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 25, 2024, 9:15am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/16 "2024-04-25T09:15:25Z")

</div>

@Joe_Kerr I’m not sure I understand what you mean by “copy last node” 😁 Can you develop the idea or eventually edit a screenshot of the inspector to show the concept ?

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 25, 2024, 9:30am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/17 "2024-04-25T09:30:27Z")

</div>

Sure thing 🙂

 ![Untitled](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/a/3a8380d43d9c98d4d7ed3e6d1850da09cfd64890.jpeg)

Like so?

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 25, 2024, 2:08pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/18 "2024-04-25T14:08:17Z")

</div>

Ah yes, I see, nice idea !  
I don’t know exactly the rules about global scope variables in BJS, so for now I extended the existing `window` interface, by adding a `debugNode` property :

```javascript
declare global {
    interface Window {debugNode: any;}
}

```

And I’m overriding it in the `onSelect` of the `treeItemComponents`

Result is cool 😍 :

What do you think ? 😁

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 25, 2024, 2:23pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/19 "2024-04-25T14:23:52Z")

</div>

No way 🤯 You did and already?

Voting for making today the “Tricotou-Inspector-Magic” day 😁

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 25, 2024, 6:20pm UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/20 "2024-04-25T18:20:28Z")

</div>

> [@Joe\_Kerr](#):
>
> You did and already?

Yes, it works like a charm 🥰

If you want to give it a try easily, I build it (and already used it, by the way 😁 )  
You can get the inspector bundle [HERE](https://hover.tricotools.com/libs/js/babylon.inspector.bundle.js)

* * *

By the way, about adding the `debugNode` triggered by click in the Scene Viewer… The commit is [10 lines !](https://github.com/BabylonJS/Babylon.js/commit/efb8ea64c334e3142c6f4a61b3c20eabe0b082e9) 😂 I have seen much worse commits in my life, to be honest, ahah. The ratio `Usefull / Lines of Codes` is good, I’m happy 😅

* * *

> [@Joe\_Kerr](#):
>
> Voting for making today the “Tricotou-Inspector-Magic” day 😁

Ahah, sure 😁

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 26, 2024, 9:52am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/21 "2024-04-26T09:52:50Z")

</div>

> [@Tricotou](#):
>
> You can get the inspector bundle [HERE](https://hover.tricotools.com/libs/js/babylon.inspector.bundle.js)

I tried, in the console, “debugNode” and “window.debugNode” but it returns undefined 🥺

…wait, does the Inspector need the same version as Babylon - because I am still at 7.0.0 with Babylon?

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [April 26, 2024, 9:58am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/22 "2024-04-26T09:58:19Z")

</div>

> [@Joe\_Kerr](#):
>
> does the Inspector need the same version as Babylon

I’m too new to the repo to answer a definitive “YES”, but anyway I would advise indeed to keep the core at same version.

In addition to the `babylon.inspector.bundle.js`, on the same server I’m also hosting `babylon.js`, `babylon.gui.min.js`, `babylonjs.material.min.js` and `babylon.glTFFileLoader.min.js`. They have been build together.

* * *

[EDIT] I apologize, indeed the repo on [hover.tricotools.com](http://hover.tricotools.com) what not on the last commit. `copyCommandToClipboard` was ok, but not the last `debugNode` update. I just pushed, you can give it a new try 🙂

* * *

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Joe\_Kerr](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/joe_kerr/32/39017_2.png) [@Joe\_Kerr](https://forum.babylonjs.com/u/Joe_Kerr)\
**Post date:** [April 26, 2024, 10:16am UTC](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796/23 "2024-04-26T10:16:00Z")

</div>

It is working and it is so cool 🕶 Thanks Tricotou.

[Next page](https://forum.babylonjs.com/t/scene-debuglayer-copy-last-command-to-clipboard/49796.md?page=2)
