Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_main_api.c
| Show All 29 Lines | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <errno.h> | #include <errno.h> | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_modifier_types.h" | #include "DNA_modifier_types.h" | ||||
| #include "DNA_space_types.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #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_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_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_icons.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_group.h" | ||||
| #include "BKE_brush.h" | #include "BKE_brush.h" | ||||
| ▲ Show 20 Lines • Show All 733 Lines • ▼ Show 20 Lines | |||||
| static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC) != 0; } | static int rna_Main_actions_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_AC) != 0; } | ||||
| static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA) != 0; } | static int rna_Main_particles_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PA) != 0; } | ||||
| static int rna_Main_palettes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PAL) != 0; } | static int rna_Main_palettes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_PAL) != 0; } | ||||
| static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD) != 0; } | static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_GD) != 0; } | ||||
| static int rna_Main_linestyle_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LS) != 0; } | static int rna_Main_linestyle_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_LS) != 0; } | ||||
| #else | #else | ||||
| void RNA_api_main(StructRNA *srna) | void RNA_api_main(StructRNA *UNUSED(srna)) | ||||
| { | { | ||||
| #if 0 | #if 0 | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| /* maybe we want to add functions in 'bpy.data' still? | /* maybe we want to add functions in 'bpy.data' still? | ||||
| * for now they are all in collections bpy.data.images.new(...) */ | * for now they are all in collections bpy.data.images.new(...) */ | ||||
| func = RNA_def_function(srna, "add_image", "rna_Main_add_image"); | func = RNA_def_function(srna, "add_image", "rna_Main_add_image"); | ||||
| RNA_def_function_ui_description(func, "Add a new image"); | RNA_def_function_ui_description(func, "Add a new image"); | ||||
| parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from"); | parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_property_flag(parm, PROP_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "image", "Image", "", "New image"); | parm = RNA_def_pointer(func, "image", "Image", "", "New image"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| #else | |||||
| (void)srna; | |||||
| #endif | #endif | ||||
| } | } | ||||
| void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop) | void RNA_def_main_cameras(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, "BlendDataCameras"); | RNA_def_property_srna(cprop, "BlendDataCameras"); | ||||
| srna = RNA_def_struct(brna, "BlendDataCameras", NULL); | srna = RNA_def_struct(brna, "BlendDataCameras", NULL); | ||||
| RNA_def_struct_sdna(srna, "Main"); | RNA_def_struct_sdna(srna, "Main"); | ||||
| RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras"); | RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras"); | ||||
| func = RNA_def_function(srna, "new", "rna_Main_cameras_new"); | func = RNA_def_function(srna, "new", "rna_Main_cameras_new"); | ||||
| RNA_def_function_ui_description(func, "Add a new camera to the main database"); | RNA_def_function_ui_description(func, "Add a new camera to the main database"); | ||||
| parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock"); | parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_property_flag(parm, PROP_REQUIRED); | ||||
| /* return type */ | /* return type */ | ||||
| parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock"); | parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove"); | func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove"); | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| RNA_def_function_ui_description(func, "Remove a camera from the current blendfile"); | RNA_def_function_ui_description(func, "Remove a camera from the current blendfile"); | ||||
| parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove"); | parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); | ||||
| RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | ||||
| func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); | func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag"); | ||||
| parm = RNA_def_boolean(func, "value", 0, "Value", ""); | parm = RNA_def_boolean(func, "value", 0, "Value", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_property_flag(parm, PROP_REQUIRED); | ||||
campbellbarton: Putting thumbnail funcs here seems rather odd. not sure where it fits exactly,
For example, if… | |||||
Not Done Inline ActionsYes, agree this is not the right place, but I do not know where to put them actually. Thing is, i’d like to have them available even in background mode (to allow e.g. first generation of previews from heavy files (like hdr) in a background process - reading the previews from thumbnail is really quick, but generating them from org files can be too slow for UI code). Maybe they could be class members of UILayout? mont29: Yes, agree this is not the right place, but I do not know where to put them actually.
Thing is… | |||||
| 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_cameras_is_updated_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL); | ||||
| } | } | ||||
| void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) | void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,043 Lines • Show Last 20 Lines | |||||
Putting thumbnail funcs here seems rather odd. not sure where it fits exactly,
For example, if they're in main then they should be freed when the user makes a new file, is this the case?