From b60af57e12b08b0f4a69e2a1b71b7c7a3034ad57 Mon Sep 17 00:00:00 2001 From: tschw Date: Thu, 18 Aug 2016 22:37:35 +0200 Subject: [PATCH] Editor: Fixed texture load issues. (#9487) * Editor: Fixed texture load issues. * Don't update twice, but forbid enabling empty maps. --- editor/js/Sidebar.Material.js | 2 ++ editor/js/libs/ui.three.js | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/editor/js/Sidebar.Material.js b/editor/js/Sidebar.Material.js index b9d59c720d..fc25ea6bf7 100644 --- a/editor/js/Sidebar.Material.js +++ b/editor/js/Sidebar.Material.js @@ -893,6 +893,8 @@ Sidebar.Material = function ( editor ) { } + refreshUI(); + } if ( textureWarning ) { diff --git a/editor/js/libs/ui.three.js b/editor/js/libs/ui.three.js index dec8f31567..394cfa4b73 100644 --- a/editor/js/libs/ui.three.js +++ b/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(); -- GitLab