[Bf-committers] Wondering about the review of the command port patch...

Ton Roosendaal ton at blender.org
Fri Sep 19 09:56:53 CEST 2008


Hi,

You can reply in the tracker if you have questions.

The fact that patch submitters do so much work is unfortunately not a  
guarantee we do the the same for them... that's just not practical with  
100+ open patches to look at.
I'm also not impressed or intimidated by coding work in itself. A patch  
should never be a blackmail version of a feature request. :)

I wanted to go over almost all open patches, and then come with a  
proposal for more clear guidelines, so submitters know better what they  
can expect, and to have active Blender developers involved with reviews  
without them feeling obliged to spend hours on reviews.

Further I'm also human and can make mistakes! Maybe your patch is  
great, but then try to find people in the active developer/user  
community to review and use it?

-Ton-

------------------------------------------------------------------------
Ton Roosendaal  Blender Foundation   ton at blender.org    www.blender.org
Blender Institute BV  Entrepotdok 57A  1018AD Amsterdam The Netherlands

On 19 Sep, 2008, at 5:30, Dietrich Bollmann wrote:

> Hi Ton,
>
>> Comment By: Ton Roosendaal (ton)
>> Date: 2008-09-18 19:49
>>
>> Message:
>> A review gave following considerations;
>>
>> It's basically a good idea, but the patch is gigantic, changing a lot  
>> of internals,
>> which is unknown if that's going to be maintained. For an option that  
>> not many people
>> will use too problematic. My reason to close this one for now.
>
> No, the changes to the internals are minimal.
>
> It is the NEW functionality in dir source/blender/commandport which is
> huge.
>
> I think the reviewer currently is too busy to look at the patch itself
> and just wanted to get rid of an item in his todo list.  Probably he  
> was
> scared away by the number of lines and decided before looking into the
> code itself.  What exactly did he write and who is he?  I would like to
> have a chance to react to his comments.
>
> Even if somehow disappointed about the way my patch was treated from  
> the
> beginning, of course I accept if you don't want it.  But I would like  
> to
> have it rejected with arguments which are motivated by the code itself
> and not by the fact of everybody being very busy - which I understand  
> of
> course very well!
>
> Please do not understand me wrong.  I know that everybody is very busy
> and I know that everybody has to manage his time.  Sometimes it is good
> to follow the first impression.  Still I would be happier with real
> arguments - at least I could learn what exactly the blender coders
> didn't like about my code.
>
> Here is a list of the c source files which have been manipulated:
>
> egrep '^Index: .*\.c'
> blender-command-port-patch.2008-07-12.2.46.r15538.txt \
>   | egrep -v 'source/blender/commandport'
>
> Index: source/creator/creator.c
> Index: source/blender/python/BPY_interface.c
> Index: source/blender/src/mainqueue.c
> Index: source/blender/src/editscreen.c
> Index: source/blender/src/usiblender.c
> Index: source/blender/src/eventdebug.c
>
> I append the corresponding diffs.
>
> Thanks for your understanding,
>
> Sincerely, Dietrich
>
>> The good news is that a similar functionality (commandline python  
>> editing) is on
>> the wishlist in Blender itself. After that, an external console  
>> should be easy.
>
> If it was the patch would be shorter :)
>
>
> ======================================================================= 
> =========
> Index: source/creator/creator.c
> ===================================================================
> --- source/creator/creator.c	(revision 15538)
> +++ source/creator/creator.c	(working copy)
> @@ -22,7 +22,7 @@
>   *
>   * The Original Code is: all of this file.
>   *
> - * Contributor(s): none yet.
> + * Contributor(s): Dietrich Bollmann.
>   *
>   * ***** END GPL LICENSE BLOCK *****
>   */
> @@ -83,6 +83,10 @@
>  #include "nla.h"
>  #include "datatoc.h"
>
> +#ifdef WITH_COMMAND_PORT
> +#include "commandport.h" /* Blender command port (dietrich) */
> +#endif
> +
>  /* for passing information between creator and gameengine */
>  #include "SYS_System.h"
>
> @@ -108,6 +112,9 @@
>
>  /*	Local Function prototypes */
>  static void print_help();
> +#ifdef WITH_COMMAND_PORT
> +static void print_debug_command_port_help(); /* (dietrich) */
> +#endif
>  static void print_version();
>
>
> @@ -224,6 +231,13 @@
>  #ifdef WIN32
>  	printf ("  -R\t\tRegister .blend extension\n");
>  #endif
> +#ifdef WITH_COMMAND_PORT
> +	printf ("  -c <port number> | --command-port <port number>\n" /*  
> (dietrich) */
> +			"    \t\tStart the Command Port using port <port number>\n");
> +	printf ("  --debug-command-port <debug level>\tTurn debug mode on  
> for the command port.\n"); /* (dietrich) */
> +	printf ("  \t\tFour different debug levels are defined: 1, 2, 3 and  
> 4.\n");
> +	printf ("  \t\tFor more information try --debug-command-port  
> help.\n");
> +#endif
>  	printf ("  -v\t\tPrint Blender version and exit\n");
>  	printf ("  --\t\tEnds option processing.  Following arguments are  
> \n");
>  	printf ("    \t\t   passed unchanged.  Access via Python's  
> sys.argv\n");
> @@ -252,7 +266,37 @@
>  	printf ("    \"blender -b test.blend -o /tmp -f 1\" works as  
> expected.\n\n");
>  }
>
> +#ifdef WITH_COMMAND_PORT
> +/**
> +   help message for the command port debug mode
>
> +   (dietrich)
> +*/
> +static void print_debug_command_port_help()
> +{
> +	printf("\n"
> +		   "* Command Port Debug Mode\n"
> +		   "\n"
> +		   "Usage:\n"
> +		   "\n"
> +		   "    blender --command-port <port number> --debug-command-port  
> <debug level> [more options]\n"
> +		   "\n"
> +		   "Print messages for debugging the command port functionality.\n"
> +		   "This mode is very useful when developing new command port  
> client applications.\n"
> +		   "\n"
> +		   "Four different debug levels are defined:\n"
> +		   "\n"
> + 		   "  1 - Print general command port debug messages.\n"
> + 		   "  2 - Print more detailed information about the evaluation of  
> received commands,\n"
> + 		   "      the command packages received from a Blender client and  
> the result packages\n"
> + 		   "      sent back to the client after evaluating the commands.\n"
> + 		   "  3 - Hexdump the received packages before processing them.\n"
> + 		   "  4 - Hexdump the received packages without processing them.\n"
> +		   "\n"
> +		   );
> +}
> +#endif
> +
>  double PIL_check_seconds_timer(void);
>  extern void winlay_get_screensize(int *width_r, int *height_r);
>
> @@ -269,6 +313,10 @@
>  {
>  	int a, i, stax=0, stay=0, sizx, sizy, scr_init = 0;
>  	SYS_SystemHandle syshandle;
> +#ifdef WITH_COMMAND_PORT
> +	unsigned short port;            /* command port */
> +	int command_port_debug_level;   /* command port debug level */
> +#endif
>
>  #if defined(WIN32) || defined (__linux__)
>  	int audio = 1;
> @@ -554,6 +602,61 @@
>  	for(a=1; a<argc; a++) {
>  		if (G.afbreek==1) break;
>
> +#ifdef WITH_COMMAND_PORT
> +
> +		/* handle command port option */
> +		if (!strcmp(argv[a], "-c") ||
> +			!strcmp(argv[a], "--command-port")) {
> +
> +			/* get port number */
> +			if ((argc - a) < 2) {
> +				printf("\nERROR: A port number has to be specified "
> +					   "after the command port option!\n");
> +				exit(1);
> +			}
> +			a++;
> +			port = (unsigned short) atoi(argv[a]);
> +			
> +			/* init the command port */
> +			commandport_init(port);
> +			
> +			/* continue with next option */
> +			continue;
> +			
> +		} else
> +
> +		/* handle command port debug level option */
> +		if (!strcmp(argv[a], "--debug-command-port")) {
> +
> +			/* debug level */
> +			if ((argc - a) < 2) {
> +				printf("\nERROR: A debug level has to be specified "
> +					   "as value of the command port debug level option!\n");
> +				exit(1);
> +			}
> +			a++;
> +
> +			/* check if help was requested */
> +			if (!strcmp(argv[a], "help")) {
> +
> +				/* print command port debug help and exit */
> +				print_debug_command_port_help();
> +				exit(0);
> +			}
> +
> +			/* get the debug level */
> +			command_port_debug_level = (unsigned short) atoi(argv[a]);
> +
> +			/* init the command port debug level */
> +			commandport_set_debug_level(command_port_debug_level);
> +
> +			/* continue with next option */
> +			continue;
> +			
> +		} else
> +
> +#endif
> +
>  		if(argv[a][0] == '-') {
>  			switch(argv[a][1]) {
>  			case '-':  /* -- ends argument processing */
>
> ======================================================================= 
> =========
> Index: source/blender/python/BPY_interface.c
> ===================================================================
> --- source/blender/python/BPY_interface.c	(revision 15538)
> +++ source/blender/python/BPY_interface.c	(working copy)
> @@ -100,7 +100,7 @@
>   *    creates list in __main__ module dict
>   */
>
> -int setup_armature_weakrefs()
> +int BPY_setup_armature_weakrefs()
>  {
>  	PyObject *maindict;
>  	PyObject *main_module;
> @@ -123,7 +123,7 @@
>  		if (PyDict_SetItemString(maindict,
>  								 list_name,
>  								 PyList_New(0)) == -1){
> -			printf("Oops - setup_armature_weakrefs()\n");
> +			printf("Oops - BPY_setup_armature_weakrefs()\n");
>  			
>  			return 0;
>  		}
> @@ -674,7 +674,7 @@
>
>  	py_dict = CreateGlobalDictionary(  );
>
> -	if( !setup_armature_weakrefs()){
> +	if( !BPY_setup_armature_weakrefs()){
>  		printf("Oops - weakref dict\n");
>  		PyGILState_Release(gilstate);
>  		return 0;
> @@ -857,7 +857,7 @@
>
>  	script->py_globaldict = py_dict;
>
> -	if( !setup_armature_weakrefs()){
> +	if( !BPY_setup_armature_weakrefs()){
>  		printf("Oops - weakref dict\n");
>  		free_libblock( &G.main->script, script );
>  		ReleaseGlobalDictionary( py_dict );
> @@ -1539,7 +1539,7 @@
>  		PyList_SET_ITEM(tarmats, index, tarmat);
>  	}
>  	
> -	if (!setup_armature_weakrefs()) {
> +	if (!BPY_setup_armature_weakrefs()) {
>  		fprintf(stderr, "Oops - weakref dict setup\n");
>  		PyGILState_Release(gilstate);
>
> @@ -1707,7 +1707,7 @@
>  	tarmat = newMatrixObject((float *)ct->matrix, 4, 4, Py_NEW);
>  	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
>  	
> -	if (!setup_armature_weakrefs()) {
> +	if (!BPY_setup_armature_weakrefs()) {
>  		fprintf(stderr, "Oops - weakref dict setup\n");
>  		PyGILState_Release(gilstate);
>  		return;
> @@ -2021,7 +2021,7 @@
>
>  	setitem_retval = EXPP_dict_set_item_str(bpy_pydriver_Dict, "self",  
> bpy_ob);
>
> -	if( !setup_armature_weakrefs()){
> +	if( !BPY_setup_armature_weakrefs()){
>  		fprintf( stderr, "Oops - weakref dict setup\n");
>  		PyGILState_Release(gilstate);
>  		return result;
> @@ -2108,7 +2108,7 @@
>  	}
>
>
> -	if( !setup_armature_weakrefs()){
> +	if( !BPY_setup_armature_weakrefs()){
>  		fprintf(stderr, "Oops - weakref dict\n");
>  		PyGILState_Release(gilstate);
>  		return -1;
> @@ -2262,7 +2262,7 @@
>
>  		gilstate = PyGILState_Ensure();
>
> -		if( !setup_armature_weakrefs()){
> +		if( !BPY_setup_armature_weakrefs()){
>  			printf("Oops - weakref dict, this is a bug\n");
>  			PyGILState_Release(gilstate);
>  			return;
> @@ -2504,7 +2504,7 @@
>  		
>  		gilstate = PyGILState_Ensure();
>  		
> -		if( !setup_armature_weakrefs()){
> +		if( !BPY_setup_armature_weakrefs()){
>  			printf("Oops - weakref dict, this is a bug\n");
>  			PyGILState_Release(gilstate);
>  			return 0;
> ======================================================================= 
> =========
> Index: source/blender/src/mainqueue.c
> ===================================================================
> --- source/blender/src/mainqueue.c	(revision 15538)
> +++ source/blender/src/mainqueue.c	(working copy)
> @@ -22,7 +22,10 @@
>   *
>   * The Original Code is: all of this file.
>   *
> - * Contributor(s): none yet.
> + * Contributor(s):
> + * - Dietrich Bollmann
> + *   - added thread protection (mainqueue_mutex) for main queue.
> + *   - added the new parameter 'args' to pass an argument struct  
> pointer
>   *
>   * ***** END GPL LICENSE BLOCK *****
>   *
> @@ -32,16 +35,58 @@
>
>  #include <stdlib.h>
>  #include <string.h>
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +#include <pthread.h>
> +#endif
> +#include <stdio.h>
> +
>  #include "BIF_mainqueue.h"
>
>  #ifdef HAVE_CONFIG_H
>  #include <config.h>
>  #endif
>
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +/**
> +	Using a mutex to protect the mainqueue against simultaneous access
> +	by different threads:
> +*/
> +pthread_mutex_t mainqueue_mutex = PTHREAD_MUTEX_INITIALIZER;
> +
> +/**
> +	 Locking the mutex
> +	 protecting the mainqueue against access by multiple threads.
> +*/
> +void lock_mainqueue_mutex()
> +{
> +	if ( pthread_mutex_lock( &mainqueue_mutex ) ) {
> +		perror( "Error: couldn't lock the mainqueue mutex!" );
> +		exit( 1 );
> +	}
> +}
> +
> +/**
> +	 Unlocking the mutex
> +	 protecting the mainqueue against access by multiple threads.
> +*/
> +void unlock_mainqueue_mutex()
> +{
> +	if ( pthread_mutex_unlock( &mainqueue_mutex ) ) {
> +		perror( "Error: couldn't unlock the mainqueue mutex!" );
> +		exit( 1 );
> +	}
> +}
> +#endif
> +
>  typedef struct {
> -	unsigned short event;
> -	short val;
> -	char ascii;
> +	unsigned short  event;
> +	short           val;
> +	char            ascii;
> +#ifdef WITH_COMMAND_PORT
> +	void*           args;
> +#endif
>  } QEvent;
>
>  static QEvent mainqueue[MAXQUEUE];
> @@ -49,51 +94,154 @@
>
>  unsigned short mainqread(short *val, char *ascii)
>  {
> +    void* dummy;
> +	return mainqread_args(val, ascii
> +#ifdef WITH_COMMAND_PORT
> +						  , &dummy
> +#endif
> +						  );
> +}
> +
> +unsigned short mainqread_args(short *val, char *ascii
> +#ifdef WITH_COMMAND_PORT
> +							  , void** args
> +#endif
> +							  )
> +{
> +	unsigned short event = 0;
> +
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	lock_mainqueue_mutex();
> +	/* begin of critical section */
> +#endif
> +
>  	if (nevents) {
>  		nevents--;
>  		
> -		*val= mainqueue[nevents].val;
> -		*ascii= mainqueue[nevents].ascii;
> +		*val   = mainqueue[nevents].val;
> +		*ascii = mainqueue[nevents].ascii;
> +#ifdef WITH_COMMAND_PORT
> +		*args  = mainqueue[nevents].args;
> +#endif
>  		if((*ascii<32)||(*ascii==127)) *ascii=0;
> -		return mainqueue[nevents].event;
> -	} else
> -		return 0;
> +		event = mainqueue[nevents].event;
> +	}
> +
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	/* end of critical section */
> +	unlock_mainqueue_mutex();
> +#endif
> +	
> +	return event;
>  }
>
>  void mainqenter(unsigned short event, short val)
>  {
> -	mainqenter_ext(event, val, 0);
> +	mainqenter_args(event, val, 0
> +#ifdef WITH_COMMAND_PORT
> +					, NULL
> +#endif
> +					);
>  }
>
>  void mainqenter_ext(unsigned short event, short val, char ascii)
>  {
> +	mainqenter_args(event, val, ascii
> +#ifdef WITH_COMMAND_PORT
> +					, NULL
> +#endif
> +					);
> +}
> +
> +void mainqenter_args(unsigned short event, short val, char ascii
> +#ifdef WITH_COMMAND_PORT
> +					 , void* args
> +#endif
> +					 )
> +{
>  	if (!event)
>  		return;
>
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	lock_mainqueue_mutex();
> +	/* begin of critical section */
> +#endif
> +
>  	if (nevents<MAXQUEUE) {
> +
>  		memmove(mainqueue+1, mainqueue, sizeof(*mainqueue)*nevents);	
> -		mainqueue[0].event= event;
> -		mainqueue[0].val= val;
> -		mainqueue[0].ascii= ascii;
> +		mainqueue[0].event = event;
> +		mainqueue[0].val   = val;
> +		mainqueue[0].ascii = ascii;
> +#ifdef WITH_COMMAND_PORT
> +		mainqueue[0].args  = args;
> +#endif
>  		
>  		nevents++;
>  	}
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	/* end of critical section */
> +	unlock_mainqueue_mutex();
> +#endif
>  }
>
>  void mainqpushback(unsigned short event, short val, char ascii)
>  {
> +	mainqpushback_args(event, val, ascii
> +#ifdef WITH_COMMAND_PORT
> +					   , NULL
> +#endif
> +					   );
> +}
> +
> +void mainqpushback_args(unsigned short event, short val, char ascii
> +#ifdef WITH_COMMAND_PORT
> +						, void* args
> +#endif
> +						)
> +{
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	lock_mainqueue_mutex();
> +	/* begin of critical section */
> +#endif
> +
>  	if (nevents<MAXQUEUE) {
> -		mainqueue[nevents].event= event;
> -		mainqueue[nevents].val= val;
> -		mainqueue[nevents].ascii= ascii;
> +		mainqueue[nevents].event = event;
> +		mainqueue[nevents].val   = val;
> +		mainqueue[nevents].ascii = ascii;
> +#ifdef WITH_COMMAND_PORT
> +		mainqueue[nevents].args  = args;
> +#endif
>  		nevents++;
>  	}
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	/* end of critical section */
> +	unlock_mainqueue_mutex();
> +#endif
>  }
>
>  unsigned short mainqtest()
>  {
> +	unsigned short event = 0;
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	lock_mainqueue_mutex();
> +	/* begin of critical section */
> +#endif
> +
>  	if (nevents)
> -		return mainqueue[nevents-1].event;
> -	else
> -		return 0;
> +		event = mainqueue[nevents-1].event;
> +
> +#ifdef WITH_MULTI_THREADING_SUPPORT
> +	/* end of critical section */
> +	unlock_mainqueue_mutex();
> +#endif
> +
> +	return event;
>  }
> +
> +/* fin */
> ======================================================================= 
> =========
> Index: source/blender/src/editscreen.c
> ===================================================================
> --- source/blender/src/editscreen.c	(revision 15538)
> +++ source/blender/src/editscreen.c	(working copy)
> @@ -22,7 +22,8 @@
>   *
>   * The Original Code is: all of this file.
>   *
> - * Contributor(s): none yet.
> + * Contributor(s):
> + * - Dietrich Bollmann - added command port functionality.
>   *
>   * ***** END GPL LICENSE BLOCK *****
>   * All screen functions that are related to the interface
> @@ -108,6 +109,10 @@
>  #include "mydevice.h"
>  #include "blendef.h"
>
> +#ifdef WITH_COMMAND_PORT
> +#include "commandport.h" /* the Blender command port (dietrich) */
> +#endif
> +
>  #include "winlay.h"
>
>  /* TIPS:
> @@ -138,6 +143,12 @@
>  /* prototypes -------------------*/
>  int afterqtest(short win, unsigned short evt);
>  unsigned short screen_qread(short *val, char *ascii);
> +unsigned short screen_qread_args(short *val, char *ascii
> +#ifdef WITH_COMMAND_PORT
> +								 , void** args  /* (dietrich) */
> +#endif
> +								 );
> +unsigned short filter_event(unsigned short event, short val);
>  void add_to_mainqueue(Window *win, void *user_data, short evt, short  
> val, char ascii);
>  static void drawscredge_area(ScrArea *sa);
>
> @@ -938,35 +949,88 @@
>  	return 0;
>  }
>
> +/**
> +   busy waiting for new events.
> +
> +   Note: The blocking GHOST event processing is
> +   implemented in the same way using busy waiting (polling)
> +   on the GHOST event queue.  Doing the same on the Blender
> +   event queue makes it possible to also react to events
> +   inserted into the Blender main event queue by parallel
> +   threads - for example the Blender command port thread.
> +
> +   Added to make the command port work :)
> +   (dietrich)
> +*/
> +static void wait_for_event()
> +{
> +	while (!mainqtest()) {
> +		PIL_sleep_ms(5);          /* sleep for 5 milliseconds */
> +		winlay_process_events(0); /* if there are events in the GHOST queue,
> +									 (non-blocking polling of GHOST events)
> +									 preprocess them and copy them over
> +									 into the Blender main event queue.
> +								  */
> +	}
> +}
> +
> +/*
> +  Original version - not reacting on events inserted into the
> +  Blender main event by other threads.
> +
>  static void wait_for_event(void)
>  {
>  	while (!mainqtest()) {
>  		winlay_process_events(1);
>  	}
>  }
> +*/
>
> -unsigned short screen_qread(short *val, char *ascii)
> +unsigned short screen_qread(short* val, char* ascii)
>  {
> +	void* dummy;
> +	return screen_qread_args(val, ascii
> +#ifdef WITH_COMMAND_PORT
> +							 , &dummy
> +#endif
> +							 );
> +}
> +	
> +unsigned short screen_qread_args(short* val, char* ascii
> +#ifdef WITH_COMMAND_PORT
> +								 , void** args
> +#endif
> +								 )
> +{
>  	unsigned short event;
>
>  	wait_for_event();
>
> -	event= mainqread(val, ascii);
> +	event = mainqread_args(val, ascii
> +#ifdef WITH_COMMAND_PORT
> +						   , args
> +#endif
> +						   );
>  	
> +	return filter_event(event, *val);
> +}
> +	
> +unsigned short filter_event(unsigned short event, short val)
> +{
>  	if(event==RIGHTSHIFTKEY || event==LEFTSHIFTKEY) {
> -		if(*val) G.qual |= LR_SHIFTKEY;
> +		if (val) G.qual |= LR_SHIFTKEY;
>  		else G.qual &= ~LR_SHIFTKEY;
>  	}
>  	else if(event==RIGHTALTKEY || event==LEFTALTKEY) {
> -		if(*val) G.qual |= LR_ALTKEY;
> +		if (val) G.qual |= LR_ALTKEY;
>  		else G.qual &= ~LR_ALTKEY;
>  	}
>  	else if(event==RIGHTCTRLKEY || event==LEFTCTRLKEY) {
> -		if(*val) G.qual |= LR_CTRLKEY;
> +		if (val) G.qual |= LR_CTRLKEY;
>  		else G.qual &= ~LR_CTRLKEY;
>  	}
>  	else if(event==COMMANDKEY) {		// OSX
> -		if(*val) G.qual |= LR_COMMANDKEY;
> +		if (val) G.qual |= LR_COMMANDKEY;
>  		else G.qual &= ~LR_COMMANDKEY;
>  	}
>
> @@ -1274,19 +1338,38 @@
>  	int firsttime = 1;
>  	int onload_script = 0;
>
> +#ifdef WITH_COMMAND_PORT
> +	/* Start the command port.
> +
> +	   Note: The command port will be started only if the option
> +	     -c <port> or --bcp <port>
> +	   was specified on the command line.
> +
> +	   (dietrich)
> +	*/
> +	commandport_start();
> +#endif
> +
>  	window_make_active(mainwin);
>  	
>  	while (1) {
>  		unsigned short event;
>  		short val, towin;
>  		char ascii;
> +#ifdef WITH_COMMAND_PORT
> +		void* args;
> +#endif
>
>  		flush_extqd_events();
>  		if (nafterqitems && !qtest()) {
>  			append_afterqueue();
>  			event= val= ascii= 0;
>  		} else {
> -			event= screen_qread(&val, &ascii);
> +			event= screen_qread_args(&val, &ascii
> +#ifdef WITH_COMMAND_PORT
> +									 , &args
> +#endif
> +									 );
>  		}
>  		
>  		// window_make_active(mainwin); // (only for inputchange, removed,  
> (ton))
> @@ -1375,6 +1458,12 @@
>  			BIF_read_file(ext_load_str);
>  			sound_initialize_sounds();
>  		}
> +#ifdef WITH_COMMAND_PORT
> +		else if (event == COMMAND_PORT_INPUT) {
> +			/* handle Blender command port input (dietrich) */
> +			commandport_handle_input_allocate(args);
> +		}
> +#endif
>  		else if ((event==ONLOAD_SCRIPT) && BPY_has_onload_script()) {
>  			/* event queued in setup_app_data() in blender.c, where G.f is  
> checked */
>  			onload_script = 1;
> @@ -2124,10 +2213,10 @@
>  void BIF_wait_for_statechange(void)
>  {
>  	if (!statechanged) {
> -			/* Safety, don't wait more than 0.1 seconds */
> +		/* Safety, don't wait more than 0.1 seconds */
>  		double stime= PIL_check_seconds_timer();
>  		while (!statechanged) {
> -			winlay_process_events(1);
> +			wait_for_event();
>  			if ((PIL_check_seconds_timer()-stime)>0.1) break;
>  		}
>  		statechanged= 0;
> ======================================================================= 
> =========
> Index: source/blender/src/usiblender.c
> ===================================================================
> --- source/blender/src/usiblender.c	(revision 15538)
> +++ source/blender/src/usiblender.c	(working copy)
> @@ -22,7 +22,7 @@
>   *
>   * The Original Code is: all of this file.
>   *
> - * Contributor(s): none yet.
> + * Contributor(s): Dietrich Bollmann.
>   *
>   * ***** END GPL LICENSE BLOCK *****
>   */
> @@ -143,6 +143,10 @@
>  #include "radio.h"
>  #include "datatoc.h"
>
> +#ifdef WITH_COMMAND_PORT
> +#include "commandport.h" /* Blender command port (dietrich) */
> +#endif
> +
>  #include "SYS_System.h"
>
>  #include "PIL_time.h"
> @@ -1054,6 +1058,11 @@
>  {
>  	struct TmpFont *tf;
>  	
> +#ifdef WITH_COMMAND_PORT
> +	/* cleanup the command port (dietrich) */
> +	commandport_destroy();
> +#endif
> +
>  	BIF_clear_tempfiles();
>  	
>  	tf= G.ttfdata.first;
> ======================================================================= 
> =========
> Index: source/blender/src/eventdebug.c
> ===================================================================
> --- source/blender/src/eventdebug.c	(revision 15538)
> +++ source/blender/src/eventdebug.c	(working copy)
> @@ -187,6 +187,9 @@
>  	smap(ENDKEY);
>  	smap(REDRAWNLA);
>  	smap(ONLOAD_SCRIPT);
> +#ifdef WITH_COMMAND_PORT
> +	smap(COMMAND_PORT_INPUT); /* (dietrich) */
> +#endif
>  	}
>  	#undef smap
>  }
> ======================================================================= 
> =========
> ======================================================================= 
> =========
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



More information about the Bf-committers mailing list