|
5 | 5 | setupDevtoolsPlugin,
|
6 | 6 | } from '@vue/devtools-api'
|
7 | 7 | import { reactive } from 'vue'
|
8 |
| -import type { Mesh } from 'three' |
| 8 | +import { Color, type Mesh } from 'three' |
9 | 9 | import { createHighlightMesh, editSceneObject } from '../utils'
|
| 10 | +import * as is from '../utils/is' |
10 | 11 | import { bytesToKB, calculateMemoryUsage } from '../utils/perf'
|
11 | 12 | import type { TresContext } from '../composables'
|
12 | 13 | import type { TresObject } from './../types'
|
@@ -51,14 +52,16 @@ const createNode = (object: TresObject): SceneGraphObject => {
|
51 | 52 | }
|
52 | 53 |
|
53 | 54 | if (object.type.includes('Light')) {
|
| 55 | + if (is.light(object)) { |
| 56 | + node.tags.push({ |
| 57 | + label: `${object.intensity}`, |
| 58 | + textColor: 0x9499A6, |
| 59 | + backgroundColor: 0xF8F9FA, |
| 60 | + tooltip: 'Intensity', |
| 61 | + }) |
| 62 | + } |
54 | 63 | node.tags.push({
|
55 |
| - label: `${object.intensity}`, |
56 |
| - textColor: 0x9499A6, |
57 |
| - backgroundColor: 0xF8F9FA, |
58 |
| - tooltip: 'Intensity', |
59 |
| - }) |
60 |
| - node.tags.push({ |
61 |
| - label: `#${object.color.getHexString()}`, |
| 64 | + label: `#${new Color(object.color).getHexString()}`, |
62 | 65 | textColor: 0x9499A6,
|
63 | 66 | backgroundColor: 0xF8F9FA,
|
64 | 67 | tooltip: 'Color',
|
@@ -173,6 +176,9 @@ export function registerTresDevtools(app: DevtoolsApp, tres: TresContext) {
|
173 | 176 | payload.state = {
|
174 | 177 | object: Object.entries(instance)
|
175 | 178 | .map(([key, value]) => {
|
| 179 | + if (key === 'children') { |
| 180 | + return { key, value: value.filter(child => child.type !== 'HightlightMesh') } |
| 181 | + } |
176 | 182 | return { key, value, editable: true }
|
177 | 183 | })
|
178 | 184 | .filter(({ key }) => {
|
|
0 commit comments