1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 17 /** \file 18 * \ingroup RNA 19 */ 20 21 #pragma once 22 23 #include "BLI_utildefines.h" 24 25 #include "BLI_compiler_attrs.h" 26 27 #include "rna_internal_types.h" 28 29 #include "UI_resources.h" 30 31 #define RNA_MAGIC ((int)~0) 32 33 struct FreestyleSettings; 34 struct ID; 35 struct IDOverrideLibrary; 36 struct IDOverrideLibraryPropertyOperation; 37 struct IDProperty; 38 struct Main; 39 struct Object; 40 struct ReportList; 41 struct SDNA; 42 struct ViewLayer; 43 44 /* Data structures used during define */ 45 46 typedef struct ContainerDefRNA { 47 void *next, *prev; 48 49 ContainerRNA *cont; 50 ListBase properties; 51 } ContainerDefRNA; 52 53 typedef struct FunctionDefRNA { 54 ContainerDefRNA cont; 55 56 FunctionRNA *func; 57 const char *srna; 58 const char *call; 59 const char *gencall; 60 } FunctionDefRNA; 61 62 typedef struct PropertyDefRNA { 63 struct PropertyDefRNA *next, *prev; 64 65 struct ContainerRNA *cont; 66 struct PropertyRNA *prop; 67 68 /* struct */ 69 const char *dnastructname; 70 const char *dnastructfromname; 71 const char *dnastructfromprop; 72 73 /* property */ 74 const char *dnaname; 75 const char *dnatype; 76 int dnaarraylength; 77 int dnapointerlevel; 78 /** 79 * Offset in bytes within `dnastructname`. 80 * -1 when unusable (follows pointer for e.g.). */ 81 int dnaoffset; 82 int dnasize; 83 84 /* for finding length of array collections */ 85 const char *dnalengthstructname; 86 const char *dnalengthname; 87 int dnalengthfixed; 88 89 int64_t booleanbit; 90 bool booleannegative; 91 92 /* not to be confused with PROP_ENUM_FLAG 93 * this only allows one of the flags to be set at a time, clearing all others */ 94 int enumbitflags; 95 } PropertyDefRNA; 96 97 typedef struct StructDefRNA { 98 ContainerDefRNA cont; 99 100 struct StructRNA *srna; 101 const char *filename; 102 103 const char *dnaname; 104 105 /* for derived structs to find data in some property */ 106 const char *dnafromname; 107 const char *dnafromprop; 108 109 ListBase functions; 110 } StructDefRNA; 111 112 typedef struct AllocDefRNA { 113 struct AllocDefRNA *next, *prev; 114 void *mem; 115 } AllocDefRNA; 116 117 typedef struct BlenderDefRNA { 118 struct SDNA *sdna; 119 ListBase structs; 120 ListBase allocs; 121 struct StructRNA *laststruct; 122 bool error; 123 bool silent; 124 bool preprocess; 125 bool verify; 126 bool animate; 127 /** Whether RNA properties defined should be overridable or not by default. */ 128 bool make_overridable; 129 130 /* Keep last. */ 131 #ifndef RNA_RUNTIME 132 struct { 133 /** #RNA_def_property_update */ 134 struct { 135 int noteflag; 136 const char *updatefunc; 137 } property_update; 138 } fallback; 139 #endif 140 } BlenderDefRNA; 141 142 extern BlenderDefRNA DefRNA; 143 144 /* Define functions for all types */ 145 #ifndef __RNA_ACCESS_H__ 146 extern BlenderRNA BLENDER_RNA; 147 #endif 148 149 void RNA_def_ID(struct BlenderRNA *brna); 150 void RNA_def_action(struct BlenderRNA *brna); 151 void RNA_def_animation(struct BlenderRNA *brna); 152 void RNA_def_animviz(struct BlenderRNA *brna); 153 void RNA_def_armature(struct BlenderRNA *brna); 154 void RNA_def_attribute(struct BlenderRNA *brna); 155 void RNA_def_boid(struct BlenderRNA *brna); 156 void RNA_def_brush(struct BlenderRNA *brna); 157 void RNA_def_cachefile(struct BlenderRNA *brna); 158 void RNA_def_camera(struct BlenderRNA *brna); 159 void RNA_def_cloth(struct BlenderRNA *brna); 160 void RNA_def_collections(struct BlenderRNA *brna); 161 void RNA_def_color(struct BlenderRNA *brna); 162 void RNA_def_constraint(struct BlenderRNA *brna); 163 void RNA_def_context(struct BlenderRNA *brna); 164 void RNA_def_curve(struct BlenderRNA *brna); 165 void RNA_def_depsgraph(struct BlenderRNA *brna); 166 void RNA_def_dynamic_paint(struct BlenderRNA *brna); 167 void RNA_def_fcurve(struct BlenderRNA *brna); 168 void RNA_def_gpencil(struct BlenderRNA *brna); 169 void RNA_def_greasepencil_modifier(struct BlenderRNA *brna); 170 void RNA_def_shader_fx(struct BlenderRNA *brna); 171 void RNA_def_hair(struct BlenderRNA *brna); 172 void RNA_def_image(struct BlenderRNA *brna); 173 void RNA_def_key(struct BlenderRNA *brna); 174 void RNA_def_light(struct BlenderRNA *brna); 175 void RNA_def_lattice(struct BlenderRNA *brna); 176 void RNA_def_linestyle(struct BlenderRNA *brna); 177 void RNA_def_main(struct BlenderRNA *brna); 178 void RNA_def_material(struct BlenderRNA *brna); 179 void RNA_def_mesh(struct BlenderRNA *brna); 180 void RNA_def_meta(struct BlenderRNA *brna); 181 void RNA_def_modifier(struct BlenderRNA *brna); 182 void RNA_def_nla(struct BlenderRNA *brna); 183 void RNA_def_nodetree(struct BlenderRNA *brna); 184 void RNA_def_object(struct BlenderRNA *brna); 185 void RNA_def_object_force(struct BlenderRNA *brna); 186 void RNA_def_packedfile(struct BlenderRNA *brna); 187 void RNA_def_palette(struct BlenderRNA *brna); 188 void RNA_def_particle(struct BlenderRNA *brna); 189 void RNA_def_pointcloud(struct BlenderRNA *brna); 190 void RNA_def_pose(struct BlenderRNA *brna); 191 void RNA_def_profile(struct BlenderRNA *brna); 192 void RNA_def_lightprobe(struct BlenderRNA *brna); 193 void RNA_def_render(struct BlenderRNA *brna); 194 void RNA_def_rigidbody(struct BlenderRNA *brna); 195 void RNA_def_rna(struct BlenderRNA *brna); 196 void RNA_def_scene(struct BlenderRNA *brna); 197 void RNA_def_simulation(struct BlenderRNA *brna); 198 void RNA_def_view_layer(struct BlenderRNA *brna); 199 void RNA_def_screen(struct BlenderRNA *brna); 200 void RNA_def_sculpt_paint(struct BlenderRNA *brna); 201 void RNA_def_sequencer(struct BlenderRNA *brna); 202 void RNA_def_fluid(struct BlenderRNA *brna); 203 void RNA_def_space(struct BlenderRNA *brna); 204 void RNA_def_speaker(struct BlenderRNA *brna); 205 void RNA_def_test(struct BlenderRNA *brna); 206 void RNA_def_text(struct BlenderRNA *brna); 207 void RNA_def_texture(struct BlenderRNA *brna); 208 void RNA_def_timeline_marker(struct BlenderRNA *brna); 209 void RNA_def_sound(struct BlenderRNA *brna); 210 void RNA_def_ui(struct BlenderRNA *brna); 211 void RNA_def_userdef(struct BlenderRNA *brna); 212 void RNA_def_vfont(struct BlenderRNA *brna); 213 void RNA_def_volume(struct BlenderRNA *brna); 214 void RNA_def_wm(struct BlenderRNA *brna); 215 void RNA_def_wm_gizmo(struct BlenderRNA *brna); 216 void RNA_def_workspace(struct BlenderRNA *brna); 217 void RNA_def_world(struct BlenderRNA *brna); 218 void RNA_def_movieclip(struct BlenderRNA *brna); 219 void RNA_def_tracking(struct BlenderRNA *brna); 220 void RNA_def_mask(struct BlenderRNA *brna); 221 void RNA_def_xr(struct BlenderRNA *brna); 222 223 /* Common Define functions */ 224 225 void rna_def_attributes_common(struct StructRNA *srna); 226 227 void rna_AttributeGroup_iterator_begin(CollectionPropertyIterator *iter, PointerRNA *ptr); 228 void rna_AttributeGroup_iterator_next(CollectionPropertyIterator *iter); 229 PointerRNA rna_AttributeGroup_iterator_get(CollectionPropertyIterator *iter); 230 int rna_AttributeGroup_length(PointerRNA *ptr); 231 232 void rna_def_animdata_common(struct StructRNA *srna); 233 234 bool rna_AnimaData_override_apply(struct Main *bmain, 235 struct PointerRNA *ptr_local, 236 struct PointerRNA *ptr_reference, 237 struct PointerRNA *ptr_storage, 238 struct PropertyRNA *prop_local, 239 struct PropertyRNA *prop_reference, 240 struct PropertyRNA *prop_storage, 241 const int len_local, 242 const int len_reference, 243 const int len_storage, 244 struct PointerRNA *ptr_item_local, 245 struct PointerRNA *ptr_item_reference, 246 struct PointerRNA *ptr_item_storage, 247 struct IDOverrideLibraryPropertyOperation *opop); 248 249 void rna_def_animviz_common(struct StructRNA *srna); 250 void rna_def_motionpath_common(struct StructRNA *srna); 251 252 void rna_def_bone_curved_common(struct StructRNA *srna, bool is_posebone, bool is_editbone); 253 254 void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable); 255 void rna_def_mtex_common(struct BlenderRNA *brna, 256 struct StructRNA *srna, 257 const char *begin, 258 const char *activeget, 259 const char *activeset, 260 const char *activeeditable, 261 const char *structname, 262 const char *structname_slots, 263 const char *update, 264 const char *update_index); 265 void rna_def_texpaint_slots(struct BlenderRNA *brna, struct StructRNA *srna); 266 void rna_def_view_layer_common(struct StructRNA *srna, const bool scene); 267 268 void rna_def_actionbone_group_common(struct StructRNA *srna, 269 int update_flag, 270 const char *update_cb); 271 void rna_ActionGroup_colorset_set(struct PointerRNA *ptr, int value); 272 bool rna_ActionGroup_is_custom_colorset_get(struct PointerRNA *ptr); 273 274 void rna_ID_name_get(struct PointerRNA *ptr, char *value); 275 int rna_ID_name_length(struct PointerRNA *ptr); 276 void rna_ID_name_set(struct PointerRNA *ptr, const char *value); 277 struct StructRNA *rna_ID_refine(struct PointerRNA *ptr); 278 struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, bool create); 279 void rna_ID_fake_user_set(struct PointerRNA *ptr, bool value); 280 void **rna_ID_instance(PointerRNA *ptr); 281 struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, bool create); 282 void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type); 283 struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, 284 struct ReportList *reports, 285 void *data, 286 const char *identifier, 287 StructValidateFunc validate, 288 StructCallbackFunc call, 289 StructFreeFunc free); 290 struct StructRNA *rna_PropertyGroup_refine(struct PointerRNA *ptr); 291 292 void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index); 293 int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index); 294 void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index); 295 void rna_object_vgroup_name_set(struct PointerRNA *ptr, 296 const char *value, 297 char *result, 298 int maxlen); 299 void rna_object_uvlayer_name_set(struct PointerRNA *ptr, 300 const char *value, 301 char *result, 302 int maxlen); 303 void rna_object_vcollayer_name_set(struct PointerRNA *ptr, 304 const char *value, 305 char *result, 306 int maxlen); 307 PointerRNA rna_object_shapekey_index_get(struct ID *id, int value); 308 int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current); 309 310 /* ViewLayer related functions defined in rna_scene.c but required in rna_layer.c */ 311 void rna_def_freestyle_settings(struct BlenderRNA *brna); 312 struct PointerRNA rna_FreestyleLineSet_linestyle_get(struct PointerRNA *ptr); 313 void rna_FreestyleLineSet_linestyle_set(struct PointerRNA *ptr, 314 struct PointerRNA value, 315 struct ReportList *reports); 316 struct FreestyleLineSet *rna_FreestyleSettings_lineset_add(struct ID *id, 317 struct FreestyleSettings *config, 318 struct Main *bmain, 319 const char *name); 320 void rna_FreestyleSettings_lineset_remove(struct ID *id, 321 struct FreestyleSettings *config, 322 struct ReportList *reports, 323 struct PointerRNA *lineset_ptr); 324 struct PointerRNA rna_FreestyleSettings_active_lineset_get(struct PointerRNA *ptr); 325 void rna_FreestyleSettings_active_lineset_index_range( 326 struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax); 327 int rna_FreestyleSettings_active_lineset_index_get(struct PointerRNA *ptr); 328 void rna_FreestyleSettings_active_lineset_index_set(struct PointerRNA *ptr, int value); 329 struct FreestyleModuleConfig *rna_FreestyleSettings_module_add(struct ID *id, 330 struct FreestyleSettings *config); 331 void rna_FreestyleSettings_module_remove(struct ID *id, 332 struct FreestyleSettings *config, 333 struct ReportList *reports, 334 struct PointerRNA *module_ptr); 335 336 void rna_Scene_use_view_map_cache_update(struct Main *bmain, 337 struct Scene *scene, 338 struct PointerRNA *ptr); 339 void rna_Scene_glsl_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); 340 void rna_Scene_freestyle_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); 341 void rna_ViewLayer_name_set(struct PointerRNA *ptr, const char *value); 342 void rna_ViewLayer_material_override_update(struct Main *bmain, 343 struct Scene *activescene, 344 struct PointerRNA *ptr); 345 void rna_ViewLayer_pass_update(struct Main *bmain, 346 struct Scene *activescene, 347 struct PointerRNA *ptr); 348 349 /* named internal so as not to conflict with obj.update() rna func */ 350 void rna_Object_internal_update_data(struct Main *bmain, 351 struct Scene *scene, 352 struct PointerRNA *ptr); 353 void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); 354 void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr); 355 356 /* basic poll functions for object types */ 357 bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 358 bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 359 bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 360 bool rna_GPencil_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 361 bool rna_Light_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 362 bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 363 bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value); 364 365 /* basic poll functions for actions (to prevent actions getting set in wrong places) */ 366 bool rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value); 367 bool rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value); 368 369 /* Grease Pencil datablock polling functions - for filtering GP Object vs Annotation datablocks */ 370 bool rna_GPencil_datablocks_annotations_poll(struct PointerRNA *ptr, 371 const struct PointerRNA value); 372 bool rna_GPencil_datablocks_obdata_poll(struct PointerRNA *ptr, const struct PointerRNA value); 373 374 char *rna_TextureSlot_path(struct PointerRNA *ptr); 375 char *rna_Node_ImageUser_path(struct PointerRNA *ptr); 376 377 /* Set U.is_dirty and redraw. */ 378 void rna_userdef_is_dirty_update_impl(void); 379 void rna_userdef_is_dirty_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); 380 381 /* API functions */ 382 383 void RNA_api_action(StructRNA *srna); 384 void RNA_api_animdata(struct StructRNA *srna); 385 void RNA_api_armature_edit_bone(StructRNA *srna); 386 void RNA_api_bone(StructRNA *srna); 387 void RNA_api_camera(StructRNA *srna); 388 void RNA_api_curve(StructRNA *srna); 389 void RNA_api_curve_nurb(StructRNA *srna); 390 void RNA_api_fcurves(StructRNA *srna); 391 void RNA_api_drivers(StructRNA *srna); 392 void RNA_api_image_packed_file(struct StructRNA *srna); 393 void RNA_api_image(struct StructRNA *srna); 394 void RNA_api_lattice(struct StructRNA *srna); 395 void RNA_api_operator(struct StructRNA *srna); 396 void RNA_api_macro(struct StructRNA *srna); 397 void RNA_api_gizmo(struct StructRNA *srna); 398 void RNA_api_gizmogroup(struct StructRNA *srna); 399 void RNA_api_keyconfig(struct StructRNA *srna); 400 void RNA_api_keyconfigs(struct StructRNA *srna); 401 void RNA_api_keyingset(struct StructRNA *srna); 402 void RNA_api_keymap(struct StructRNA *srna); 403 void RNA_api_keymaps(struct StructRNA *srna); 404 void RNA_api_keymapitem(struct StructRNA *srna); 405 void RNA_api_keymapitems(struct StructRNA *srna); 406 void RNA_api_main(struct StructRNA *srna); 407 void RNA_api_material(StructRNA *srna); 408 void RNA_api_mesh(struct StructRNA *srna); 409 void RNA_api_meta(struct StructRNA *srna); 410 void RNA_api_object(struct StructRNA *srna); 411 void RNA_api_pose(struct StructRNA *srna); 412 void RNA_api_pose_channel(struct StructRNA *srna); 413 void RNA_api_scene(struct StructRNA *srna); 414 void RNA_api_scene_render(struct StructRNA *srna); 415 void RNA_api_sequence_strip(StructRNA *srna); 416 void RNA_api_text(struct StructRNA *srna); 417 void RNA_api_ui_layout(struct StructRNA *srna); 418 void RNA_api_window(struct StructRNA *srna); 419 void RNA_api_wm(struct StructRNA *srna); 420 void RNA_api_space_node(struct StructRNA *srna); 421 void RNA_api_space_text(struct StructRNA *srna); 422 void RNA_api_region_view3d(struct StructRNA *srna); 423 void RNA_api_texture(struct StructRNA *srna); 424 void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop); 425 void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop); 426 void RNA_api_sound(struct StructRNA *srna); 427 void RNA_api_vfont(struct StructRNA *srna); 428 void RNA_api_workspace(struct StructRNA *srna); 429 void RNA_api_workspace_tool(struct StructRNA *srna); 430 431 /* main collection functions */ 432 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop); 433 void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop); 434 void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop); 435 void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop); 436 void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop); 437 void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop); 438 void RNA_def_main_lights(BlenderRNA *brna, PropertyRNA *cprop); 439 void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop); 440 void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop); 441 void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop); 442 void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop); 443 void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop); 444 void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop); 445 void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop); 446 void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop); 447 void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop); 448 void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop); 449 void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop); 450 void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop); 451 void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop); 452 void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop); 453 void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop); 454 void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop); 455 void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop); 456 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop); 457 void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop); 458 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop); 459 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop); 460 void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop); 461 void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop); 462 void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop); 463 void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop); 464 void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop); 465 void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop); 466 #ifdef WITH_HAIR_NODES 467 void RNA_def_main_hairs(BlenderRNA *brna, PropertyRNA *cprop); 468 #endif 469 #ifdef WITH_POINT_CLOUD 470 void RNA_def_main_pointclouds(BlenderRNA *brna, PropertyRNA *cprop); 471 #endif 472 void RNA_def_main_volumes(BlenderRNA *brna, PropertyRNA *cprop); 473 #ifdef WITH_GEOMETRY_NODES 474 void RNA_def_main_simulations(BlenderRNA *brna, PropertyRNA *cprop); 475 #endif 476 477 /* ID Properties */ 478 479 extern StringPropertyRNA rna_PropertyGroupItem_string; 480 extern IntPropertyRNA rna_PropertyGroupItem_int; 481 extern IntPropertyRNA rna_PropertyGroupItem_int_array; 482 extern FloatPropertyRNA rna_PropertyGroupItem_float; 483 extern FloatPropertyRNA rna_PropertyGroupItem_float_array; 484 extern PointerPropertyRNA rna_PropertyGroupItem_group; 485 extern PointerPropertyRNA rna_PropertyGroupItem_id; 486 extern CollectionPropertyRNA rna_PropertyGroupItem_collection; 487 extern CollectionPropertyRNA rna_PropertyGroupItem_idp_array; 488 extern FloatPropertyRNA rna_PropertyGroupItem_double; 489 extern FloatPropertyRNA rna_PropertyGroupItem_double_array; 490 491 #ifndef __RNA_ACCESS_H__ 492 extern StructRNA RNA_PropertyGroupItem; 493 extern StructRNA RNA_PropertyGroup; 494 #endif 495 496 struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, 497 struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; 498 struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, 499 struct PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT; 500 struct PropertyRNA *rna_ensure_property(struct PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT; 501 502 /* Override default callbacks. */ 503 /* Default override callbacks for all types. */ 504 /* TODO: Maybe at some point we'll want to write that in direct RNA-generated code instead 505 * (like we do for default get/set/etc.)? 506 * Not obvious though, those are fairly more complicated than basic SDNA access. 507 */ 508 int rna_property_override_diff_default(struct Main *bmain, 509 struct PropertyRNAOrID *prop_a, 510 struct PropertyRNAOrID *prop_b, 511 const int mode, 512 struct IDOverrideLibrary *override, 513 const char *rna_path, 514 const size_t rna_path_len, 515 const int flags, 516 bool *r_override_changed); 517 518 bool rna_property_override_store_default(struct Main *bmain, 519 struct PointerRNA *ptr_local, 520 struct PointerRNA *ptr_reference, 521 struct PointerRNA *ptr_storage, 522 struct PropertyRNA *prop_local, 523 struct PropertyRNA *prop_reference, 524 struct PropertyRNA *prop_storage, 525 const int len_local, 526 const int len_reference, 527 const int len_storage, 528 struct IDOverrideLibraryPropertyOperation *opop); 529 530 bool rna_property_override_apply_default(struct Main *bmain, 531 struct PointerRNA *ptr_dst, 532 struct PointerRNA *ptr_src, 533 struct PointerRNA *ptr_storage, 534 struct PropertyRNA *prop_dst, 535 struct PropertyRNA *prop_src, 536 struct PropertyRNA *prop_storage, 537 const int len_dst, 538 const int len_src, 539 const int len_storage, 540 struct PointerRNA *ptr_item_dst, 541 struct PointerRNA *ptr_item_src, 542 struct PointerRNA *ptr_item_storage, 543 struct IDOverrideLibraryPropertyOperation *opop); 544 545 /* Builtin Property Callbacks */ 546 547 void rna_builtin_properties_begin(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr); 548 void rna_builtin_properties_next(struct CollectionPropertyIterator *iter); 549 PointerRNA rna_builtin_properties_get(struct CollectionPropertyIterator *iter); 550 PointerRNA rna_builtin_type_get(struct PointerRNA *ptr); 551 int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr); 552 553 /* Iterators */ 554 555 void rna_iterator_listbase_begin(struct CollectionPropertyIterator *iter, 556 struct ListBase *lb, 557 IteratorSkipFunc skip); 558 void rna_iterator_listbase_next(struct CollectionPropertyIterator *iter); 559 void *rna_iterator_listbase_get(struct CollectionPropertyIterator *iter); 560 void rna_iterator_listbase_end(struct CollectionPropertyIterator *iter); 561 PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, 562 StructRNA *type, 563 struct ListBase *lb, 564 int index); 565 566 void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, 567 void *ptr, 568 int itemsize, 569 int length, 570 bool free_ptr, 571 IteratorSkipFunc skip); 572 void rna_iterator_array_next(struct CollectionPropertyIterator *iter); 573 void *rna_iterator_array_get(struct CollectionPropertyIterator *iter); 574 void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter); 575 void rna_iterator_array_end(struct CollectionPropertyIterator *iter); 576 PointerRNA rna_array_lookup_int( 577 PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index); 578 579 /* Duplicated code since we can't link in blenlib */ 580 581 #ifndef RNA_RUNTIME 582 void *rna_alloc_from_buffer(const char *buffer, int buffer_len); 583 void *rna_calloc(int buffer_len); 584 #endif 585 586 void rna_addtail(struct ListBase *listbase, void *vlink); 587 void rna_freelinkN(struct ListBase *listbase, void *vlink); 588 void rna_freelistN(struct ListBase *listbase); 589 PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier); 590 591 StructDefRNA *rna_find_struct_def(StructRNA *srna); 592 FunctionDefRNA *rna_find_function_def(FunctionRNA *func); 593 PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm); 594 PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop); 595 596 /* Pointer Handling */ 597 598 PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *type, void *data); 599 600 /* Functions */ 601 602 int rna_parameter_size(struct PropertyRNA *parm); 603 604 /* XXX, these should not need to be defined here~! */ 605 struct MTex *rna_mtex_texture_slots_add(struct ID *self, 606 struct bContext *C, 607 struct ReportList *reports); 608 struct MTex *rna_mtex_texture_slots_create(struct ID *self, 609 struct bContext *C, 610 struct ReportList *reports, 611 int index); 612 void rna_mtex_texture_slots_clear(struct ID *self, 613 struct bContext *C, 614 struct ReportList *reports, 615 int index); 616 617 int rna_IDMaterials_assign_int(struct PointerRNA *ptr, 618 int key, 619 const struct PointerRNA *assign_ptr); 620 621 const char *rna_translate_ui_text(const char *text, 622 const char *text_ctxt, 623 struct StructRNA *type, 624 struct PropertyRNA *prop, 625 bool translate); 626 627 /* Internal functions that cycles uses so we need to declare (tsk tsk) */ 628 void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values); 629 630 #ifdef RNA_RUNTIME 631 # ifdef __GNUC__ 632 # pragma GCC diagnostic ignored "-Wredundant-decls" 633 # endif 634 #endif 635 636 /* C11 for compile time range checks */ 637 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) 638 # define USE_RNA_RANGE_CHECK 639 # define TYPEOF_MAX(x) \ 640 _Generic((x), bool : 1, char \ 641 : CHAR_MAX, signed char \ 642 : SCHAR_MAX, unsigned char \ 643 : UCHAR_MAX, signed short \ 644 : SHRT_MAX, unsigned short \ 645 : USHRT_MAX, signed int \ 646 : INT_MAX, unsigned int \ 647 : UINT_MAX, float \ 648 : FLT_MAX, double \ 649 : DBL_MAX) 650 651 # define TYPEOF_MIN(x) \ 652 _Generic((x), bool : 0, char \ 653 : CHAR_MIN, signed char \ 654 : SCHAR_MIN, unsigned char : 0, signed short \ 655 : SHRT_MIN, unsigned short : 0, signed int \ 656 : INT_MIN, unsigned int : 0, float \ 657 : -FLT_MAX, double \ 658 : -DBL_MAX) 659 #endif 660