2
0
Эх сурвалжийг харах

Improve status bar and add display compiled button

Leonardo Jeanteur 4 жил өмнө
parent
commit
1db132c4fa

+ 4 - 2
bin/style.css

@@ -1529,12 +1529,14 @@ input[type=checkbox]:checked:after {
   border: 1px solid #444;
   left: -1px;
   bottom: -1px;
+  max-height: 60%;
+  overflow: auto;
 }
-.graph-view .heaps-scene #status-bar span {
+.graph-view .heaps-scene #status-bar pre {
   padding: 10px;
   vertical-align: sub;
 }
-.graph-view .heaps-scene #status-bar span.error {
+.graph-view .heaps-scene #status-bar pre.error {
   color: #c74848;
 }
 .graph-view .heaps-scene svg g {

+ 3 - 1
bin/style.less

@@ -1739,8 +1739,10 @@ input[type=checkbox] {
 
 			left: -1px;
 			bottom: -1px;
+			max-height: 60%;
+			overflow: auto;
 
-			span {
+			pre {
 				padding: 10px;
 				vertical-align: sub;
 

+ 2 - 1
hide/view/Graph.hx

@@ -69,7 +69,8 @@ class Graph extends FileView {
 			</div>');
 		parent = element.find(".heaps-scene");
 		editor = new SVG(parent);
-		statusBar = new Element('<div id="status-bar" ><span> </span></div>').appendTo(parent).find("span");
+		statusBar = new Element('<div id="status-bar" ><pre> </pre></div>').appendTo(parent).find("pre");
+		statusBar.on("wheel", (e) -> { e.stopPropagation(); });
 
 		editorMatrix = editor.group(editor.element);
 

+ 15 - 0
hide/view/shadereditor/ShaderEditor.hx

@@ -63,6 +63,7 @@ class ShaderEditor extends hide.view.Graph {
 								<input id="changeModel" type="button" value="Change Model" />
 								<input id="centerView" type="button" value="Center View" />
 								<input id="togglelight" type="button" value="Toggle Default Lights" />
+								<input id="displayCompiled" type="button" value="Display compiled Glsl" />
 							</div>
 						</div>)');
 		parent.on("drop", function(e) {
@@ -229,6 +230,8 @@ class ShaderEditor extends hide.view.Graph {
 
 		element.find("#togglelight").on("click", toggleDefaultLight);
 
+		element.find("#displayCompiled").on("click", displayCompiled);
+
 		parametersList = element.find("#parametersList");
 
 		editorMatrix.on("click", "input, select", function(ev) {
@@ -709,6 +712,18 @@ class ShaderEditor extends hide.view.Graph {
 		};
 	}
 
+	function displayCompiled() {
+		var text = "";
+		if( currentShaderDef == null || currentShader == null )
+			text += "No valid shader in memory";
+		if( currentShaderDef != null ) {
+			text += "\n\n";
+			text += hxsl.GlslOut.compile(currentShaderDef.shader.data);
+		}
+
+		info(text);
+	}
+
 	function compileShader() {
 		var newShader : DynamicShader = null;
 		try {