diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-27 16:59:01 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-06-27 16:59:01 +0300 |
commit | cbce7fef1604fdfd3099fd196b2a44f61b22eb76 (patch) | |
tree | b11963a42641ef95c61c01a7b2b83dddce4cd1a2 /source/blender/blenkernel | |
parent | c2dc77983dc4d3271858737a15ee058ef48fb833 (diff) | |
parent | e2c7ee773311734450a229051673fbfea61b641a (diff) |
Merge branch 'master' into blender2.8
Conflicts:
source/blender/blenkernel/intern/pointcache.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_particle.c
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender_undo.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_displist.h | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_movieclip.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_text.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 53 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender_undo.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idcode.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library_remap.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 67 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 185 |
18 files changed, 98 insertions, 311 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 8ce85c8e615..d2d9c763031 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -50,6 +50,11 @@ void BKE_blender_userdef_refresh(void); void BKE_blender_callback_test_break_set(void (*func)(void)); int BKE_blender_test_break(void); +/* Blenders' own atexit (avoids leaking) */ +void BKE_blender_atexit_register(void (*func)(void *user_data), void *user_data); +void BKE_blender_atexit_unregister(void (*func)(void *user_data), const void *user_data); +void BKE_blender_atexit(void); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index cd18bd8db40..9547eeb9838 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -45,6 +45,8 @@ extern const char *BKE_undo_get_name(int nr, bool *r_active); extern bool BKE_undo_save_file(const char *filename); extern struct Main *BKE_undo_get_main(struct Scene **r_scene); +extern void BKE_undo_callback_wm_kill_jobs_set(void (*callback)(struct bContext *C)); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 3b096773d96..9625f05192a 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -45,10 +45,14 @@ #define DL_VERTS 7 /* dl->flag */ -#define DL_CYCL_U 1 -#define DL_CYCL_V 2 -#define DL_FRONT_CURVE 4 -#define DL_BACK_CURVE 8 +enum { + /** U/V swapped here compared with #Nurb.flagu, #Nurb.flagv and #CU_NURB_CYCLIC */ + DL_CYCL_U = (1 << 0), + DL_CYCL_V = (1 << 1), + + DL_FRONT_CURVE = (1 << 2), + DL_BACK_CURVE = (1 << 3), +}; /* prototypes */ @@ -70,7 +74,7 @@ typedef struct DispList { int charidx; int totindex; /* indexed array drawing surfaces */ - unsigned int *bevelSplitFlag; + unsigned int *bevel_split; /* BLI_bitmap */ } DispList; void BKE_displist_copy(struct ListBase *lbn, struct ListBase *lb); diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h index afca326c727..3d963ac109c 100644 --- a/source/blender/blenkernel/BKE_movieclip.h +++ b/source/blender/blenkernel/BKE_movieclip.h @@ -40,7 +40,6 @@ struct MovieClipUser; struct MovieDistortion; void BKE_movieclip_free(struct MovieClip *clip); -void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip); struct MovieClip *BKE_movieclip_file_add(struct Main *bmain, const char *name); struct MovieClip *BKE_movieclip_file_add_exists_ex(struct Main *bmain, const char *name, bool *r_exists); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index b14593f5a56..858feeeab10 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -53,7 +53,6 @@ struct Text *BKE_text_load_ex(struct Main *bmain, const char *file, const cha const bool is_internal); struct Text *BKE_text_load (struct Main *bmain, const char *file, const char *relpath); struct Text *BKE_text_copy (struct Main *bmain, struct Text *ta); -void BKE_text_unlink (struct Main *bmain, struct Text *text); void BKE_text_clear (struct Text *text); void BKE_text_write (struct Text *text, const char *str); int BKE_text_file_modified_check(struct Text *text); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index df715531cb7..74930dbea4a 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -49,9 +49,6 @@ set(INC ../../../intern/smoke/extern ../../../intern/atomic ../../../intern/libmv - - # XXX - BAD LEVEL CALL WM_api.h - ../windowmanager ) set(INC_SYS diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 15492fbd20d..0805335da66 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -226,3 +226,56 @@ int BKE_blender_test_break(void) return (G.is_break == true); } + +/** \name Blender's AtExit + * + * \note Don't use MEM_mallocN so functions can be registered at any time. + * \{ */ + +struct AtExitData { + struct AtExitData *next; + + void (*func)(void *user_data); + void *user_data; +} *g_atexit = NULL; + +void BKE_blender_atexit_register(void (*func)(void *user_data), void *user_data) +{ + struct AtExitData *ae = malloc(sizeof(*ae)); + ae->next = g_atexit; + ae->func = func; + ae->user_data = user_data; + g_atexit = ae; +} + +void BKE_blender_atexit_unregister(void (*func)(void *user_data), const void *user_data) +{ + struct AtExitData *ae = g_atexit; + struct AtExitData **ae_p = &g_atexit; + + while (ae) { + if ((ae->func == func) && (ae->user_data == user_data)) { + *ae_p = ae->next; + free(ae); + return; + } + ae_p = &ae; + ae = ae->next; + } +} + +void BKE_blender_atexit(void) +{ + struct AtExitData *ae = g_atexit, *ae_next; + while (ae) { + ae_next = ae->next; + + ae->func(ae->user_data); + + free(ae); + ae = ae_next; + } + g_atexit = NULL; +} + +/** \} */ diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index ca0a1b91cea..d64bf7ecf43 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -66,9 +66,6 @@ #include "BLO_readfile.h" #include "BLO_writefile.h" -#include "WM_api.h" // XXXXX BAD, very BAD dependency (bad level call) - remove asap, elubie - - /* -------------------------------------------------------------------- */ /** \name Global Undo @@ -87,6 +84,15 @@ typedef struct UndoElem { static ListBase undobase = {NULL, NULL}; static UndoElem *curundo = NULL; +/** + * Avoid bad-level call to #WM_jobs_kill_all_except() + */ +static void (*undo_wm_job_kill_callback)(struct bContext *C) = NULL; + +void BKE_undo_callback_wm_kill_jobs_set(void (*callback)(struct bContext *C)) +{ + undo_wm_job_kill_callback = callback; +} static int read_undosave(bContext *C, UndoElem *uel) { @@ -94,7 +100,7 @@ static int read_undosave(bContext *C, UndoElem *uel) int success = 0, fileflags; /* This is needed so undoing/redoing doesn't crash with threaded previews going */ - WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); + undo_wm_job_kill_callback(C); BLI_strncpy(mainstr, G.main->name, sizeof(mainstr)); /* temporal store */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index a3e006a162f..44cacffb71f 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -216,21 +216,6 @@ void BKE_brush_free(Brush *brush) BKE_previewimg_free(&(brush->preview)); } -/** - * \note Currently users don't remove brushes from the UI (as is done for scene, text... etc) - * This is only used by RNA, which can remove brushes. - */ -void BKE_brush_unlink(Main *bmain, Brush *brush) -{ - Brush *brush_iter; - - for (brush_iter = bmain->brush.first; brush_iter; brush_iter = brush_iter->id.next) { - if (brush_iter->toggle_brush == brush) { - brush_iter->toggle_brush = NULL; - } - } -} - static void extern_local_brush(Brush *brush) { id_lib_extern((ID *)brush->mtex.tex); diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 7821946eb6e..e0277c38e61 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -565,7 +565,7 @@ BVHTree *bvhtree_from_mesh_verts( /** * Builds a bvh tree where nodes are the given vertices (note: does not copy given mverts!). * \param vert_allocated if true, vert freeing will be done when freeing data. - * \param mask if not null, true elements give which vert to add to BVH tree. + * \param verts_mask if not null, true elements give which vert to add to BVH tree. * \param verts_num_active if >= 0, number of active verts to add to BVH tree (else will be computed from mask). */ BVHTree *bvhtree_from_mesh_verts_ex( @@ -804,7 +804,7 @@ BVHTree *bvhtree_from_mesh_faces( * Builds a bvh tree where nodes are the given tessellated faces (note: does not copy given mfaces!). * \param vert_allocated if true, vert freeing will be done when freeing data. * \param face_allocated if true, face freeing will be done when freeing data. - * \param mask if not null, true elements give which faces to add to BVH tree. + * \param faces_mask: if not null, true elements give which faces to add to BVH tree. * \param numFaces_active if >= 0, number of active faces to add to BVH tree (else will be computed from mask). */ BVHTree *bvhtree_from_mesh_faces_ex( diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 267f7a65e00..159d5b82a6c 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -61,8 +61,6 @@ #include "GPU_shader.h" #include "GPU_basic_shader.h" -#include "WM_api.h" - #include <string.h> #include <limits.h> #include <math.h> @@ -699,10 +697,10 @@ static void cdDM_drawMappedFaces( } if ((orig != ORIGINDEX_NONE) && !is_hidden) - WM_framebuffer_index_get(orig + 1, &selcol); + GPU_select_index_get(orig + 1, &selcol); } else if (orig != ORIGINDEX_NONE) - WM_framebuffer_index_get(orig + 1, &selcol); + GPU_select_index_get(orig + 1, &selcol); for (j = 0; j < mpoly->totloop; j++) fi_map[start_element++] = selcol; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 98cbe47c7f9..49db75a0474 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -71,7 +71,7 @@ void BKE_displist_elem_free(DispList *dl) if (dl->verts) MEM_freeN(dl->verts); if (dl->nors) MEM_freeN(dl->nors); if (dl->index) MEM_freeN(dl->index); - if (dl->bevelSplitFlag) MEM_freeN(dl->bevelSplitFlag); + if (dl->bevel_split) MEM_freeN(dl->bevel_split); MEM_freeN(dl); } } @@ -144,8 +144,9 @@ void BKE_displist_copy(ListBase *lbn, ListBase *lb) dln->nors = MEM_dupallocN(dl->nors); dln->index = MEM_dupallocN(dl->index); - if (dl->bevelSplitFlag) - dln->bevelSplitFlag = MEM_dupallocN(dl->bevelSplitFlag); + if (dl->bevel_split) { + dln->bevel_split = MEM_dupallocN(dl->bevel_split); + } dl = dl->next; } @@ -1629,7 +1630,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if (dlb->type == DL_POLY) { dl->flag |= DL_CYCL_U; } - if ((bl->poly >= 0) && (steps != 2)) { + if ((bl->poly >= 0) && (steps > 2)) { dl->flag |= DL_CYCL_V; } @@ -1642,8 +1643,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba /* CU_2D conflicts with R_NOPUNOFLIP */ dl->rt = nu->flag & ~CU_2D; - dl->bevelSplitFlag = MEM_callocN(sizeof(*dl->bevelSplitFlag) * ((steps + 0x1F) >> 5), - "bevelSplitFlag"); + dl->bevel_split = BLI_BITMAP_NEW(steps, "bevel_split"); /* for each point of poly make a bevel piece */ bevp_first = bl->bevpoints; @@ -1683,7 +1683,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba } if (bevp->split_tag) { - dl->bevelSplitFlag[a >> 5] |= 1 << (a & 0x1F); + BLI_BITMAP_ENABLE(dl->bevel_split, a); } /* rotate bevel piece and write in data */ diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index ea99fa8f55a..c7a346d49ec 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -123,7 +123,7 @@ static IDType *idtype_from_code(short idcode) /** * Return if the ID code is a valid ID code. * - * \param code The code to check. + * \param idcode: The code to check. * \return Boolean, 0 when invalid. */ bool BKE_idcode_is_valid(short idcode) @@ -134,7 +134,7 @@ bool BKE_idcode_is_valid(short idcode) /** * Return non-zero when an ID type is linkable. * - * \param code The code to check. + * \param idcode: The code to check. * \return Boolean, 0 when non linkable. */ bool BKE_idcode_is_linkable(short idcode) @@ -147,7 +147,7 @@ bool BKE_idcode_is_linkable(short idcode) /** * Convert an idcode into a name. * - * \param code The code to convert. + * \param idcode: The code to convert. * \return A static string representing the name of * the code. */ @@ -258,7 +258,7 @@ short BKE_idcode_from_idfilter(const int idfilter) /** * Convert an idcode into a name (plural). * - * \param code The code to convert. + * \param idcode: The code to convert. * \return A static string representing the name of * the code. */ @@ -272,7 +272,7 @@ const char *BKE_idcode_to_name_plural(short idcode) /** * Convert an idcode into its translations' context. * - * \param code The code to convert. + * \param idcode: The code to convert. * \return A static string representing the i18n context of the code. */ const char *BKE_idcode_to_translation_context(short idcode) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 14a445649ad..69384a70969 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -95,8 +95,6 @@ #include "DNA_screen_types.h" #include "DNA_view3d_types.h" -#include "WM_api.h" - static SpinLock image_spin; /* prototypes */ diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index 9335d41f399..3747b09fd99 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -162,15 +162,14 @@ static int foreach_libblock_remap_callback(void *user_data, ID *UNUSED(id_self), } if (*id_p && (*id_p == old_id)) { + const bool is_indirect = (id->lib != NULL); + const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0; /* Note: proxy usage implies LIB_TAG_EXTERN, so on this aspect it is direct, * on the other hand since they get reset to lib data on file open/reload it is indirect too... * Edit Mode is also a 'skip direct' case. */ const bool is_obj = (GS(id->name) == ID_OB); const bool is_proxy = (is_obj && (((Object *)id)->proxy || ((Object *)id)->proxy_group)); const bool is_obj_editmode = (is_obj && BKE_object_is_in_editmode((Object *)id)); - /* Note that indirect data from same file as processed ID is **not** considered indirect! */ - const bool is_indirect = ((id->lib != NULL) && (id->lib != old_id->lib)); - const bool skip_indirect = (id_remap_data->flag & ID_REMAP_SKIP_INDIRECT_USAGE) != 0; const bool is_never_null = ((cb_flag & IDWALK_NEVER_NULL) && (new_id == NULL) && (id_remap_data->flag & ID_REMAP_FORCE_NEVER_NULL_USAGE) == 0); const bool skip_never_null = (id_remap_data->flag & ID_REMAP_SKIP_NEVER_NULL_USAGE) != 0; @@ -184,7 +183,7 @@ static int foreach_libblock_remap_callback(void *user_data, ID *UNUSED(id_self), (is_obj_editmode && (((Object *)id)->data == *id_p)) || (skip_indirect && (is_proxy || is_indirect))) { - if (is_never_null || is_proxy || is_obj_editmode) { + if (!is_indirect && (is_never_null || is_proxy || is_obj_editmode)) { id_remap_data->skipped_direct++; } else { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 4e47dfcce74..f82e5cf61b3 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -427,12 +427,6 @@ bool BKE_mesh_has_custom_loop_normals(Mesh *me) } } -/* Note: unlinking is called when me->id.us is 0, question remains how - * much unlinking of Library data in Mesh should be done... probably - * we need a more generic method, like the expand() functions in - * readfile.c */ - - /** Free (or release) any data used by this mesh (does not free the mesh itself). */ void BKE_mesh_free(Mesh *me) { diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 5f667732b04..f99457a4c26 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1491,73 +1491,6 @@ void BKE_movieclip_free(MovieClip *clip) BKE_tracking_free(&clip->tracking); } -void BKE_movieclip_unlink(Main *bmain, MovieClip *clip) -{ - bScreen *scr; - ScrArea *area; - SpaceLink *sl; - Scene *sce; - Object *ob; - - for (scr = bmain->screen.first; scr; scr = scr->id.next) { - for (area = scr->areabase.first; area; area = area->next) { - for (sl = area->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_CLIP) { - SpaceClip *sc = (SpaceClip *) sl; - - if (sc->clip == clip) - sc->clip = NULL; - } - else if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *) sl; - BGpic *bgpic; - - for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) { - if (bgpic->clip == clip) - bgpic->clip = NULL; - } - } - } - } - } - - for (sce = bmain->scene.first; sce; sce = sce->id.next) { - if (sce->clip == clip) - sce->clip = NULL; - } - - for (ob = bmain->object.first; ob; ob = ob->id.next) { - bConstraint *con; - - for (con = ob->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_FOLLOWTRACK) { - bFollowTrackConstraint *data = (bFollowTrackConstraint *) con->data; - - if (data->clip == clip) - data->clip = NULL; - } - else if (con->type == CONSTRAINT_TYPE_CAMERASOLVER) { - bCameraSolverConstraint *data = (bCameraSolverConstraint *) con->data; - - if (data->clip == clip) - data->clip = NULL; - } - else if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) { - bObjectSolverConstraint *data = (bObjectSolverConstraint *) con->data; - - if (data->clip == clip) - data->clip = NULL; - } - } - } - - FOREACH_NODETREE(bmain, ntree, id) { - BKE_node_tree_unlink_id((ID *)clip, ntree); - } FOREACH_NODETREE_END - - clip->id.us = 0; -} - float BKE_movieclip_remap_scene_to_clip_frame(MovieClip *clip, float framenr) { return framenr - (float) clip->start_frame + 1.0f; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 594f9dffbee..fdc2edba57f 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -498,191 +498,6 @@ Text *BKE_text_copy(Main *bmain, Text *ta) return tan; } -void BKE_text_unlink(Main *bmain, Text *text) -{ - bScreen *scr; - ScrArea *area; - SpaceLink *sl; - Object *ob; - bController *cont; - bActuator *act; - bConstraint *con; - bNodeTree *ntree; - bNode *node; - Material *mat; - Lamp *la; - Tex *te; - World *wo; - FreestyleLineStyle *linestyle; - Scene *sce; - SceneRenderLayer *srl; - FreestyleModuleConfig *module; - bool update; - - for (ob = bmain->object.first; ob; ob = ob->id.next) { - /* game controllers */ - for (cont = ob->controllers.first; cont; cont = cont->next) { - if (cont->type == CONT_PYTHON) { - bPythonCont *pc; - - pc = cont->data; - if (pc->text == text) pc->text = NULL; - } - } - /* game actuators */ - for (act = ob->actuators.first; act; act = act->next) { - if (act->type == ACT_2DFILTER) { - bTwoDFilterActuator *tfa; - - tfa = act->data; - if (tfa->text == text) tfa->text = NULL; - } - } - - /* pyconstraints */ - update = 0; - - if (ob->type == OB_ARMATURE && ob->pose) { - bPoseChannel *pchan; - for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { - for (con = pchan->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_PYTHON) { - bPythonConstraint *data = con->data; - if (data->text == text) data->text = NULL; - update = 1; - - } - } - } - } - - for (con = ob->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_PYTHON) { - bPythonConstraint *data = con->data; - if (data->text == text) data->text = NULL; - update = 1; - } - } - - if (update) - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - } - - /* nodes */ - for (la = bmain->lamp.first; la; la = la->id.next) { - ntree = la->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == NODE_FRAME) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - for (linestyle = bmain->linestyle.first; linestyle; linestyle = linestyle->id.next) { - ntree = linestyle->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == NODE_FRAME) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - for (mat = bmain->mat.first; mat; mat = mat->id.next) { - ntree = mat->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (ELEM(node->type, SH_NODE_SCRIPT, NODE_FRAME)) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - for (te = bmain->tex.first; te; te = te->id.next) { - ntree = te->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == NODE_FRAME) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - for (wo = bmain->world.first; wo; wo = wo->id.next) { - ntree = wo->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == NODE_FRAME) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - for (sce = bmain->scene.first; sce; sce = sce->id.next) { - ntree = sce->nodetree; - if (!ntree) - continue; - for (node = ntree->nodes.first; node; node = node->next) { - if (node->type == NODE_FRAME) { - Text *ntext = (Text *)node->id; - if (ntext == text) node->id = NULL; - } - } - - /* Freestyle (while looping over the scene) */ - for (srl = sce->r.layers.first; srl; srl = srl->next) { - for (module = srl->freestyleConfig.modules.first; module; module = module->next) { - if (module->script == text) - module->script = NULL; - } - } - } - - for (ntree = bmain->nodetree.first; ntree; ntree = ntree->id.next) { - for (node = ntree->nodes.first; node; node = node->next) { - if (ELEM(node->type, SH_NODE_SCRIPT, NODE_FRAME)) { - if ((Text *)node->id == text) { - node->id = NULL; - } - } - } - } - - /* text space */ - for (scr = bmain->screen.first; scr; scr = scr->id.next) { - for (area = scr->areabase.first; area; area = area->next) { - for (sl = area->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_TEXT) { - SpaceText *st = (SpaceText *) sl; - - if (st->text == text) { - st->text = NULL; - st->top = 0; - } - } - } - } - } - - text->id.us = 0; -} - void BKE_text_clear(Text *text) /* called directly from rna */ { int oldstate; |