* Added REQUIRED flag for function parameters.
* Made dupliframes/verts/faces/groups an enum, and make it editable.
* Enum bitflags were broken, fixed.
This commit is contained in:
Brecht Van Lommel
2009-04-11 01:43:50 +00:00
parent 728767bad7
commit 344449e483
7 changed files with 34 additions and 22 deletions

View File

@@ -348,6 +348,7 @@ const struct ListBase *RNA_struct_defined_functions(StructRNA *srna);
const char *RNA_property_identifier(PointerRNA *ptr, PropertyRNA *prop);
PropertyType RNA_property_type(PointerRNA *ptr, PropertyRNA *prop);
PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_flag(PointerRNA *ptr, PropertyRNA *prop);
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);

View File

@@ -89,6 +89,9 @@ typedef enum PropertyFlag {
* and collections */
PROP_ANIMATEABLE = 2,
/* function paramater flags */
PROP_REQUIRED = 4,
/* internal flags */
PROP_BUILTIN = 128,
PROP_EXPORT = 256,

View File

@@ -77,7 +77,7 @@ clean::
# we want the .o's to be in the makesrna/ directory, but the
# .c's are in the editors/*/ directories
$(DIR)/$(DEBUG_DIR)%_api.o: ../../editors/interface/*_api.c
$(DIR)/$(DEBUG_DIR)%_api.o: ../../editors/interface/%_api.c
ifdef NAN_DEPEND
@set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
| sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \

View File

@@ -198,7 +198,8 @@ static void rna_def_ID(BlenderRNA *brna)
/* XXX temporary for testing */
func= RNA_def_function(srna, "rename", "rename_id");
RNA_def_function_ui_description(func, "Rename this ID datablock.");
RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
prop= RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
RNA_def_property_flag(prop, PROP_REQUIRED);
}
static void rna_def_library(BlenderRNA *brna)

View File

@@ -401,6 +401,13 @@ PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop)
return prop->subtype;
}
int RNA_property_flag(PointerRNA *ptr, PropertyRNA *prop)
{
rna_idproperty_check(&prop, ptr);
return prop->flag;
}
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
{
IDProperty *idprop;

View File

@@ -1404,7 +1404,7 @@ void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structnam
dp= rna_find_struct_property_def(prop);
if(dp)
dp->booleannegative= 1;
dp->enumbitflags= 1;
}
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)

View File

@@ -48,6 +48,12 @@ static void rna_Object_update(bContext *C, PointerRNA *ptr)
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
}
static void rna_Object_scene_update(bContext *C, PointerRNA *ptr)
{
DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
DAG_scene_sort(CTX_data_scene(C));
}
static int rna_VertexGroup_index_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
@@ -483,6 +489,14 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
{1, "OBJECT", "Object", ""},
{0, NULL, NULL, NULL}};
static EnumPropertyItem dupli_items[] = {
{0, "NONE", "None", ""},
{OB_DUPLIFRAMES, "FRAMES", "Frames", "Make copy of object for every frame."},
{OB_DUPLIVERTS, "VERTS", "Verts", "Duplicate child objects on all vertices."},
{OB_DUPLIFACES, "FACES", "Faces", "Duplicate child objects on all faces."},
{OB_DUPLIGROUP, "GROUP", "Group", "Enable group instancing."},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "Object", "ID");
RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene..");
@@ -720,25 +734,11 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship.");
prop= RNA_def_property(srna, "dupli_frames", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFRAMES);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
RNA_def_property_ui_text(prop, "Dupli Frames", "Make copy of object for every frame.");
prop= RNA_def_property(srna, "dupli_verts", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIVERTS);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
RNA_def_property_ui_text(prop, "Dupli Verts", "Duplicate child objects on all vertices.");
prop= RNA_def_property(srna, "dupli_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
RNA_def_property_ui_text(prop, "Dupli Faces", "Duplicate child objects on all faces.");
prop= RNA_def_property(srna, "use_dupli_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIGROUP);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // clear other flags
RNA_def_property_ui_text(prop, "Use Dupli Group", "Enable group instancing.");
prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
RNA_def_property_enum_items(prop, dupli_items);
RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use.");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_scene_update");
prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);