[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60460] trunk/blender: Follow-up to r60433 (related to Bug #36878): additional checks for NULL line styles.
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Tue Oct 1 01:02:29 CEST 2013
Revision: 60460
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60460
Author: kjym3
Date: 2013-09-30 23:02:29 +0000 (Mon, 30 Sep 2013)
Log Message:
-----------
Follow-up to r60433 (related to Bug #36878): additional checks for NULL line styles.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60433
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/properties_freestyle.py
trunk/blender/source/blender/blenkernel/intern/freestyle.c
trunk/blender/source/blender/editors/render/render_shading.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_freestyle.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_freestyle.py 2013-09-30 23:00:47 UTC (rev 60459)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_freestyle.py 2013-09-30 23:02:29 UTC (rev 60460)
@@ -530,6 +530,8 @@
linestyle = lineset.linestyle
layout.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
+ if linestyle is None:
+ return
row = layout.row(align=True)
row.prop(linestyle, "panel", expand=True)
if linestyle.panel == 'STROKES':
Modified: trunk/blender/source/blender/blenkernel/intern/freestyle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/freestyle.c 2013-09-30 23:00:47 UTC (rev 60459)
+++ trunk/blender/source/blender/blenkernel/intern/freestyle.c 2013-09-30 23:02:29 UTC (rev 60460)
@@ -107,7 +107,7 @@
static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset)
{
new_lineset->linestyle = lineset->linestyle;
- if (lineset->linestyle)
+ if (new_lineset->linestyle)
new_lineset->linestyle->id.us++;
new_lineset->flags = lineset->flags;
new_lineset->selection = lineset->selection;
Modified: trunk/blender/source/blender/editors/render/render_shading.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_shading.c 2013-09-30 23:00:47 UTC (rev 60459)
+++ trunk/blender/source/blender/editors/render/render_shading.c 2013-09-30 23:02:29 UTC (rev 60460)
@@ -860,8 +860,12 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to");
return OPERATOR_CANCELLED;
}
- lineset->linestyle->id.us--;
- lineset->linestyle = BKE_copy_linestyle(lineset->linestyle);
+ if (lineset->linestyle) {
+ lineset->linestyle->id.us--;
+ lineset->linestyle = BKE_copy_linestyle(lineset->linestyle);
+ } else {
+ lineset->linestyle = BKE_new_linestyle("LineStyle", NULL);
+ }
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -894,6 +898,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_color_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type");
return OPERATOR_CANCELLED;
@@ -933,6 +941,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_alpha_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type");
return OPERATOR_CANCELLED;
@@ -972,6 +984,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_thickness_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type");
return OPERATOR_CANCELLED;
@@ -1011,6 +1027,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_add_linestyle_geometry_modifier(lineset->linestyle, type) == NULL) {
BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type");
return OPERATOR_CANCELLED;
@@ -1064,6 +1084,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
@@ -1114,6 +1138,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
@@ -1165,6 +1193,10 @@
BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to");
return OPERATOR_CANCELLED;
}
+ if (!lineset->linestyle) {
+ BKE_report(op->reports, RPT_ERROR, "The active lineset does not have a line style (indicating data corruption)");
+ return OPERATOR_CANCELLED;
+ }
switch (freestyle_get_modifier_type(&ptr)) {
case LS_MODIFIER_TYPE_COLOR:
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2013-09-30 23:00:47 UTC (rev 60459)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2013-09-30 23:02:29 UTC (rev 60460)
@@ -1541,7 +1541,8 @@
{
FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
- lineset->linestyle->id.us--;
+ if (lineset->linestyle)
+ lineset->linestyle->id.us--;
lineset->linestyle = (FreestyleLineStyle *)value.data;
lineset->linestyle->id.us++;
}
More information about the Bf-blender-cvs
mailing list