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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-07 17:09:18 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-07 17:09:18 +0400
commit673a39dab1827def82c8b405df6d6704e140c6fe (patch)
treee9b386aa0dece4a442a825b0149aa2743ab64fcf /source/blender/makesrna/intern/rna_ID.c
parent38e998e022411dd33a211a29650766bdca03bdc7 (diff)
RNA:
* Accept None as NULL pointers through python function calls. * Added type callback for pointers back, it's useful still in some cases. Made Object.data editable using this, the pointer type varying based on object type. * Wrap pin ID pointer in buttons space. * Added subclasses for text and surface curve ID blocks, to organize data better and get proper icons. * Added RNA_type_to_ID_code and ID_code_to_RNA_type functions. * Update RNA_access.h with new RNA types.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index eb57c91a9f7..56eda4eb735 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_types.h"
@@ -57,11 +58,41 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value)
test_idbutton(id->name+2);
}
-StructRNA *rna_ID_refine(PointerRNA *ptr)
+short RNA_type_to_ID_code(StructRNA *type)
{
- ID *id= (ID*)ptr->data;
+ if(RNA_struct_is_a(type, &RNA_Action)) return ID_AC;
+ if(RNA_struct_is_a(type, &RNA_Armature)) return ID_AR;
+ if(RNA_struct_is_a(type, &RNA_Brush)) return ID_BR;
+ if(RNA_struct_is_a(type, &RNA_Camera)) return ID_CA;
+ if(RNA_struct_is_a(type, &RNA_Curve)) return ID_CU;
+ if(RNA_struct_is_a(type, &RNA_Group)) return ID_GR;
+ if(RNA_struct_is_a(type, &RNA_Image)) return ID_IM;
+ //if(RNA_struct_is_a(type, &RNA_Ipo)) return case ID_IP;
+ if(RNA_struct_is_a(type, &RNA_Key)) return ID_KE;
+ if(RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA;
+ if(RNA_struct_is_a(type, &RNA_Library)) return ID_LI;
+ if(RNA_struct_is_a(type, &RNA_Lattice)) return ID_LT;
+ if(RNA_struct_is_a(type, &RNA_Material)) return ID_MA;
+ if(RNA_struct_is_a(type, &RNA_MetaBall)) return ID_MB;
+ if(RNA_struct_is_a(type, &RNA_NodeTree)) return ID_NT;
+ if(RNA_struct_is_a(type, &RNA_Mesh)) return ID_ME;
+ if(RNA_struct_is_a(type, &RNA_Object)) return ID_OB;
+ if(RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
+ if(RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
+ if(RNA_struct_is_a(type, &RNA_Screen)) return ID_SCR;
+ if(RNA_struct_is_a(type, &RNA_Sound)) return ID_SO;
+ if(RNA_struct_is_a(type, &RNA_Text)) return ID_TXT;
+ if(RNA_struct_is_a(type, &RNA_Texture)) return ID_TE;
+ if(RNA_struct_is_a(type, &RNA_VectorFont)) return ID_VF;
+ if(RNA_struct_is_a(type, &RNA_World)) return ID_WO;
+ if(RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
+
+ return 0;
+}
- switch(GS(id->name)) {
+StructRNA *ID_code_to_RNA_type(short idcode)
+{
+ switch(idcode) {
case ID_AC: return &RNA_Action;
case ID_AR: return &RNA_Armature;
case ID_BR: return &RNA_Brush;
@@ -92,6 +123,13 @@ StructRNA *rna_ID_refine(PointerRNA *ptr)
}
}
+StructRNA *rna_ID_refine(PointerRNA *ptr)
+{
+ ID *id= (ID*)ptr->data;
+
+ return ID_code_to_RNA_type(GS(id->name));
+}
+
IDProperty *rna_ID_idproperties(PointerRNA *ptr, int create)
{
return IDP_GetProperties(ptr->data, create);