[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45835] branches/soc-2008-mxcurioni: Added operators for adding the data paths to Freestyle edge/ face mark properties of
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Sun Apr 22 02:59:27 CEST 2012
Revision: 45835
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45835
Author: kjym3
Date: 2012-04-22 00:59:27 +0000 (Sun, 22 Apr 2012)
Log Message:
-----------
Added operators for adding the data paths to Freestyle edge/face mark properties of
selected edges/polygons into the active keying set. This makes it easy to keyframe
a number of Freestyle edge/face marks.
Modified Paths:
--------------
branches/soc-2008-mxcurioni/release/scripts/startup/bl_operators/freestyle.py
branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_mesh.c
Modified: branches/soc-2008-mxcurioni/release/scripts/startup/bl_operators/freestyle.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/startup/bl_operators/freestyle.py 2012-04-22 00:27:38 UTC (rev 45834)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_operators/freestyle.py 2012-04-22 00:59:27 UTC (rev 45835)
@@ -69,3 +69,65 @@
m.range_min = min_dist
m.range_max = max_dist
return {'FINISHED'}
+
+
+class SCENE_OT_freestyle_add_edge_marks_to_keying_set(bpy.types.Operator):
+ '''Add the data paths to the Freestyle Edge Mark property of selected edges to the active keying set'''
+ bl_idname = "scene.freestyle_add_edge_marks_to_keying_set"
+ bl_label = "Add Edge Marks to Keying Set"
+ bl_options = {'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return (ob and ob.type == 'MESH')
+
+ def execute(self, context):
+ # active keying set
+ scene = context.scene
+ ks = scene.keying_sets.active
+ if ks is None:
+ ks = scene.keying_sets.new(idname="FreestyleEdgeMarkKeyingSet", name="Freestyle Edge Mark Keying Set")
+ ks.bl_description = ""
+ # add data paths to the keying set
+ ob = context.active_object
+ ob_mode = ob.mode
+ mesh = ob.data
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ for i, edge in enumerate(mesh.edges):
+ if not edge.hide and edge.select:
+ path = 'edges[%d].use_freestyle_edge_mark' % i
+ ks.paths.add(mesh, path, index=0)
+ bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
+ return {'FINISHED'}
+
+
+class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator):
+ '''Add the data paths to the Freestyle Face Mark property of selected polygons to the active keying set'''
+ bl_idname = "scene.freestyle_add_face_marks_to_keying_set"
+ bl_label = "Add Face Marks to Keying Set"
+ bl_options = {'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return (ob and ob.type == 'MESH')
+
+ def execute(self, context):
+ # active keying set
+ scene = context.scene
+ ks = scene.keying_sets.active
+ if ks is None:
+ ks = scene.keying_sets.new(idname="FreestyleFaceMarkKeyingSet", name="Freestyle Face Mark Keying Set")
+ ks.bl_description = ""
+ # add data paths to the keying set
+ ob = context.active_object
+ ob_mode = ob.mode
+ mesh = ob.data
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ for i, polygon in enumerate(mesh.polygons):
+ if not polygon.hide and polygon.select:
+ path = 'polygons[%d].use_freestyle_face_mark' % i
+ ks.paths.add(mesh, path, index=0)
+ bpy.ops.object.mode_set(mode=ob_mode, toggle=False)
+ return {'FINISHED'}
Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_mesh.c 2012-04-22 00:27:38 UTC (rev 45834)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_mesh.c 2012-04-22 00:59:27 UTC (rev 45835)
@@ -1596,6 +1596,11 @@
RNA_def_property_ui_text(prop, "Smooth", "");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ prop = RNA_def_property(srna, "use_freestyle_face_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FREESTYLE_FACE);
+ RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle feature edge detection");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -1.0f, 1.0f);
More information about the Bf-blender-cvs
mailing list