[Bf-blender-cvs] [a6f92cd] master: Freestyle: added more conditions to be able to switch to the line style texture properties context.

Tamito Kajiyama noreply at git.blender.org
Tue May 6 09:59:26 CEST 2014


Commit: a6f92cd29ad4585745dc0bb420cb79f1b97aeb1e
Author: Tamito Kajiyama
Date:   Mon May 5 19:53:13 2014 +0900
https://developer.blender.org/rBa6f92cd29ad4585745dc0bb420cb79f1b97aeb1e

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

===================================================================

M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/buttons_texture.c

===================================================================

diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 4b37ac6..a00aac1 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -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) {
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 4ba0dda..7fb2d0f 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -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),




More information about the Bf-blender-cvs mailing list