COLLADA branch: merge from trunk -r 24522:24758.
authorArystanbek Dyussenov <arystan.d@gmail.com>
Sun, 22 Nov 2009 13:51:29 +0000 (13:51 +0000)
committerArystanbek Dyussenov <arystan.d@gmail.com>
Sun, 22 Nov 2009 13:51:29 +0000 (13:51 +0000)
1  2 
CMakeLists.txt
config/linux2-config.py
source/blender/windowmanager/intern/wm_operators.c
tools/Blender.py

diff --combined CMakeLists.txt
index db9e5948f33846c5f36a0a9122ce403b62602e71,c7e08d7b1ba8840617fa745572971b9486106a08..14510cbeecdd6c8a4ad37aeba5b1c786407e318c
@@@ -70,7 -70,6 +70,6 @@@ OPTION(WITH_PYTHON        "Enable Embed
  OPTION(WITH_SDL           "Enable SDL for sound and joystick support" ON)
  OPTION(WITH_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
  OPTION(WITH_OPENAL        "Enable OpenAL Support (http://www.openal.org)" ON)
- OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" OFF)
  OPTION(WITH_WEBPLUGIN     "Enable Web Plugin (Unix only)" OFF)
  OPTION(WITH_FFTW3         "Enable FFTW3 support" OFF)
  OPTION(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
@@@ -80,11 -79,19 +79,19 @@@ OPTION(WITH_LZMA          "Enable best 
  OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
  OPTION(WITH_BUILDINFO     "Include extra build details" ON)
  OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 -OPTION(WITH_OPENCOLLADA               "Enable OpenCollada Support (http://www.opencollada.org/)"      OFF)
 +OPTION(WITH_OPENCOLLADA               "Enable OpenCollada Support (http://www.opencollada.org/)"      ON)
  
+ # Unix defaults to OpenMP On
+ IF (UNIX)
+       OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
+ ELSE(UNIX)
+       OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" OFF)
+ ENDIF(UNIX)
  IF (APPLE)
- OPTION(WITH_COCOA       "Use Cocoa framework instead of deprecated Carbon" ON)
- OPTION(WITH_LIBS10.5    "Use 10.5 libs (needed for 64bit builds)" OFF)
+       OPTION(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
+       OPTION(USE_QTKIT          "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
+       OPTION(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
  ENDIF (APPLE)
  
  IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
@@@ -209,8 -216,8 +216,8 @@@ IF(UNIX AND NOT APPLE
  
        IF (WITH_OPENCOLLADA)
                SET(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
 -              SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA})
 -              SET(OPENCOLLADA_LIB OpenCollada)
 +              SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
 +              SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa Buffer)
                SET(OPENCOLLADA_INC ${OPENCOLLADA})
                SET(PCRE /usr CACHE FILEPATH "PCRE Directory")
                SET(PCRE_LIBPATH ${PCRE}/lib)
        ENDIF(WITH_OPENMP)
  
  
-       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
+       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-char-subscripts")
  
        SET(PLATFORM_LINKFLAGS "-pthread")
  
@@@ -525,7 -532,15 +532,15 @@@ IF(APPLE
  
        IF (WITH_COCOA)
        SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DGHOST_COCOA")
-       SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
+       SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
+       IF(USE_QTKIT)
+       SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
+       SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
+       ELSE(USE_QTKIT)
+       IF(WITH_QUICKTIME)
+       SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
+       ENDIF(WITH_QUICKTIME)
+       ENDIF(USE_QTKIT)
        ELSE (WITH_COCOA)
        SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
        SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
diff --combined config/linux2-config.py
index c0c600f2498a6bbe68d9ab1bc20bec44d0d4a785,3eccb9139329a783e96ef4b0c2b967e6555f985a..f03daacbdbab6bc8edd9400df7f6a6100b068eeb
@@@ -151,13 -151,13 +151,13 @@@ BF_OPENGL_LIB = 'GL GLU X11 Xi
  BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
  BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
  
 -WITH_BF_COLLADA = False
 +WITH_BF_COLLADA = True
  BF_COLLADA = '#source/blender/collada'
  BF_COLLADA_INC = '${BF_COLLADA}'
  BF_COLLADA_LIB = 'bf_collada'
 -BF_OPENCOLLADA = ''
 -BF_OPENCOLLADA_LIB = 'OpenCollada'
 -BF_OPENCOLLADA_LIBPATH = '/usr/lib'
 +BF_OPENCOLLADA = '/usr'
 +BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre Buffer ftoa'
 +BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
  BF_PCRE = ''
  BF_PCRE_LIB = 'pcre'
  BF_PCRE_LIBPATH = '/usr/lib'
@@@ -165,6 -165,8 +165,8 @@@ BF_EXPAT = '/usr
  BF_EXPAT_LIB = 'expat'
  BF_EXPAT_LIBPATH = '/usr/lib'
  
+ WITH_BF_OPENMP = True
  ##
  CC = 'gcc'
  CXX = 'g++'
  
  CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
  
- CPPFLAGS = ['-DXP_UNIX']
+ CPPFLAGS = []
  CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
  REL_CFLAGS = ['-O2']
  REL_CCFLAGS = ['-O2']
index 1f8e2e280241c328faa6918851785553840c1b38,beece8c9226c62766156c4912e7c2c8c1ed92c44..a68a4b8414e68aad82c8627b7c7f8affc2666665
@@@ -167,71 -167,159 +167,159 @@@ void WM_operatortype_append_ptr(void (*
  
  /* ********************* macro operator ******************** */
  
+ typedef struct {
+       int retval;
+ } MacroData;
+ static void wm_macro_start(wmOperator *op)
+ {
+       if (op->customdata == NULL) {
+               op->customdata = MEM_callocN(sizeof(MacroData), "MacroData");
+       }
+ }
+ static int wm_macro_end(wmOperator *op, int retval)
+ {
+       if (retval & OPERATOR_CANCELLED) {
+               MacroData *md = op->customdata;
+               if (md->retval & OPERATOR_FINISHED) {
+                       retval |= OPERATOR_FINISHED;
+                       retval &= ~OPERATOR_CANCELLED;
+               }
+       }
+       /* if modal is ending, free custom data */
+       if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED)) {
+               if (op->customdata) {
+                       MEM_freeN(op->customdata);
+               }
+       }
+       return retval;
+ }
  /* macro exec only runs exec calls */
  static int wm_macro_exec(bContext *C, wmOperator *op)
  {
        wmOperator *opm;
        int retval= OPERATOR_FINISHED;
        
//    printf("macro exec %s\n", op->type->idname);
-       
      wm_macro_start(op);
        for(opm= op->macro.first; opm; opm= opm->next) {
                
                if(opm->type->exec) {
- //                    printf("macro exec %s\n", opm->type->idname);
                        retval= opm->type->exec(C, opm);
                
-                       if(!(retval & OPERATOR_FINISHED))
-                               break;
+                       if (retval & OPERATOR_FINISHED) {
+                               MacroData *md = op->customdata;
+                               md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
+                       } else {
+                               break; /* operator didn't finish, end macro */
+                       }
                }
        }
- //    if(opm)
- //            printf("macro ended not finished\n");
- //    else
- //            printf("macro end\n");
        
-       return retval;
+       return wm_macro_end(op, retval);
  }
  
static int wm_macro_invoke(bContext *C, wmOperator *op, wmEvent *event)
int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, wmOperator *opm)
  {
-       wmOperator *opm;
        int retval= OPERATOR_FINISHED;
-       
- //    printf("macro invoke %s\n", op->type->idname);
-       
-       for(opm= op->macro.first; opm; opm= opm->next) {
-               
+       /* start from operator received as argument */
+       for( ; opm; opm= opm->next) {
                if(opm->type->invoke)
                        retval= opm->type->invoke(C, opm, event);
                else if(opm->type->exec)
                        retval= opm->type->exec(C, opm);
-               
-               if(!(retval & OPERATOR_FINISHED))
-                       break;
+               if (retval & OPERATOR_FINISHED) {
+                       MacroData *md = op->customdata;
+                       md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
+               } else {
+                       break; /* operator didn't finish, end macro */
+               }
        }
-       
- //    if(opm)
- //            printf("macro ended not finished\n");
- //    else
- //            printf("macro end\n");
-       
-       
-       return retval;
+       return wm_macro_end(op, retval);
+ }
+ static int wm_macro_invoke(bContext *C, wmOperator *op, wmEvent *event)
+ {
+       wm_macro_start(op);
+       return wm_macro_invoke_internal(C, op, event, op->macro.first);
  }
  
  static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
  {
- //    printf("macro modal %s\n", op->type->idname);
+       wmOperator *opm = op->opm;
+       int retval= OPERATOR_FINISHED;
        
-       if(op->opm==NULL)
+       if(opm==NULL)
                printf("macro error, calling NULL modal()\n");
        else {
- //            printf("macro modal %s\n", op->opm->type->idname);
-               return op->opm->type->modal(C, op->opm, event);
-       }       
-       
-       return OPERATOR_FINISHED;
+               retval = opm->type->modal(C, opm, event);
+               /* if this one is done but it's not the last operator in the macro */
+               if ((retval & OPERATOR_FINISHED) && opm->next) {
+                       MacroData *md = op->customdata;
+                       md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
+                       retval = wm_macro_invoke_internal(C, op, event, opm->next);
+                       /* if new operator is modal and also added its own handler */
+                       if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) {
+                               wmWindow *win = CTX_wm_window(C);
+                               wmEventHandler *handler = NULL;
+                               for (handler = win->modalhandlers.first; handler; handler = handler->next) {
+                                       /* first handler in list is the new one */
+                                       if (handler->op == op)
+                                               break;
+                               }
+                               if (handler) {
+                                       BLI_remlink(&win->modalhandlers, handler);
+                                       wm_event_free_handler(handler);
+                               }
+                               /* if operator is blocking, grab cursor
+                                * This may end up grabbing twice, but we don't care.
+                                * */
+                               if(op->opm->type->flag & OPTYPE_BLOCKING) {
+                                       int bounds[4] = {-1,-1,-1,-1};
+                                       int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
+                                       if(wrap) {
+                                               ARegion *ar= CTX_wm_region(C);
+                                               if(ar) {
+                                                       bounds[0]= ar->winrct.xmin;
+                                                       bounds[1]= ar->winrct.ymax;
+                                                       bounds[2]= ar->winrct.xmax;
+                                                       bounds[3]= ar->winrct.ymin;
+                                               }
+                                       }
+                                       WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds);
+                               }
+                       }
+               }
+       }
+       return wm_macro_end(op, retval);
+ }
+ static int wm_macro_cancel(bContext *C, wmOperator *op)
+ {
+       /* call cancel on the current modal operator, if any */
+       if (op->opm && op->opm->type->cancel) {
+               op->opm->type->cancel(C, op->opm);
+       }
+       return wm_macro_end(op, OPERATOR_CANCELLED);
  }
  
  /* Names have to be static for now */
@@@ -254,6 -342,7 +342,7 @@@ wmOperatorType *WM_operatortype_append_
        ot->exec= wm_macro_exec;
        ot->invoke= wm_macro_invoke;
        ot->modal= wm_macro_modal;
+       ot->cancel= wm_macro_cancel;
        ot->poll= NULL;
        
        RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:"(undocumented operator)"); // XXX All ops should have a description but for now allow them not to.
@@@ -656,7 -745,6 +745,7 @@@ int WM_operator_redo_popup(bContext *C
        return OPERATOR_CANCELLED;
  }
  
 +
  /* ***************** Debug menu ************************* */
  
  static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op)
@@@ -2215,7 -2303,6 +2304,7 @@@ void WM_OT_radial_control_partial(wmOpe
        RNA_def_int_vector(ot->srna, "initial_mouse", 2, NULL, INT_MIN, INT_MAX, "initial_mouse", "", INT_MIN, INT_MAX);
  }
  
 +
  /* ************************** timer for testing ***************** */
  
  /* uses no type defines, fully local testing function anyway... ;) */
@@@ -2379,6 -2466,7 +2468,6 @@@ void wm_operatortype_init(void
        WM_operatortype_append(WM_OT_memory_statistics);
        WM_operatortype_append(WM_OT_debug_menu);
        WM_operatortype_append(WM_OT_search_menu);
 -      WM_operatortype_append(WM_OT_call_menu);
  
  #ifdef WITH_COLLADA
        /* XXX: move these */
        WM_operatortype_append(WM_OT_collada_import);
  #endif
  
 +      WM_operatortype_append(WM_OT_call_menu);
  }
  
  /* called in transform_ops.c, on each regeneration of keymaps  */
@@@ -2475,18 -2562,22 +2564,22 @@@ static void gesture_border_modal_keymap
  #endif
  
        /* assign map to operators */
-       WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
-       WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
- //    WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template
        WM_modalkeymap_assign(keymap, "ACT_OT_select_border");
+       WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_border");
+       WM_modalkeymap_assign(keymap, "ANIM_OT_previewrange_set");
        WM_modalkeymap_assign(keymap, "CONSOLE_OT_select_border");
        WM_modalkeymap_assign(keymap, "FILE_OT_select_border");
        WM_modalkeymap_assign(keymap, "GRAPH_OT_select_border");
+       WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
        WM_modalkeymap_assign(keymap, "NLA_OT_select_border");
        WM_modalkeymap_assign(keymap, "NODE_OT_select_border");
+ //    WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template
        WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_border");
-       WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_border");
        WM_modalkeymap_assign(keymap, "UV_OT_select_border");
+       WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
+       WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
+       WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_border");
+       WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border");
  }
  
  /* default keymap for windows and screens, only call once per WM */
diff --combined tools/Blender.py
index 2b3f405ed8b205ad5afb270a52cae9d359687348,4dad70bbef5ea4d12dd9f2bfed933bcd11529d71..097549a08c7ae0739c88c8c36af2a7cf15b758b5
@@@ -216,7 -216,6 +216,7 @@@ def setup_syslibs(lenv)
                syslibs += Split(lenv['BF_OPENGL_LIB'])
        if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'):
                syslibs += Split(lenv['BF_PTHREADS_LIB'])
 +
        if lenv['WITH_BF_LCMS']:
                syslibs.append(lenv['BF_LCMS_LIB'])
        if lenv['WITH_BF_COLLADA']:
@@@ -546,6 -545,14 +546,14 @@@ def UnixPyBundle(target=None, source=No
        py_src =        env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
        py_target =     env.subst( dir + '/python/lib/python'+env['BF_PYTHON_VERSION'] )
        
+       # This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow.
+       if os.path.exists(py_target):
+               print 'Using existing python from:'
+               print '\t"%s"' %                        py_target
+               print '\t(skipping copy)\n'
+               return
+               
+       
        # Copied from source/creator/CMakeLists.txt, keep in sync.
        print 'Install python from:'
        print '\t"%s" into...' %        py_src