Freestyle: added more conditions to be able to switch to the line style texture properties context.

This commit is contained in:
Tamito Kajiyama 2014-05-05 19:53:13 +09:00
parent fd7f5c4230
commit a6f92cd29a
2 changed files with 26 additions and 2 deletions

@ -525,12 +525,20 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
static bool buttons_context_linestyle_pinnable(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
SceneRenderLayer *actsrl;
FreestyleConfig *config;
SpaceButs *sbuts;
/* if Freestyle is disabled in the scene */
if ((scene->r.mode & R_EDGE_FRS) == 0) {
return false;
}
/* if Freestyle is not in the Parameter Editor mode */
actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
config = &actsrl->freestyleConfig;
if (config->mode != FREESTYLE_CONTROL_EDITOR_MODE) {
return false;
}
/* if the scene has already been pinned */
sbuts = CTX_wm_space_buts(C);
if (sbuts->pinid && sbuts->pinid == &scene->id) {

@ -61,6 +61,7 @@
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
#include "BKE_freestyle.h"
#include "RNA_access.h"
@ -104,8 +105,23 @@ bool ED_texture_context_check_particles(const bContext *C)
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));
SceneRenderLayer *actsrl;
FreestyleConfig *config;
FreestyleLineSet *lineset;
FreestyleLineStyle *linestyle;
if (scene && (scene->r.mode & R_EDGE_FRS)) {
actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
config = &actsrl->freestyleConfig;
if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) {
lineset = BKE_freestyle_lineset_get_active(config);
if (lineset) {
linestyle = lineset->linestyle;
return linestyle && (linestyle->flag & LS_TEXTURE);
}
}
}
return false;
}
static void texture_context_check_modifier_foreach(void *userData, Object *UNUSED(ob), ModifierData *UNUSED(md),