#endif
typedef struct Mathutils_Callback Mathutils_Callback;
+
+typedef int (*BaseMathCheckFunc)(PyObject *);
+typedef int (*BaseMathGetFunc)(PyObject *, int, float *);
+typedef int (*BaseMathSetFunc)(PyObject *, int, float *);
+typedef int (*BaseMathGetIndexFunc)(PyObject *, int, float *, int);
+typedef int (*BaseMathSetIndexFunc)(PyObject *, int, float *, int);
+
struct Mathutils_Callback {
int (*check)(PyObject *user); /* checks the user is still valid */
int (*get)(PyObject *user, int subtype, float *from); /* gets the vector from the user */
}
Mathutils_Callback mathutils_rna_array_cb = {
- mathutils_rna_generic_check,
- mathutils_rna_vector_get,
- mathutils_rna_vector_set,
- mathutils_rna_vector_get_index,
- mathutils_rna_vector_set_index
+ (BaseMathCheckFunc) mathutils_rna_generic_check,
+ (BaseMathGetFunc) mathutils_rna_vector_get,
+ (BaseMathSetFunc) mathutils_rna_vector_set,
+ (BaseMathGetIndexFunc) mathutils_rna_vector_get_index,
+ (BaseMathSetIndexFunc) mathutils_rna_vector_set_index
};
+
/* bpyrna matrix callbacks */
static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
}
Mathutils_Callback mathutils_rna_matrix_cb = {
- mathutils_rna_generic_check,
- mathutils_rna_matrix_get,
- mathutils_rna_matrix_set,
- NULL,
- NULL
+ (BaseMathCheckFunc) mathutils_rna_generic_check,
+ (BaseMathGetFunc) mathutils_rna_matrix_get,
+ (BaseMathSetFunc) mathutils_rna_matrix_set,
+ (BaseMathGetIndexFunc) NULL,
+ (BaseMathSetIndexFunc) NULL
};
#endif
/* done with rna instance */
}
-PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
- StructRNA *srna, *base;
-
- if(ptr->type == &RNA_Struct)
- srna= ptr->data;
- else
- srna= ptr->type;
if (srna == NULL) {
newclass= NULL; /* Nothing to do */
} else if ((newclass= RNA_struct_py_type_get(srna))) {
Py_INCREF(newclass);
} else {
+ StructRNA *base;
+
/* for now, return the base RNA type rather then a real module */
/* Assume RNA_struct_py_type_get(srna) was alredy checked */
PyObject *py_base= NULL;
PyObject *dict = PyDict_New();
PyObject *item;
-
+
// arg 1
//PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(tp_name));
PyTuple_SET_ITEM(args, 0, PyUnicode_FromString(RNA_struct_identifier(srna)));
// arg 2
-#if 0 // XXX - This should be possible but for some reason it does a recursive call for MirrorModifier
base= RNA_struct_base(srna);
if(base && base != srna) {
- // printf("debug subtype %s\n", RNA_struct_identifier(srna));
- py_base= pyrna_struct_Subtype(base);
+ /*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */
+ py_base= pyrna_srna_Subtype(base);
}
-#endif
+
if(py_base==NULL) {
- py_base= &pyrna_struct_Type;
+ py_base= (PyObject *)&pyrna_struct_Type;
Py_INCREF(py_base);
}
return newclass;
}
+PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+{
+ return pyrna_srna_Subtype((ptr->type == &RNA_Struct) ? ptr->data : ptr->type);
+}
+
/*-----------------------CreatePyObject---------------------------------*/
PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
{