more fixes relating to [#36878], freestyle was only checking for NULL linestyles in some places.

This commit is contained in:
Campbell Barton
2013-09-30 09:28:43 +00:00
parent 65233bc49e
commit b6ea073af2
4 changed files with 20 additions and 10 deletions

View File

@@ -107,7 +107,8 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con
static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset)
{
new_lineset->linestyle = lineset->linestyle;
new_lineset->linestyle->id.us++;
if (lineset->linestyle)
new_lineset->linestyle->id.us++;
new_lineset->flags = lineset->flags;
new_lineset->selection = lineset->selection;
new_lineset->qi = lineset->qi;

View File

@@ -643,7 +643,9 @@ void BKE_object_unlink(Object *ob)
for (lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first;
lineset; lineset = lineset->next)
{
BKE_unlink_linestyle_target_object(lineset->linestyle, ob);
if (lineset->linestyle) {
BKE_unlink_linestyle_target_object(lineset->linestyle, ob);
}
}
}
}

View File

@@ -1546,7 +1546,9 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
for (srl = sce->r.layers.first; srl; srl = srl->next) {
for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
lineset->linestyle->id.flag |= LIB_DOIT;
if (lineset->linestyle) {
lineset->linestyle->id.flag |= LIB_DOIT;
}
}
}
@@ -1562,8 +1564,11 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
if (!(linestyle->id.flag & LIB_DOIT))
if ((linestyle == NULL) ||
!(linestyle->id.flag & LIB_DOIT))
{
continue;
}
linestyle->id.flag &= ~LIB_DOIT;
/* add scene-level animation channels */

View File

@@ -369,7 +369,7 @@ static void prepare(Main *bmain, Render *re, SceneRenderLayer *srl)
if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
if (G.debug & G_DEBUG_FREESTYLE) {
cout << " " << layer_count+1 << ": " << lineset->name << " - " <<
lineset->linestyle->id.name + 2 << endl;
(lineset->linestyle ? (lineset->linestyle->id.name + 2) : "<NULL>") << endl;
}
Text *text = create_lineset_handler(bmain, srl->name, lineset->name);
controller->InsertStyleModule(layer_count, lineset->name, text);
@@ -680,9 +680,11 @@ void FRS_paste_active_lineset(FreestyleConfig *config)
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
if (lineset) {
lineset->linestyle->id.us--;
if (lineset->linestyle)
lineset->linestyle->id.us--;
lineset->linestyle = lineset_buffer.linestyle;
lineset->linestyle->id.us++;
if (lineset->linestyle)
lineset->linestyle->id.us++;
lineset->flags = lineset_buffer.flags;
lineset->selection = lineset_buffer.selection;
lineset->qi = lineset_buffer.qi;
@@ -711,10 +713,10 @@ void FRS_delete_active_lineset(FreestyleConfig *config)
if (lineset) {
if (lineset->group) {
lineset->group->id.us--;
lineset->group = NULL;
}
lineset->linestyle->id.us--;
lineset->linestyle = NULL;
if (lineset->linestyle) {
lineset->linestyle->id.us--;
}
BLI_remlink(&config->linesets, lineset);
MEM_freeN(lineset);
BKE_freestyle_lineset_set_active_index(config, 0);