Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-05 01:02:43 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-05 01:02:43 +0400
commit5dd9f7635afeda66ca4475288b1eb7ad621486f4 (patch)
tree731ca793fb25b3ee986abaca0c08b4f90c74a06d /source/blender/blenkernel/intern/text.c
parent670296dabe9c4c5444c696af54e1b4ef07a8e60b (diff)
2.5
Make local and make single user are back for ID template. Internally these calls got unified, id_make_local and id_copy are now used to do these operations for all types that support it. Also reveals that for some ID types the implementation is still missing. Further, some small changes: * unlink_text is now in blenkernel. * copy_group was implemented. * ID template now has an open operator again. * fix preview to not change material reference count, even if temporary it shows up with threaded preview. * id_unlink unifies unlink for text, object and group.
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c93
1 files changed, 90 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 8e3d59bbc58..dac426de4eb 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -37,14 +37,22 @@
#include "BLI_blenlib.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_controller_types.h"
#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
#include "DNA_text_types.h"
-#include "BKE_utildefines.h"
-#include "BKE_text.h"
-#include "BKE_library.h"
+#include "BKE_depsgraph.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_text.h"
+#include "BKE_utildefines.h"
#ifndef DISABLE_PYTHON
#include "BPY_extern.h"
@@ -451,6 +459,85 @@ Text *copy_text(Text *ta)
return tan;
}
+void unlink_text(Main *bmain, Text *text)
+{
+ bScreen *scr;
+ ScrArea *area;
+ SpaceLink *sl;
+ Scene *scene;
+ Object *ob;
+ bController *cont;
+ bConstraint *con;
+ short update;
+
+ /* dome */
+ for(scene=bmain->scene.first; scene; scene=scene->id.next)
+ if(scene->r.dometext == text)
+ scene->r.dometext = NULL;
+
+ 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;
+ }
+ }
+
+ /* 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_flush_update(&ob->id, OB_RECALC_DATA);
+ }
+
+ /* pynodes */
+ // XXX nodeDynamicUnlinkText(&text->id);
+
+ /* 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;
+}
+
+
/*****************************/
/* Editing utility functions */
/*****************************/