Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_main_api.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "rna_internal.h" | #include "rna_internal.h" | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_collection.h" | |||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_lamp.h" | #include "BKE_lamp.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_library_remap.h" | #include "BKE_library_remap.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_icons.h" | #include "BKE_icons.h" | ||||
| #include "BKE_idcode.h" | #include "BKE_idcode.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_sound.h" | #include "BKE_sound.h" | ||||
| #include "BKE_text.h" | #include "BKE_text.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "BKE_group.h" | |||||
| #include "BKE_brush.h" | #include "BKE_brush.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| #include "BKE_world.h" | #include "BKE_world.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_font.h" | #include "BKE_font.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| ▲ Show 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | static World *rna_Main_worlds_new(Main *bmain, const char *name) | ||||
| char safe_name[MAX_ID_NAME - 2]; | char safe_name[MAX_ID_NAME - 2]; | ||||
| rna_idname_validate(name, safe_name); | rna_idname_validate(name, safe_name); | ||||
| World *world = BKE_world_add(bmain, safe_name); | World *world = BKE_world_add(bmain, safe_name); | ||||
| id_us_min(&world->id); | id_us_min(&world->id); | ||||
| return world; | return world; | ||||
| } | } | ||||
| static Group *rna_Main_groups_new(Main *bmain, const char *name) | static Collection *rna_Main_collections_new(Main *bmain, const char *name) | ||||
| { | { | ||||
| char safe_name[MAX_ID_NAME - 2]; | char safe_name[MAX_ID_NAME - 2]; | ||||
| rna_idname_validate(name, safe_name); | rna_idname_validate(name, safe_name); | ||||
| return BKE_group_add(bmain, safe_name); | return BKE_collection_add(bmain, NULL, safe_name); | ||||
| } | } | ||||
| static Speaker *rna_Main_speakers_new(Main *bmain, const char *name) | static Speaker *rna_Main_speakers_new(Main *bmain, const char *name) | ||||
| { | { | ||||
| char safe_name[MAX_ID_NAME - 2]; | char safe_name[MAX_ID_NAME - 2]; | ||||
| rna_idname_validate(name, safe_name); | rna_idname_validate(name, safe_name); | ||||
| Speaker *speaker = BKE_speaker_add(bmain, safe_name); | Speaker *speaker = BKE_speaker_add(bmain, safe_name); | ||||
| ▲ Show 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | |||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(images, image, ID_IM) | RNA_MAIN_ID_TAG_FUNCS_DEF(images, image, ID_IM) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(lattices, latt, ID_LT) | RNA_MAIN_ID_TAG_FUNCS_DEF(lattices, latt, ID_LT) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(curves, curve, ID_CU) | RNA_MAIN_ID_TAG_FUNCS_DEF(curves, curve, ID_CU) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(metaballs, mball, ID_MB) | RNA_MAIN_ID_TAG_FUNCS_DEF(metaballs, mball, ID_MB) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, vfont, ID_VF) | RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, vfont, ID_VF) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(textures, tex, ID_TE) | RNA_MAIN_ID_TAG_FUNCS_DEF(textures, tex, ID_TE) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brush, ID_BR) | RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brush, ID_BR) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, world, ID_WO) | RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, world, ID_WO) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(groups, group, ID_GR) | RNA_MAIN_ID_TAG_FUNCS_DEF(collections, collection, ID_GR) | ||||
| //RNA_MAIN_ID_TAG_FUNCS_DEF(shape_keys, key, ID_KE) | //RNA_MAIN_ID_TAG_FUNCS_DEF(shape_keys, key, ID_KE) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(texts, text, ID_TXT) | RNA_MAIN_ID_TAG_FUNCS_DEF(texts, text, ID_TXT) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK) | RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sound, ID_SO) | RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sound, ID_SO) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armature, ID_AR) | RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armature, ID_AR) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(actions, action, ID_AC) | RNA_MAIN_ID_TAG_FUNCS_DEF(actions, action, ID_AC) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particle, ID_PA) | RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particle, ID_PA) | ||||
| RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL) | RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL) | ||||
| ▲ Show 20 Lines • Show All 637 Lines • ▼ Show 20 Lines | void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_property_srna(cprop, "BlendDataTextures"); | RNA_def_property_srna(cprop, "BlendDataTextures"); | ||||
| srna = RNA_def_struct(brna, "BlendDataTextures", NULL); | srna = RNA_def_struct(brna, "BlendDataTextures", NULL); | ||||
| RNA_def_struct_sdna(srna, "Main"); | RNA_def_struct_sdna(srna, "Main"); | ||||
| RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups"); | RNA_def_struct_ui_text(srna, "Main Textures", "Collection of textures"); | ||||
| func = RNA_def_function(srna, "new", "rna_Main_textures_new"); | func = RNA_def_function(srna, "new", "rna_Main_textures_new"); | ||||
| RNA_def_function_ui_description(func, "Add a new texture to the main database"); | RNA_def_function_ui_description(func, "Add a new texture to the main database"); | ||||
| parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the data-block"); | parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the data-block"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_enum(func, "type", rna_enum_texture_type_items, 0, "Type", "The type of texture to add"); | parm = RNA_def_enum(func, "type", rna_enum_texture_type_items, 0, "Type", "The type of texture to add"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return type */ | /* return type */ | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| parm = RNA_def_boolean(func, "value", 0, "Value", ""); | parm = RNA_def_boolean(func, "value", 0, "Value", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL); | ||||
| } | } | ||||
| void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop) | void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| RNA_def_property_srna(cprop, "BlendDataGroups"); | RNA_def_property_srna(cprop, "BlendDataCollections"); | ||||
| srna = RNA_def_struct(brna, "BlendDataGroups", NULL); | srna = RNA_def_struct(brna, "BlendDataCollections", NULL); | ||||
| RNA_def_struct_sdna(srna, "Main"); | RNA_def_struct_sdna(srna, "Main"); | ||||
| RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups"); | RNA_def_struct_ui_text(srna, "Main Collections", "Collection of collections"); | ||||
| func = RNA_def_function(srna, "new", "rna_Main_groups_new"); | func = RNA_def_function(srna, "new", "rna_Main_collections_new"); | ||||
| RNA_def_function_ui_description(func, "Add a new group to the main database"); | RNA_def_function_ui_description(func, "Add a new collection to the main database"); | ||||
| parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the data-block"); | parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return type */ | /* return type */ | ||||
| parm = RNA_def_pointer(func, "group", "Group", "", "New group data-block"); | parm = RNA_def_pointer(func, "collection", "Collection", "", "New collection data-block"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); | func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); | ||||
| RNA_def_function_ui_description(func, "Remove a group from the current blendfile"); | RNA_def_function_ui_description(func, "Remove a collection from the current blendfile"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove"); | parm = RNA_def_pointer(func, "collection", "Collection", "", "Collection to remove"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | ||||
| RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this group before deleting it"); | RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this collection before deleting it"); | ||||
| RNA_def_boolean(func, "do_id_user", true, "", | RNA_def_boolean(func, "do_id_user", true, "", | ||||
| "Decrement user counter of all datablocks used by this group"); | "Decrement user counter of all datablocks used by this collection"); | ||||
| RNA_def_boolean(func, "do_ui_user", true, "", | RNA_def_boolean(func, "do_ui_user", true, "", | ||||
| "Make sure interface does not reference this group"); | "Make sure interface does not reference this collection"); | ||||
| func = RNA_def_function(srna, "tag", "rna_Main_groups_tag"); | func = RNA_def_function(srna, "tag", "rna_Main_collections_tag"); | ||||
| parm = RNA_def_boolean(func, "value", 0, "Value", ""); | parm = RNA_def_boolean(func, "value", 0, "Value", ""); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_Main_collections_is_updated_get", NULL); | ||||
| } | } | ||||
| void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) | void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 571 Lines • Show Last 20 Lines | |||||