Explorar o código

Editor: Fixed texture load issues. (#9487)

* Editor: Fixed texture load issues.

* Don't update twice, but forbid enabling empty maps.
tschw %!s(int64=9) %!d(string=hai) anos
pai
achega
b60af57e12
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  1. 2 0
      editor/js/Sidebar.Material.js
  2. 7 0
      editor/js/libs/ui.three.js

+ 2 - 0
editor/js/Sidebar.Material.js

@@ -893,6 +893,8 @@ Sidebar.Material = function ( editor ) {
 
 			}
 
+			refreshUI();
+
 		}
 
 		if ( textureWarning ) {

+ 7 - 0
editor/js/libs/ui.three.js

@@ -44,6 +44,11 @@ UI.Texture = function ( mapping ) {
 	name.style.border = '1px solid #ccc';
 	dom.appendChild( name );
 
+	var form = document.createElement( 'form' );
+	form.appendChild( input );
+	form.style.display = 'none';
+	dom.appendChild( form );
+
 	var loadFile = function ( file ) {
 
 		if ( file.type.match( 'image.*' ) ) {
@@ -58,6 +63,7 @@ UI.Texture = function ( mapping ) {
 
 					var texture = new THREE.CanvasTexture( canvas, mapping );
 					texture.sourceFile = file.name;
+					form.reset();
 
 					scope.setValue( texture );
 
@@ -79,6 +85,7 @@ UI.Texture = function ( mapping ) {
 						texture.needsUpdate = true;
 
 						scope.setValue( texture );
+						form.reset();
 
 						if ( scope.onChangeCallback ) scope.onChangeCallback();