more fixes relating to [#36878], freestyle was only checking for NULL linestyles in some places.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user