[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33385] branches/soc-2008-mxcurioni/source /blender: Fix for properly unlinking target object pointers when objects are deleted
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Mon Nov 29 22:24:55 CET 2010
Revision: 33385
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33385
Author: kjym3
Date: 2010-11-29 22:24:55 +0100 (Mon, 29 Nov 2010)
Log Message:
-----------
Fix for properly unlinking target object pointers when objects are deleted
from scenes.
Modified Paths:
--------------
branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h
branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/object.c
branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h 2010-11-29 20:57:02 UTC (rev 33384)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h 2010-11-29 21:24:55 UTC (rev 33385)
@@ -39,6 +39,7 @@
#define LS_MODIFIER_TYPE_THICKNESS 3
struct Main;
+struct Object;
FreestyleLineStyle *FRS_new_linestyle(char *name, struct Main *main);
void FRS_free_linestyle(FreestyleLineStyle *linestyle);
@@ -58,4 +59,6 @@
void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase);
char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp);
+void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob);
+
#endif
Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c 2010-11-29 20:57:02 UTC (rev 33384)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c 2010-11-29 21:24:55 UTC (rev 33385)
@@ -368,3 +368,30 @@
found:
return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", m->name);
}
+
+void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob)
+{
+ LineStyleModifier *m;
+
+ for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) {
+ if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+ if (((LineStyleColorModifier_DistanceFromObject *)m)->target == ob) {
+ ((LineStyleColorModifier_DistanceFromObject *)m)->target = NULL;
+ }
+ }
+ }
+ for (m = (LineStyleModifier *)linestyle->alpha_modifiers.first; m; m = m->next) {
+ if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+ if (((LineStyleAlphaModifier_DistanceFromObject *)m)->target == ob) {
+ ((LineStyleAlphaModifier_DistanceFromObject *)m)->target = NULL;
+ }
+ }
+ }
+ for (m = (LineStyleModifier *)linestyle->thickness_modifiers.first; m; m = m->next) {
+ if (m->type == LS_MODIFIER_DISTANCE_FROM_OBJECT) {
+ if (((LineStyleThicknessModifier_DistanceFromObject *)m)->target == ob) {
+ ((LineStyleThicknessModifier_DistanceFromObject *)m)->target = NULL;
+ }
+ }
+ }
+}
Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/object.c 2010-11-29 20:57:02 UTC (rev 33384)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/object.c 2010-11-29 21:24:55 UTC (rev 33385)
@@ -102,6 +102,8 @@
#include "GPU_material.h"
+#include "FRS_freestyle.h"
+
/* Local function protos */
static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul);
@@ -577,6 +579,14 @@
}
SEQ_END
}
+
+ {
+ SceneRenderLayer *srl;
+
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
+ FRS_unlink_target_object(&srl->freestyleConfig, ob);
+ }
+ }
}
sce= sce->id.next;
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h 2010-11-29 20:57:02 UTC (rev 33384)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h 2010-11-29 21:24:55 UTC (rev 33385)
@@ -39,6 +39,7 @@
#include "DNA_scene_types.h"
#include "BKE_context.h"
+ #include "BKE_object.h"
extern Scene *freestyle_scene;
extern float freestyle_viewpoint[3];
@@ -71,6 +72,8 @@
short FRS_get_active_lineset_index(FreestyleConfig *config);
void FRS_set_active_lineset_index(FreestyleConfig *config, short index);
+ void FRS_unlink_target_object(FreestyleConfig *config, struct Object *ob);
+
#ifdef __cplusplus
}
#endif
Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp 2010-11-29 20:57:02 UTC (rev 33384)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp 2010-11-29 21:24:55 UTC (rev 33385)
@@ -519,6 +519,15 @@
}
}
+ void FRS_unlink_target_object(FreestyleConfig *config, Object *ob)
+ {
+ FreestyleLineSet *lineset;
+
+ for(lineset=(FreestyleLineSet *)config->linesets.first; lineset; lineset=lineset->next) {
+ FRS_unlink_linestyle_target_object(lineset->linestyle, ob);
+ }
+ }
+
#ifdef __cplusplus
}
#endif
More information about the Bf-blender-cvs
mailing list