@@ -85,6 +85,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
85
85
}
86
86
87
87
let object = null ;
88
+ let materialSlot = null ;
88
89
let material = null ;
89
90
90
91
function onChange ( ) {
@@ -103,7 +104,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
103
104
104
105
}
105
106
106
- editor . execute ( new SetMaterialMapCommand ( editor , object , property , newMap , 0 /* TODO: currentMaterialSlot */ ) ) ;
107
+ editor . execute ( new SetMaterialMapCommand ( editor , object , property , newMap , materialSlot ) ) ;
107
108
108
109
}
109
110
@@ -132,7 +133,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
132
133
133
134
if ( material [ `${ property } Intensity` ] !== intensity . getValue ( ) ) {
134
135
135
- editor . execute ( new SetMaterialValueCommand ( editor , object , `${ property } Intensity` , intensity . getValue ( ) , 0 /* TODO: currentMaterialSlot */ ) ) ;
136
+ editor . execute ( new SetMaterialValueCommand ( editor , object , `${ property } Intensity` , intensity . getValue ( ) , materialSlot ) ) ;
136
137
137
138
}
138
139
@@ -142,7 +143,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
142
143
143
144
if ( material [ `${ mapType } Scale` ] !== scale . getValue ( ) ) {
144
145
145
- editor . execute ( new SetMaterialValueCommand ( editor , object , `${ mapType } Scale` , scale . getValue ( ) , 0 /* TODO: currentMaterialSlot */ ) ) ;
146
+ editor . execute ( new SetMaterialValueCommand ( editor , object , `${ mapType } Scale` , scale . getValue ( ) , materialSlot ) ) ;
146
147
147
148
}
148
149
@@ -154,7 +155,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
154
155
155
156
if ( material [ `${ mapType } Scale` ] . x !== value [ 0 ] || material [ `${ mapType } Scale` ] . y !== value [ 1 ] ) {
156
157
157
- editor . execute ( new SetMaterialVectorCommand ( editor , object , `${ mapType } Scale` , value , 0 /* TODOL currentMaterialSlot */ ) ) ;
158
+ editor . execute ( new SetMaterialVectorCommand ( editor , object , `${ mapType } Scale` , value , materialSlot ) ) ;
158
159
159
160
}
160
161
@@ -166,18 +167,21 @@ function SidebarMaterialMapProperty( editor, property, name ) {
166
167
167
168
if ( material [ `${ mapType } Range` ] [ 0 ] !== value [ 0 ] || material [ `${ mapType } Range` ] [ 1 ] !== value [ 1 ] ) {
168
169
169
- editor . execute ( new SetMaterialRangeCommand ( editor , object , `${ mapType } Range` , value [ 0 ] , value [ 1 ] , 0 /* TODOL currentMaterialSlot */ ) ) ;
170
+ editor . execute ( new SetMaterialRangeCommand ( editor , object , `${ mapType } Range` , value [ 0 ] , value [ 1 ] , materialSlot ) ) ;
170
171
171
172
}
172
173
173
174
}
174
175
175
- function update ( ) {
176
+ function update ( currentObject , currentMaterialSlot = 0 ) {
177
+
178
+ object = currentObject ;
179
+ materialSlot = currentMaterialSlot ;
176
180
177
181
if ( object === null ) return ;
178
182
if ( object . material === undefined ) return ;
179
183
180
- material = object . material ;
184
+ material = editor . getObjectMaterial ( object , materialSlot ) ;
181
185
182
186
if ( property in material ) {
183
187
@@ -230,11 +234,9 @@ function SidebarMaterialMapProperty( editor, property, name ) {
230
234
231
235
signals . objectSelected . add ( function ( selected ) {
232
236
233
- object = selected ;
234
-
235
237
map . setValue ( null ) ;
236
238
237
- update ( ) ;
239
+ update ( selected ) ;
238
240
239
241
} ) ;
240
242
0 commit comments