minor fixes for merge of soc-2009-kazanbas, rev23422

- 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).
This commit is contained in:
Campbell Barton 2009-09-22 17:50:29 +00:00
parent abb49829ef
commit b4ef0c7d8d
4 changed files with 7 additions and 19 deletions

@ -4679,6 +4679,7 @@ int EdgeLoopDelete(EditMesh *em, wmOperator *op)
// DAG_id_flush_update(obedit->data, OB_RECALC_DATA); // DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
return 1; return 1;
#endif #endif
return 0;
} }

@ -31,6 +31,7 @@
#include "RNA_define.h" #include "RNA_define.h"
#include "RNA_types.h" #include "RNA_types.h"
#include "RNA_enum_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_material_types.h" #include "DNA_material_types.h"
@ -135,21 +136,6 @@ void RNA_api_main(StructRNA *srna)
FunctionRNA *func; FunctionRNA *func;
PropertyRNA *parm; 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"); func= RNA_def_function(srna, "add_object", "rna_Main_add_object");
RNA_def_function_ui_description(func, "Add a new object."); RNA_def_function_ui_description(func, "Add a new object.");
parm= RNA_def_enum(func, "type", object_type_items, 0, "", "Type of Object."); parm= RNA_def_enum(func, "type", object_type_items, 0, "", "Type of Object.");

@ -978,13 +978,11 @@ static void rna_def_mface(BlenderRNA *brna)
// XXX allows creating invalid meshes // XXX allows creating invalid meshes
prop= RNA_def_property(srna, "verts", PROP_INT, PROP_UNSIGNED); 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_array(prop, 4);
/*
RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_dynamic_array_funcs(prop, "rna_MeshFace_verts_get_length"); 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_int_funcs(prop, "rna_MeshFace_verts_get", "rna_MeshFace_verts_set", NULL);
*/
RNA_def_property_ui_text(prop, "Vertices", "Vertex indices"); RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);

@ -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 */ /* nurbs_to_mesh changes the type to a mesh, check it worked */
if (tmpobj->type != OB_MESH) { 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?"); BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?");
return NULL; return NULL;
} }
@ -125,6 +125,9 @@ static Mesh *rna_Object_create_mesh(Object *ob, bContext *C, ReportList *reports
case OB_MBALL: case OB_MBALL:
/* metaballs don't have modifiers, so just convert to mesh */ /* metaballs don't have modifiers, so just convert to mesh */
ob = find_basis_mball( sce, ob ); ob = find_basis_mball( sce, ob );
/* todo, re-generatre for render-res */
/* metaball_polygonize(scene, ob) */
tmpmesh = add_mesh("Mesh"); tmpmesh = add_mesh("Mesh");
mball_to_mesh( &ob->disp, tmpmesh ); mball_to_mesh( &ob->disp, tmpmesh );
break; break;