[Bf-blender-cvs] [544b7e6] master: Cycles Standalone: Add a help message, which appears when pressing the "h" key.

Thomas Dinges noreply at git.blender.org
Fri Jan 24 12:59:40 CET 2014


Commit: 544b7e6be42cda0f07fb83590a089a516bd6cfec
Author: Thomas Dinges
Date:   Fri Jan 24 12:57:19 2014 +0100
https://developer.blender.org/rB544b7e6be42cda0f07fb83590a089a516bd6cfec

Cycles Standalone: Add a help message, which appears when pressing the "h" key.

This is very basic for now, but can be extended with more info (available devices for example) later.

Thanks to Bastien and Sergey for some help with the glRect coordinates stuff.

===================================================================

M	intern/cycles/app/cycles_standalone.cpp
M	intern/cycles/util/util_view.cpp
M	intern/cycles/util/util_view.h

===================================================================

diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp
index 6b20101..0993b0d 100644
--- a/intern/cycles/app/cycles_standalone.cpp
+++ b/intern/cycles/app/cycles_standalone.cpp
@@ -45,7 +45,7 @@ struct Options {
 	int width, height;
 	SceneParams scene_params;
 	SessionParams session_params;
-	bool quiet;
+	bool quiet, show_help;
 } options;
 
 static void session_print(const string& str)
@@ -167,6 +167,9 @@ static void display_info(Progress& progress)
 		latency, sample, total_time, sample_time, status.c_str());
 
 	view_display_info(str.c_str());
+	
+	if(options.show_help)
+		view_display_help();
 }
 
 static void display()
@@ -189,6 +192,8 @@ static void keyboard(unsigned char key)
 {
 	if(key == 'r')
 		options.session->reset(session_buffer_params(), options.session_params.samples);
+	else if(key == 'h')
+		options.show_help = !(options.show_help);
 	else if(key == 27) // escape
 		options.session->progress.set_cancel("Canceled");
 }
diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp
index 27c8d51..1e8db00 100644
--- a/intern/cycles/util/util_view.cpp
+++ b/intern/cycles/util/util_view.cpp
@@ -74,6 +74,35 @@ void view_display_info(const char *info)
 	glColor3f(1.0f, 1.0f, 1.0f);
 }
 
+void view_display_help()
+{
+	const int w = V.width / 1.15;
+	const int h = V.height / 1.15;
+	
+	const int x1 = (V.width - w) / 2;
+	const int x2 = x1 + w;
+	
+	const int y1 = (V.height - h) / 2;
+	const int y2 = y1 + h;
+	
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glColor4f(0.4f, 0.4f, 0.4f, 0.8f);
+	glRectf(x1, y1, x2, y2);
+	glDisable(GL_BLEND);
+	
+	glColor3f(0.8f, 0.8f, 0.8f);
+
+	view_display_text(x1+20, y2-20, "Cycles Renderer");
+	view_display_text(x1+20, y2-40, "(C) 2011-2014 Blender Foundation");
+	view_display_text(x1+20, y2-80, "Help:");
+	view_display_text(x1+20, y2-100, "h:  Toggle this help message");
+	view_display_text(x1+20, y2-120, "r:  Restart the render");
+	view_display_text(x1+20, y2-140, "q:  Quit the program");
+	
+	glColor3f(1.0f, 1.0f, 1.0f);
+}
+
 static void view_display()
 {
 	if(V.first_display) {
diff --git a/intern/cycles/util/util_view.h b/intern/cycles/util/util_view.h
index 2339e45..a0d0d49 100644
--- a/intern/cycles/util/util_view.h
+++ b/intern/cycles/util/util_view.h
@@ -34,6 +34,7 @@ void view_main_loop(const char *title, int width, int height,
 	ViewKeyboardFunc keyboard);
 
 void view_display_info(const char *info);
+void view_display_help();
 void view_redraw();
 
 CCL_NAMESPACE_END




More information about the Bf-blender-cvs mailing list