[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23677] branches/soc-2008-mxcurioni: committed Tamito Kajiyama' s RNA and GUI patch for Freestyle integration into Blender 2.5.

Maxime Curioni maxime.curioni at gmail.com
Wed Oct 7 07:16:23 CEST 2009


Revision: 23677
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23677
Author:   mxcurioni
Date:     2009-10-07 07:16:23 +0200 (Wed, 07 Oct 2009)

Log Message:
-----------
committed Tamito Kajiyama's RNA and GUI patch for Freestyle integration into Blender 2.5. As of I right now, Freestyle is back in the UI, but rendering still fails because of the texture manager.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/ui/buttons_scene.py
    branches/soc-2008-mxcurioni/source/blender/editors/CMakeLists.txt
    branches/soc-2008-mxcurioni/source/blender/editors/render/SConscript
    branches/soc-2008-mxcurioni/source/blender/editors/render/render_intern.h
    branches/soc-2008-mxcurioni/source/blender/editors/render/render_ops.c
    branches/soc-2008-mxcurioni/source/blender/editors/render/render_shading.c
    branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2008-mxcurioni/release/scripts/ui/buttons_scene.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/ui/buttons_scene.py	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/release/scripts/ui/buttons_scene.py	2009-10-07 05:16:23 UTC (rev 23677)
@@ -80,11 +80,12 @@
 		col.itemR(rl, "solid")
 		col.itemR(rl, "halo")
 		col.itemR(rl, "ztransp")
+		col.itemR(rl, "sky")
 
 		col = split.column()
-		col.itemR(rl, "sky")
 		col.itemR(rl, "edge")
 		col.itemR(rl, "strand")
+		col.itemR(rl, "freestyle")
 
 		if rl.zmask:
 			split = layout.split()
@@ -125,6 +126,33 @@
 		row.itemR(rl, "pass_refraction")
 		row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
 
+		if rl.freestyle:
+			layout.itemS()
+
+			split = layout.split()
+
+			col = split.column()
+			col.itemL(text="Freestyle:")
+			freestyle = rl.freestyle_settings
+			col.itemR(freestyle, "sphere_radius", text="Sphere Radius")
+			col.itemR(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
+			col.itemR(freestyle, "suggestive_contours", text="Suggestive Contours")
+			col.itemR(freestyle, "dkr_epsilon", text="Dkr Epsilon")
+
+			col.itemO("scene.freestyle_module_add", text="Add Style Module")
+
+			for i, module in enumerate(freestyle.modules):
+				box = layout.box()
+				box.set_context_pointer("freestyle_module", module)
+				row = box.row(align=True)
+				row.itemR(module, "is_displayed", text="")
+				row.itemR(module, "module_path", text="")
+				row.itemO("scene.freestyle_module_remove", icon='ICON_X', text="")
+				props = row.itemO("scene.freestyle_module_move_up", icon='VICON_MOVE_UP', text="", properties=True)
+				props.active = (i > 0)
+				props = row.itemO("scene.freestyle_module_move_down", icon='VICON_MOVE_DOWN', text="", properties=True)
+				props.active = (i < len(freestyle.modules) - 1)
+
 class SCENE_PT_shading(RenderButtonsPanel):
 	__label__ = "Shading"
 	COMPAT_ENGINES = set(['BLENDER_RENDER'])
@@ -224,6 +252,13 @@
 		sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
 		sub.itemR(rd, "edge_color", text="")
 		
+		layout.itemS()
+
+		split = layout.split()
+		col = split.column()
+		col.itemR(rd, "freestyle", text="Freestyle")
+
+
 class SCENE_PT_output(RenderButtonsPanel):
 	__label__ = "Output"
 	COMPAT_ENGINES = set(['BLENDER_RENDER'])

Modified: branches/soc-2008-mxcurioni/source/blender/editors/CMakeLists.txt
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/CMakeLists.txt	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/editors/CMakeLists.txt	2009-10-07 05:16:23 UTC (rev 23677)
@@ -39,6 +39,7 @@
 	../../../intern/audaspace/intern
 	../nodes
 	../gpu
+	../freestyle
 	../blenfont
 	../ikplugin
 )

Modified: branches/soc-2008-mxcurioni/source/blender/editors/render/SConscript
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/render/SConscript	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/editors/render/SConscript	2009-10-07 05:16:23 UTC (rev 23677)
@@ -5,7 +5,7 @@
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' #/intern/guardedalloc ../../gpu'
+incs += ' #/intern/guardedalloc ../../gpu ../../freestyle'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
 incs += ' ../../blenloader'
 

Modified: branches/soc-2008-mxcurioni/source/blender/editors/render/render_intern.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/render/render_intern.h	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/editors/render/render_intern.h	2009-10-07 05:16:23 UTC (rev 23677)
@@ -44,6 +44,10 @@
 
 void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
 void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
+void SCENE_OT_freestyle_module_add(struct wmOperatorType *ot);
+void SCENE_OT_freestyle_module_remove(struct wmOperatorType *ot);
+void SCENE_OT_freestyle_module_move_up(struct wmOperatorType *ot);
+void SCENE_OT_freestyle_module_move_down(struct wmOperatorType *ot);
 
 #endif /* RENDER_INTERN_H */
 

Modified: branches/soc-2008-mxcurioni/source/blender/editors/render/render_ops.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/render/render_ops.c	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/editors/render/render_ops.c	2009-10-07 05:16:23 UTC (rev 23677)
@@ -50,5 +50,9 @@
 
 	WM_operatortype_append(SCENE_OT_render_layer_add);
 	WM_operatortype_append(SCENE_OT_render_layer_remove);
+	WM_operatortype_append(SCENE_OT_freestyle_module_add);
+	WM_operatortype_append(SCENE_OT_freestyle_module_remove);
+	WM_operatortype_append(SCENE_OT_freestyle_module_move_up);
+	WM_operatortype_append(SCENE_OT_freestyle_module_move_down);
 }
 

Modified: branches/soc-2008-mxcurioni/source/blender/editors/render/render_shading.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/editors/render/render_shading.c	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/editors/render/render_shading.c	2009-10-07 05:16:23 UTC (rev 23677)
@@ -58,6 +58,8 @@
 
 #include "GPU_material.h"
 
+#include "FRS_freestyle.h"
+
 #include "RNA_access.h"
 #include "RNA_enum_types.h"
 
@@ -643,3 +645,122 @@
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
+static int freestyle_module_add_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+
+	printf("freestyle_module_add_exec\n");
+	FRS_add_module();
+
+	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	
+	return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_freestyle_module_add(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Add Freestyle Module";
+	ot->idname= "SCENE_OT_freestyle_module_add";
+	ot->description="Add a style module into the list of modules.";
+	
+	/* api callbacks */
+	ot->exec= freestyle_module_add_exec;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int freestyle_module_remove_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+	PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
+	FreestyleModuleConfig *module= ptr.data;
+
+	printf("freestyle_module_remove_exec\n");
+	FRS_delete_module(module, NULL);
+
+	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	
+	return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_freestyle_module_remove(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Remove Freestyle Module";
+	ot->idname= "SCENE_OT_freestyle_module_remove";
+	ot->description="Remove the style module from the stack.";
+	
+	/* api callbacks */
+	ot->exec= freestyle_module_remove_exec;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int freestyle_module_move_up_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+	PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
+	FreestyleModuleConfig *module= ptr.data;
+	int active = RNA_boolean_get(op->ptr, "active");
+
+	printf("freestyle_module_move_up_exec\n");
+	if(active)
+		FRS_move_up_module(module, NULL);
+
+	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	
+	return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_freestyle_module_move_up(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Move Up Freestyle Module";
+	ot->idname= "SCENE_OT_freestyle_module_move_up";
+	ot->description="Move the style module up in the stack.";
+	
+	/* api callbacks */
+	ot->exec= freestyle_module_move_up_exec;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* props */
+	RNA_def_boolean(ot->srna, "active", 0, "Active", "True if the operator is enabled.");
+}
+
+static int freestyle_module_move_down_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+	PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
+	FreestyleModuleConfig *module= ptr.data;
+	int active = RNA_boolean_get(op->ptr, "active");
+
+	printf("freestyle_module_move_down_exec\n");
+	if(active)
+		FRS_move_down_module(module, NULL);
+
+	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	
+	return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_freestyle_module_move_down(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name= "Move Down Freestyle Module";
+	ot->idname= "SCENE_OT_freestyle_module_move_down";
+	ot->description="Move the style module down in the stack.";
+	
+	/* api callbacks */
+	ot->exec= freestyle_module_move_down_exec;
+
+	/* flags */
+	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* props */
+	RNA_def_boolean(ot->srna, "active", 0, "Active", "True if the operator is enabled.");
+}

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2009-10-07 05:16:23 UTC (rev 23677)
@@ -1,9 +1,6 @@
 #ifndef FRS_FREESTYLE_H
 #define FRS_FREESTYLE_H
 
-#define FREESTYLE_SUGGESTIVE_CONTOURS_FLAG  1
-#define FREESTYLE_RIDGES_AND_VALLEYS_FLAG   2
-
 #ifdef __cplusplus
 extern "C" {
 #endif	

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2009-10-07 05:13:31 UTC (rev 23676)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2009-10-07 05:16:23 UTC (rev 23677)
@@ -295,22 +295,22 @@
 	
 	void FRS_delete_module(void *module_index_ptr, void *unused)
 	{
-		FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) BLI_findlink(freestyle_modules, (intptr_t)module_index_ptr);
+		FreestyleModuleConfig* module_conf = (FreestyleModuleConfig*) module_index_ptr;
 
 		BLI_freelinkN( freestyle_modules, module_conf);
 	}
 	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list