[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24587] trunk/blender: add hook in vertex and control point menu's, Ctrl+H

Campbell Barton ideasman42 at gmail.com
Mon Nov 16 14:59:27 CET 2009


Revision: 24587
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24587
Author:   campbellbarton
Date:     2009-11-16 14:59:27 +0100 (Mon, 16 Nov 2009)

Log Message:
-----------
add hook in vertex and control point menu's, Ctrl+H

TODO's
- add for lattice
- break up add_hook
- add other hook operators

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_physics_softbody.py
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/blenkernel/intern/paint.c
    trunk/blender/source/blender/editors/curve/curve_ops.c
    trunk/blender/source/blender/editors/mesh/mesh_ops.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/object/object_hook.c
    trunk/blender/source/blender/editors/object/object_intern.h
    trunk/blender/source/blender/editors/object/object_ops.c

Modified: trunk/blender/release/scripts/ui/properties_physics_softbody.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_physics_softbody.py	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/release/scripts/ui/properties_physics_softbody.py	2009-11-16 13:59:27 UTC (rev 24587)
@@ -49,7 +49,7 @@
         ob = context.object
 
         split = layout.split()
-        split.operator_context = "EXEC_DEFAULT"
+        split.operator_context = 'EXEC_DEFAULT'
 
         if md:
             # remove modifier + settings

Modified: trunk/blender/release/scripts/ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/ui/space_image.py	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/release/scripts/ui/space_image.py	2009-11-16 13:59:27 UTC (rev 24587)
@@ -154,7 +154,7 @@
 
     def draw(self, context):
         layout = self.layout
-        layout.operator_context = "EXEC_REGION_WIN"
+        layout.operator_context = 'EXEC_REGION_WIN'
 
         props = layout.itemO("tfm.mirror", text="X Axis", properties=True)
         props.constraint_axis[0] = True

Modified: trunk/blender/release/scripts/ui/space_info.py
===================================================================
--- trunk/blender/release/scripts/ui/space_info.py	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/release/scripts/ui/space_info.py	2009-11-16 13:59:27 UTC (rev 24587)
@@ -69,9 +69,9 @@
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.itemO("wm.read_homefile", text="New", icon='ICON_NEW')
-        layout.operator_context = "INVOKE_AREA"
+        layout.operator_context = 'INVOKE_AREA'
         layout.itemO("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER')
         layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
         layout.itemO("wm.recover_last_session")
@@ -79,14 +79,14 @@
 
         layout.itemS()
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.itemO("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK')
-        layout.operator_context = "INVOKE_AREA"
+        layout.operator_context = 'INVOKE_AREA'
         layout.itemO("wm.save_as_mainfile", text="Save As...")
         layout.itemO("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES')
 
         layout.itemS()
-        layout.operator_context = "INVOKE_AREA"
+        layout.operator_context = 'INVOKE_AREA'
         layout.itemO("wm.link_append", text="Link")
         layout.item_booleanO("wm.link_append", "link", False, text="Append")
         layout.itemS()
@@ -100,7 +100,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.itemO("wm.exit_blender", text="Quit", icon='ICON_QUIT')
 
 # test for expanding menus
@@ -177,7 +177,7 @@
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = "EXEC_SCREEN"
+        layout.operator_context = 'EXEC_SCREEN'
 
         # layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
         layout.itemM("INFO_MT_mesh_add", icon='ICON_OUTLINER_OB_MESH')
@@ -189,7 +189,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "INVOKE_SCREEN"
+        layout.operator_context = 'INVOKE_SCREEN'
 
         layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
         layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
@@ -199,7 +199,7 @@
 
         layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
 
-        layout.operator_context = "EXEC_SCREEN"
+        layout.operator_context = 'EXEC_SCREEN'
 
         layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP')
 

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2009-11-16 13:59:27 UTC (rev 24587)
@@ -29,11 +29,11 @@
 
         userpref = context.user_preferences
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.itemO("wm.save_homefile", text="Save As Default")
 
         if userpref.active_section == 'INPUT':
-            layout.operator_context = "INVOKE_DEFAULT"
+            layout.operator_context = 'INVOKE_DEFAULT'
             layout.itemO("wm.keyconfig_export", "Export Key Configuration...")
 
 

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2009-11-16 13:59:27 UTC (rev 24587)
@@ -137,7 +137,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "INVOKE_REGION_WIN"
+        layout.operator_context = 'INVOKE_REGION_WIN'
 
         layout.itemO("view3d.clip_border", text="Clipping Border...")
         layout.itemO("view3d.zoom_border", text="Zoom Border...")
@@ -668,6 +668,18 @@
         props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True)
         props.selected = True
 
+
+class VIEW3D_MT_hook(bpy.types.Menu):
+    bl_label = "Hooks"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'EXEC_AREA'
+        layout.items_enumO("object.hook_add", "type")
+        # layout.itemS()
+        # Other operators still need porting
+
+
 # ********** Sculpt menu **********
 
 
@@ -782,7 +794,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.item_enumO("pose.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right")
         layout.item_enumO("pose.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back")
         layout.item_enumO("pose.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom")
@@ -791,7 +803,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "INVOKE_AREA"
+        layout.operator_context = 'INVOKE_AREA'
         layout.itemO("pose.armature_layers", text="Change Armature Layers...")
         layout.itemO("pose.bone_layers", text="Change Bone Layers...")
 
@@ -973,7 +985,11 @@
         layout.itemO("object.vertex_group_blend")
         layout.itemO("mesh.shape_propagate_to_all")
 
+        layout.itemS()
 
+        layout.itemM("VIEW3D_MT_hook")
+
+
 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
     bl_label = "Edges"
 
@@ -1128,7 +1144,11 @@
 
             layout.item_menu_enumO("curve.handle_type_set", "type")
 
+            layout.itemS()
 
+            layout.itemM("VIEW3D_MT_hook")
+
+
 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
     bl_label = "Segments"
 
@@ -1294,7 +1314,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "EXEC_AREA"
+        layout.operator_context = 'EXEC_AREA'
         layout.item_enumO("armature.autoside_names", "type", 'XAXIS', text="AutoName Left/Right")
         layout.item_enumO("armature.autoside_names", "type", 'YAXIS', text="AutoName Front/Back")
         layout.item_enumO("armature.autoside_names", "type", 'ZAXIS', text="AutoName Top/Bottom")
@@ -1302,7 +1322,7 @@
 
         layout.itemS()
 
-        layout.operator_context = "INVOKE_DEFAULT"
+        layout.operator_context = 'INVOKE_DEFAULT'
         layout.itemO("armature.armature_layers")
         layout.itemO("armature.bone_layers")
 
@@ -1679,6 +1699,7 @@
 bpy.types.register(VIEW3D_MT_make_single_user)
 bpy.types.register(VIEW3D_MT_make_links)
 
+bpy.types.register(VIEW3D_MT_hook)
 
 bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
 

Modified: trunk/blender/source/blender/blenkernel/intern/paint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/paint.c	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/source/blender/blenkernel/intern/paint.c	2009-11-16 13:59:27 UTC (rev 24587)
@@ -161,7 +161,7 @@
 
 int paint_facesel_test(Object *ob)
 {
-	return (ob && ob->data && (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_MASK) && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
+	return (ob && ob->type==OB_MESH && ob->data && (((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_MASK) && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)));
 }
 
 void paint_init(Paint *p, const char col[3])

Modified: trunk/blender/source/blender/editors/curve/curve_ops.c
===================================================================
--- trunk/blender/source/blender/editors/curve/curve_ops.c	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/source/blender/editors/curve/curve_ops.c	2009-11-16 13:59:27 UTC (rev 24587)
@@ -164,6 +164,7 @@
 void ED_keymap_curve(wmKeyConfig *keyconf)
 {
 	wmKeyMap *keymap;
+	wmKeyMapItem *kmi;
 	
 	keymap= WM_keymap_find(keyconf, "Font", 0, 0);
 	keymap->poll= ED_operator_editfont;
@@ -249,6 +250,10 @@
 
 	WM_keymap_add_item(keymap, "CURVE_OT_specials_menu", WKEY, KM_PRESS, 0, 0);
 
+	/* menus */
+	kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", HKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_hook");
+
 	ED_object_generic_keymap(keyconf, keymap, TRUE);
 }
 

Modified: trunk/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-11-16 12:44:33 UTC (rev 24586)
+++ trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-11-16 13:59:27 UTC (rev 24587)
@@ -157,7 +157,7 @@
 {
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
-	int constraint_axis[3] = {0, 0, 1};
+//	int constraint_axis[3] = {0, 0, 1};
 
 	/*combining operators with invoke and exec portions doesn't work yet.
 	
@@ -231,7 +231,7 @@
 	WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list