소스 검색

Editor: Some work towards fixing #5982. Still not done, the first render doesn't show the new "groups".

Mr.doob 10 년 전
부모
커밋
0c5b9d0e6c
1개의 변경된 파일15개의 추가작업 그리고 3개의 파일을 삭제
  1. 15 3
      editor/js/Sidebar.Material.js

+ 15 - 3
editor/js/Sidebar.Material.js

@@ -369,7 +369,7 @@ Sidebar.Material = function ( editor ) {
 
 		var geometry = object.geometry;
 		var material = object.material;
-		
+
 		var textureWarning = false;
 		var objectHasUvs = false;
 
@@ -436,8 +436,20 @@ Sidebar.Material = function ( editor ) {
 
 			if ( material.vertexColors !== undefined ) {
 
-				material.vertexColors = parseInt( materialVertexColors.getValue() );
-				material.needsUpdate = true;
+				var vertexColors = parseInt( materialVertexColors.getValue() );
+
+				if ( material.vertexColors !== vertexColors ) {
+
+					if ( geometry instanceof THREE.Geometry ) {
+
+						geometry.groupsNeedUpdate = true;
+
+					}
+
+					material.vertexColors = vertexColors;
+					material.needsUpdate = true;
+
+				}
 
 			}