minor fixes for merge of soc-2009-kazanbas, rev23422
authorCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2009 17:50:29 +0000 (17:50 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 22 Sep 2009 17:50:29 +0000 (17:50 +0000)
- Use CTX_data_main(C) over G.main
- no need to define object_type_items inline.
- rna_mesh.c - dynamic length array was commented out, not sure why this was needed. Povray and PLY scripts rely on faces having 3/4 verts rather then checking the 4th index is 0 (ok in C, not nice in py).

source/blender/editors/mesh/editmesh_tools.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_object_api.c

index 2c20e4a147c356eed5e897a1f1c04a9e736203cc..26bee09c925bcf7ec65772ae5f6bfb5e81933a7f 100644 (file)
@@ -4679,6 +4679,7 @@ int EdgeLoopDelete(EditMesh *em, wmOperator *op)
        //      DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
        return 1;
 #endif
+       return 0;
 }
 
 
index 9d42c473f509f3813900c385b80af733a9ad0622..379cf75d450b29ca40d8cae3d17d0d950c76f7c4 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "RNA_define.h"
 #include "RNA_types.h"
+#include "RNA_enum_types.h"
 
 #include "DNA_object_types.h"
 #include "DNA_material_types.h"
@@ -135,21 +136,6 @@ void RNA_api_main(StructRNA *srna)
        FunctionRNA *func;
        PropertyRNA *parm;
 
-       /* copied from rna_def_object */
-       static EnumPropertyItem object_type_items[] = {
-               {OB_EMPTY, "EMPTY", 0, "Empty", ""},
-               {OB_MESH, "MESH", 0, "Mesh", ""},
-               {OB_CURVE, "CURVE", 0, "Curve", ""},
-               {OB_SURF, "SURFACE", 0, "Surface", ""},
-               {OB_FONT, "TEXT", 0, "Text", ""},
-               {OB_MBALL, "META", 0, "Meta", ""},
-               {OB_LAMP, "LAMP", 0, "Lamp", ""},
-               {OB_CAMERA, "CAMERA", 0, "Camera", ""},
-               {OB_WAVE, "WAVE", 0, "Wave", ""},
-               {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
-               {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
-               {0, NULL, 0, NULL, NULL}};
-
        func= RNA_def_function(srna, "add_object", "rna_Main_add_object");
        RNA_def_function_ui_description(func, "Add a new object.");
        parm= RNA_def_enum(func, "type", object_type_items, 0, "", "Type of Object.");
index cfc1e017f3c21d348d5a1d4684ad19fe33f1abda..ecfe59a01424238231ef9f533d949b637da8a476 100644 (file)
@@ -978,13 +978,11 @@ static void rna_def_mface(BlenderRNA *brna)
 
        // XXX allows creating invalid meshes
        prop= RNA_def_property(srna, "verts", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_sdna(prop, NULL, "v1");
        RNA_def_property_array(prop, 4);
-       /*
        RNA_def_property_flag(prop, PROP_DYNAMIC);
        RNA_def_property_dynamic_array_funcs(prop, "rna_MeshFace_verts_get_length");
        RNA_def_property_int_funcs(prop, "rna_MeshFace_verts_get", "rna_MeshFace_verts_set", NULL);
-       */
+
        RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
 
        prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
index f809868c1309f0451ce08a0c3b6c5f0a010900c1..af6254a99b01172359c761f98ecb0da0e2eef267 100644 (file)
@@ -114,7 +114,7 @@ static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports
                
                /* nurbs_to_mesh changes the type to a mesh, check it worked */
                if (tmpobj->type != OB_MESH) {
-                       free_libblock_us( &G.main->object, tmpobj );
+                       free_libblock_us( &(CTX_data_main(C)->object), tmpobj );
                        BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?");
                        return NULL;
                }
@@ -125,6 +125,9 @@ static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports
        case OB_MBALL:
                /* metaballs don't have modifiers, so just convert to mesh */
                ob = find_basis_mball( sce, ob );
+               /* todo, re-generatre for render-res */
+               /* metaball_polygonize(scene, ob) */
+
                tmpmesh = add_mesh("Mesh");
                mball_to_mesh( &ob->disp, tmpmesh );
                break;