svn merge -r37700:37800 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 14:34:36 +0000 (14:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 14:34:36 +0000 (14:34 +0000)
26 files changed:
1  2 
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/bvhutils.c
source/blender/blenkernel/intern/particle.c
source/blender/blenlib/BLI_callbacks.h
source/blender/blenlib/BLI_math_color.h
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/intern/callbacks.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/bpy_app_handlers.h
source/blender/render/intern/source/convertblender.c
source/blender/windowmanager/intern/wm_init_exit.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index 0000000000000000000000000000000000000000,1735848e774c5bcfeadec66875f4368840daf979..fc5c5a80131a158c18861eb18861ffceb1d4cefa
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,72 +1,72 @@@
 - * $Id$
+ /*
++ * $Id: BLI_callbacks.h 37799 2011-06-24 23:14:26Z gsrb3d $
+  *
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+  * All rights reserved.
+  *
+  * The Original Code is: all of this file.
+  *
+  * Contributor(s): mar 2001 Nzc
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ /** \file blender/blenlib/BLI_callbacks.h
+  *  \ingroup bli
+  */
+ #ifndef BLI_CALLBACKS_H
+ #define BLI_CALLBACKS_H
+ struct bContext;
+ struct Main;
+ struct ID;
+ typedef enum {
+       BLI_CB_EVT_RENDER_PRE,
+       BLI_CB_EVT_RENDER_POST,
+       BLI_CB_EVT_LOAD_PRE,
+       BLI_CB_EVT_LOAD_POST,
+       BLI_CB_EVT_SAVE_PRE,
+       BLI_CB_EVT_SAVE_POST,
+       BLI_CB_EVT_TOT
+ } eCbEvent;
+ typedef struct {
+       struct bCallbackFuncStore *next, *prev;
+       void (* func)(struct Main *, struct ID *, void *arg);
+       void *arg;
+       short alloc;
+ } bCallbackFuncStore;
+ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt);
+ void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt);
+ #endif
+ void BLI_cb_init(void);
+ void BLI_cb_finalize(void);
+ /* This is blenlib internal only, unrelated to above */
+ void callLocalErrorCallBack(const char* msg);
Simple merge
index 0000000000000000000000000000000000000000,a033e01696d16b1cabf650bea6abca7e789389ba..2599c21812324a5493404b28445a1da51c1b97ce
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,70 +1,70 @@@
 - * $Id$
+ /*
++ * $Id: callbacks.c 37799 2011-06-24 23:14:26Z gsrb3d $
+  *
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * Contributor(s): Blender Foundation (2011)
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ #include "BLI_utildefines.h"
+ #include "BLI_listbase.h"
+ #include "BLI_callbacks.h"
+ #include "MEM_guardedalloc.h"
+ static ListBase callback_slots[BLI_CB_EVT_TOT]= {{0}};
+ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt)
+ {
+       ListBase *lb= &callback_slots[evt];
+       bCallbackFuncStore *funcstore;
+       for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
+               funcstore->func(main, self, funcstore->arg);
+       }
+ }
+ void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt)
+ {
+       ListBase *lb= &callback_slots[evt];
+       BLI_addtail(lb, funcstore);
+ }
+ void BLI_cb_init(void)
+ {
+       /* do nothing */
+ }
+ /* call on application exit */
+ void BLI_cb_finalize(void)
+ {
+       eCbEvent evt;
+       for(evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
+               ListBase *lb= &callback_slots[evt];
+               bCallbackFuncStore *funcstore;
+               bCallbackFuncStore *funcstore_next;
+               for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
+                       funcstore_next= (bCallbackFuncStore *)funcstore->next;
+                       BLI_remlink(lb, funcstore);
+                       if(funcstore->alloc) {
+                               MEM_freeN(funcstore);
+                       }
+               }
+       }
+ }
index 0cf299aa5b05e9da910af2cc26c229d904c5a5d5,80c98e8c428b5f9d83cacd925b923701d7861ddb..d44fc379fdad46555f6825840f39f996c7588e1c
@@@ -267,16 -305,12 +267,17 @@@ static void rna_MeshFace_material_index
        Mesh *me= (Mesh*)ptr->id.data;
        *min= 0;
        *max= me->totcol-1;
+       *max= MAX2(0, *max);
  }
  
 -static CustomData *rna_mesh_fdata(Mesh *me)
 +static CustomData *rna_mesh_pdata(Mesh *me)
  {
 -      return (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
 +      return (me->edit_btmesh)? &me->edit_btmesh->bm->pdata: &me->pdata;
 +}
 +
 +static CustomData *rna_mesh_ldata(Mesh *me)
 +{
 +      return (me->edit_btmesh)? &me->edit_btmesh->bm->ldata: &me->ldata;
  }
  
  static int rna_CustomDataLayer_length(PointerRNA *ptr, int type)
index 0000000000000000000000000000000000000000,26d9ca76e3fa62d1381c43e2c5e8878278f7b0cc..77ba6031da5cf8936cf940596b8d1da4be345bb5
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,170 +1,170 @@@
 - * $Id$
+ /*
++ * $Id: bpy_app_handlers.c 37799 2011-06-24 23:14:26Z gsrb3d $
+  *
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * Contributor(s): Campbell Barton
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ /** \file blender/python/intern/bpy_app_handlers.c
+  *  \ingroup pythonintern
+  */
+ #include <Python.h>
+ #include "BLI_utildefines.h"
+ #include "BLI_callbacks.h"
+ #include "RNA_types.h"
+ #include "RNA_access.h"
+ #include "bpy_rna.h"
+ #include "bpy_app_handlers.h"
+ void bpy_app_generic_callback(struct Main *main, struct ID *id, void *arg);
+ static PyTypeObject BlenderAppCbType;
+ static PyStructSequence_Field app_cb_info_fields[]= {
+       {(char *)"render_pre", NULL},
+       {(char *)"render_post", NULL},
+     {(char *)"load_pre", NULL},
+       {(char *)"load_post", NULL},
+     {(char *)"save_pre", NULL},
+       {(char *)"save_post", NULL},
+       {NULL}
+ };
+ static PyStructSequence_Desc app_cb_info_desc= {
+       (char *)"bpy.app.handlers",     /* name */
+       (char *)"This module contains callbacks",    /* doc */
+       app_cb_info_fields,    /* fields */
+       (sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field)) - 1
+ };
+ /*
+ #if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
+ #  error "Callbacks are out of sync"
+ #endif
+ */
+ static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
+ static PyObject *make_app_cb_info(void)
+ {
+       PyObject *app_cb_info;
+       int pos= 0;
+       app_cb_info= PyStructSequence_New(&BlenderAppCbType);
+       if (app_cb_info == NULL) {
+               return NULL;
+       }
+       for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+               if(app_cb_info_fields[pos].name == NULL) {
+                       Py_FatalError("invalid callback slots 1");
+               }
+               PyStructSequence_SET_ITEM(app_cb_info, pos, (py_cb_array[pos]= PyList_New(0)));
+       }
+       if(app_cb_info_fields[pos].name != NULL) {
+               Py_FatalError("invalid callback slots 2");
+       }
+       return app_cb_info;
+ }
+ PyObject *BPY_app_handlers_struct(void)
+ {
+       PyObject *ret;
+       PyStructSequence_InitType(&BlenderAppCbType, &app_cb_info_desc);
+       ret= make_app_cb_info();
+       /* prevent user from creating new instances */
+       BlenderAppCbType.tp_init= NULL;
+       BlenderAppCbType.tp_new= NULL;
+       /* assign the C callbacks */
+       if(ret) {
+               static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
+               bCallbackFuncStore *funcstore;
+               int pos= 0;
+               for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+                       funcstore= &funcstore_array[pos];
+                       funcstore->func= bpy_app_generic_callback;
+                       funcstore->alloc= 0;
+                       funcstore->arg= SET_INT_IN_POINTER(pos);
+                       BLI_add_cb(funcstore, pos);
+               }
+       }
+       return ret;
+ }
+ void BPY_app_handlers_reset(void)
+ {
+       int pos= 0;
+       for(pos= 0; pos < BLI_CB_EVT_TOT; pos++) {
+               PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
+       }
+ }
+ /* the actual callback - not necessarily called from py */
+ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
+ {
+       PyObject *cb_list= py_cb_array[GET_INT_FROM_POINTER(arg)];
+       Py_ssize_t cb_list_len;
+       if((cb_list_len= PyList_GET_SIZE(cb_list)) > 0) {
+               PyGILState_STATE gilstate= PyGILState_Ensure();
+               PyObject* args= PyTuple_New(1); // save python creating each call
+               PyObject* func;
+               PyObject* ret;
+               Py_ssize_t pos;
+               /* setup arguments */
+               if(id) {
+                       PointerRNA id_ptr;
+                       RNA_id_pointer_create(id, &id_ptr);
+                       PyTuple_SET_ITEM(args, 0, pyrna_struct_CreatePyObject(&id_ptr));
+               }
+               else {
+                       PyTuple_SET_ITEM(args, 0, Py_None);
+                       Py_INCREF(Py_None);
+               }
+               // Iterate the list and run the callbacks
+               for (pos=0; pos < cb_list_len; pos++) {
+                       func= PyList_GET_ITEM(cb_list, pos);
+                       ret= PyObject_Call(func, args, NULL);
+                       if (ret==NULL) {
+                               PyErr_Print();
+                               PyErr_Clear();
+                       }
+                       else {
+                               Py_DECREF(ret);
+                       }
+               }
+               Py_DECREF(args);
+               PyGILState_Release(gilstate);
+       }
+ }
index ad09339e61a1176c80aae6803fd364ad4c2352fb,bfa413438b17fc1854395109c8c29c78b269ac4c..8c1faa19c542d6bb37839a7accb57b1467dca034
@@@ -1,9 -1,5 +1,5 @@@
  /*
-  * blenlib/BLI_editVert.h    mar 2001 Nzc
-  *
-  * These callbacks are needed in the lib
-  *
-- * $Id$
++ * $Id: bpy_app_handlers.h 37799 2011-06-24 23:14:26Z gsrb3d $
   *
   * ***** BEGIN GPL LICENSE BLOCK *****
   *
Simple merge
Simple merge