Răsfoiți Sursa

MaterialLibrary: manage old mat libs declaration in props.json

lviguier 1 lună în urmă
părinte
comite
7f20aa6064
2 a modificat fișierele cu 9 adăugiri și 2 ștergeri
  1. 5 2
      hide/comp/Scene.hx
  2. 4 0
      hide/view/settings/ProjectSettings.hx

+ 5 - 2
hide/comp/Scene.hx

@@ -682,9 +682,12 @@ class Scene extends hide.comp.Component implements h3d.IDrawable {
 		var matLibs : Array<Dynamic> = config.get("materialLibraries");
 		if( matLibs == null ) matLibs = [];
 
-		if (matLibs.length > 0 && matLibs[0] is String) {
+		if (matLibs.length > 0) {
 			for (idx in 0...matLibs.length) {
-				matLibs[idx] = { name : matLibs[idx], path : matLibs[idx] };
+				var m = Std.isOfType(matLibs[idx], String) ? cast (matLibs[idx]) : null;
+				if (m == null)
+					continue;
+				matLibs[idx] = { name : m.substring(m.lastIndexOf("/") + 1), path : m };
 			}
 		}
 

+ 4 - 0
hide/view/settings/ProjectSettings.hx

@@ -193,6 +193,10 @@ class ProjectSettings extends hide.ui.View<{}> {
 
 		if (matLibs != null) {
 			for (ml in matLibs) {
+				if (Std.isOfType(ml, String)) {
+					var p : String = cast ml;
+					ml = { name: p.substring(p.lastIndexOf("/") + 1), path: p };
+				}
 				var row = new Element('<div class="row">
 					<div class="ico ico-circle"></div>
 					<input value="${Reflect.field(ml, "name")}"/>