[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29697] branches/soc-2008-mxcurioni: A step toward a new user-friendly GUI for manipulating line style parameters .

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Jun 26 00:45:42 CEST 2010


Revision: 29697
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29697
Author:   kjym3
Date:     2010-06-26 00:45:42 +0200 (Sat, 26 Jun 2010)

Log Message:
-----------
A step toward a new user-friendly GUI for manipulating line style parameters.
This commit is just meant to give the new GUI framework a concrete shape.
There is no usefulness in newly introduced elements at the moment.

Freestyle options in render layers now include a pull-down menu named Control
Mode that allows you to choose either the Python Scripting or Parameter Editor
mode.  The Python Scripting mode is the conventional way of controlling
Freestyle by directly using style modules written in Python.  The Parameter
Editor is a new control mode that is intended to be used by everyone without
relying on Python programming.

In the Parameter Editor mode, you can specify multiple line sets for each
render layer.  A line set defines feature edge selection criteria, as
well as a line style for drawing the selected feature edges using specific
line stylization parameters.  Line style is a new datablock type, meaning
that a line style can be shared by multiple line sets (possibly those in
different render layers in different scenes).

Much more additions are anticipated in subsequent commits to implement UI
controls for specifying feature edge selection criteria and line stylization
parameters.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_main.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/library.c
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/scene.c
    branches/soc-2008-mxcurioni/source/blender/blenloader/intern/readblenentry.c
    branches/soc-2008-mxcurioni/source/blender/blenloader/intern/readfile.c
    branches/soc-2008-mxcurioni/source/blender/blenloader/intern/writefile.c
    branches/soc-2008-mxcurioni/source/blender/editors/interface/interface_templates.c
    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_ID.h
    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/RNA_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/CMakeLists.txt
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/SConscript
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/makesrna.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_ID.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_internal.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_main.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_main_api.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c

Added Paths:
-----------
    branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c

Modified: branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py	2010-06-25 21:24:59 UTC (rev 29696)
+++ branches/soc-2008-mxcurioni/release/scripts/ui/properties_render.py	2010-06-25 22:45:42 UTC (rev 29697)
@@ -69,6 +69,27 @@
         layout.prop(rd, "display_mode", text="Display")
 
 
+class RENDER_PT_freestyle_linestyle(RenderButtonsPanel):
+    bl_label = "Freestyle Line Style"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def poll(self, context):
+        rd = context.scene.render
+        rl = rd.layers[rd.active_layer_index]
+        return rl and rl.freestyle and rl.freestyle_settings.active_lineset
+
+    def draw(self, context):
+        layout = self.layout
+
+        rd = context.scene.render
+        rl = rd.layers[rd.active_layer_index]
+        linestyle = rl.freestyle_settings.active_lineset.linestyle
+
+        split = layout.split()
+        col = split.column()
+        col.prop(linestyle, "name")
+
+
 class RENDER_PT_layers(RenderButtonsPanel):
     bl_label = "Layers"
     bl_default_closed = True
@@ -182,28 +203,57 @@
             col = split.column()
             col.label(text="Freestyle:")
             freestyle = rl.freestyle_settings
-            col.prop(freestyle, "crease_angle", text="Crease Angle")
-            col.prop(freestyle, "sphere_radius", text="Sphere Radius")
-            col.prop(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
-            col.prop(freestyle, "suggestive_contours", text="Suggestive Contours")
-            col.prop(freestyle, "material_boundaries", text="Material Boundaries")
-            col.prop(freestyle, "dkr_epsilon", text="Dkr Epsilon")
+            col.prop(freestyle, "mode", text="Control Mode")
+            if freestyle.mode == "EDITOR":
 
-            col.operator("scene.freestyle_module_add", text="Add Style Module")
+                lineset = freestyle.active_lineset
 
-            for i, module in enumerate(freestyle.modules):
-                    box = layout.box()
-                    box.set_context_pointer("freestyle_module", module)
-                    row = box.row(align=True)
-                    row.prop(module, "is_displayed", text="")
-                    row.prop(module, "module_path", text="")
-                    row.operator("scene.freestyle_module_remove", icon='X', text="")
-                    props = row.operator("scene.freestyle_module_move_up", icon='MOVE_UP_VEC', text="")
-                    props.active = (i > 0)
-                    props = row.operator("scene.freestyle_module_move_down", icon='MOVE_DOWN_VEC', text="")
-                    props.active = (i < len(freestyle.modules) - 1)
+                col.label(text="Line Sets:")
 
+                row = col.row()
+                rows = 2
+                if lineset:
+                    rows = 5
+                # FIXME: scrollbar does not work correctly
+                row.template_list(freestyle, "linesets", freestyle, "active_lineset_index", rows=rows)
 
+                sub = row.column()
+
+                subsub = sub.column(align=True)
+                subsub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
+                subsub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
+
+                if lineset:
+                    sub.separator()
+
+                    subsub = sub.column(align=True)
+                    subsub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
+                    subsub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+
+                    col.prop(lineset, "name")
+                    col.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
+
+            else:
+                col.prop(freestyle, "crease_angle", text="Crease Angle")
+                col.prop(freestyle, "sphere_radius", text="Sphere Radius")
+                col.prop(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
+                col.prop(freestyle, "suggestive_contours", text="Suggestive Contours")
+                col.prop(freestyle, "material_boundaries", text="Material Boundaries")
+                col.prop(freestyle, "dkr_epsilon", text="Dkr Epsilon")
+
+                col.operator("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.prop(module, "is_displayed", text="")
+                        row.prop(module, "module_path", text="")
+                        row.operator("scene.freestyle_module_remove", icon='X', text="")
+                        row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
+                        row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+
+
 class RENDER_PT_shading(RenderButtonsPanel):
     bl_label = "Shading"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -706,6 +756,7 @@
     RENDER_MT_ffmpeg_presets,
     RENDER_PT_render,
     RENDER_PT_layers,
+    RENDER_PT_freestyle_linestyle,
     RENDER_PT_dimensions,
     RENDER_PT_antialiasing,
     RENDER_PT_motion_blur,

Added: branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h	                        (rev 0)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_linestyle.h	2010-06-25 22:45:42 UTC (rev 29697)
@@ -0,0 +1,42 @@
+/* BKE_linestyle.h
+ *
+ *
+ * $Id: BKE_particle.h 29187 2010-06-03 15:39:02Z kjym3 $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BKE_LINESTYLE_H
+#define BKE_LINESTYLE_H
+
+#include "DNA_freestyle_types.h"
+
+struct Main;
+
+FreestyleLineStyle *FRS_new_linestyle(char *name, struct Main *main);
+void FRS_free_linestyle(FreestyleLineStyle *linestyle);
+
+#endif

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_main.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_main.h	2010-06-25 21:24:59 UTC (rev 29696)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/BKE_main.h	2010-06-25 22:45:42 UTC (rev 29697)
@@ -78,6 +78,7 @@
 	ListBase particle;
 	ListBase wm;
 	ListBase gpencil;
+	ListBase linestyle;
 } Main;
 
 

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/anim_sys.c	2010-06-25 21:24:59 UTC (rev 29696)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/anim_sys.c	2010-06-25 22:45:42 UTC (rev 29697)
@@ -466,6 +466,7 @@
 	ANIMDATA_IDS_CB(main->particle.first);	/* particles */
 	ANIMDATA_IDS_CB(main->object.first);	/* objects */
 	ANIMDATA_IDS_CB(main->world.first);		/* worlds */
+	ANIMDATA_IDS_CB(main->linestyle.first);	/* linestyles */
 
 	/* scenes */
 	for (id= main->scene.first; id; id= id->next) {
@@ -542,6 +543,9 @@
 	/* worlds */
 	RENAMEFIX_ANIM_IDS(mainptr->world.first);
 	
+	/* linestyles */
+	RENAMEFIX_ANIM_IDS(mainptr->linestyle.first);
+	
 	/* scenes */
 	for (id= mainptr->scene.first; id; id= id->next) {
 		AnimData *adt= BKE_animdata_from_id(id);
@@ -1890,6 +1894,9 @@
 	/* particles */
 	EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM);
 	
+	/* linestyles */
+	EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM);
+	
 	/* objects */
 		/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets 
 		 * this tagged by Depsgraph on framechange. This optimisation means that objects

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/library.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/library.c	2010-06-25 21:24:59 UTC (rev 29696)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/library.c	2010-06-25 22:45:42 UTC (rev 29697)
@@ -99,6 +99,7 @@
 #include "BKE_particle.h"
 #include "BKE_gpencil.h"
 #include "BKE_fcurve.h"
+#include "BKE_linestyle.h"
 
 #define MAX_IDPUP		60	/* was 24 */
 
@@ -226,6 +227,8 @@
 			return 0; /* can't be linked */
 		case ID_GD:
 			return 0; /* not implemented */
+		case ID_LS:
+			return 0; /* not implemented */
 	}
 
 	return 0;
@@ -315,6 +318,8 @@
 			return 0; /* can't be copied from here */
 		case ID_GD:
 			return 0; /* not implemented */
+		case ID_LS:
+			return 0; /* not implemented */
 	}
 	
 	return 0;
@@ -413,6 +418,8 @@
 			return &(mainlib->wm);
 		case ID_GD:
 			return &(mainlib->gpencil);
+		case ID_LS:
+			return &(mainlib->linestyle);
 	}
 	return 0;
 }
@@ -493,6 +500,7 @@
 	lb[a++]= &(main->library);
 	lb[a++]= &(main->wm);
 	lb[a++]= &(main->gpencil);
+	lb[a++]= &(main->linestyle);
 	
 	lb[a]= NULL;
 
@@ -601,6 +609,9 @@
 		case ID_GD:
 			id = MEM_callocN(sizeof(bGPdata), "Grease Pencil");
 			break;
+		case ID_LS:
+			id = MEM_callocN(sizeof(FreestyleLineStyle), "Freestyle Line Style");
+			break;
 	}
 	return id;
 }
@@ -806,6 +817,9 @@
 		case ID_GD:
 			free_gpencil_data((bGPdata *)id);
 			break;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list