svn merge -r39877:39878 https://svn.blender.org/svnroot/bf-blender/trunk/blender...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 3 Sep 2011 12:39:17 +0000 (12:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 3 Sep 2011 12:39:17 +0000 (12:39 +0000)
release/scripts/modules/bpy_types.py
source/blender/bmesh/operators/mesh_conv.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c

index e80c913a865419013bb91f1e58fba78148373aa7..4a5de9f9e573ba47385364e01001465496bf4f6d 100644 (file)
@@ -183,7 +183,7 @@ class _GenericBone:
     @property
     def center(self):
         """The midpoint between the head and the tail."""
-        return (self.head + self.tail) * 0.5
+        return self.head.lerp(self.tail, 0.5)
 
     @property
     def length(self):
@@ -568,7 +568,7 @@ class _GenericUI:
         draw_funcs = cls._dyn_ui_initialize()
         try:
             draw_funcs.remove(draw_func)
-        except:
+        except ValueError:
             pass
 
 
index 60b8b2770f25094edfd17a9dc56f7ac9fcedee2f..0df65d0f28183572f9955b5654c6e81297687974 100644 (file)
@@ -620,7 +620,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) {
                int i,j;
 
                for (ob=G.main->object.first; ob; ob=ob->id.next) {
-                       if (ob->parent==ob && ELEM(ob->partype, PARVERT1,PARVERT3)) {
+                       if (ob->parent==bm->ob && ELEM(ob->partype, PARVERT1,PARVERT3)) {
                                
                                /* duplicate code from below, make it function later...? */
                                if (!vertMap) {
index 01fab0813d4d3fc388a1b9fddefe63297bb6b864..98375ca03ce7fadbb273081c3c07eead0fff0d0b 100644 (file)
@@ -65,6 +65,7 @@
 
 #include "ED_curve.h"
 #include "ED_mesh.h"
+#include "ED_lattice.h"
 #include "ED_screen.h"
 
 #include "WM_types.h"
@@ -297,7 +298,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
        return totvert;
 }
 
-static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
+static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
 {
        *indexar= NULL;
        *tot= 0;
@@ -307,7 +308,10 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
                case OB_MESH:
                {
                        Mesh *me= obedit->data;
-                       BMEditMesh *em = me->edit_btmesh;
+                       BMEditMesh *em;
+                       EDBM_LoadEditBMesh(scene, obedit);
+                       EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit);
+                       em = me->edit_btmesh;
 
                        /* check selected vertices first */
                        if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
@@ -319,10 +323,15 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
                }
                case OB_CURVE:
                case OB_SURF:
+                       load_editNurb(obedit);
+                       make_editNurb(obedit);
                        return return_editcurve_indexar(obedit, tot, indexar, cent_r);
                case OB_LATTICE:
                {
                        Lattice *lt= obedit->data;
+                       load_editLatt(obedit);
+                       make_editLatt(obedit);
+
                        return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
                }
                default:
@@ -430,7 +439,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
        int tot, ok, *indexar;
        char name[32];
        
-       ok = object_hook_index_array(obedit, &tot, &indexar, name, cent);
+       ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
        
        if (!ok) return;        // XXX error("Requires selected vertices or active Vertex Group");
        
@@ -763,7 +772,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
        
        /* assign functionality */
        
-       if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) {
+       if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) {
                BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
                return OPERATOR_CANCELLED;
        }
index b79d355aa2a5b42683a0d82d534a7be232453f0e..9fe0b7d3210e28dee0518efda251ec9600c7fc86 100644 (file)
@@ -92,6 +92,8 @@
 
 #include "ED_armature.h"
 #include "ED_curve.h"
+#include "ED_lattice.h"
+#include "ED_mesh.h"
 #include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_screen.h"
@@ -124,7 +126,11 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
        
        if(obedit->type==OB_MESH) {
                Mesh *me= obedit->data;
-               BMEditMesh *em = me->edit_btmesh;
+               BMEditMesh *em;
+
+               EDBM_LoadEditBMesh(scene, obedit);
+               EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit);
+               em = me->edit_btmesh;
 
                BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
                        if (BM_TestHFlag(eve, BM_SELECT)) {
@@ -137,8 +143,13 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                }
        }
        else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
-               ListBase *editnurb= curve_get_editcurve(obedit);
-               
+               ListBase *editnurb;
+
+               load_editNurb(obedit);
+               make_editNurb(obedit);
+
+               editnurb= curve_get_editcurve(obedit);
+
                cu= obedit->data;
 
                nu= editnurb->first;
@@ -177,8 +188,13 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                }
        }
        else if(obedit->type==OB_LATTICE) {
-               Lattice *lt= obedit->data;
-               
+               Lattice *lt;
+
+               load_editLatt(obedit);
+               make_editLatt(obedit);
+
+               lt= obedit->data;
+
                a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
                bp= lt->editlatt->latt->def;
                while(a--) {