From 647969f9b617b0ef6d49d7502aef7c1035769bc0 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Wed, 16 Jul 2014 13:36:39 +0900 Subject: Renamed CTX_data_linestyle_from_scene() to BKE_get_linestyle_from_scene(). The function is to retrieve the active line style ID datablock from a scene and there is nothing related to bContext. --- source/blender/blenkernel/BKE_context.h | 1 - source/blender/blenkernel/BKE_linestyle.h | 2 ++ source/blender/blenkernel/intern/context.c | 14 -------------- source/blender/blenkernel/intern/linestyle.c | 13 +++++++++++++ source/blender/editors/space_buttons/buttons_context.c | 3 ++- source/blender/editors/space_buttons/buttons_texture.c | 4 ++-- source/blender/nodes/texture/node_texture_tree.c | 3 ++- 7 files changed, 21 insertions(+), 19 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index e30c8ecee2b..877e376b343 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -234,7 +234,6 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBas struct Main *CTX_data_main(const bContext *C); struct Scene *CTX_data_scene(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); -struct FreestyleLineStyle *CTX_data_linestyle_from_scene(struct Scene *scene); const char *CTX_data_mode_string(const bContext *C); int CTX_data_mode_enum(const bContext *C); diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index 8bc8cc44d92..3b448e1c402 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -48,6 +48,8 @@ FreestyleLineStyle *BKE_new_linestyle(const char *name, struct Main *main); void BKE_free_linestyle(FreestyleLineStyle *linestyle); FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle); +FreestyleLineStyle *BKE_get_linestyle_from_scene(struct Scene *scene); + LineStyleModifier *BKE_add_linestyle_color_modifier(FreestyleLineStyle *linestyle, const char *name, int type); LineStyleModifier *BKE_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, const char *name, int type); LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, const char *name, int type); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 47b29b49689..de285f87444 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -48,7 +48,6 @@ #include "BKE_context.h" #include "BKE_main.h" #include "BKE_screen.h" -#include "BKE_freestyle.h" #include "RNA_access.h" @@ -1091,16 +1090,3 @@ int CTX_data_visible_pose_bones(const bContext *C, ListBase *list) { return ctx_data_collection_get(C, "visible_pose_bones", list); } - -FreestyleLineStyle *CTX_data_linestyle_from_scene(Scene *scene) -{ - SceneRenderLayer *actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleConfig *config = &actsrl->freestyleConfig; - FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - - if (lineset) { - return lineset->linestyle; - } - - return NULL; -} diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index d92fa328e87..5d51eb09b6e 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -43,6 +43,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BKE_freestyle.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_linestyle.h" @@ -209,6 +210,18 @@ FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle) return new_linestyle; } +FreestyleLineStyle *BKE_get_linestyle_from_scene(Scene *scene) +{ + SceneRenderLayer *actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay); + FreestyleConfig *config = &actsrl->freestyleConfig; + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); + + if (lineset) { + return lineset->linestyle; + } + return NULL; +} + static LineStyleModifier *new_modifier(const char *name, int type, size_t size) { LineStyleModifier *m; diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 5fcceb25e4e..fc9ac27b5b8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -55,6 +55,7 @@ #include "BKE_particle.h" #include "BKE_screen.h" #include "BKE_texture.h" +#include "BKE_linestyle.h" #include "RNA_access.h" @@ -153,7 +154,7 @@ static int buttons_context_path_linestyle(ButsContextPath *path) /* if we have a scene, use the lineset's linestyle */ else if (buttons_context_path_scene(path)) { scene = path->ptr[path->len - 1].data; - linestyle = CTX_data_linestyle_from_scene(scene); + linestyle = BKE_get_linestyle_from_scene(scene); if (linestyle) { RNA_id_pointer_create(&linestyle->id, &path->ptr[path->len]); path->len++; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index 0aa3e47df4b..930a05088b1 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -53,8 +53,8 @@ #include "DNA_world_types.h" #include "DNA_linestyle_types.h" - #include "BKE_context.h" +#include "BKE_linestyle.h" #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_node.h" @@ -352,7 +352,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext * ob = (scene->basact) ? scene->basact->object : NULL; wrld = scene->world; brush = BKE_paint_brush(BKE_paint_get_active_from_context(C)); - linestyle = CTX_data_linestyle_from_scene(scene); + linestyle = BKE_get_linestyle_from_scene(scene); } if (ob && ob->type == OB_LAMP && !la) diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 882c843f317..a79b95525d3 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -44,6 +44,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_linestyle.h" #include "BKE_main.h" #include "BKE_node.h" #include "BKE_paint.h" @@ -110,7 +111,7 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr } } else if (snode->texfrom == SNODE_TEX_LINESTYLE) { - FreestyleLineStyle *linestyle = CTX_data_linestyle_from_scene(scene); + FreestyleLineStyle *linestyle = BKE_get_linestyle_from_scene(scene); if (linestyle) { *r_from = (ID *)linestyle; tx = give_current_linestyle_texture(linestyle); -- cgit v1.2.3