[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24284] trunk/blender: - remove UV mapping operator, call a header menu directly ( so python can add items there)

Campbell Barton ideasman42 at gmail.com
Tue Nov 3 19:20:03 CET 2009


Revision: 24284
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24284
Author:   campbellbarton
Date:     2009-11-03 19:20:03 +0100 (Tue, 03 Nov 2009)

Log Message:
-----------
- remove UV mapping operator, call a header menu directly (so python can add items there)
- forgot to move bpy_sys.py last commit

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/source/blender/editors/mesh/mesh_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_intern.h
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c

Added Paths:
-----------
    trunk/blender/release/scripts/modules/bpy_utils.py

Removed Paths:
-------------
    trunk/blender/release/scripts/modules/bpy_sys.py

Deleted: trunk/blender/release/scripts/modules/bpy_sys.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_sys.py	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/release/scripts/modules/bpy_sys.py	2009-11-03 18:20:03 UTC (rev 24284)
@@ -1,30 +0,0 @@
-# ##### 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-import bpy
-import os
-
-def expandpath(path):
-    if path.startswith("//"):
-        return os.path.join(os.path.dirname(bpy.data.filename), path[2:])
-
-    return path
-
-import types
-bpy.utils = types.ModuleType("bpy.utils")
-bpy.utils.expandpath = expandpath

Copied: trunk/blender/release/scripts/modules/bpy_utils.py (from rev 24283, trunk/blender/release/scripts/modules/bpy_sys.py)
===================================================================
--- trunk/blender/release/scripts/modules/bpy_utils.py	                        (rev 0)
+++ trunk/blender/release/scripts/modules/bpy_utils.py	2009-11-03 18:20:03 UTC (rev 24284)
@@ -0,0 +1,30 @@
+# ##### 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+import os
+
+def expandpath(path):
+    if path.startswith("//"):
+        return os.path.join(os.path.dirname(bpy.data.filename), path[2:])
+
+    return path
+
+import types
+bpy.utils = types.ModuleType("bpy.utils")
+bpy.utils.expandpath = expandpath


Property changes on: trunk/blender/release/scripts/modules/bpy_utils.py
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/blender/release/scripts/ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d.py	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/release/scripts/ui/space_view3d.py	2009-11-03 18:20:03 UTC (rev 24284)
@@ -90,6 +90,22 @@
         layout.itemO("view3d.snap_cursor_to_grid", text="Cursor to Grid")
         layout.itemO("view3d.snap_cursor_to_active", text="Cursor to Active")
 
+class VIEW3D_MT_uv_map(bpy.types.Menu):
+    bl_label = "UV Mapping"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.itemO("uv.unwrap")
+        layout.itemO("uv.cube_project")
+        layout.itemO("uv.cylinder_project")
+        layout.itemO("uv.sphere_project")
+        layout.itemO("uv.project_from_view")
+
+        layout.itemS()
+
+        layout.itemO("uv.reset")
+
 # ********** View menus **********
 
 
@@ -831,7 +847,7 @@
 
         layout.itemS()
 
-        layout.itemO("uv.mapping_menu", text="UV Unwrap...")
+        layout.itemM("VIEW3D_MT_uv_map", text="UV Unwrap...")
 
         layout.itemS()
 
@@ -1603,6 +1619,7 @@
 bpy.types.register(VIEW3D_MT_pose_showhide)
 
 bpy.types.register(VIEW3D_MT_snap) # Edit Menus
+bpy.types.register(VIEW3D_MT_uv_map) # Edit Menus
 
 bpy.types.register(VIEW3D_MT_edit_mesh)
 bpy.types.register(VIEW3D_MT_edit_mesh_specials) # Only as a menu for keybindings

Modified: trunk/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/source/blender/editors/mesh/mesh_ops.c	2009-11-03 18:20:03 UTC (rev 24284)
@@ -291,8 +291,8 @@
 	kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", VKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_edit_mesh_vertices");
 
-	/* UV's */
-	WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0);
+	kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", UKEY, KM_PRESS, 0, 0);
+    RNA_string_set(kmi->ptr, "name", "VIEW3D_MT_uv_map");
 
 	ED_object_generic_keymap(keyconf, keymap, TRUE);
 }

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_intern.h
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_intern.h	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_intern.h	2009-11-03 18:20:03 UTC (rev 24284)
@@ -70,7 +70,6 @@
 void UV_OT_cube_project(struct wmOperatorType *ot);
 void UV_OT_cylinder_project(struct wmOperatorType *ot);
 void UV_OT_from_view(struct wmOperatorType *ot);
-void UV_OT_mapping_menu(struct wmOperatorType *ot);
 void UV_OT_minimize_stretch(struct wmOperatorType *ot);
 void UV_OT_pack_islands(struct wmOperatorType *ot);
 void UV_OT_reset(struct wmOperatorType *ot);

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2009-11-03 18:20:03 UTC (rev 24284)
@@ -3090,7 +3090,6 @@
 	WM_operatortype_append(UV_OT_cube_project);
 	WM_operatortype_append(UV_OT_cylinder_project);
 	WM_operatortype_append(UV_OT_from_view);
-	WM_operatortype_append(UV_OT_mapping_menu);
 	WM_operatortype_append(UV_OT_minimize_stretch);
 	WM_operatortype_append(UV_OT_pack_islands);
 	WM_operatortype_append(UV_OT_reset);

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2009-11-03 18:08:25 UTC (rev 24283)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c	2009-11-03 18:20:03 UTC (rev 24284)
@@ -1307,69 +1307,3 @@
 	RNA_def_float(ot->srna, "cube_size", 1.0f, 0.0f, FLT_MAX, "Cube Size", "Size of the cube to project on.", 0.001f, 100.0f);
 	uv_map_clip_correct_properties(ot);
 }
-
-/******************* Mapping Menu operator ****************/
-
-static int mapping_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	uiPopupMenu *pup;
-	uiLayout *layout;
-
-	pup= uiPupMenuBegin(C, "UV Mapping", 0);
-	layout= uiPupMenuLayout(pup);
-
-	uiItemO(layout, NULL, 0, "UV_OT_unwrap");
-	uiItemS(layout);
-	uiItemO(layout, NULL, 0, "UV_OT_cube_project");
-	uiItemO(layout, NULL, 0, "UV_OT_cylinder_project");
-	uiItemO(layout, NULL, 0, "UV_OT_sphere_project");
-	uiItemO(layout, NULL, 0, "UV_OT_project_from_view");
-	uiItemS(layout);
-	uiItemO(layout, NULL, 0, "UV_OT_reset");
-
-	uiPupMenuEnd(C, pup);
-
-	/* XXX python */
-#ifndef DISABLE_PYTHON
-#if 0
-	/* note that we account for the 10 previous entries with i+10: */
-	for(pym = BPyMenuTable[PYMENU_UVCALCULATION]; pym; pym = pym->next, i++) {
-		
-		if(!has_pymenu) {
-			strcat(uvmenu, "|%l");
-			has_pymenu = 1;
-		}
-		
-		strcat(uvmenu, "|");
-		strcat(uvmenu, pym->name);
-		strcat(uvmenu, " %x");
-		sprintf(menu_number, "%d", i+10);
-		strcat(uvmenu, menu_number);
-	}
-#endif
-#endif
-	
-#ifndef DISABLE_PYTHON
-#if 0
-	mode= pupmenu(uvmenu);
-	if(mode >= 10) {
-		BPY_menu_do_python(PYMENU_UVCALCULATION, mode - 10);
-		return;
-	}
-#endif
-#endif	
-
-	return OPERATOR_CANCELLED;
-}
-
-void UV_OT_mapping_menu(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "UV Mapping";
-	ot->idname= "UV_OT_mapping_menu";
-	
-	/* api callbacks */
-	ot->invoke= mapping_menu_invoke;
-	ot->poll= ED_operator_uvmap;
-}
-





More information about the Bf-blender-cvs mailing list