diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 307 |
1 files changed, 105 insertions, 202 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index f00b308e36b..835d6e5117f 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -51,8 +51,8 @@ #include "BKE_main.h" #include "BKE_camera.h" +#include "BKE_collection.h" #include "BKE_curve.h" -#include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_mesh.h" #include "BKE_armature.h" @@ -69,7 +69,6 @@ #include "BKE_sound.h" #include "BKE_text.h" #include "BKE_action.h" -#include "BKE_group.h" #include "BKE_brush.h" #include "BKE_lattice.h" #include "BKE_mball.h" @@ -78,12 +77,16 @@ #include "BKE_paint.h" #include "BKE_font.h" #include "BKE_node.h" -#include "BKE_depsgraph.h" #include "BKE_speaker.h" +#include "BKE_lightprobe.h" #include "BKE_movieclip.h" #include "BKE_mask.h" #include "BKE_gpencil.h" #include "BKE_linestyle.h" +#include "BKE_workspace.h" + +#include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" @@ -93,6 +96,7 @@ #include "DNA_mesh_types.h" #include "DNA_speaker_types.h" #include "DNA_sound_types.h" +#include "DNA_lightprobe_types.h" #include "DNA_text_types.h" #include "DNA_texture_types.h" #include "DNA_group_types.h" @@ -115,6 +119,8 @@ # include "BPY_extern.h" #endif +#include "WM_api.h" + static void rna_idname_validate(const char *name, char *r_name) { @@ -170,14 +176,15 @@ static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports (scene_new = scene->id.next)) { if (do_unlink) { - bScreen *sc = CTX_wm_screen(C); - if (sc->scene == scene) { + wmWindow *win = CTX_wm_window(C); + + if (WM_window_get_active_scene(win) == scene) { #ifdef WITH_PYTHON BPy_BEGIN_ALLOW_THREADS; #endif - ED_screen_set_scene(C, sc, scene_new); + WM_window_change_active_scene(bmain, C, win, scene_new); #ifdef WITH_PYTHON BPy_END_ALLOW_THREADS; @@ -241,7 +248,6 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char } ob = BKE_object_add_only_object(bmain, type, safe_name); - id_us_min(&ob->id); ob->data = data; test_object_materials(bmain, ob, ob->data); @@ -291,11 +297,12 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) } /* copied from Mesh_getFromObject and adapted to RNA interface */ -/* settings: 1 - preview, 2 - render */ Mesh *rna_Main_meshes_new_from_object( - Main *bmain, ReportList *reports, Scene *sce, - Object *ob, int apply_modifiers, int settings, int calc_tessface, int calc_undeformed) + Main *bmain, ReportList *reports, Depsgraph *depsgraph, + Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed) { + Scene *sce = DEG_get_evaluated_scene(depsgraph); + switch (ob->type) { case OB_FONT: case OB_CURVE: @@ -308,7 +315,7 @@ Mesh *rna_Main_meshes_new_from_object( return NULL; } - return BKE_mesh_new_from_object(bmain, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed); + return BKE_mesh_new_from_object(depsgraph, bmain, sce, ob, apply_modifiers, calc_tessface, calc_undeformed); } static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type) @@ -435,12 +442,12 @@ static World *rna_Main_worlds_new(Main *bmain, const char *name) 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]; 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) @@ -544,7 +551,7 @@ static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, cons } if (clip != NULL) { - DAG_relations_tag_update(bmain); + DEG_relations_tag_update(bmain); } else { BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, @@ -573,14 +580,21 @@ static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name return linestyle; } -/* tag and is_updated functions, all the same */ +static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name) +{ + char safe_name[MAX_ID_NAME - 2]; + rna_idname_validate(name, safe_name); + + LightProbe *probe = BKE_lightprobe_add(bmain, safe_name); + id_us_min(&probe->id); + return probe; +} + +/* tag functions, all the same */ #define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \ static void rna_Main_##_func_name##_tag(Main *bmain, int value) { \ BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \ } \ - static int rna_Main_##_func_name##_is_updated_get(PointerRNA *ptr) { \ - return DAG_id_type_tagged(ptr->data, _id_type) != 0; \ - } RNA_MAIN_ID_TAG_FUNCS_DEF(cameras, camera, ID_CA) RNA_MAIN_ID_TAG_FUNCS_DEF(scenes, scene, ID_SCE) @@ -600,7 +614,7 @@ 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(brushes, brush, ID_BR) 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(texts, text, ID_TXT) RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK) @@ -615,6 +629,8 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(masks, mask, ID_MSK) RNA_MAIN_ID_TAG_FUNCS_DEF(linestyle, linestyle, ID_LS) RNA_MAIN_ID_TAG_FUNCS_DEF(cachefiles, cachefiles, ID_CF) RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC) +RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS) +RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobe, ID_LP) #undef RNA_MAIN_ID_TAG_FUNCS_DEF @@ -642,7 +658,6 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataCameras"); srna = RNA_def_struct(brna, "BlendDataCameras", NULL); @@ -674,10 +689,6 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL); } void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) @@ -685,7 +696,6 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataScenes"); srna = RNA_def_struct(brna, "BlendDataScenes", NULL); @@ -711,10 +721,6 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL); } void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) @@ -722,7 +728,6 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataObjects"); srna = RNA_def_struct(brna, "BlendDataObjects", NULL); @@ -756,10 +761,6 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_objects_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL); } void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) @@ -767,7 +768,6 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMaterials"); srna = RNA_def_struct(brna, "BlendDataMaterials", NULL); @@ -797,17 +797,12 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_materials_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL); } void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; static const EnumPropertyItem dummy_items[] = { {0, "DUMMY", 0, "", ""}, @@ -845,23 +840,12 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL); } void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; - - static const EnumPropertyItem mesh_type_items[] = { - {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, - {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, - {0, NULL, 0, NULL, NULL} - }; RNA_def_property_srna(cprop, "BlendDataMeshes"); srna = RNA_def_struct(brna, "BlendDataMeshes", NULL); @@ -879,14 +863,12 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object"); RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied"); RNA_def_function_flag(func, FUNC_USE_REPORTS); - parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); + parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph within wich to evaluate modifiers"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", @@ -910,17 +892,12 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL); } void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLamps"); srna = RNA_def_struct(brna, "BlendDataLamps", NULL); @@ -954,10 +931,6 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL); } void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) @@ -965,7 +938,6 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLibraries"); srna = RNA_def_struct(brna, "BlendDataLibraries", NULL); @@ -975,10 +947,6 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL); } void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) @@ -986,7 +954,6 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataScreens"); srna = RNA_def_struct(brna, "BlendDataScreens", NULL); @@ -996,10 +963,6 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_screens_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL); } void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) @@ -1007,7 +970,6 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataWindowManagers"); srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL); @@ -1017,17 +979,12 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL); } void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataImages"); srna = RNA_def_struct(brna, "BlendDataImages", NULL); @@ -1074,10 +1031,6 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_images_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL); } void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) @@ -1085,7 +1038,6 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLattices"); srna = RNA_def_struct(brna, "BlendDataLattices", NULL); @@ -1117,17 +1069,12 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL); } void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataCurves"); srna = RNA_def_struct(brna, "BlendDataCurves", NULL); @@ -1161,17 +1108,12 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_curves_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL); } void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMetaBalls"); srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL); @@ -1203,17 +1145,12 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL); } void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataFonts"); srna = RNA_def_struct(brna, "BlendDataFonts", NULL); @@ -1245,22 +1182,17 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL); } void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataTextures"); srna = RNA_def_struct(brna, "BlendDataTextures", NULL); 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"); RNA_def_function_ui_description(func, "Add a new texture to the main database"); @@ -1287,17 +1219,12 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_textures_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL); } void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataBrushes"); srna = RNA_def_struct(brna, "BlendDataBrushes", NULL); @@ -1328,10 +1255,6 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL); } void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) @@ -1339,7 +1262,6 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataWorlds"); srna = RNA_def_struct(brna, "BlendDataWorlds", NULL); @@ -1369,51 +1291,42 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - 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; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; - RNA_def_property_srna(cprop, "BlendDataGroups"); - srna = RNA_def_struct(brna, "BlendDataGroups", NULL); + RNA_def_property_srna(cprop, "BlendDataCollections"); + srna = RNA_def_struct(brna, "BlendDataCollections", NULL); 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"); - RNA_def_function_ui_description(func, "Add a new group to the main database"); - parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the data-block"); + func = RNA_def_function(srna, "new", "rna_Main_collections_new"); + RNA_def_function_ui_description(func, "Add a new collection to the main database"); + parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* 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); 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); - 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_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, "", - "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, "", - "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", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL); } void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) @@ -1421,7 +1334,6 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataSpeakers"); srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL); @@ -1453,10 +1365,6 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL); } void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) @@ -1464,7 +1372,6 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataTexts"); srna = RNA_def_struct(brna, "BlendDataTexts", NULL); @@ -1505,10 +1412,6 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_texts_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL); } void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) @@ -1516,7 +1419,6 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataSounds"); srna = RNA_def_struct(brna, "BlendDataSounds", NULL); @@ -1548,10 +1450,6 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL); } void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) @@ -1559,7 +1457,6 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataArmatures"); srna = RNA_def_struct(brna, "BlendDataArmatures", NULL); @@ -1591,17 +1488,12 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL); } void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataActions"); srna = RNA_def_struct(brna, "BlendDataActions", NULL); @@ -1631,17 +1523,12 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_actions_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL); } void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataParticles"); srna = RNA_def_struct(brna, "BlendDataParticles", NULL); @@ -1671,17 +1558,13 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_particles_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL); } + void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataPalettes"); srna = RNA_def_struct(brna, "BlendDataPalettes", NULL); @@ -1711,17 +1594,12 @@ void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_palettes_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_palettes_is_updated_get", NULL); } void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataCacheFiles"); srna = RNA_def_struct(brna, "BlendDataCacheFiles", NULL); @@ -1731,17 +1609,12 @@ void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_cachefiles_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_cachefiles_is_updated_get", NULL); } void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataPaintCurves"); srna = RNA_def_struct(brna, "BlendDataPaintCurves", NULL); @@ -1751,17 +1624,12 @@ void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "tag", "rna_Main_paintcurves_tag"); parm = RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_paintcurves_is_updated_get", NULL); } void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataGreasePencils"); srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL); @@ -1791,10 +1659,6 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) "Decrement user counter of all datablocks used by this grease pencil"); RNA_def_boolean(func, "do_ui_user", true, "", "Make sure interface does not reference this grease pencil"); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL); } void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop) @@ -1802,7 +1666,6 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMovieClips"); srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL); @@ -1838,10 +1701,6 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop) /* return type */ parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip data-block"); RNA_def_function_return(func, parm); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_movieclips_is_updated_get", NULL); } void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) @@ -1849,7 +1708,6 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataMasks"); srna = RNA_def_struct(brna, "BlendDataMasks", NULL); @@ -1880,10 +1738,6 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) "Decrement user counter of all datablocks used by this mask"); RNA_def_boolean(func, "do_ui_user", true, "", "Make sure interface does not reference this mask"); - - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_masks_is_updated_get", NULL); } void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) @@ -1891,7 +1745,6 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - PropertyRNA *prop; RNA_def_property_srna(cprop, "BlendDataLineStyles"); srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL); @@ -1921,10 +1774,60 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) "Decrement user counter of all datablocks used by this line style"); RNA_def_boolean(func, "do_ui_user", true, "", "Make sure interface does not reference this line style"); +} + +void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "BlendDataWorkSpaces"); + srna = RNA_def_struct(brna, "BlendDataWorkSpaces", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Workspaces", "Collection of workspaces"); + + func = RNA_def_function(srna, "tag", "rna_Main_workspaces_tag"); + parm = RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); +} + +void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "BlendDataProbes"); + srna = RNA_def_struct(brna, "BlendDataProbes", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Light Probes", "Collection of light probes"); + + func = RNA_def_function(srna, "new", "rna_Main_lightprobe_new"); + RNA_def_function_ui_description(func, "Add a new probe to the main database"); + parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "New light probe data-block"); + RNA_def_function_return(func, parm); - prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_boolean_funcs(prop, "rna_Main_linestyle_is_updated_get", NULL); + func = RNA_def_function(srna, "remove", "rna_Main_ID_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a probe from the current blendfile"); + parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Probe to remove"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); + RNA_def_boolean(func, "do_unlink", true, "", + "Unlink all usages of this probe before deleting it " + "(WARNING: will also delete objects instancing that light probe data)"); + RNA_def_boolean(func, "do_id_user", true, "", + "Decrement user counter of all datablocks used by this light probe"); + RNA_def_boolean(func, "do_ui_user", true, "", + "Make sure interface does not reference this light probe"); + + func = RNA_def_function(srna, "tag", "rna_Main_lightprobes_tag"); + parm = RNA_def_boolean(func, "value", 0, "Value", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); } #endif |