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
path: root/source
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-11-30 00:24:55 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-11-30 00:24:55 +0300
commit2f52fa782077e8b18d86062ad9dea6a19114d8bc (patch)
tree220d1c73a2f5ce49dfaf073e2fa83c3730898461 /source
parent7f2829d30e9e39820afb3c756e78b9d72bb5c992 (diff)
Fix for properly unlinking target object pointers when objects are deleted
from scenes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_linestyle.h3
-rw-r--r--source/blender/blenkernel/intern/linestyle.c27
-rw-r--r--source/blender/blenkernel/intern/object.c10
-rw-r--r--source/blender/freestyle/FRS_freestyle.h3
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp9
5 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h
index 2e68ab38ecd..ebbfe7c5559 100644
--- a/source/blender/blenkernel/BKE_linestyle.h
+++ b/source/blender/blenkernel/BKE_linestyle.h
@@ -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_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineSt
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
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 4b12473eda2..f6f8378cebc 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -368,3 +368,30 @@ char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *c
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;
+ }
+ }
+ }
+}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index fe557dfefa0..79818ba6799 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -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 @@ void unlink_object(Object *ob)
}
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;
diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h
index 8252e932215..ae8adb86c1c 100644
--- a/source/blender/freestyle/FRS_freestyle.h
+++ b/source/blender/freestyle/FRS_freestyle.h
@@ -39,6 +39,7 @@ extern "C" {
#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 @@ extern "C" {
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
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 5fb472865e6..7cb7349f61d 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -519,6 +519,15 @@ extern "C" {
}
}
+ 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