[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53421] trunk/blender/source/blender/ editors/space_text/text_format_osl.c: OSL Syntax Highlighting:

Thomas Dinges blender at dingto.org
Sun Dec 30 03:51:36 CET 2012


Revision: 53421
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53421
Author:   dingto
Date:     2012-12-30 02:51:29 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
OSL Syntax Highlighting:
* Added the remaining shader types
* Some comment and link fixes. 

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/text_format_osl.c

Modified: trunk/blender/source/blender/editors/space_text/text_format_osl.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_format_osl.c	2012-12-30 01:39:55 UTC (rev 53420)
+++ trunk/blender/source/blender/editors/space_text/text_format_osl.c	2012-12-30 02:51:29 UTC (rev 53421)
@@ -24,7 +24,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/editors/space_text/text_format_py.c
+/** \file blender/editors/space_text/text_format_osl.c
  *  \ingroup sptext
  */
 
@@ -44,8 +44,8 @@
 static int txtfmt_osl_find_builtinfunc(const char *string)
 {
 	int i, len;
-	/* list is from...
-	 * XXX - link to docs!
+	/* list is from
+	 * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
 	 */
 	if      (STR_LITERAL_STARTSWITH(string, "break",        len)) i = len;
 	else if (STR_LITERAL_STARTSWITH(string, "closure",      len)) i = len;
@@ -83,7 +83,7 @@
 {
 	int i, len;
 	/* list is from...
-	 * XXX - link to docs!
+	 * https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
 	 */
 	if      (STR_LITERAL_STARTSWITH(string, "bool",         len)) i = len;
 	else if (STR_LITERAL_STARTSWITH(string, "case",         len)) i = len;
@@ -129,7 +129,7 @@
 	return i;
 }
 
-/* Checks the specified source string for a Python special name. This name must
+/* Checks the specified source string for a OSL special name. This name must
  * start at the beginning of the source string and must be followed by a non-
  * identifier (see text_check_identifier(char)) or null character.
  *
@@ -139,8 +139,12 @@
 static int txtfmt_osl_find_specialvar(const char *string)
 {
 	int i, len;
-
-	if      (STR_LITERAL_STARTSWITH(string, "shader", len)) i = len;
+	
+	/* OSL shader types */
+	if      (STR_LITERAL_STARTSWITH(string, "shader", 		len)) i = len;
+	else if (STR_LITERAL_STARTSWITH(string, "surface", 		len)) i = len;
+	else if (STR_LITERAL_STARTSWITH(string, "volume", 		len)) i = len;
+	else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len;
 	else                                                    i = 0;
 
 	/* If next source char is an identifier (eg. 'i' in "definate") no match */




More information about the Bf-blender-cvs mailing list