|
@@ -85,6 +85,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
}
|
|
}
|
|
|
|
|
|
let object = null;
|
|
let object = null;
|
|
|
|
+ let materialSlot = null;
|
|
let material = null;
|
|
let material = null;
|
|
|
|
|
|
function onChange() {
|
|
function onChange() {
|
|
@@ -103,7 +104,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- editor.execute( new SetMaterialMapCommand( editor, object, property, newMap, 0 /* TODO: currentMaterialSlot */ ) );
|
|
|
|
|
|
+ editor.execute( new SetMaterialMapCommand( editor, object, property, newMap, materialSlot ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -132,7 +133,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
if ( material[ `${ property }Intensity` ] !== intensity.getValue() ) {
|
|
if ( material[ `${ property }Intensity` ] !== intensity.getValue() ) {
|
|
|
|
|
|
- editor.execute( new SetMaterialValueCommand( editor, object, `${ property }Intensity`, intensity.getValue(), 0 /* TODO: currentMaterialSlot */ ) );
|
|
|
|
|
|
+ editor.execute( new SetMaterialValueCommand( editor, object, `${ property }Intensity`, intensity.getValue(), materialSlot ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -142,7 +143,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
if ( material[ `${ mapType }Scale` ] !== scale.getValue() ) {
|
|
if ( material[ `${ mapType }Scale` ] !== scale.getValue() ) {
|
|
|
|
|
|
- editor.execute( new SetMaterialValueCommand( editor, object, `${ mapType }Scale`, scale.getValue(), 0 /* TODO: currentMaterialSlot */ ) );
|
|
|
|
|
|
+ editor.execute( new SetMaterialValueCommand( editor, object, `${ mapType }Scale`, scale.getValue(), materialSlot ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -154,7 +155,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
if ( material[ `${ mapType }Scale` ].x !== value[ 0 ] || material[ `${ mapType }Scale` ].y !== value[ 1 ] ) {
|
|
if ( material[ `${ mapType }Scale` ].x !== value[ 0 ] || material[ `${ mapType }Scale` ].y !== value[ 1 ] ) {
|
|
|
|
|
|
- editor.execute( new SetMaterialVectorCommand( editor, object, `${ mapType }Scale`, value, 0 /* TODOL currentMaterialSlot */ ) );
|
|
|
|
|
|
+ editor.execute( new SetMaterialVectorCommand( editor, object, `${ mapType }Scale`, value, materialSlot ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -166,18 +167,21 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
if ( material[ `${ mapType }Range` ][ 0 ] !== value[ 0 ] || material[ `${ mapType }Range` ][ 1 ] !== value[ 1 ] ) {
|
|
if ( material[ `${ mapType }Range` ][ 0 ] !== value[ 0 ] || material[ `${ mapType }Range` ][ 1 ] !== value[ 1 ] ) {
|
|
|
|
|
|
- editor.execute( new SetMaterialRangeCommand( editor, object, `${ mapType }Range`, value[ 0 ], value[ 1 ], 0 /* TODOL currentMaterialSlot */ ) );
|
|
|
|
|
|
+ editor.execute( new SetMaterialRangeCommand( editor, object, `${ mapType }Range`, value[ 0 ], value[ 1 ], materialSlot ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- function update() {
|
|
|
|
|
|
+ function update( currentObject, currentMaterialSlot = 0 ) {
|
|
|
|
+
|
|
|
|
+ object = currentObject;
|
|
|
|
+ materialSlot = currentMaterialSlot;
|
|
|
|
|
|
if ( object === null ) return;
|
|
if ( object === null ) return;
|
|
if ( object.material === undefined ) return;
|
|
if ( object.material === undefined ) return;
|
|
|
|
|
|
- material = object.material;
|
|
|
|
|
|
+ material = editor.getObjectMaterial( object, materialSlot );
|
|
|
|
|
|
if ( property in material ) {
|
|
if ( property in material ) {
|
|
|
|
|
|
@@ -230,11 +234,9 @@ function SidebarMaterialMapProperty( editor, property, name ) {
|
|
|
|
|
|
signals.objectSelected.add( function ( selected ) {
|
|
signals.objectSelected.add( function ( selected ) {
|
|
|
|
|
|
- object = selected;
|
|
|
|
-
|
|
|
|
map.setValue( null );
|
|
map.setValue( null );
|
|
|
|
|
|
- update();
|
|
|
|
|
|
+ update( selected );
|
|
|
|
|
|
} );
|
|
} );
|
|
|
|
|