| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup RNA | 
					
						
							| 
									
										
										
										
											2011-02-27 20:20:01 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | #include <stdio.h>
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #include <stdlib.h>
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "DNA_ID.h"
 | 
					
						
							| 
									
										
										
										
											2011-07-31 12:43:41 +00:00
										 |  |  | #include "DNA_material_types.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  | #include "DNA_object_types.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #include "DNA_vfont_types.h"
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | #include "BKE_icons.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 12:58:59 +01:00
										 |  |  | #include "BKE_lib_id.h"
 | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  | #include "BKE_object.h"
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | #include "RNA_access.h"
 | 
					
						
							|  |  |  | #include "RNA_define.h"
 | 
					
						
							| 
									
										
										
										
											2013-09-11 21:27:14 +00:00
										 |  |  | #include "RNA_enum_types.h"
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-25 23:13:47 +00:00
										 |  |  | #include "WM_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-03 23:16:51 +00:00
										 |  |  | #include "rna_internal.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-18 09:27:36 +00:00
										 |  |  | /* enum of ID-block types
 | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |  * NOTE: need to keep this in line with the other defines for these | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-10-18 15:07:26 +11:00
										 |  |  | const EnumPropertyItem rna_enum_id_type_items[] = { | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_AC, "ACTION", ICON_ACTION, "Action", ""}, | 
					
						
							|  |  |  |     {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""}, | 
					
						
							|  |  |  |     {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""}, | 
					
						
							|  |  |  |     {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""}, | 
					
						
							| 
									
										
										
											
												Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
											
										 
											2016-08-06 06:20:37 +02:00
										 |  |  |     {ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_CU, "CURVE", ICON_CURVE_DATA, "Curve", ""}, | 
					
						
							|  |  |  |     {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""}, | 
					
						
							|  |  |  |     {ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""}, | 
					
						
							| 
									
										
										
										
											2020-11-13 18:39:19 -07:00
										 |  |  |     {ID_GR, "COLLECTION", ICON_OUTLINER_COLLECTION, "Collection", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""}, | 
					
						
							|  |  |  |     {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""}, | 
					
						
							| 
									
										
										
										
											2018-06-27 14:41:53 +02:00
										 |  |  |     {ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-15 13:47:18 +00:00
										 |  |  |     {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""}, | 
					
						
							| 
									
										
										
										
											2014-03-04 03:47:58 +11:00
										 |  |  |     {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""}, | 
					
						
							| 
									
										
										
										
											2014-10-06 21:39:03 +02:00
										 |  |  |     {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, | 
					
						
							| 
									
										
										
										
											2016-07-26 20:15:00 +02:00
										 |  |  |     {ID_MB, "META", ICON_META_DATA, "Metaball", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""}, | 
					
						
							| 
									
										
										
										
											2018-12-31 13:50:56 +01:00
										 |  |  |     {ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""}, | 
					
						
							| 
									
										
										
										
											2016-07-26 20:15:00 +02:00
										 |  |  |     {ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""}, | 
					
						
							| 
									
										
										
										
											2014-10-06 21:39:03 +02:00
										 |  |  |     {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""}, | 
					
						
							|  |  |  |     {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""}, | 
					
						
							| 
									
										
										
										
											2018-05-17 13:40:59 +02:00
										 |  |  |     {ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""}, | 
					
						
							| 
									
										
										
										
											2020-04-20 10:37:38 +02:00
										 |  |  |     {ID_SIM, "SIMULATION", ICON_PHYSICS, "Simulation", ""}, /* TODO: Use correct icon. */ | 
					
						
							| 
									
										
										
										
											2018-05-17 13:40:59 +02:00
										 |  |  |     {ID_SO, "SOUND", ICON_SOUND, "Sound", ""}, | 
					
						
							| 
									
										
										
										
											2011-08-01 11:44:20 +00:00
										 |  |  |     {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""}, | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  |     {ID_TXT, "TEXT", ICON_TEXT, "Text", ""}, | 
					
						
							|  |  |  |     {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""}, | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |     {ID_HA, "HAIR", ICON_HAIR_DATA, "Hair", ""}, | 
					
						
							| 
									
										
										
										
											2021-01-06 22:54:10 -06:00
										 |  |  |     {ID_PT, "POINTCLOUD", ICON_POINTCLOUD_DATA, "Point Cloud", ""}, | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |     {ID_VO, "VOLUME", ICON_VOLUME_DATA, "Volume", ""}, | 
					
						
							| 
									
										
										
										
											2018-10-31 17:30:47 +01:00
										 |  |  |     {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""}, | 
					
						
							| 
									
										
										
										
											2015-08-06 12:34:31 +10:00
										 |  |  |     {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""}, | 
					
						
							| 
									
										
										
										
											2018-10-01 10:45:50 +02:00
										 |  |  |     {ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |     {0, NULL, 0, NULL, NULL}, | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2009-10-14 09:08:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #ifdef RNA_RUNTIME
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  | #  include "DNA_anim_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 18:05:55 +02:00
										 |  |  | #  include "BLI_listbase.h"
 | 
					
						
							| 
									
										
										
										
											2019-01-26 20:41:52 +11:00
										 |  |  | #  include "BLI_math_base.h"
 | 
					
						
							| 
									
										
										
										
											2016-06-22 18:05:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-03 13:07:36 +02:00
										 |  |  | #  include "BKE_anim_data.h"
 | 
					
						
							| 
									
										
										
										
											2012-08-03 23:44:50 +00:00
										 |  |  | #  include "BKE_font.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #  include "BKE_global.h" /* XXX, remove me */
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | #  include "BKE_idprop.h"
 | 
					
						
							| 
									
										
										
										
											2020-07-23 11:22:55 +02:00
										 |  |  | #  include "BKE_idtype.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 12:58:59 +01:00
										 |  |  | #  include "BKE_lib_override.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #  include "BKE_lib_query.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 12:58:59 +01:00
										 |  |  | #  include "BKE_lib_remap.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 17:10:17 +01:00
										 |  |  | #  include "BKE_library.h"
 | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  | #  include "BKE_material.h"
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  | #  include "DEG_depsgraph.h"
 | 
					
						
							|  |  |  | #  include "DEG_depsgraph_build.h"
 | 
					
						
							| 
									
										
										
										
											2018-10-02 14:13:25 +02:00
										 |  |  | #  include "DEG_depsgraph_query.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  | #  include "WM_api.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | void rna_ID_override_library_property_operation_refname_get(PointerRNA *ptr, char *value) | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   IDOverrideLibraryPropertyOperation *opop = ptr->data; | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | int rna_ID_override_library_property_operation_refname_length(PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   IDOverrideLibraryPropertyOperation *opop = ptr->data; | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | void rna_ID_override_library_property_operation_locname_get(PointerRNA *ptr, char *value) | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   IDOverrideLibraryPropertyOperation *opop = ptr->data; | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | int rna_ID_override_library_property_operation_locname_length(PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   IDOverrideLibraryPropertyOperation *opop = ptr->data; | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | /* name functions that ignore the first two ID characters */ | 
					
						
							| 
									
										
										
										
											2009-01-08 13:57:29 +00:00
										 |  |  | void rna_ID_name_get(PointerRNA *ptr, char *value) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 13:57:29 +00:00
										 |  |  | int rna_ID_name_length(PointerRNA *ptr) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   return strlen(id->name + 2); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-08 13:57:29 +00:00
										 |  |  | void rna_ID_name_set(PointerRNA *ptr, const char *value) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2); | 
					
						
							| 
									
										
										
										
											2018-11-09 10:44:02 -02:00
										 |  |  |   BLI_assert(BKE_id_is_in_global_main(id)); | 
					
						
							| 
									
										
										
										
											2018-06-22 12:35:41 +02:00
										 |  |  |   BLI_libblock_ensure_unique_name(G_MAIN, id->name); | 
					
						
							| 
									
										
										
										
											2018-11-09 10:59:12 -02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (GS(id->name) == ID_OB) { | 
					
						
							|  |  |  |     Object *ob = (Object *)id; | 
					
						
							|  |  |  |     if (ob->type == OB_MBALL) { | 
					
						
							| 
									
										
										
										
											2018-12-06 17:52:37 +01:00
										 |  |  |       DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | 
					
						
							| 
									
										
										
										
											2018-11-09 10:59:12 -02:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-22 00:10:53 +02:00
										 |  |  | static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info)) | 
					
						
							| 
									
										
										
										
											2010-01-11 05:10:57 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							| 
									
										
										
										
											2018-06-09 14:40:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-11 05:10:57 +00:00
										 |  |  |   if (GS(id->name) == ID_VF) { | 
					
						
							| 
									
										
										
										
											2012-08-03 22:12:57 +00:00
										 |  |  |     VFont *vfont = (VFont *)id; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |     if (BKE_vfont_is_builtin(vfont)) { | 
					
						
							| 
									
										
										
										
											2018-11-09 16:49:08 +01:00
										 |  |  |       return 0; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-11-09 16:49:08 +01:00
										 |  |  |   } | 
					
						
							|  |  |  |   else if (!BKE_id_is_in_global_main(id)) { | 
					
						
							|  |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2010-01-11 05:10:57 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-06-09 14:40:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-06 21:43:04 +11:00
										 |  |  |   return PROP_EDITABLE; | 
					
						
							| 
									
										
										
										
											2010-01-11 05:10:57 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-31 13:22:00 +01:00
										 |  |  | void rna_ID_name_full_get(PointerRNA *ptr, char *value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							| 
									
										
										
										
											2020-06-10 15:08:23 +02:00
										 |  |  |   BKE_id_full_name_get(value, id, 0); | 
					
						
							| 
									
										
										
										
											2018-10-31 13:22:00 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int rna_ID_name_full_length(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   char name[MAX_ID_FULL_NAME]; | 
					
						
							| 
									
										
										
										
											2020-06-10 15:08:23 +02:00
										 |  |  |   BKE_id_full_name_get(name, id, 0); | 
					
						
							| 
									
										
										
										
											2018-10-31 13:22:00 +01:00
										 |  |  |   return strlen(name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-02 14:13:25 +02:00
										 |  |  | static int rna_ID_is_evaluated_get(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return (DEG_get_original_id(id) != id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static PointerRNA rna_ID_original_get(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return rna_pointer_inherit_refine(ptr, &RNA_ID, DEG_get_original_id(id)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-12 01:42:42 +02:00
										 |  |  | short RNA_type_to_ID_code(const StructRNA *type) | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |   const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID); | 
					
						
							|  |  |  |   if (UNLIKELY(base_type == NULL)) { | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (base_type == &RNA_Action) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_AC; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Armature) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_AR; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Brush) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_BR; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_CacheFile) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_CF; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Camera) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_CA; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Curve) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_CU; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_GreasePencil) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_GD; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Collection) { | 
					
						
							| 
									
										
											  
											
												Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
  which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
  and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
  for each. For many workflows one view layer can be used, these are more of an
  advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
  which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
  These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
  can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
  text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
  with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
  but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
  into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
  cases. The main thing that's still a bit slower is multiple scenes, we have to
  change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
  updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
  lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
  controls. Of course users may not want to set up their scenes differently
  now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
  files. There's a few things which are know to be not quite compatible, like
  nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
  #ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
  need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
  still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
  be done later, we'll have to see how important this is as all objects within
  the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
											
										 
											2018-04-30 15:57:22 +02:00
										 |  |  |     return ID_GR; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Image) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_IM; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Key) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_KE; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Light) { | 
					
						
							| 
									
										
										
										
											2018-06-27 14:41:53 +02:00
										 |  |  |     return ID_LA; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Library) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_LI; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_FreestyleLineStyle) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_LS; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  ifdef WITH_HAIR_NODES
 | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |   if (base_type == &RNA_Hair) { | 
					
						
							|  |  |  |     return ID_HA; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (base_type == &RNA_Lattice) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_LT; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Material) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_MA; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_MetaBall) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_MB; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_MovieClip) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_MC; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Mesh) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_ME; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Mask) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_MSK; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_NodeTree) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_NT; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Object) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_OB; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_ParticleSettings) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_PA; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Palette) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_PAL; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_PaintCurve) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_PC; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-12-15 13:07:02 +01:00
										 |  |  | #  ifdef WITH_POINT_CLOUD
 | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |   if (base_type == &RNA_PointCloud) { | 
					
						
							|  |  |  |     return ID_PT; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-12-15 13:07:02 +01:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (base_type == &RNA_LightProbe) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_LP; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Scene) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_SCE; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Screen) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_SCR; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-10-21 13:47:50 +02:00
										 |  |  | #  ifdef WITH_GEOMETRY_NODES
 | 
					
						
							| 
									
										
										
										
											2020-04-20 10:37:38 +02:00
										 |  |  |   if (base_type == &RNA_Simulation) { | 
					
						
							|  |  |  |     return ID_SIM; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (base_type == &RNA_Sound) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_SO; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Speaker) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_SPK; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Texture) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_TE; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_Text) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_TXT; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_VectorFont) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_VF; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |   if (base_type == &RNA_Volume) { | 
					
						
							|  |  |  |     return ID_VO; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (base_type == &RNA_WorkSpace) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_WS; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_World) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_WO; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (base_type == &RNA_WindowManager) { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     return ID_WM; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-07 13:09:18 +00:00
										 |  |  |   return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-07 13:09:18 +00:00
										 |  |  | StructRNA *ID_code_to_RNA_type(short idcode) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |   /* Note, this switch doesn't use a 'default',
 | 
					
						
							|  |  |  |    * so adding new ID's causes a warning. */ | 
					
						
							|  |  |  |   switch ((ID_Type)idcode) { | 
					
						
							| 
									
										
										
										
											2009-01-05 16:31:00 +00:00
										 |  |  |     case ID_AC: | 
					
						
							|  |  |  |       return &RNA_Action; | 
					
						
							| 
									
										
										
										
											2008-12-09 11:29:40 +00:00
										 |  |  |     case ID_AR: | 
					
						
							|  |  |  |       return &RNA_Armature; | 
					
						
							| 
									
										
										
										
											2008-12-01 06:52:18 +00:00
										 |  |  |     case ID_BR: | 
					
						
							|  |  |  |       return &RNA_Brush; | 
					
						
							| 
									
										
										
										
											2008-11-29 19:53:49 +00:00
										 |  |  |     case ID_CA: | 
					
						
							|  |  |  |       return &RNA_Camera; | 
					
						
							| 
									
										
										
											
												Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
											
										 
											2016-08-06 06:20:37 +02:00
										 |  |  |     case ID_CF: | 
					
						
							|  |  |  |       return &RNA_CacheFile; | 
					
						
							| 
									
										
										
										
											2008-12-01 19:02:27 +00:00
										 |  |  |     case ID_CU: | 
					
						
							|  |  |  |       return &RNA_Curve; | 
					
						
							| 
									
										
										
										
											2009-08-27 06:03:41 +00:00
										 |  |  |     case ID_GD: | 
					
						
							|  |  |  |       return &RNA_GreasePencil; | 
					
						
							| 
									
										
											  
											
												Collections and groups unification
OVERVIEW
* In 2.7 terminology, all layers and groups are now collection datablocks.
* These collections are nestable, linkable, instanceable, overrideable, ..
  which opens up new ways to set up scenes and link + override data.
* Viewport/render visibility and selectability are now a part of the collection
  and shared across all view layers and linkable.
* View layers define which subset of the scene collection hierarchy is excluded
  for each. For many workflows one view layer can be used, these are more of an
  advanced feature now.
OUTLINER
* The outliner now has a "View Layer" display mode instead of "Collections",
  which can display the collections and/or objects in the view layer.
* In this display mode, collections can be excluded with the right click menu.
  These will then be greyed out and their objects will be excluded.
* To view collections not linked to any scene, the "Blender File" display mode
  can be used, with the new filtering option to just see Colleciton datablocks.
* The outliner right click menus for collections and objects were reorganized.
* Drag and drop still needs to be improved. Like before, dragging the icon or
  text gives different results, we'll unify this later.
LINKING AND OVERRIDES
* Collections can now be linked into the scene without creating an instance,
  with the link/append operator or from the collections view in the outliner.
* Collections can get static overrides with the right click menu in the outliner,
  but this is rather unreliable and not clearly communicated at the moment.
* We still need to improve the make override operator to turn collection instances
  into collections with overrides directly in the scene.
PERFORMANCE
* We tried to make performance not worse than before and improve it in some
  cases. The main thing that's still a bit slower is multiple scenes, we have to
  change the layer syncing to only updated affected scenes.
* Collections keep a list of their parent collections for faster incremental
  updates in syncing and caching.
* View layer bases are now in a object -> base hash to avoid quadratic time
  lookups internally and in API functions like visible_get().
VERSIONING
* Compatibility with 2.7 files should be improved due to the new visibility
  controls. Of course users may not want to set up their scenes differently
  now to avoid having separate layers and groups.
* Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero
  files. There's a few things which are know to be not quite compatible, like
  nested layer collections inside groups.
* The versioning code for 2.8 files is quite complicated, and isolated behind
  #ifdef so it can be removed at the end of the release cycle.
KNOWN ISSUES
* The G-key group operators in the 3D viewport were left mostly as is, they
  need to be modified still to fit better.
* Same for the groups panel in the object properties. This needs to be updated
  still, or perhaps replaced by something better.
* Collections must all have a unique name. Less restrictive namespacing is to
  be done later, we'll have to see how important this is as all objects within
  the collections must also have a unique name anyway.
* Full scene copy and delete scene are exactly doing the right thing yet.
Differential Revision: https://developer.blender.org/D3383
https://code.blender.org/2018/05/collections-and-groups/
											
										 
											2018-04-30 15:57:22 +02:00
										 |  |  |     case ID_GR: | 
					
						
							|  |  |  |       return &RNA_Collection; | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |     case ID_HA: | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  ifdef WITH_HAIR_NODES
 | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |       return &RNA_Hair; | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  else
 | 
					
						
							|  |  |  |       return &RNA_ID; | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2008-11-30 18:39:49 +00:00
										 |  |  |     case ID_IM: | 
					
						
							|  |  |  |       return &RNA_Image; | 
					
						
							| 
									
										
										
										
											2008-12-03 21:18:10 +00:00
										 |  |  |     case ID_KE: | 
					
						
							|  |  |  |       return &RNA_Key; | 
					
						
							| 
									
										
										
										
											2018-06-27 14:41:53 +02:00
										 |  |  |     case ID_LA: | 
					
						
							|  |  |  |       return &RNA_Light; | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |     case ID_LI: | 
					
						
							|  |  |  |       return &RNA_Library; | 
					
						
							| 
									
										
										
										
											2010-06-25 22:45:42 +00:00
										 |  |  |     case ID_LS: | 
					
						
							|  |  |  |       return &RNA_FreestyleLineStyle; | 
					
						
							| 
									
										
										
										
											2008-11-30 16:38:56 +00:00
										 |  |  |     case ID_LT: | 
					
						
							|  |  |  |       return &RNA_Lattice; | 
					
						
							| 
									
										
										
										
											2008-11-27 13:36:28 +00:00
										 |  |  |     case ID_MA: | 
					
						
							|  |  |  |       return &RNA_Material; | 
					
						
							| 
									
										
										
										
											2008-11-30 20:18:55 +00:00
										 |  |  |     case ID_MB: | 
					
						
							|  |  |  |       return &RNA_MetaBall; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_MC: | 
					
						
							|  |  |  |       return &RNA_MovieClip; | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |     case ID_ME: | 
					
						
							|  |  |  |       return &RNA_Mesh; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_MSK: | 
					
						
							|  |  |  |       return &RNA_Mask; | 
					
						
							|  |  |  |     case ID_NT: | 
					
						
							|  |  |  |       return &RNA_NodeTree; | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |     case ID_OB: | 
					
						
							|  |  |  |       return &RNA_Object; | 
					
						
							| 
									
										
										
										
											2009-02-17 21:07:01 +00:00
										 |  |  |     case ID_PA: | 
					
						
							|  |  |  |       return &RNA_ParticleSettings; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_PAL: | 
					
						
							|  |  |  |       return &RNA_Palette; | 
					
						
							|  |  |  |     case ID_PC: | 
					
						
							|  |  |  |       return &RNA_PaintCurve; | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |     case ID_PT: | 
					
						
							| 
									
										
										
										
											2020-12-15 13:07:02 +01:00
										 |  |  | #  ifdef WITH_POINT_CLOUD
 | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |       return &RNA_PointCloud; | 
					
						
							| 
									
										
										
										
											2020-12-15 13:07:02 +01:00
										 |  |  | #  else
 | 
					
						
							|  |  |  |       return &RNA_ID; | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2017-06-12 20:59:54 +10:00
										 |  |  |     case ID_LP: | 
					
						
							|  |  |  |       return &RNA_LightProbe; | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |     case ID_SCE: | 
					
						
							|  |  |  |       return &RNA_Scene; | 
					
						
							| 
									
										
										
										
											2008-11-29 01:04:15 +00:00
										 |  |  |     case ID_SCR: | 
					
						
							|  |  |  |       return &RNA_Screen; | 
					
						
							| 
									
										
										
										
											2020-04-20 10:37:38 +02:00
										 |  |  |     case ID_SIM: | 
					
						
							| 
									
										
										
										
											2020-10-21 13:47:50 +02:00
										 |  |  | #  ifdef WITH_GEOMETRY_NODES
 | 
					
						
							| 
									
										
										
										
											2020-04-20 10:37:38 +02:00
										 |  |  |       return &RNA_Simulation; | 
					
						
							| 
									
										
										
										
											2020-08-17 09:47:10 +02:00
										 |  |  | #  else
 | 
					
						
							|  |  |  |       return &RNA_ID; | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2008-12-26 16:50:05 +00:00
										 |  |  |     case ID_SO: | 
					
						
							|  |  |  |       return &RNA_Sound; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_SPK: | 
					
						
							|  |  |  |       return &RNA_Speaker; | 
					
						
							| 
									
										
										
										
											2009-01-02 23:05:28 +00:00
										 |  |  |     case ID_TE: | 
					
						
							|  |  |  |       return &RNA_Texture; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_TXT: | 
					
						
							|  |  |  |       return &RNA_Text; | 
					
						
							| 
									
										
										
										
											2008-12-02 23:45:11 +00:00
										 |  |  |     case ID_VF: | 
					
						
							|  |  |  |       return &RNA_VectorFont; | 
					
						
							| 
									
										
										
										
											2020-03-17 14:41:48 +01:00
										 |  |  |     case ID_VO: | 
					
						
							|  |  |  |       return &RNA_Volume; | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |     case ID_WM: | 
					
						
							|  |  |  |       return &RNA_WindowManager; | 
					
						
							| 
									
										
										
										
											2015-01-12 19:54:52 +01:00
										 |  |  |     case ID_WO: | 
					
						
							|  |  |  |       return &RNA_World; | 
					
						
							| 
									
										
											  
											
												Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
											
										 
											2017-06-01 19:56:58 +02:00
										 |  |  |     case ID_WS: | 
					
						
							|  |  |  |       return &RNA_WorkSpace; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |     /* deprecated */ | 
					
						
							|  |  |  |     case ID_IP: | 
					
						
							|  |  |  |       break; | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-21 12:13:21 +10:00
										 |  |  |   return &RNA_ID; | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-07 13:09:18 +00:00
										 |  |  | StructRNA *rna_ID_refine(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							| 
									
										
										
										
											2009-06-07 13:09:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return ID_code_to_RNA_type(GS(id->name)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | IDProperty *rna_ID_idprops(PointerRNA *ptr, bool create) | 
					
						
							| 
									
										
										
										
											2009-05-20 09:52:02 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   return IDP_GetProperties(ptr->data, create); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-05 22:25:34 +02:00
										 |  |  | void rna_ID_fake_user_set(PointerRNA *ptr, bool value) | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-09 20:59:42 +01:00
										 |  |  |   if (value) { | 
					
						
							|  |  |  |     id_fake_user_set(id); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-11-09 20:59:42 +01:00
										 |  |  |   else { | 
					
						
							|  |  |  |     id_fake_user_clear(id); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, bool UNUSED(create)) | 
					
						
							| 
									
										
										
										
											2009-05-20 09:52:02 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   return ptr->data; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-31 02:14:25 +00:00
										 |  |  | void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type) | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   RNA_struct_free(&BLENDER_RNA, type); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-13 21:52:57 +10:00
										 |  |  | StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), | 
					
						
							|  |  |  |                                       ReportList *reports, | 
					
						
							|  |  |  |                                       void *data, | 
					
						
							|  |  |  |                                       const char *identifier, | 
					
						
							|  |  |  |                                       StructValidateFunc validate, | 
					
						
							|  |  |  |                                       StructCallbackFunc UNUSED(call), | 
					
						
							|  |  |  |                                       StructFreeFunc UNUSED(free)) | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   PointerRNA dummyptr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* create dummy pointer */ | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr); | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* validate the python class */ | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (validate(&dummyptr, data, NULL) != 0) { | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  |     return NULL; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-22 10:04:15 +00:00
										 |  |  |   /* note: it looks like there is no length limit on the srna id since its
 | 
					
						
							|  |  |  |    * just a char pointer, but take care here, also be careful that python | 
					
						
							| 
									
										
										
										
											2012-02-08 04:37:37 +00:00
										 |  |  |    * owns the string pointer which it could potentially free while blender | 
					
						
							| 
									
										
										
										
											2009-12-22 10:04:15 +00:00
										 |  |  |    * is running. */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) { | 
					
						
							| 
									
										
										
										
											2012-10-21 14:02:30 +00:00
										 |  |  |     BKE_reportf(reports, | 
					
						
							|  |  |  |                 RPT_ERROR, | 
					
						
							|  |  |  |                 "Registering id property class: '%s' is too long, maximum length is %d", | 
					
						
							|  |  |  |                 identifier, | 
					
						
							|  |  |  |                 MAX_IDPROP_NAME); | 
					
						
							| 
									
										
										
										
											2009-12-22 10:04:15 +00:00
										 |  |  |     return NULL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-09 05:32:15 +00:00
										 |  |  |   return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */ | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  | StructRNA *rna_PropertyGroup_refine(PointerRNA *ptr) | 
					
						
							| 
									
										
										
											
												2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
											
										 
											2009-08-18 01:29:25 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   return ptr->type; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
  graph. This is now done via context.evaluated_depsgraph_get().
  The call will ensure both relations and datablocks are updated.
  This way we don't allow access to some known bad state of the graph,
  and also making explicit that getting update dependency graph is not
  cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
  It was already possible to get evaluated ID via dependency graph,
  but that was a bit confusing why access to original is done via ID
  and to evaluated via depsgraph.
  If datablock is not covered by dependency graph it will be returned
  as-is.
- Similarly, request for original from an ID which is not evaluated
  will return ID as-is.
- Removed scene.update().
  This is very expensive to update all the view layers.
- Added depsgraph.update().
  Now when temporary changes to objects are to be done, this is to
  happen on original object and then dependency graph is to be
  updated.
- Changed object.to_mesh() to behave the following way:
   * When is used for original object modifiers are ignored.
     For meshes this acts similar to mesh-copy, not very useful but
     allows to keep code paths similar (i.e. for exporter which has
     Apply Modifiers option it's only matter choosing between original
     and evaluated object, the to_mesh() part can stay the same).
     For curves this gives a mesh which is constructed from displist
     without taking own modifiers and modifiers of bevel/taper objects
     into account.
     For metaballs this gives empty mesh.
     Polygonization of metaball is not possible from a single object.
   * When is used for evaluated object modifiers are always applied.
     In fact, no evaluation is happening, the mesh is either copied
     as-is, or constructed from current state of curve cache.
  Arguments to apply modifiers and calculate original coordinates (ORCO,
  aka undeformed coordinates) are removed. The ORCO is to be calculated
  as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
											
										 
											2019-05-09 11:26:49 +02:00
										 |  |  | static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return DEG_get_evaluated_id(depsgraph, id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-10 14:52:00 +02:00
										 |  |  | static ID *rna_ID_copy(ID *id, Main *bmain) | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-10-07 16:13:01 +02:00
										 |  |  |   ID *newid = BKE_id_copy(bmain, id); | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-07 16:13:01 +02:00
										 |  |  |   if (newid != NULL) { | 
					
						
							|  |  |  |     id_us_min(newid); | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-10-07 16:13:01 +02:00
										 |  |  |   return newid; | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 16:41:35 +02:00
										 |  |  | static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) | 
					
						
							| 
									
										
										
										
											2017-11-29 15:31:31 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-07-13 16:44:41 +02:00
										 |  |  |   if (!ID_IS_OVERRIDABLE_LIBRARY(id)) { | 
					
						
							| 
									
										
										
										
											2017-11-29 15:31:31 +01:00
										 |  |  |     return NULL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-05 16:41:35 +02:00
										 |  |  |   if (remap_local_usages) { | 
					
						
							|  |  |  |     BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-10 18:05:19 +01:00
										 |  |  |   ID *local_id = BKE_lib_override_library_create_from_id(bmain, id, remap_local_usages); | 
					
						
							| 
									
										
										
										
											2019-09-05 16:41:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (remap_local_usages) { | 
					
						
							|  |  |  |     BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return local_id; | 
					
						
							| 
									
										
										
										
											2017-11-29 15:31:31 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  | static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag) | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* XXX, new function for this! */ | 
					
						
							| 
									
										
										
										
											2012-03-09 18:28:30 +00:00
										 |  |  | #  if 0
 | 
					
						
							|  |  |  |   if (ob->type == OB_FONT) { | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  |     Curve *cu = ob->data; | 
					
						
							|  |  |  |     freedisplist(&cu->disp); | 
					
						
							| 
									
										
										
										
											2014-01-03 14:18:06 +11:00
										 |  |  |     BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL); | 
					
						
							| 
									
										
										
										
											2012-03-09 18:28:30 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   if (flag == 0) { | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  |     /* pass */ | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |     int allow_flag = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  |     /* ensure flag us correct for the type */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |     switch (GS(id->name)) { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |       case ID_OB: | 
					
						
							| 
									
										
										
										
											2018-12-06 17:52:37 +01:00
										 |  |  |         /* TODO(sergey): This is kind of difficult to predict since different
 | 
					
						
							|  |  |  |          * object types supports different flags. Maybe does not worth checking | 
					
						
							|  |  |  |          * for this at all. Or maybe let dependency graph to return whether | 
					
						
							|  |  |  |          * the tag was valid or not. */ | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |         allow_flag = ID_RECALC_ALL; | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |         break; | 
					
						
							|  |  |  |         /* Could add particle updates later */ | 
					
						
							| 
									
										
										
										
											2012-03-09 18:28:30 +00:00
										 |  |  | #  if 0
 | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |       case ID_PA: | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |         allow_flag = OB_RECALC_ALL | PSYS_RECALC; | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |         break; | 
					
						
							| 
									
										
										
										
											2012-03-09 18:28:30 +00:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |       case ID_AC: | 
					
						
							|  |  |  |         allow_flag = ID_RECALC_ANIMATION; | 
					
						
							|  |  |  |         break; | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |       default: | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |         if (id_can_have_animdata(id)) { | 
					
						
							|  |  |  |           allow_flag = ID_RECALC_ANIMATION; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (flag & ~allow_flag) { | 
					
						
							|  |  |  |       StructRNA *srna = ID_code_to_RNA_type(GS(id->name)); | 
					
						
							|  |  |  |       BKE_reportf(reports, | 
					
						
							|  |  |  |                   RPT_ERROR, | 
					
						
							|  |  |  |                   "%s is not compatible with %s 'refresh' options", | 
					
						
							|  |  |  |                   RNA_struct_identifier(srna), | 
					
						
							|  |  |  |                   allow_flag ? "the specified" : "any"); | 
					
						
							|  |  |  |       return; | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |   DEG_id_tag_update_ex(bmain, id, flag); | 
					
						
							| 
									
										
										
										
											2011-01-03 09:09:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 18:50:56 +00:00
										 |  |  | static void rna_ID_user_clear(ID *id) | 
					
						
							| 
									
										
										
										
											2010-03-11 17:18:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-11-09 20:59:42 +01:00
										 |  |  |   id_fake_user_clear(id); | 
					
						
							| 
									
										
										
										
											2012-03-18 07:38:51 +00:00
										 |  |  |   id->us = 0; /* don't save */ | 
					
						
							| 
									
										
										
										
											2010-03-11 17:18:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 18:05:55 +02:00
										 |  |  | static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-04-17 22:33:07 +02:00
										 |  |  |   if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) { | 
					
						
							| 
									
										
										
										
											2016-06-22 18:05:55 +02:00
										 |  |  |     /* For now, do not allow remapping data in linked data from here... */ | 
					
						
							|  |  |  |     BKE_libblock_remap( | 
					
						
							|  |  |  |         bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-01 15:47:09 +02:00
										 |  |  | static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy) | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-03-04 11:42:15 +01:00
										 |  |  |   BKE_lib_id_make_local( | 
					
						
							|  |  |  |       bmain, self, false, clear_proxy ? 0 : LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING); | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-30 15:25:54 +01:00
										 |  |  |   ID *ret_id = self->newid ? self->newid : self; | 
					
						
							|  |  |  |   BKE_id_clear_newpoin(self); | 
					
						
							|  |  |  |   return ret_id; | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-11 08:49:28 +11:00
										 |  |  | static AnimData *rna_ID_animation_data_create(ID *id, Main *bmain) | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  | { | 
					
						
							|  |  |  |   AnimData *adt = BKE_animdata_add_id(id); | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  |   DEG_relations_tag_update(bmain); | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  |   return adt; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ID_animation_data_free(ID *id, Main *bmain) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
											  
											
												ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.
Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).
One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).
This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).
This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.
A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)
Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
											
										 
											2016-06-22 17:29:38 +02:00
										 |  |  |   BKE_animdata_free(id, true); | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  |   DEG_relations_tag_update(bmain); | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-26 23:49:20 +10:00
										 |  |  | #  ifdef WITH_PYTHON
 | 
					
						
							|  |  |  | void **rna_ID_instance(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   return &id->py_instance; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-24 00:39:01 +00:00
										 |  |  | static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   IDProperty *prop = (IDProperty *)ptr->data; | 
					
						
							| 
									
										
										
										
											2010-09-24 00:39:01 +00:00
										 |  |  |   rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int rna_IDPArray_length(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   IDProperty *prop = (IDProperty *)ptr->data; | 
					
						
							| 
									
										
										
										
											2010-09-24 00:39:01 +00:00
										 |  |  |   return prop->len; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-01 21:09:42 +00:00
										 |  |  | int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr) | 
					
						
							| 
									
										
										
										
											2011-10-01 17:54:33 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2020-03-05 08:08:23 +11:00
										 |  |  |   short *totcol = BKE_id_material_len_p(id); | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   Material *mat_id = (Material *)assign_ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   if (totcol && (key >= 0 && key < *totcol)) { | 
					
						
							| 
									
										
										
										
											2018-11-09 10:44:02 -02:00
										 |  |  |     BLI_assert(BKE_id_is_in_global_main(id)); | 
					
						
							|  |  |  |     BLI_assert(BKE_id_is_in_global_main(&mat_id->id)); | 
					
						
							| 
									
										
										
										
											2020-02-05 11:23:58 +01:00
										 |  |  |     BKE_id_material_assign(G_MAIN, id, mat_id, key + 1); | 
					
						
							| 
									
										
										
										
											2011-10-11 05:45:59 +00:00
										 |  |  |     return 1; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-10-01 17:54:33 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-12 14:59:11 +02:00
										 |  |  | static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma) | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-03-05 08:08:23 +11:00
										 |  |  |   BKE_id_material_append(bmain, id, ma); | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   WM_main_add_notifier(NC_OBJECT | ND_DRAW, id); | 
					
						
							|  |  |  |   WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 14:36:57 +02:00
										 |  |  | static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i) | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2013-08-13 10:21:11 +00:00
										 |  |  |   Material *ma; | 
					
						
							| 
									
										
										
										
											2020-03-05 08:08:23 +11:00
										 |  |  |   short *totcol = BKE_id_material_len_p(id); | 
					
						
							| 
									
										
										
										
											2013-08-13 10:21:11 +00:00
										 |  |  |   const short totcol_orig = *totcol; | 
					
						
							|  |  |  |   if (index_i < 0) { | 
					
						
							|  |  |  |     index_i += (*totcol); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if ((index_i < 0) || (index_i >= (*totcol))) { | 
					
						
							|  |  |  |     BKE_report(reports, RPT_ERROR, "Index out of range"); | 
					
						
							|  |  |  |     return NULL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-05 08:08:23 +11:00
										 |  |  |   ma = BKE_id_material_pop(bmain, id, index_i); | 
					
						
							| 
									
										
										
										
											2013-08-13 10:21:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (*totcol == totcol_orig) { | 
					
						
							|  |  |  |     BKE_report(reports, RPT_ERROR, "No material to removed"); | 
					
						
							|  |  |  |     return NULL; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-06 17:52:37 +01:00
										 |  |  |   DEG_id_tag_update(id, ID_RECALC_GEOMETRY); | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  |   WM_main_add_notifier(NC_OBJECT | ND_DRAW, id); | 
					
						
							|  |  |  |   WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return ma; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-16 14:36:57 +02:00
										 |  |  | static void rna_IDMaterials_clear_id(ID *id, Main *bmain) | 
					
						
							| 
									
										
										
										
											2013-08-14 11:29:58 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-03-05 08:08:23 +11:00
										 |  |  |   BKE_id_material_clear(bmain, id); | 
					
						
							| 
									
										
										
										
											2013-08-14 11:29:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-06 17:52:37 +01:00
										 |  |  |   DEG_id_tag_update(id, ID_RECALC_GEOMETRY); | 
					
						
							| 
									
										
										
										
											2013-08-14 11:29:58 +00:00
										 |  |  |   WM_main_add_notifier(NC_OBJECT | ND_DRAW, id); | 
					
						
							|  |  |  |   WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 18:50:56 +00:00
										 |  |  | static void rna_Library_filepath_set(PointerRNA *ptr, const char *value) | 
					
						
							| 
									
										
										
										
											2011-10-23 17:52:20 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   Library *lib = (Library *)ptr->data; | 
					
						
							| 
									
										
										
										
											2018-11-09 10:44:02 -02:00
										 |  |  |   BLI_assert(BKE_id_is_in_global_main(&lib->id)); | 
					
						
							| 
									
										
										
										
											2018-06-22 12:35:41 +02:00
										 |  |  |   BKE_library_filepath_set(G_MAIN, lib, value); | 
					
						
							| 
									
										
										
										
											2011-10-23 17:52:20 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | /* ***** ImagePreview ***** */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) || | 
					
						
							|  |  |  |       (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) { | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   if (value) { | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |     prv_img->flag[size] |= PRV_USER_EDITED; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |     prv_img->flag[size] &= ~PRV_USER_EDITED; | 
					
						
							| 
									
										
										
										
											2019-06-04 00:21:57 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   prv_img->flag[size] |= PRV_CHANGED; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_clear_single(prv_img, size); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_ensure(prv_img, size); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   values[0] = prv_img->w[size]; | 
					
						
							|  |  |  |   values[1] = prv_img->h[size]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  |   BKE_previewimg_clear_single(prv_img, size); | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (values[0] && values[1]) { | 
					
						
							|  |  |  |     prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  |     prv_img->w[size] = values[0]; | 
					
						
							|  |  |  |     prv_img->h[size] = values[1]; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                               int length[RNA_MAX_ARRAY_DIMENSION], | 
					
						
							|  |  |  |                                               enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_ensure(prv_img, size); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   length[0] = prv_img->w[size] * prv_img->h[size]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return length[0]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_ensure(prv_img, size); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int)); | 
					
						
							|  |  |  |   prv_img->flag[size] |= PRV_USER_EDITED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  | static int rna_ImagePreview_pixels_float_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                                     int length[RNA_MAX_ARRAY_DIMENSION], | 
					
						
							|  |  |  |                                                     enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BLI_assert(sizeof(unsigned int) == 4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_ensure(prv_img, size); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   length[0] = prv_img->w[size] * prv_img->h[size] * 4; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return length[0]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   unsigned char *data = (unsigned char *)prv_img->rect[size]; | 
					
						
							|  |  |  |   const size_t len = prv_img->w[size] * prv_img->h[size] * 4; | 
					
						
							|  |  |  |   size_t i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BLI_assert(sizeof(unsigned int) == 4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BKE_previewimg_ensure(prv_img, size); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (i = 0; i < len; i++) { | 
					
						
							|  |  |  |     values[i] = data[i] * (1.0f / 255.0f); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, | 
					
						
							|  |  |  |                                               const float *values, | 
					
						
							|  |  |  |                                               enum eIconSizes size) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   ID *id = ptr->owner_id; | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   PreviewImage *prv_img = (PreviewImage *)ptr->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   unsigned char *data = (unsigned char *)prv_img->rect[size]; | 
					
						
							|  |  |  |   const size_t len = prv_img->w[size] * prv_img->h[size] * 4; | 
					
						
							|  |  |  |   size_t i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BLI_assert(sizeof(unsigned int) == 4); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (id != NULL) { | 
					
						
							|  |  |  |     BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (i = 0; i < len; i++) { | 
					
						
							| 
									
										
										
										
											2018-05-07 17:31:28 +02:00
										 |  |  |     data[i] = unit_float_to_uchar_clamp(values[i]); | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   prv_img->flag[size] |= PRV_USER_EDITED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-05 22:25:34 +02:00
										 |  |  | static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, bool value) | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int rna_ImagePreview_image_pixels_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                                     int length[RNA_MAX_ARRAY_DIMENSION]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  | static int rna_ImagePreview_image_pixels_float_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                                           int length[RNA_MAX_ARRAY_DIMENSION]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-05 22:25:34 +02:00
										 |  |  | static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, bool value) | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int rna_ImagePreview_icon_pixels_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                                    int length[RNA_MAX_ARRAY_DIMENSION]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  | static int rna_ImagePreview_icon_pixels_float_get_length(PointerRNA *ptr, | 
					
						
							|  |  |  |                                                          int length[RNA_MAX_ARRAY_DIMENSION]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | static int rna_ImagePreview_icon_id_get(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-22 02:48:05 +10:00
										 |  |  |   /* Using a callback here allows us to only generate icon matching
 | 
					
						
							|  |  |  |    * that preview when icon_id is requested. */ | 
					
						
							| 
									
										
										
										
											2019-08-23 09:52:12 +02:00
										 |  |  |   return BKE_icon_preview_ensure(ptr->owner_id, (PreviewImage *)(ptr->data)); | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | } | 
					
						
							|  |  |  | static void rna_ImagePreview_icon_reload(PreviewImage *prv) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* will lazy load on next use, but only in case icon is not user-modified! */ | 
					
						
							|  |  |  |   if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) && | 
					
						
							|  |  |  |       !(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED)) { | 
					
						
							|  |  |  |     BKE_previewimg_clear(prv); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  | static PointerRNA rna_IDPreview_get(PointerRNA *ptr) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ID *id = (ID *)ptr->data; | 
					
						
							|  |  |  |   PreviewImage *prv_img = BKE_previewimg_id_ensure(id); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-05 16:34:36 +02:00
										 |  |  | static IDProperty *rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr, bool UNUSED(create)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if (ptr == NULL) { | 
					
						
							|  |  |  |     return NULL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return ptr->data; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-17 12:27:07 +01:00
										 |  |  | static void rna_Library_version_get(PointerRNA *ptr, int *value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   Library *lib = (Library *)ptr->data; | 
					
						
							|  |  |  |   value[0] = lib->versionfile / 100; | 
					
						
							|  |  |  |   value[1] = lib->versionfile % 100; | 
					
						
							|  |  |  |   value[2] = lib->subversionfile; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  | static void rna_def_ID_properties(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* this is struct is used for holding the virtual
 | 
					
						
							|  |  |  |    * PropertyRNA's for ID properties */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "PropertyGroupItem", NULL); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_struct_sdna(srna, "IDProperty"); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_struct_ui_text( | 
					
						
							|  |  |  |       srna, "ID Property", "Property that stores arbitrary, user defined properties"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* IDP_STRING */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* IDP_INT */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   RNA_def_property_array(prop, 1); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* IDP_FLOAT */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   RNA_def_property_array(prop, 1); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* IDP_DOUBLE */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   RNA_def_property_array(prop, 1); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* IDP_GROUP */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2009-03-23 13:24:48 +00:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_property_struct_type(prop, "PropertyGroup"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_property_struct_type(prop, "PropertyGroup"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_property_struct_type(prop, "PropertyGroup"); | 
					
						
							| 
									
										
										
										
											2012-03-18 09:27:36 +00:00
										 |  |  |   RNA_def_property_collection_funcs(prop, | 
					
						
							|  |  |  |                                     "rna_IDPArray_begin", | 
					
						
							|  |  |  |                                     "rna_iterator_array_next", | 
					
						
							|  |  |  |                                     "rna_iterator_array_end", | 
					
						
							|  |  |  |                                     "rna_iterator_array_get", | 
					
						
							|  |  |  |                                     "rna_IDPArray_length", | 
					
						
							|  |  |  |                                     NULL, | 
					
						
							|  |  |  |                                     NULL, | 
					
						
							|  |  |  |                                     NULL); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   /* never tested, maybe its useful to have this? */ | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  | #  if 0
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting"); | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  |   RNA_def_struct_name_property(srna, prop); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Datablock ID Properties
The absence of datablock properties "will certainly be resolved soon as the need for them is becoming obvious" said the [[http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.67/Python_Nodes|Python Nodes release notes]]. So this patch allows Python scripts to create ID Properties which reference datablocks.
This functionality is implemented for `PointerProperty` and now such properties can be created with Python.
In addition to the standard update callback, `PointerProperty` can have a `poll` callback (standard RNA) which is useful for search menus. For details see the test included in this patch.
Original author: @artfunkel
Alexander (Blend4Web Team)
Reviewers: brecht, artfunkel, mont29, campbellbarton
Reviewed By: mont29, campbellbarton
Subscribers: jta, sergey, campbellbarton, wisaac, poseidon4o, mont29, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov, fjuhec, sharlybg, cardboard, duarteframos, blueprintrandom, a.romanov, BYOB, disnel, aditiapratama, bliblubli, dfelinto, lukastoenne
Maniphest Tasks: T37754
Differential Revision: https://developer.blender.org/D113
											
										 
											2017-04-13 12:30:03 +03:00
										 |  |  |   /* IDP_ID */ | 
					
						
							|  |  |  |   prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2021-01-13 12:36:02 +03:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY | PROP_EDITABLE); | 
					
						
							| 
									
										
											  
											
												Datablock ID Properties
The absence of datablock properties "will certainly be resolved soon as the need for them is becoming obvious" said the [[http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.67/Python_Nodes|Python Nodes release notes]]. So this patch allows Python scripts to create ID Properties which reference datablocks.
This functionality is implemented for `PointerProperty` and now such properties can be created with Python.
In addition to the standard update callback, `PointerProperty` can have a `poll` callback (standard RNA) which is useful for search menus. For details see the test included in this patch.
Original author: @artfunkel
Alexander (Blend4Web Team)
Reviewers: brecht, artfunkel, mont29, campbellbarton
Reviewed By: mont29, campbellbarton
Subscribers: jta, sergey, campbellbarton, wisaac, poseidon4o, mont29, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov, fjuhec, sharlybg, cardboard, duarteframos, blueprintrandom, a.romanov, BYOB, disnel, aditiapratama, bliblubli, dfelinto, lukastoenne
Maniphest Tasks: T37754
Differential Revision: https://developer.blender.org/D113
											
										 
											2017-04-13 12:30:03 +03:00
										 |  |  |   RNA_def_property_struct_type(prop, "ID"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  |   /* ID property groups > level 0, since level 0 group is merged
 | 
					
						
							|  |  |  |    * with native RNA properties. the builtin_properties will take | 
					
						
							|  |  |  |    * care of the properties here */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "PropertyGroup", NULL); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_struct_sdna(srna, "IDPropertyGroup"); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties"); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops"); | 
					
						
							| 
									
										
										
										
											2011-05-18 11:21:10 +00:00
										 |  |  |   RNA_def_struct_register_funcs( | 
					
						
							|  |  |  |       srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL); | 
					
						
							| 
									
										
										
										
											2011-02-16 02:51:56 +00:00
										 |  |  |   RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  |   /* important so python types can have their name used in list views
 | 
					
						
							| 
									
										
										
										
											2012-03-18 07:38:51 +00:00
										 |  |  |    * however this isn't prefect because it overrides how python would set the name | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  |    * when we only really want this so RNA_def_struct_name_property() is set to something useful */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2018-10-29 16:19:03 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_IDPROPERTY); | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting"); | 
					
						
							| 
									
										
										
										
											2009-12-09 22:37:02 +00:00
										 |  |  |   RNA_def_struct_name_property(srna, prop); | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  | static void rna_def_ID_materials(BlenderRNA *brna) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  |   FunctionRNA *func; | 
					
						
							|  |  |  |   PropertyRNA *parm; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  |   /* for mesh/mball/curve materials */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "IDMaterials", NULL); | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  |   RNA_def_struct_sdna(srna, "ID"); | 
					
						
							|  |  |  |   RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  |   func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id"); | 
					
						
							| 
									
										
										
										
											2016-08-12 14:59:11 +02:00
										 |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2016-09-19 16:46:20 +02:00
										 |  |  |   RNA_def_function_ui_description(func, "Add a new material to the data-block"); | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   parm = RNA_def_pointer(func, "material", "Material", "", "Material to add"); | 
					
						
							| 
									
										
										
											
												Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
											
										 
											2016-12-12 15:23:55 +01:00
										 |  |  |   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 22:38:15 +00:00
										 |  |  |   func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id"); | 
					
						
							| 
									
										
										
										
											2016-08-12 14:59:11 +02:00
										 |  |  |   RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2016-09-19 16:46:20 +02:00
										 |  |  |   RNA_def_function_ui_description(func, "Remove a material from the data-block"); | 
					
						
							| 
									
										
										
										
											2013-08-13 10:21:11 +00:00
										 |  |  |   parm = RNA_def_int( | 
					
						
							|  |  |  |       func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT); | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove"); | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-14 11:29:58 +00:00
										 |  |  |   func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id"); | 
					
						
							| 
									
										
										
										
											2018-05-27 18:46:39 +02:00
										 |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2016-09-19 16:46:20 +02:00
										 |  |  |   RNA_def_function_ui_description(func, "Remove all materials from the data-block"); | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  | static void rna_def_image_preview(BlenderRNA *brna) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  |   FunctionRNA *func; | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   srna = RNA_def_struct(brna, "ImagePreview", NULL); | 
					
						
							|  |  |  |   RNA_def_struct_sdna(srna, "PreviewImage"); | 
					
						
							|  |  |  |   RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED); | 
					
						
							|  |  |  |   RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set"); | 
					
						
							|  |  |  |   RNA_def_property_ui_text(prop, | 
					
						
							|  |  |  |                            "Custom Image", | 
					
						
							|  |  |  |                            "True if this preview image has been modified by py script," | 
					
						
							|  |  |  |                            "and is no more auto-generated by Blender"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_int_vector( | 
					
						
							|  |  |  |       srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0); | 
					
						
							|  |  |  |   RNA_def_property_subtype(prop, PROP_PIXEL); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs( | 
					
						
							|  |  |  |       prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_DYNAMIC); | 
					
						
							|  |  |  |   RNA_def_property_multi_array(prop, 1, NULL); | 
					
						
							| 
									
										
										
										
											2020-12-07 14:51:06 -08:00
										 |  |  |   RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always 32-bit RGBA)"); | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length"); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs( | 
					
						
							|  |  |  |       prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_DYNAMIC); | 
					
						
							|  |  |  |   RNA_def_property_multi_array(prop, 1, NULL); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)"); | 
					
						
							|  |  |  |   RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length"); | 
					
						
							|  |  |  |   RNA_def_property_float_funcs(prop, | 
					
						
							|  |  |  |                                "rna_ImagePreview_image_pixels_float_get", | 
					
						
							|  |  |  |                                "rna_ImagePreview_image_pixels_float_set", | 
					
						
							|  |  |  |                                NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED); | 
					
						
							|  |  |  |   RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set"); | 
					
						
							|  |  |  |   RNA_def_property_ui_text(prop, | 
					
						
							|  |  |  |                            "Custom Icon", | 
					
						
							|  |  |  |                            "True if this preview icon has been modified by py script," | 
					
						
							|  |  |  |                            "and is no more auto-generated by Blender"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_int_vector( | 
					
						
							|  |  |  |       srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0); | 
					
						
							|  |  |  |   RNA_def_property_subtype(prop, PROP_PIXEL); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs( | 
					
						
							|  |  |  |       prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_DYNAMIC); | 
					
						
							|  |  |  |   RNA_def_property_multi_array(prop, 1, NULL); | 
					
						
							| 
									
										
										
										
											2020-12-07 14:51:06 -08:00
										 |  |  |   RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always 32-bit RGBA)"); | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length"); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs( | 
					
						
							|  |  |  |       prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 17:42:12 +02:00
										 |  |  |   prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_DYNAMIC); | 
					
						
							|  |  |  |   RNA_def_property_multi_array(prop, 1, NULL); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)"); | 
					
						
							|  |  |  |   RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length"); | 
					
						
							|  |  |  |   RNA_def_property_float_funcs(prop, | 
					
						
							|  |  |  |                                "rna_ImagePreview_icon_pixels_float_get", | 
					
						
							|  |  |  |                                "rna_ImagePreview_icon_pixels_float_set", | 
					
						
							|  |  |  |                                NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   prop = RNA_def_int(srna, | 
					
						
							|  |  |  |                      "icon_id", | 
					
						
							|  |  |  |                      0, | 
					
						
							|  |  |  |                      INT_MIN, | 
					
						
							|  |  |  |                      INT_MAX, | 
					
						
							|  |  |  |                      "Icon ID", | 
					
						
							|  |  |  |                      "Unique integer identifying this preview as an icon (zero means invalid)", | 
					
						
							|  |  |  |                      INT_MIN, | 
					
						
							|  |  |  |                      INT_MAX); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description(func, "Reload the preview from its source path"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | static void rna_def_ID_override_library_property_operation(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   static const EnumPropertyItem override_library_property_operation_items[] = { | 
					
						
							|  |  |  |       {IDOVERRIDE_LIBRARY_OP_NOOP, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "NOOP", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "No-Op", | 
					
						
							|  |  |  |        "Does nothing, prevents adding actual overrides (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_REPLACE, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "REPLACE", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Replace", | 
					
						
							|  |  |  |        "Replace value of reference by overriding one"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_ADD, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "DIFF_ADD", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Differential", | 
					
						
							|  |  |  |        "Stores and apply difference between reference and local value (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_SUBTRACT, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "DIFF_SUB", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Differential", | 
					
						
							|  |  |  |        "Stores and apply difference between reference and local value (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_MULTIPLY, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "FACT_MULTIPLY", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Factor", | 
					
						
							|  |  |  |        "Stores and apply multiplication factor between reference and local value (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_INSERT_AFTER, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "INSERT_AFTER", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Insert After", | 
					
						
							|  |  |  |        "Insert a new item into collection after the one referenced in subitem_reference_name or " | 
					
						
							|  |  |  |        "_index"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_OP_INSERT_BEFORE, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "INSERT_BEFORE", | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |        0, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "Insert Before", | 
					
						
							|  |  |  |        "Insert a new item into collection after the one referenced in subitem_reference_name or " | 
					
						
							|  |  |  |        "_index (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |       {0, NULL, 0, NULL, NULL}, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   static const EnumPropertyItem override_library_property_flag_items[] = { | 
					
						
							|  |  |  |       {IDOVERRIDE_LIBRARY_FLAG_MANDATORY, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "MANDATORY", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Mandatory", | 
					
						
							| 
									
										
										
										
											2020-11-05 07:52:58 -08:00
										 |  |  |        "For templates, prevents the user from removing predefined operation (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       {IDOVERRIDE_LIBRARY_FLAG_LOCKED, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |        "LOCKED", | 
					
						
							|  |  |  |        0, | 
					
						
							|  |  |  |        "Locked", | 
					
						
							|  |  |  |        "Prevents the user from modifying that override operation (NOT USED)"}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |       {0, NULL, 0, NULL, NULL}, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   srna = RNA_def_struct(brna, "IDOverrideLibraryPropertyOperation", NULL); | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   RNA_def_struct_ui_text(srna, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                          "ID Library Override Property Operation", | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |                          "Description of an override operation over an overridden property"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_enum(srna, | 
					
						
							|  |  |  |                       "operation", | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                       override_library_property_operation_items, | 
					
						
							|  |  |  |                       IDOVERRIDE_LIBRARY_OP_REPLACE, | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |                       "Operation", | 
					
						
							|  |  |  |                       "What override operation is performed"); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_enum( | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       srna, "flag", override_library_property_flag_items, 0, "Flags", "Optional flags (NOT USED)"); | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_string(srna, | 
					
						
							|  |  |  |                         "subitem_reference_name", | 
					
						
							|  |  |  |                         NULL, | 
					
						
							|  |  |  |                         INT_MAX, | 
					
						
							|  |  |  |                         "Subitem Reference Name", | 
					
						
							|  |  |  |                         "Used to handle insertions into collection"); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							|  |  |  |   RNA_def_property_string_funcs(prop, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                                 "rna_ID_override_library_property_operation_refname_get", | 
					
						
							|  |  |  |                                 "rna_ID_override_library_property_operation_refname_length", | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |                                 NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_string(srna, | 
					
						
							|  |  |  |                         "subitem_local_name", | 
					
						
							|  |  |  |                         NULL, | 
					
						
							|  |  |  |                         INT_MAX, | 
					
						
							|  |  |  |                         "Subitem Local Name", | 
					
						
							|  |  |  |                         "Used to handle insertions into collection"); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							|  |  |  |   RNA_def_property_string_funcs(prop, | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                                 "rna_ID_override_library_property_operation_locname_get", | 
					
						
							|  |  |  |                                 "rna_ID_override_library_property_operation_locname_length", | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |                                 NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_int(srna, | 
					
						
							|  |  |  |                      "subitem_reference_index", | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      INT_MAX, | 
					
						
							|  |  |  |                      "Subitem Reference Index", | 
					
						
							|  |  |  |                      "Used to handle insertions into collection", | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      INT_MAX); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_int(srna, | 
					
						
							|  |  |  |                      "subitem_local_index", | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      INT_MAX, | 
					
						
							|  |  |  |                      "Subitem Local Index", | 
					
						
							|  |  |  |                      "Used to handle insertions into collection", | 
					
						
							|  |  |  |                      -1, | 
					
						
							|  |  |  |                      INT_MAX); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | static void rna_def_ID_override_library_property(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   srna = RNA_def_struct(brna, "IDOverrideLibraryProperty", NULL); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  |   RNA_def_struct_ui_text( | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       srna, "ID Library Override Property", "Description of an overridden property"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 02:48:05 +10:00
										 |  |  |   /* String pointer, we *should* add get/set/etc.
 | 
					
						
							|  |  |  |    * But NULL rna_path would be a nasty bug anyway. */ | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |   prop = RNA_def_string(srna, | 
					
						
							|  |  |  |                         "rna_path", | 
					
						
							|  |  |  |                         NULL, | 
					
						
							|  |  |  |                         INT_MAX, | 
					
						
							|  |  |  |                         "RNA Path", | 
					
						
							|  |  |  |                         "RNA path leading to that property, from owning ID"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */ | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_collection(srna, | 
					
						
							|  |  |  |                      "operations", | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                      "IDOverrideLibraryPropertyOperation", | 
					
						
							| 
									
										
										
										
											2018-05-01 15:18:30 +02:00
										 |  |  |                      "Operations", | 
					
						
							|  |  |  |                      "List of overriding operations for a property"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   rna_def_ID_override_library_property_operation(brna); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  | static void rna_def_ID_override_library(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   srna = RNA_def_struct(brna, "IDOverrideLibrary", NULL); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  |   RNA_def_struct_ui_text( | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       srna, "ID Library Override", "Struct gathering all data needed by overridden linked IDs"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 18:12:14 +01:00
										 |  |  |   RNA_def_pointer( | 
					
						
							|  |  |  |       srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 18:12:14 +01:00
										 |  |  |   RNA_def_collection(srna, | 
					
						
							|  |  |  |                      "properties", | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |                      "IDOverrideLibraryProperty", | 
					
						
							| 
									
										
										
										
											2018-03-20 18:12:14 +01:00
										 |  |  |                      "Properties", | 
					
						
							|  |  |  |                      "List of overridden properties"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   rna_def_ID_override_library_property(brna); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  | static void rna_def_ID(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | { | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |   StructRNA *srna; | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  |   FunctionRNA *func; | 
					
						
							|  |  |  |   PropertyRNA *prop, *parm; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 15:07:26 +11:00
										 |  |  |   static const EnumPropertyItem update_flag_items[] = { | 
					
						
							| 
									
										
										
										
											2018-12-06 17:52:37 +01:00
										 |  |  |       {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""}, | 
					
						
							|  |  |  |       {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""}, | 
					
						
							|  |  |  |       {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |       {0, NULL, 0, NULL, NULL}, | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "ID", NULL); | 
					
						
							| 
									
										
										
										
											2012-03-18 09:27:36 +00:00
										 |  |  |   RNA_def_struct_ui_text( | 
					
						
							|  |  |  |       srna, | 
					
						
							|  |  |  |       "ID", | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |       "Base type for data-blocks, defining a unique name, linking from other libraries " | 
					
						
							| 
									
										
										
										
											2012-03-18 09:27:36 +00:00
										 |  |  |       "and garbage collection"); | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   RNA_def_struct_flag(srna, STRUCT_ID | STRUCT_ID_REFCOUNT); | 
					
						
							| 
									
										
										
										
											2009-01-01 15:52:51 +00:00
										 |  |  |   RNA_def_struct_refine_func(srna, "rna_ID_refine"); | 
					
						
							| 
									
										
										
										
											2010-08-19 10:16:30 +00:00
										 |  |  |   RNA_def_struct_idprops_func(srna, "rna_ID_idprops"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name"); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |   RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set"); | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); | 
					
						
							| 
									
										
										
										
											2010-01-11 05:10:57 +00:00
										 |  |  |   RNA_def_property_editable_func(prop, "rna_ID_name_editable"); | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |   RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL); | 
					
						
							| 
									
										
										
										
											2020-06-09 19:35:11 +02:00
										 |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  |   RNA_def_struct_name_property(srna, prop); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-31 13:22:00 +01:00
										 |  |  |   prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, "Full Name", "Unique data-block ID name, including library one is any"); | 
					
						
							|  |  |  |   RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL); | 
					
						
							|  |  |  |   RNA_def_property_string_maxlength(prop, MAX_ID_FULL_NAME); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-02 14:13:25 +02:00
										 |  |  |   prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, | 
					
						
							|  |  |  |       "Is Evaluated", | 
					
						
							|  |  |  |       "Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file"); | 
					
						
							|  |  |  |   RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-02 14:13:25 +02:00
										 |  |  |   prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_struct_type(prop, "ID"); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, | 
					
						
							|  |  |  |       "Original ID", | 
					
						
							|  |  |  |       "Actual data-block from .blend file (Main database) that generated that evaluated one"); | 
					
						
							|  |  |  |   RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP); | 
					
						
							| 
									
										
										
										
											2020-11-26 10:46:35 +01:00
										 |  |  |   RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-08-20 17:48:10 +02:00
										 |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   RNA_def_property_int_sdna(prop, NULL, "us"); | 
					
						
							| 
									
										
										
										
											2009-03-23 13:24:48 +00:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users"); | 
					
						
							| 
									
										
										
										
											2018-10-31 14:43:25 +11:00
										 |  |  |   RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-12 18:04:33 +01:00
										 |  |  |   prop = RNA_def_property(srna, "is_embedded_data", PROP_BOOLEAN, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_EMBEDDED_DATA); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  |   RNA_def_property_ui_text( | 
					
						
							|  |  |  |       prop, | 
					
						
							|  |  |  |       "Embedded Data", | 
					
						
							| 
									
										
										
										
											2020-04-20 15:26:37 +02:00
										 |  |  |       "This data-block is not an independent one, but is actually a sub-data of another ID " | 
					
						
							| 
									
										
										
										
											2020-03-12 18:04:33 +01:00
										 |  |  |       "(typical example: root node trees or master collections)"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE); | 
					
						
							| 
									
										
										
											
												Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
											
										 
											2015-12-27 11:53:50 +01:00
										 |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT); | 
					
						
							| 
									
										
										
										
											2010-01-04 15:37:22 +00:00
										 |  |  |   RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); | 
					
						
							| 
									
										
										
										
											2015-04-13 22:08:51 +10:00
										 |  |  |   RNA_def_property_ui_text(prop, | 
					
						
							|  |  |  |                            "Tag", | 
					
						
							|  |  |  |                            "Tools can use this to tag data for their own purposes " | 
					
						
							|  |  |  |                            "(initial state is undefined)"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-17 09:17:39 +00:00
										 |  |  |   prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE); | 
					
						
							| 
									
										
										
											
												Split id->flag in two, persistent flags and runtime tags.
This is purely internal sanitizing/cleanup, no change in behavior is expected at all.
This change was also needed because we were getting short on ID flags, and
future enhancement of 'user_one' ID behavior requires two new ones.
id->flag remains for persistent data (fakeuser only, so far!), this also allows us
100% backward & forward compatibility.
New id->tag is used for most flags. Though written in .blend files, its content
is cleared at read time.
Note that .blend file version was bumped, so that we can clear runtimeflags from
old .blends, important in case we add new persistent flags in future.
Also, behavior of tags (either status ones, or whether they need to be cleared before/after use)
has been added as comments to their declaration.
Reviewers: sergey, campbellbarton
Differential Revision: https://developer.blender.org/D1683
											
										 
											2015-12-27 11:53:50 +01:00
										 |  |  |   RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT); | 
					
						
							| 
									
										
										
										
											2012-05-17 09:17:39 +00:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  |   RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   RNA_def_property_pointer_sdna(prop, NULL, "lib"); | 
					
						
							| 
									
										
										
										
											2009-03-23 13:24:48 +00:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2019-08-20 17:48:10 +02:00
										 |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-11 18:15:25 +01:00
										 |  |  |   prop = RNA_def_property(srna, "asset_data", PROP_POINTER, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | 
					
						
							|  |  |  |   RNA_def_property_ui_text(prop, "Asset Data", "Additional data for an asset data-block"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  |   prop = RNA_def_pointer( | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |       srna, "override_library", "IDOverrideLibrary", "Library Override", "Library override data"); | 
					
						
							| 
									
										
										
										
											2018-03-20 18:09:45 +01:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  |   prop = RNA_def_pointer( | 
					
						
							|  |  |  |       srna, | 
					
						
							|  |  |  |       "preview", | 
					
						
							|  |  |  |       "ImagePreview", | 
					
						
							|  |  |  |       "Preview", | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |       "Preview image and icon of this data-block (None if not supported for this type of data)"); | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							| 
									
										
										
										
											2020-06-19 16:52:23 +02:00
										 |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | 
					
						
							| 
									
										
										
										
											2015-08-10 17:26:37 +02:00
										 |  |  |   RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  |   /* functions */ | 
					
						
							| 
									
										
											  
											
												Dependency graph API changes
Main goal here is to make it obvious and predictable about
what is going on.
Summary of changes.
- Access to dependency graph is now only possible to a fully evaluated
  graph. This is now done via context.evaluated_depsgraph_get().
  The call will ensure both relations and datablocks are updated.
  This way we don't allow access to some known bad state of the graph,
  and also making explicit that getting update dependency graph is not
  cheap.
- Access to evaluated ID is now possible via id.evaluated_get().
  It was already possible to get evaluated ID via dependency graph,
  but that was a bit confusing why access to original is done via ID
  and to evaluated via depsgraph.
  If datablock is not covered by dependency graph it will be returned
  as-is.
- Similarly, request for original from an ID which is not evaluated
  will return ID as-is.
- Removed scene.update().
  This is very expensive to update all the view layers.
- Added depsgraph.update().
  Now when temporary changes to objects are to be done, this is to
  happen on original object and then dependency graph is to be
  updated.
- Changed object.to_mesh() to behave the following way:
   * When is used for original object modifiers are ignored.
     For meshes this acts similar to mesh-copy, not very useful but
     allows to keep code paths similar (i.e. for exporter which has
     Apply Modifiers option it's only matter choosing between original
     and evaluated object, the to_mesh() part can stay the same).
     For curves this gives a mesh which is constructed from displist
     without taking own modifiers and modifiers of bevel/taper objects
     into account.
     For metaballs this gives empty mesh.
     Polygonization of metaball is not possible from a single object.
   * When is used for evaluated object modifiers are always applied.
     In fact, no evaluation is happening, the mesh is either copied
     as-is, or constructed from current state of curve cache.
  Arguments to apply modifiers and calculate original coordinates (ORCO,
  aka undeformed coordinates) are removed. The ORCO is to be calculated
  as part of dependency graph evaluation.
File used to regression-test (a packed Python script into .blend):
{F7033464}
Patch to make addons tests to pass:
{F7033466}
NOTE: I've included changes to FBX exporter, and those are addressing
report T63689.
NOTE: All the enabled-by-default addons are to be ported still, but
first want to have agreement on this part of changes.
NOTE: Also need to work on documentation for Python API, but, again,
better be done after having agreement on this work.
Reviewers: brecht, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D4834
											
										 
											2019-05-09 11:26:49 +02:00
										 |  |  |   func = RNA_def_function(srna, "evaluated_get", "rna_ID_evaluated_get"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description( | 
					
						
							|  |  |  |       func, "Get corresponding evaluated ID from the given dependency graph"); | 
					
						
							|  |  |  |   parm = RNA_def_pointer( | 
					
						
							|  |  |  |       func, "depsgraph", "Depsgraph", "", "Dependency graph to perform lookup in"); | 
					
						
							|  |  |  |   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | 
					
						
							|  |  |  |   parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | 
					
						
							|  |  |  |   RNA_def_function_return(func, parm); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   func = RNA_def_function(srna, "copy", "rna_ID_copy"); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_function_ui_description( | 
					
						
							|  |  |  |       func, "Create a copy of this data-block (not supported for all data-blocks)"); | 
					
						
							| 
									
										
										
										
											2016-07-10 14:52:00 +02:00
										 |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); | 
					
						
							| 
									
										
										
										
											2009-09-28 14:28:45 +00:00
										 |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-29 15:31:31 +01:00
										 |  |  |   func = RNA_def_function(srna, "override_create", "rna_ID_override_create"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description(func, | 
					
						
							|  |  |  |                                   "Create an overridden local copy of this linked data-block (not " | 
					
						
							|  |  |  |                                   "supported for all data-blocks)"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							|  |  |  |   parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID"); | 
					
						
							|  |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-09-05 16:41:35 +02:00
										 |  |  |   RNA_def_boolean(func, | 
					
						
							|  |  |  |                   "remap_local_usages", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "", | 
					
						
							|  |  |  |                   "Whether local usages of the linked ID should be remapped to the new " | 
					
						
							|  |  |  |                   "library override of it"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear"); | 
					
						
							| 
									
										
										
										
											2015-10-24 02:44:43 +11:00
										 |  |  |   RNA_def_function_ui_description(func, | 
					
						
							|  |  |  |                                   "Clear the user count of a data-block so its not saved, " | 
					
						
							| 
									
										
										
										
											2012-05-12 11:01:29 +00:00
										 |  |  |                                   "on reload the data will be removed"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 18:05:55 +02:00
										 |  |  |   func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description( | 
					
						
							|  |  |  |       func, "Replace all usage in the .blend file of this ID by new given one"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							|  |  |  |   parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use"); | 
					
						
							| 
									
										
										
											
												Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
											
										 
											2016-12-12 15:23:55 +01:00
										 |  |  |   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  |   func = RNA_def_function(srna, "make_local", "rna_ID_make_local"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description( | 
					
						
							|  |  |  |       func, | 
					
						
							|  |  |  |       "Make this datablock local, return local one " | 
					
						
							|  |  |  |       "(may be a copy of the original, in case it is also indirectly used)"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2016-11-21 20:57:02 +01:00
										 |  |  |   parm = RNA_def_boolean( | 
					
						
							|  |  |  |       func, | 
					
						
							|  |  |  |       "clear_proxy", | 
					
						
							|  |  |  |       true, | 
					
						
							|  |  |  |       "", | 
					
						
							|  |  |  |       "Whether to clear proxies (the default behavior, " | 
					
						
							|  |  |  |       "note that if object has to be duplicated to be made local, proxies are always cleared)"); | 
					
						
							| 
									
										
										
										
											2016-11-10 10:42:28 +01:00
										 |  |  |   parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied"); | 
					
						
							|  |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-06 19:34:42 +01:00
										 |  |  |   func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID"); | 
					
						
							|  |  |  |   RNA_def_function_ui_description(func, | 
					
						
							|  |  |  |                                   "Count the number of times that ID uses/references given one"); | 
					
						
							|  |  |  |   parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages"); | 
					
						
							| 
									
										
										
											
												Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
											
										 
											2016-12-12 15:23:55 +01:00
										 |  |  |   RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | 
					
						
							| 
									
										
										
										
											2016-01-06 19:34:42 +01:00
										 |  |  |   parm = RNA_def_int(func, | 
					
						
							|  |  |  |                      "count", | 
					
						
							|  |  |  |                      0, | 
					
						
							|  |  |  |                      0, | 
					
						
							|  |  |  |                      INT_MAX, | 
					
						
							| 
									
										
										
										
											2016-09-19 16:46:20 +02:00
										 |  |  |                      "", | 
					
						
							|  |  |  |                      "Number of usages/references of given id by current data-block", | 
					
						
							|  |  |  |                      0, | 
					
						
							|  |  |  |                      INT_MAX); | 
					
						
							| 
									
										
										
										
											2016-01-06 19:34:42 +01:00
										 |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  |   func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2011-09-19 13:23:58 +00:00
										 |  |  |   RNA_def_function_ui_description( | 
					
						
							|  |  |  |       func, "Create animation data to this ID, note that not all ID types support this"); | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL"); | 
					
						
							| 
									
										
										
										
											2009-11-05 10:50:58 +00:00
										 |  |  |   RNA_def_function_return(func, parm); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-14 11:19:27 +02:00
										 |  |  |   func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN); | 
					
						
							| 
									
										
										
										
											2011-09-19 13:23:58 +00:00
										 |  |  |   RNA_def_function_ui_description(func, "Clear animation on this this ID"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag"); | 
					
						
							| 
									
										
										
										
											2019-05-22 14:33:28 +03:00
										 |  |  |   RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); | 
					
						
							| 
									
										
										
										
											2015-04-13 22:08:51 +10:00
										 |  |  |   RNA_def_function_ui_description(func, | 
					
						
							|  |  |  |                                   "Tag the ID to update its display data, " | 
					
						
							|  |  |  |                                   "e.g. when calling :class:`bpy.types.Scene.update`"); | 
					
						
							| 
									
										
										
										
											2011-09-19 13:23:58 +00:00
										 |  |  |   RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-26 23:49:20 +10:00
										 |  |  | #  ifdef WITH_PYTHON
 | 
					
						
							|  |  |  |   RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance"); | 
					
						
							|  |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  | static void rna_def_library(BlenderRNA *brna) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							| 
									
										
										
										
											2016-07-19 17:49:01 +02:00
										 |  |  |   FunctionRNA *func; | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "Library", "ID"); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked"); | 
					
						
							| 
									
										
										
										
											2009-06-03 23:16:51 +00:00
										 |  |  |   RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); | 
					
						
							| 
									
										
										
										
											2020-06-23 09:54:14 +10:00
										 |  |  |   RNA_def_property_string_sdna(prop, NULL, "filepath"); | 
					
						
							| 
									
										
										
										
											2010-06-02 17:58:28 +00:00
										 |  |  |   RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file"); | 
					
						
							| 
									
										
										
										
											2011-10-23 17:52:20 +00:00
										 |  |  |   RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2010-06-11 10:46:47 +00:00
										 |  |  |   RNA_def_property_struct_type(prop, "Library"); | 
					
						
							| 
									
										
										
										
											2019-08-20 17:48:10 +02:00
										 |  |  |   RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | 
					
						
							| 
									
										
										
										
											2012-03-18 09:27:36 +00:00
										 |  |  |   RNA_def_property_ui_text(prop, "Parent", ""); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-06 03:10:53 +10:00
										 |  |  |   prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); | 
					
						
							|  |  |  |   RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); | 
					
						
							|  |  |  |   RNA_def_property_ui_text(prop, "Packed File", ""); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-17 12:27:07 +01:00
										 |  |  |   prop = RNA_def_int_vector(srna, | 
					
						
							|  |  |  |                             "version", | 
					
						
							|  |  |  |                             3, | 
					
						
							|  |  |  |                             NULL, | 
					
						
							|  |  |  |                             0, | 
					
						
							|  |  |  |                             INT_MAX, | 
					
						
							|  |  |  |                             "Version", | 
					
						
							|  |  |  |                             "Version of Blender the library .blend was saved with", | 
					
						
							|  |  |  |                             0, | 
					
						
							|  |  |  |                             INT_MAX); | 
					
						
							|  |  |  |   RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL); | 
					
						
							|  |  |  |   RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_THICK_WRAP); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-19 17:49:01 +02:00
										 |  |  |   func = RNA_def_function(srna, "reload", "WM_lib_reload"); | 
					
						
							|  |  |  |   RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); | 
					
						
							| 
									
										
										
										
											2016-09-19 16:46:20 +02:00
										 |  |  |   RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks"); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-04-05 16:34:36 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * \attention This is separate from the above. It allows for RNA functions to | 
					
						
							|  |  |  |  * return an IDProperty *. See MovieClip.metadata for a usage example. | 
					
						
							| 
									
										
										
										
											2019-03-19 15:17:46 +11:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-04-05 16:34:36 +02:00
										 |  |  | static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   StructRNA *srna; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL); | 
					
						
							|  |  |  |   RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops"); | 
					
						
							|  |  |  |   RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  | void RNA_def_ID(BlenderRNA *brna) | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-19 04:06:24 +00:00
										 |  |  |   StructRNA *srna; | 
					
						
							| 
									
										
										
										
											2009-01-10 22:57:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 00:49:39 +00:00
										 |  |  |   /* built-in unknown type */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "UnknownType", NULL); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_struct_ui_text( | 
					
						
							|  |  |  |       srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data"); | 
					
						
							| 
									
										
										
										
											2008-11-30 15:55:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-07 00:49:39 +00:00
										 |  |  |   /* built-in any type */ | 
					
						
							| 
									
										
										
										
											2012-03-05 23:30:41 +00:00
										 |  |  |   srna = RNA_def_struct(brna, "AnyType", NULL); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data"); | 
					
						
							| 
									
										
										
										
											2009-04-07 00:49:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |   rna_def_ID(brna); | 
					
						
							| 
									
										
										
										
											2019-06-14 23:16:04 +02:00
										 |  |  |   rna_def_ID_override_library(brna); | 
					
						
							| 
									
										
										
										
											2015-05-11 16:29:12 +02:00
										 |  |  |   rna_def_image_preview(brna); | 
					
						
							| 
									
										
											  
											
												RNA
* More ID property support. What was already possible was showing
  ID properties as RNA properties. Now it is possible to define
  RNA properties and have an ID property automatically created the
  first time it is set (if not set it retuns the default).
* Added support for defining RNA structs and properties at runtime.
  This is useful for python and plugins, and could also be used
  for operators, not sure yet what is best there, they could be done
  in preprocess for speed, but not sure how to do that while keeping
  operator registration a single function.
* Added quick functions to get/set properties based on names, to be
  used for operators.
* Added some simple support for inheritance, was already doing this
  but having it as a feature simplifies things. Two things were added
  for this: when defining a struct you can give a 'from' struct whose
  properties will be copied, and structs like ID, operator, modifier,
  can define a refine callback that will return the more specific type
  of the struct like ID -> Object, Mesh, .. .
* Added simple windowmanager wrap with only the registered operators
  list, used for testing RNA for operators.
											
										 
											2008-11-21 02:23:46 +00:00
										 |  |  |   rna_def_ID_properties(brna); | 
					
						
							| 
									
										
										
										
											2010-09-03 07:25:37 +00:00
										 |  |  |   rna_def_ID_materials(brna); | 
					
						
							| 
									
										
										
										
											2008-11-29 19:08:46 +00:00
										 |  |  |   rna_def_library(brna); | 
					
						
							| 
									
										
										
										
											2018-04-05 16:34:36 +02:00
										 |  |  |   rna_def_idproperty_wrap_ptr(brna); | 
					
						
							| 
									
										
										
										
											2008-11-17 18:44:06 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-07 02:58:25 +00:00
										 |  |  | #endif
 |