diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-19 06:33:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-03-19 06:34:14 +0300 |
commit | 2a2bf3c1ab1f9f844a66d1f5f69232d64e16d678 (patch) | |
tree | 46cbf2a670b469789dbc1ba1d0aa1d05dc5790e5 /source/blender/blenkernel/intern | |
parent | 9b54c88e0fdadf3a42cdd85bab68766dc83861a5 (diff) |
Freestyle: pass Main struct to new/copy
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/freestyle.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 11 |
3 files changed, 7 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index cc9ad63d451..f6c4263cff7 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -179,7 +179,7 @@ static FreestyleLineSet *alloc_lineset(void) return (FreestyleLineSet *)MEM_callocN(sizeof(FreestyleLineSet), "Freestyle line set"); } -FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config, const char *name) +FreestyleLineSet *BKE_freestyle_lineset_add(struct Main *bmain, FreestyleConfig *config, const char *name) { int lineset_index = BLI_listbase_count(&config->linesets); @@ -187,7 +187,7 @@ FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config, const char BLI_addtail(&config->linesets, (void *)lineset); BKE_freestyle_lineset_set_active_index(config, lineset_index); - lineset->linestyle = BKE_linestyle_new("LineStyle", NULL); + lineset->linestyle = BKE_linestyle_new(bmain, "LineStyle"); lineset->flags |= FREESTYLE_LINESET_ENABLED; lineset->selection = FREESTYLE_SEL_VISIBILITY | FREESTYLE_SEL_EDGE_TYPES | FREESTYLE_SEL_IMAGE_BORDER; lineset->qi = FREESTYLE_QI_VISIBLE; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index c602067d5bd..9cda4d91933 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -384,7 +384,7 @@ bool id_copy(ID *id, ID **newid, bool test) if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id); return true; case ID_LS: - if (!test) *newid = (ID *)BKE_linestyle_copy((FreestyleLineStyle *)id); + if (!test) *newid = (ID *)BKE_linestyle_copy(G.main, (FreestyleLineStyle *)id); return true; } diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index b97bf0ed9b0..28b7ceded67 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -107,14 +107,11 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle) linestyle->caps = LS_CAPS_BUTT; } -FreestyleLineStyle *BKE_linestyle_new(const char *name, struct Main *main) +FreestyleLineStyle *BKE_linestyle_new(struct Main *bmain, const char *name) { FreestyleLineStyle *linestyle; - if (!main) - main = G.main; - - linestyle = (FreestyleLineStyle *)BKE_libblock_alloc(main, ID_LS, name); + linestyle = (FreestyleLineStyle *)BKE_libblock_alloc(bmain, ID_LS, name); default_linestyle_settings(linestyle); @@ -149,13 +146,13 @@ void BKE_linestyle_free(FreestyleLineStyle *linestyle) BKE_linestyle_geometry_modifier_remove(linestyle, m); } -FreestyleLineStyle *BKE_linestyle_copy(FreestyleLineStyle *linestyle) +FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *linestyle) { FreestyleLineStyle *new_linestyle; LineStyleModifier *m; int a; - new_linestyle = BKE_linestyle_new(linestyle->id.name + 2, NULL); + new_linestyle = BKE_linestyle_new(bmain, linestyle->id.name + 2); BKE_linestyle_free(new_linestyle); for (a = 0; a < MAX_MTEX; a++) { |