Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2008-11-29 16:36:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2008-11-29 16:36:08 +0300
commitf23894c3658ca876c8591d564dd73df14135ae8e (patch)
tree89d31e82b304733073a692f51f91487373e84aa6 /source/blender/python/intern/bpy_rna.h
parentd1c0d0aa2c1472345c523d8258f732cc03747fdc (diff)
Python RNA API
* Matches the C/RNA api structure * Thin wrapper ~(600 lines) * No functions specific to any blender object type. * Defines 2 types, BPy_StructRNA and BPy_PropertyRNA. * Python 3.0 target (compatible with python 2.4,5,6) * http://wiki.blender.org/index.php/BlenderDev/Blender2.5/PyRNA - continue docs/discussion here. Todo * Collection iterators * Write access to data * Define how constants should be accessed (as strings or some special type) * Solve the "Python keeping invalid blender pointers" problem. This cant just be solved in the py api - we need blender to notify when ID's are removed Examples Here are some examples that work with the current implementation of the api. rna.lamps["Lamp.006"].energy -> (1.0) rna.lamps["Lamp.007"].shadow -> ("NOSHADOW") rna.materials.keys() -> ['flyingsquirrel_eye', 'frankie_skin', 'frankie_theeth'] rna.scenes["hud"].objects["num_text_p2_4"].data.novnormalflip -> False rna.meshes["mymesh"].uv_layers.keys() -> ['UVTex', 'UVTex'] rna.meshes.items() For a dump of yo-frankie level see - http://pasteall.org/3294/python Notes * Added python back, can only execute scripts from the command line with -P script.py * bpy_interface.c is just enough functionality to run a python file.
Diffstat (limited to 'source/blender/python/intern/bpy_rna.h')
-rw-r--r--source/blender/python/intern/bpy_rna.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
new file mode 100644
index 00000000000..f5fa5dffb67
--- /dev/null
+++ b/source/blender/python/intern/bpy_rna.h
@@ -0,0 +1,48 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef BPY_RNA_H
+#define BPY_RNA_H
+
+#include <Python.h>
+
+#include "RNA_access.h"
+#include "RNA_types.h"
+
+typedef struct {
+ PyObject_VAR_HEAD /* required python macro */
+ PointerRNA ptr;
+} BPy_StructRNA;
+
+typedef struct {
+ PyObject_VAR_HEAD /* required python macro */
+ PointerRNA ptr;
+ PropertyRNA *prop;
+} BPy_PropertyRNA;
+
+PyObject *BPY_rna_module( void );
+
+PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr );
+PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );
+
+#endif