[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22582] branches/blender2.5/blender/source /creator/creator.c: New command line argument to specify render engine

Martin Poirier theeth at yahoo.com
Mon Aug 17 22:04:28 CEST 2009


Revision: 22582
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22582
Author:   theeth
Date:     2009-08-17 22:04:28 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
New command line argument to specify render engine

-E <engine>

-E help: lists all available engine and then quits. (blender window might flash open and then disappear. io python scripts need to be read for all engine, so we have to load interface and not do that before like other help options).

When run after -b, only builtin engines are available because of the python scripts not being read correctly bug.

Modified Paths:
--------------
    branches/blender2.5/blender/source/creator/creator.c

Modified: branches/blender2.5/blender/source/creator/creator.c
===================================================================
--- branches/blender2.5/blender/source/creator/creator.c	2009-08-17 19:54:29 UTC (rev 22581)
+++ branches/blender2.5/blender/source/creator/creator.c	2009-08-17 20:04:28 UTC (rev 22582)
@@ -177,6 +177,8 @@
 	printf ("        When the filename has no #, The suffix #### is added to the filename\n");
 	printf ("      The frame number will be added at the end of the filename.\n");
 	printf ("      eg: blender -b foobar.blend -o //render_ -F PNG -x 1 -a\n");
+	printf ("    -E <engine>\tSpecify the render engine.\n");
+	printf ("      use -E help to list available engines.\n");
 	printf ("\nFormat options:\n");
 	printf ("    -F <format>\tSet the render format, Valid options are...\n");
 	printf ("    \tTGA IRIS HAMX JPEG MOVIE IRIZ RAWTGA\n");
@@ -692,6 +694,47 @@
 					printf("\nError: you must specify a path after '-o '.\n");
 				}
 				break;
+			case 'E':
+				a++;
+				if (a < argc)
+				{
+					if (!strcmp(argv[a],"help"))
+					{
+						RenderEngineType *type = NULL;
+
+						for( type = R_engines.first; type; type = type->next )
+						{
+							printf("\t%s\n", type->idname);
+						}
+						exit(0);
+					}
+					else 
+					{
+						if (CTX_data_scene(C)==NULL)
+						{
+							printf("\nError: no blend loaded. order the arguments so '-E ' is after the blend is loaded.\n");
+						}
+						else 
+						{
+							Scene *scene= CTX_data_scene(C);
+							RenderData *rd = &scene->r;
+							RenderEngineType *type = NULL;
+							
+							for( type = R_engines.first; type; type = type->next )
+							{
+								if (!strcmp(argv[a],type->idname))
+								{
+									BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine));
+								}
+							}
+						}
+					}
+				}
+				else
+				{
+					printf("\nEngine not specified.\n");
+				}
+				break;
 			case 'F':
 				a++;
 				if (a < argc){





More information about the Bf-blender-cvs mailing list