Skip to content

Commit

Permalink
feat: (devtools) add userData to inspectable properties (#740)
Browse files Browse the repository at this point in the history
* devtools: add userData to inspectable properties

* feat: use all properties of the instance

---------

Co-authored-by: Alvaro Saburido <[email protected]>
  • Loading branch information
DennisSmuda and alvarosabu authored Jul 8, 2024
1 parent 8c1c668 commit 00bef33
Showing 1 changed file with 7 additions and 85 deletions.
92 changes: 7 additions & 85 deletions src/devtools/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,91 +171,13 @@ export function registerTresDevtools(app: DevtoolsApp, tres: TresContext) {
}

payload.state = {
object: [
{
key: 'uuid',
editable: true,
value: instance.uuid,
},
{
key: 'name',
editable: true,
value: instance.name,
},
{
key: 'type',
editable: true,
value: instance.type,
},
{
key: 'position',
editable: true,
value: instance.position,
},
{
key: 'rotation',
editable: true,
value: instance.rotation,
},
{
key: 'scale',
editable: true,
value: instance.scale,
},
{
key: 'geometry',
value: instance.geometry,
},
{
key: 'material',
value: instance.material,
},
{
key: 'color',
editable: true,
value: instance.color,
},
{
key: 'intensity',
editable: true,
value: instance.intensity,
},
{
key: 'castShadow',
editable: true,
value: instance.castShadow,
},
{
key: 'receiveShadow',
editable: true,
value: instance.receiveShadow,
},
{
key: 'frustumCulled',
editable: true,
value: instance.frustumCulled,
},
{
key: 'matrixAutoUpdate',
editable: true,
value: instance.matrixAutoUpdate,
},
{
key: 'matrixWorldNeedsUpdate',
editable: true,
value: instance.matrixWorldNeedsUpdate,
},
{
key: 'matrixWorld',
value: instance.matrixWorld,
},

{
key: 'visible',
editable: true,
value: instance.visible,
},
],
object: Object.entries(instance)
.map(([key, value]) => {
return { key, value, editable: true }
})
.filter(({ key }) => {
return key !== 'parent'
}),
}

if (instance.isScene) {
Expand Down

0 comments on commit 00bef33

Please sign in to comment.