1- import { UIRow , UIText , UISpan , UIBreak } from './libs/ui.js' ;
1+ import { UIRow , UIText , UISpan , UIBreak , UICheckbox } from './libs/ui.js' ;
22
33function SidebarGeometryBufferGeometry ( editor ) {
44
@@ -20,19 +20,23 @@ function SidebarGeometryBufferGeometry( editor ) {
2020 container . clear ( ) ;
2121 container . setDisplay ( 'block' ) ;
2222
23- const text = new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/attributes' ) ) . setWidth ( '90px' ) ;
24- container . add ( text ) ;
23+ // attributes
2524
26- const container2 = new UISpan ( ) . setDisplay ( 'inline-block' ) . setVerticalAlign ( 'middle' ) . setWidth ( '160px' ) ;
27- container . add ( container2 ) ;
25+ const attributesRow = new UIRow ( ) ;
26+
27+ const textAttributes = new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/attributes' ) ) . setWidth ( '90px' ) ;
28+ attributesRow . add ( textAttributes ) ;
29+
30+ const containerAttributes = new UISpan ( ) . setDisplay ( 'inline-block' ) . setVerticalAlign ( 'middle' ) . setWidth ( '160px' ) ;
31+ attributesRow . add ( containerAttributes ) ;
2832
2933 const index = geometry . index ;
3034
3135 if ( index !== null ) {
3236
33- container2 . add ( new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/index' ) ) . setWidth ( '80px' ) ) ;
34- container2 . add ( new UIText ( ( index . count ) . format ( ) ) . setFontSize ( '12px' ) ) ;
35- container2 . add ( new UIBreak ( ) ) ;
37+ containerAttributes . add ( new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/index' ) ) . setWidth ( '80px' ) ) ;
38+ containerAttributes . add ( new UIText ( ( index . count ) . format ( ) ) . setFontSize ( '12px' ) ) ;
39+ containerAttributes . add ( new UIBreak ( ) ) ;
3640
3741 }
3842
@@ -42,9 +46,54 @@ function SidebarGeometryBufferGeometry( editor ) {
4246
4347 const attribute = attributes [ name ] ;
4448
45- container2 . add ( new UIText ( name ) . setWidth ( '80px' ) ) ;
46- container2 . add ( new UIText ( ( attribute . count ) . format ( ) + ' (' + attribute . itemSize + ')' ) . setFontSize ( '12px' ) ) ;
47- container2 . add ( new UIBreak ( ) ) ;
49+ containerAttributes . add ( new UIText ( name ) . setWidth ( '80px' ) ) ;
50+ containerAttributes . add ( new UIText ( ( attribute . count ) . format ( ) + ' (' + attribute . itemSize + ')' ) . setFontSize ( '12px' ) ) ;
51+ containerAttributes . add ( new UIBreak ( ) ) ;
52+
53+ }
54+
55+ container . add ( attributesRow ) ;
56+
57+ // morph targets
58+
59+ const morphAttributes = geometry . morphAttributes ;
60+ const hasMorphTargets = Object . keys ( morphAttributes ) . length > 0 ;
61+
62+ if ( hasMorphTargets === true ) {
63+
64+ // morph attributes
65+
66+ const rowMorphAttributes = new UIRow ( ) ;
67+
68+ const textMorphAttributes = new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/morphAttributes' ) ) . setWidth ( '90px' ) ;
69+ rowMorphAttributes . add ( textMorphAttributes ) ;
70+
71+ const containerMorphAttributes = new UISpan ( ) . setDisplay ( 'inline-block' ) . setVerticalAlign ( 'middle' ) . setWidth ( '160px' ) ;
72+ rowMorphAttributes . add ( containerMorphAttributes ) ;
73+
74+ for ( const name in morphAttributes ) {
75+
76+ const morphTargets = morphAttributes [ name ] ;
77+
78+ containerMorphAttributes . add ( new UIText ( name ) . setWidth ( '80px' ) ) ;
79+ containerMorphAttributes . add ( new UIText ( ( morphTargets . length ) . format ( ) ) . setFontSize ( '12px' ) ) ;
80+ containerMorphAttributes . add ( new UIBreak ( ) ) ;
81+
82+ }
83+
84+ container . add ( rowMorphAttributes ) ;
85+
86+ // morph relative
87+
88+ const rowMorphRelative = new UIRow ( ) ;
89+
90+ const textMorphRelative = new UIText ( strings . getKey ( 'sidebar/geometry/buffer_geometry/morphRelative' ) ) . setWidth ( '90px' ) ;
91+ rowMorphRelative . add ( textMorphRelative ) ;
92+
93+ const checkboxMorphRelative = new UICheckbox ( ) . setValue ( geometry . morphTargetsRelative ) . setDisabled ( true ) ;
94+ rowMorphRelative . add ( checkboxMorphRelative ) ;
95+
96+ container . add ( rowMorphRelative ) ;
4897
4998 }
5099
0 commit comments