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]= {{NULL}}; 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; }
PyObject *BPY_app_handlers_struct(void) { PyObject *ret; #if defined(_MSC_VER) || defined(FREE_WINDOWS) BPyPersistent_Type.ob_base.ob_base.ob_type = &PyType_Type; #endif if (PyType_Ready(&BPyPersistent_Type) < 0) { BLI_assert(!"error initializing 'bpy.app.handlers.persistent'"); } 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; BlenderAppCbType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */ /* assign the C callbacks */ if (ret) { static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT] = {{NULL}}; 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; }