[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17352] branches/blender2.5/blender/source /blender/makesrna: RNA
Brecht Van Lommel
brecht at blender.org
Fri Nov 7 03:58:27 CET 2008
Revision: 17352
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17352
Author: blendix
Date: 2008-11-07 03:58:25 +0100 (Fri, 07 Nov 2008)
Log Message:
-----------
RNA
* Added more error prints for wrong definitions, for cases that
would laters cause problems compiling or crash at runtime, and
also made messages more clear.
* Added some skeleton code for main/ID/mesh/vertex types for testing.
* Added support for automatic arrays as collections using SDNA.
* Changed how pointers to data work. Now they are always wrapped
in a PointerRNA struct, which contains the data pointer and type,
and also the data pointer and type of the ID datablock that this
belongs to, since for example a vertex on it's own may not have
enough information for some operations, it also needs the mesh.
* Added some code for defining dependencies with RNA, and looking up
data with paths like: scenes[0].objects["Cube"].data.verts[7].co.
Note sure either will end up being used, this is experimental.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
branches/blender2.5/blender/source/blender/makesrna/RNA_types.h
branches/blender2.5/blender/source/blender/makesrna/intern/SConscript
branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
branches/blender2.5/blender/source/blender/makesrna/intern/rna_object.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c
Added Paths:
-----------
branches/blender2.5/blender/source/blender/makesrna/intern/rna_ID.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_dependency.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_main.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_mesh.c
Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h 2008-11-06 23:52:47 UTC (rev 17351)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h 2008-11-07 02:58:25 UTC (rev 17352)
@@ -27,49 +27,90 @@
struct bContext;
struct BlenderRNA;
+struct StructRNA;
struct PropertyRNA;
-struct StructRNA;
+struct PointerRNA;
struct CollectionPropertyIterator;
+struct Main;
-/* Property */
+/* Pointer
+ *
+ * Currently only an RNA pointer to Main can be obtained, this
+ * should be extended to allow making other pointers as well. */
-void RNA_property_notify(struct PropertyRNA *prop, struct bContext *C, void *data);
-int RNA_property_readonly(struct PropertyRNA *prop, struct bContext *C, void *data);
+void RNA_pointer_main_get(struct Main *main, struct PointerRNA *r_ptr);
-int RNA_property_boolean_get(struct PropertyRNA *prop, void *data);
-void RNA_property_boolean_set(struct PropertyRNA *prop, void *data, int value);
-int RNA_property_boolean_get_array(struct PropertyRNA *prop, void *data, int index);
-void RNA_property_boolean_set_array(struct PropertyRNA *prop, void *data, int index, int value);
+/* Property
+ *
+ * Access to struct properties. All this works with RNA pointers rather than
+ * direct pointers to the data. */
-int RNA_property_int_get(struct PropertyRNA *prop, void *data);
-void RNA_property_int_set(struct PropertyRNA *prop, void *data, int value);
-int RNA_property_int_get_array(struct PropertyRNA *prop, void *data, int index);
-void RNA_property_int_set_array(struct PropertyRNA *prop, void *data, int index, int value);
+int RNA_property_editable(struct PropertyRNA *prop, struct PointerRNA *ptr);
+int RNA_property_evaluated(struct PropertyRNA *prop, struct PointerRNA *ptr);
-float RNA_property_float_get(struct PropertyRNA *prop, void *data);
-void RNA_property_float_set(struct PropertyRNA *prop, void *data, float value);
-float RNA_property_float_get_array(struct PropertyRNA *prop, void *data, int index);
-void RNA_property_float_set_array(struct PropertyRNA *prop, void *data, int index, float value);
+void RNA_property_notify(struct PropertyRNA *prop, struct bContext *C, struct PointerRNA *ptr);
-void RNA_property_string_get(struct PropertyRNA *prop, void *data, char *value);
-int RNA_property_string_length(struct PropertyRNA *prop, void *data);
-void RNA_property_string_set(struct PropertyRNA *prop, void *data, const char *value);
+int RNA_property_boolean_get(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_boolean_set(struct PropertyRNA *prop, struct PointerRNA *ptr, int value);
+int RNA_property_boolean_get_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index);
+void RNA_property_boolean_set_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index, int value);
-int RNA_property_enum_get(struct PropertyRNA *prop, void *data);
-void RNA_property_enum_set(struct PropertyRNA *prop, void *data, int value);
+int RNA_property_int_get(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_int_set(struct PropertyRNA *prop, struct PointerRNA *ptr, int value);
+int RNA_property_int_get_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index);
+void RNA_property_int_set_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index, int value);
-void *RNA_property_pointer_get(struct PropertyRNA *prop, void *data);
-void RNA_property_pointer_set(struct PropertyRNA *prop, void *data, void *value);
-struct StructRNA *RNA_property_pointer_type(struct PropertyRNA *prop, void *data);
+float RNA_property_float_get(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_float_set(struct PropertyRNA *prop, struct PointerRNA *ptr, float value);
+float RNA_property_float_get_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index);
+void RNA_property_float_set_array(struct PropertyRNA *prop, struct PointerRNA *ptr, int index, float value);
-void RNA_property_collection_begin(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter, void *data);
+void RNA_property_string_get(struct PropertyRNA *prop, struct PointerRNA *ptr, char *value);
+int RNA_property_string_length(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_string_set(struct PropertyRNA *prop, struct PointerRNA *ptr, const char *value);
+
+int RNA_property_enum_get(struct PropertyRNA *prop, struct PointerRNA *ptr);
+void RNA_property_enum_set(struct PropertyRNA *prop, struct PointerRNA *ptr, int value);
+
+void RNA_property_pointer_get(struct PropertyRNA *prop, struct PointerRNA *ptr, struct PointerRNA *r_ptr);
+void RNA_property_pointer_set(struct PropertyRNA *prop, struct PointerRNA *ptr, struct PointerRNA *ptr_value);
+struct StructRNA *RNA_property_pointer_type(struct PropertyRNA *prop, struct PointerRNA *ptr);
+
+void RNA_property_collection_begin(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter, struct PointerRNA *ptr);
void RNA_property_collection_next(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter);
void RNA_property_collection_end(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter);
-void *RNA_property_collection_get(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter);
+void RNA_property_collection_get(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter, struct PointerRNA *r_ptr);
struct StructRNA *RNA_property_collection_type(struct PropertyRNA *prop, struct CollectionPropertyIterator *iter);
-int RNA_property_collection_length(struct PropertyRNA *prop, void *data);
-void *RNA_property_collection_lookup_int(struct PropertyRNA *prop, void *data, int key, struct StructRNA **type);
-void *RNA_property_collection_lookup_string(struct PropertyRNA *prop, void *data, const char *key, struct StructRNA **type);
+int RNA_property_collection_length(struct PropertyRNA *prop, struct PointerRNA *ptr);
+int RNA_property_collection_lookup_int(struct PropertyRNA *prop, struct PointerRNA *ptr, int key, struct PointerRNA *r_ptr);
+int RNA_property_collection_lookup_string(struct PropertyRNA *prop, struct PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr);
+/* Path
+ *
+ * Experimental method to refer to structs and properties with a string,
+ * using a syntax like: scenes[0].objects["Cube"].data.verts[7].co
+ *
+ * This provides a way to refer to RNA data while being detached from any
+ * particular pointers, which is useful in a number of applications, like
+ * UI code or Actions, though efficiency is a concern. */
+
+char *RNA_path_append(const char *path, struct PropertyRNA *prop, int intkey, const char *strkey);
+char *RNA_path_back(const char *path);
+
+int RNA_path_resolve(struct PointerRNA *ptr, const char *path,
+ struct PointerRNA *r_ptr, struct PropertyRNA **r_prop);
+
+/* Dependency
+ *
+ * Experimental code that will generate callbacks for each dependency
+ * between ID types. This may end up being useful for UI
+ * and evaluation code that needs to know such dependencies for correct
+ * redraws and re-evaluations. */
+
+typedef void (*PropDependencyCallback)(void *udata, struct PointerRNA *from, struct PointerRNA *to);
+void RNA_test_dependencies_cb(void *udata, struct PointerRNA *from, struct PointerRNA *to);
+
+void RNA_generate_dependencies(struct PointerRNA *mainptr, void *udata, PropDependencyCallback cb);
+
#endif /* RNA_ACCESS */
Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_define.h 2008-11-06 23:52:47 UTC (rev 17351)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_define.h 2008-11-07 02:58:25 UTC (rev 17352)
@@ -48,12 +48,13 @@
/* Struct */
struct StructRNA *RNA_def_struct(struct BlenderRNA *brna, const char *cname, const char *name);
-void RNA_def_struct_sdna(struct StructRNA *rna, const char *structname);
-void RNA_def_struct_name_property(struct StructRNA *rna, struct PropertyRNA *prop);
+void RNA_def_struct_sdna(struct StructRNA *srna, const char *structname);
+void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop);
+void RNA_def_struct_flag(struct StructRNA *srna, int flag);
/* Property */
-struct PropertyRNA *RNA_def_property(struct StructRNA *strct, const char *cname, int type, int subtype);
+struct PropertyRNA *RNA_def_property(struct StructRNA *srna, const char *cname, int type, int subtype);
void RNA_def_property_boolean_sdna(struct PropertyRNA *prop, const char *structname, const char *propname, int bit);
void RNA_def_property_int_sdna(struct PropertyRNA *prop, const char *structname, const char *propname);
@@ -61,10 +62,10 @@
void RNA_def_property_string_sdna(struct PropertyRNA *prop, const char *structname, const char *propname);
void RNA_def_property_enum_sdna(struct PropertyRNA *prop, const char *structname, const char *propname);
void RNA_def_property_pointer_sdna(struct PropertyRNA *prop, const char *structname, const char *propname);
-void RNA_def_property_collection_sdna(struct PropertyRNA *prop, const char *structname, const char *propname);
+void RNA_def_property_collection_sdna(struct PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname);
+void RNA_def_property_flag(struct PropertyRNA *prop, int flag);
void RNA_def_property_array(struct PropertyRNA *prop, int arraylength);
-void RNA_def_property_access(struct PropertyRNA *prop, int editable, int evaluatable);
void RNA_def_property_range(struct PropertyRNA *prop, double min, double max);
void RNA_def_property_enum_items(struct PropertyRNA *prop, const struct PropertyEnumItem *item);
@@ -83,14 +84,14 @@
void RNA_def_property_ui_text(struct PropertyRNA *prop, const char *name, const char *description);
void RNA_def_property_ui_range(struct PropertyRNA *prop, double min, double max, double step, double precision);
-void RNA_def_property_funcs(struct PropertyRNA *prop, char *notify, char *readonly);
-void RNA_def_property_boolean_funcs(struct PropertyRNA *prop, char *get, char *set);
-void RNA_def_property_int_funcs(struct PropertyRNA *prop, char *get, char *set);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list