Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-05-03 13:51:53 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-05-03 13:54:59 +0400
commitb7f085d9c128f31d576c732c6439b5a71e8922ee (patch)
tree8a1fdc2e95470f61d9121b18b125dc272e87d536 /source/blender/editors/space_buttons/buttons_texture.c
parent6ec2d72eca618be05e9bf0723886b10e6d5efa46 (diff)
Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle Reviewed By: brecht, kjym3 Differential Revision: https://developer.blender.org/D246
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_texture.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_texture.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 7c42ea9a13b..4ba0ddaed50 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -51,6 +51,8 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_world_types.h"
+#include "DNA_linestyle_types.h"
+
#include "BKE_context.h"
#include "BKE_material.h"
@@ -99,6 +101,13 @@ bool ED_texture_context_check_particles(const bContext *C)
return (ob && ob->particlesystem.first);
}
+bool ED_texture_context_check_linestyle(const bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ FreestyleLineStyle *ls = CTX_data_linestyle_from_scene(scene);
+ return (scene && (scene->r.mode & R_EDGE_FRS) && ls && (ls->flag & LS_TEXTURE));
+}
+
static void texture_context_check_modifier_foreach(void *userData, Object *UNUSED(ob), ModifierData *UNUSED(md),
const char *UNUSED(propname))
{
@@ -148,6 +157,7 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts)
bool valid_material = ED_texture_context_check_material(C);
bool valid_lamp = ED_texture_context_check_lamp(C);
bool valid_particles = ED_texture_context_check_particles(C);
+ bool valid_linestyle = ED_texture_context_check_linestyle(C);
bool valid_others = ED_texture_context_check_others(C);
/* this is similar to direct user action, no need to keep "better" ctxt in _prev */
@@ -163,6 +173,9 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts)
else if ((sbuts->mainb == BCONTEXT_PARTICLE) && valid_particles) {
sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_PARTICLES;
}
+ else if ((sbuts->mainb == BCONTEXT_RENDER_LAYER) && valid_linestyle) {
+ sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_LINESTYLE;
+ }
else if ((ELEM(sbuts->mainb, BCONTEXT_MODIFIER, BCONTEXT_PHYSICS)) && valid_others) {
sbuts->texture_context = sbuts->texture_context_prev = SB_TEXC_OTHER;
}
@@ -172,6 +185,7 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts)
((sbuts->texture_context_prev == SB_TEXC_MATERIAL) && valid_material) ||
((sbuts->texture_context_prev == SB_TEXC_LAMP) && valid_lamp) ||
((sbuts->texture_context_prev == SB_TEXC_PARTICLES) && valid_particles) ||
+ ((sbuts->texture_context_prev == SB_TEXC_LINESTYLE) && valid_linestyle) ||
((sbuts->texture_context_prev == SB_TEXC_OTHER) && valid_others)))
{
sbuts->texture_context = sbuts->texture_context_prev;
@@ -181,6 +195,7 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts)
((sbuts->texture_context == SB_TEXC_MATERIAL) && !valid_material) ||
((sbuts->texture_context == SB_TEXC_LAMP) && !valid_lamp) ||
((sbuts->texture_context == SB_TEXC_PARTICLES) && !valid_particles) ||
+ ((sbuts->texture_context == SB_TEXC_LINESTYLE) && !valid_linestyle) ||
((sbuts->texture_context == SB_TEXC_OTHER) && !valid_others))
{
/* this is default fallback, do keep "better" ctxt in _prev */
@@ -194,6 +209,9 @@ static void set_texture_context(const bContext *C, SpaceButs *sbuts)
else if (valid_particles) {
sbuts->texture_context = SB_TEXC_PARTICLES;
}
+ else if (valid_linestyle) {
+ sbuts->texture_context = SB_TEXC_LINESTYLE;
+ }
else if (valid_world) {
sbuts->texture_context = SB_TEXC_WORLD;
}
@@ -284,6 +302,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
Material *ma = NULL;
Lamp *la = NULL;
World *wrld = NULL;
+ FreestyleLineStyle *linestyle = NULL;
Brush *brush = NULL;
ID *pinid = sbuts->pinid;
bool limited_mode = (sbuts->flag & SB_TEX_USER_LIMITED) != 0;
@@ -302,6 +321,8 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
ma = (Material *)pinid;
else if (GS(pinid->name) == ID_BR)
brush = (Brush *)pinid;
+ else if (GS(pinid->name) == ID_LS)
+ linestyle = (FreestyleLineStyle *)pinid;
}
if (!scene)
@@ -311,6 +332,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);
}
if (ob && ob->type == OB_LAMP && !la)
@@ -327,6 +349,8 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
buttons_texture_users_find_nodetree(users, &la->id, la->nodetree, "Lamp");
if (wrld && !limited_mode)
buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World");
+ if (linestyle && !limited_mode)
+ buttons_texture_users_find_nodetree(users, &linestyle->id, linestyle->nodetree, "LineStyle");
if (ob) {
ParticleSystem *psys = psys_get_current(ob);