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-04-19 17:37:59 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-04-19 17:37:59 +0400
commitadff6aeb1c749183921c0facd373972bbeb874b4 (patch)
tree07987d408713eee8a3dd8bb5cb4ecf3c112de654 /source/blender/editors
parentd880257d165888638b7c924fb6ef7071343b783e (diff)
RNA: Generic Type Registration
The Python API to define Panels and Operators is based on subclassing, this makes that system more generic, and based on RNA. Hopefully that will make it easy to make various parts of Blender more extensible. * The system simply uses RNA properties and functions and marks them with REGISTER to make them part of the type registration process. Additionally, the struct must provide a register/unregister callback to create/free the PanelType or similar. * From the python side there were some small changes, mainly that registration now goes trough bpy.types.register instead of bpy.ui.addPanel. * Only Panels have been wrapped this way now. Check rna_ui.c to see how this code works. There's still some rough edges and possibilities to make it cleaner, though it works without any manual python code. * Started some docs here: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration * Also changed some RNA_property and RNA_struct functions to not require a PointerRNA anymore, where they were not required (which is actually the cause of most changed files).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c12
-rw-r--r--source/blender/editors/animation/drivers.c4
-rw-r--r--source/blender/editors/animation/keyframing.c22
-rw-r--r--source/blender/editors/animation/keyingsets.c4
-rw-r--r--source/blender/editors/interface/interface.c62
-rw-r--r--source/blender/editors/interface/interface_anim.c4
-rw-r--r--source/blender/editors/interface/interface_layout.c24
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_regions.c10
-rw-r--r--source/blender/editors/interface/interface_utils.c22
-rw-r--r--source/blender/editors/space_outliner/outliner.c34
-rw-r--r--source/blender/editors/space_text/text_header.c8
12 files changed, 105 insertions, 105 deletions
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index ae0b8435635..4d4079a260a 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -135,19 +135,19 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* for structname, we use a custom name if one is available */
// xxx we might want an icon from types?
// xxx it is hard to differentiate between object and bone channels then, if ob + bone motion occur together...
- nameprop= RNA_struct_name_property(&ptr);
+ nameprop= RNA_struct_name_property(ptr.type);
if (nameprop) {
/* this gets a string which will need to be freed */
structname= RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0);
}
else
- structname= (char *)RNA_struct_ui_name(&ptr);
+ structname= (char *)RNA_struct_ui_name(ptr.type);
/* Property Name is straightforward */
- propname= (char *)RNA_property_ui_name(&ptr, prop);
+ propname= (char *)RNA_property_ui_name(prop);
/* Array Index - only if applicable */
- if (RNA_property_array_length(&ptr, prop)) {
+ if (RNA_property_array_length(prop)) {
// XXX the format of these is not final... we don't know how this will go yet
// format 1 style
//static char *vectoritem[4]= {".X", ".Y", ".Z", ".W"};
@@ -158,8 +158,8 @@ void getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
static char *quatitem[4]= {"W ", "X ", "Y ", "Z "};
static char *coloritem[4]= {"R ", "G ", "B ", "A "};
- int tot= RNA_property_array_length(&ptr, prop);
- int propsubtype= RNA_property_subtype(&ptr, prop);
+ int tot= RNA_property_array_length(prop);
+ int propsubtype= RNA_property_subtype(prop);
/* get string to use for array index */
if ((tot == 4) && (propsubtype == PROP_ROTATION))
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index ef8ac517e54..9c401289011 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -183,7 +183,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
if (path) {
if (all) {
- length= RNA_property_array_length(&ptr, prop);
+ length= RNA_property_array_length(prop);
if (length) index= 0;
else length= 1;
@@ -245,7 +245,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
if (path) {
if (all) {
- length= RNA_property_array_length(&ptr, prop);
+ length= RNA_property_array_length(prop);
if(length) index= 0;
else length= 1;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 0a911f2281a..c341e32db8c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -473,21 +473,21 @@ static float setting_get_rna_value (PointerRNA *ptr, PropertyRNA *prop, int inde
{
float value= 0.0f;
- switch (RNA_property_type(ptr, prop)) {
+ switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if (RNA_property_array_length(ptr, prop))
+ if (RNA_property_array_length(prop))
value= (float)RNA_property_boolean_get_index(ptr, prop, index);
else
value= (float)RNA_property_boolean_get(ptr, prop);
break;
case PROP_INT:
- if (RNA_property_array_length(ptr, prop))
+ if (RNA_property_array_length(prop))
value= (float)RNA_property_int_get_index(ptr, prop, index);
else
value= (float)RNA_property_int_get(ptr, prop);
break;
case PROP_FLOAT:
- if (RNA_property_array_length(ptr, prop))
+ if (RNA_property_array_length(prop))
value= RNA_property_float_get_index(ptr, prop, index);
else
value= RNA_property_float_get(ptr, prop);
@@ -538,14 +538,14 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
Object *ob= (Object *)ptr->data;
con= ob->constraints.first;
- identifier= (char *)RNA_property_identifier(ptr, prop);
+ identifier= (char *)RNA_property_identifier(prop);
}
else if (ptr->type == &RNA_PoseChannel) {
/* Pose Channel */
bPoseChannel *pchan= (bPoseChannel *)ptr->data;
con= pchan->constraints.first;
- identifier= (char *)RNA_property_identifier(ptr, prop);
+ identifier= (char *)RNA_property_identifier(prop);
}
/* check if any data to search using */
@@ -624,7 +624,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
*/
static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_index)
{
- char *identifier= (char *)RNA_property_identifier(ptr, prop);
+ char *identifier= (char *)RNA_property_identifier(prop);
/* handle for Objects or PoseChannels only
* - constraints can be on either Objects or PoseChannels, so we only check if the
@@ -726,7 +726,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_
float curval= 0.0f;
/* set additional flags for the F-Curve (i.e. only integer values) */
- if (RNA_property_type(&ptr, prop) != PROP_FLOAT)
+ if (RNA_property_type(prop) != PROP_FLOAT)
fcu->flag |= FCURVE_INT_VALUES;
/* apply special time tweaking */
@@ -1201,12 +1201,12 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
memset(&ptr, 0, sizeof(PointerRNA));
uiAnimContextProperty(C, &ptr, &prop, &index);
- if(ptr.data && prop && RNA_property_animateable(ptr.data, prop)) {
+ if(ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
path= RNA_path_from_ID_to_property(&ptr, prop);
if(path) {
if(all) {
- length= RNA_property_array_length(&ptr, prop);
+ length= RNA_property_array_length(prop);
if(length) index= 0;
else length= 1;
@@ -1270,7 +1270,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
if(path) {
if(all) {
- length= RNA_property_array_length(&ptr, prop);
+ length= RNA_property_array_length(prop);
if(length) index= 0;
else length= 1;
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index adc0b744d53..0f5cef51bdb 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -1031,7 +1031,7 @@ int modify_keyframes (bContext *C, ListBase *dsources, bAction *act, KeyingSet *
RNA_id_pointer_create(ksp->id, &id_ptr);
if (RNA_path_resolve(&id_ptr, ksp->rna_path, &ptr, &prop) && prop)
- arraylen= RNA_property_array_length(&ptr, prop);
+ arraylen= RNA_property_array_length(prop);
}
/* for each possible index, perform operation
@@ -1133,7 +1133,7 @@ int modify_keyframes (bContext *C, ListBase *dsources, bAction *act, KeyingSet *
RNA_id_pointer_create(cks->id, &id_ptr);
if (RNA_path_resolve(&id_ptr, path, &ptr, &prop) && prop)
- arraylen= RNA_property_array_length(&ptr, prop);
+ arraylen= RNA_property_array_length(prop);
}
/* for each possible index, perform operation
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 47c73c3398d..eb4bd5f940b 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1127,8 +1127,8 @@ void ui_get_but_vectorf(uiBut *but, float *vec)
vec[0]= vec[1]= vec[2]= 0.0f;
- if(RNA_property_type(&but->rnapoin, prop) == PROP_FLOAT) {
- tot= RNA_property_array_length(&but->rnapoin, prop);
+ if(RNA_property_type(prop) == PROP_FLOAT) {
+ tot= RNA_property_array_length(prop);
tot= MIN2(tot, 3);
for(a=0; a<tot; a++)
@@ -1161,8 +1161,8 @@ void ui_set_but_vectorf(uiBut *but, float *vec)
if(but->rnaprop) {
prop= but->rnaprop;
- if(RNA_property_type(&but->rnapoin, prop) == PROP_FLOAT) {
- tot= RNA_property_array_length(&but->rnapoin, prop);
+ if(RNA_property_type(prop) == PROP_FLOAT) {
+ tot= RNA_property_array_length(prop);
tot= MIN2(tot, 3);
for(a=0; a<tot; a++)
@@ -1186,7 +1186,7 @@ int ui_is_but_float(uiBut *but)
if(but->pointype==FLO && but->poin)
return 1;
- if(but->rnaprop && RNA_property_type(&but->rnapoin, but->rnaprop) == PROP_FLOAT)
+ if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
return 1;
return 0;
@@ -1203,21 +1203,21 @@ double ui_get_but_val(uiBut *but)
if(but->rnaprop) {
prop= but->rnaprop;
- switch(RNA_property_type(&but->rnapoin, prop)) {
+ switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_boolean_get(&but->rnapoin, prop);
break;
case PROP_INT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_int_get(&but->rnapoin, prop);
break;
case PROP_FLOAT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
else
value= RNA_property_float_get(&but->rnapoin, prop);
@@ -1267,21 +1267,21 @@ void ui_set_but_val(uiBut *but, double value)
prop= but->rnaprop;
if(RNA_property_editable(&but->rnapoin, prop)) {
- switch(RNA_property_type(&but->rnapoin, prop)) {
+ switch(RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_boolean_set(&but->rnapoin, prop, value);
break;
case PROP_INT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_int_set(&but->rnapoin, prop, value);
break;
case PROP_FLOAT:
- if(RNA_property_array_length(&but->rnapoin, prop))
+ if(RNA_property_array_length(prop))
RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
else
RNA_property_float_set(&but->rnapoin, prop, value);
@@ -1364,7 +1364,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
PropertyType type;
char *buf= NULL;
- type= RNA_property_type(&but->rnapoin, but->rnaprop);
+ type= RNA_property_type(but->rnaprop);
if(type == PROP_STRING) {
/* RNA string */
@@ -1375,7 +1375,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
PropertyRNA *nameprop;
- if(ptr.data && (nameprop = RNA_struct_name_property(&ptr)))
+ if(ptr.data && (nameprop = RNA_struct_name_property(ptr.type)))
buf= RNA_property_string_get_alloc(&ptr, nameprop, str, maxlen);
else
BLI_strncpy(str, "", maxlen);
@@ -1433,7 +1433,7 @@ static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, Prope
/* look for collection property in Main */
RNA_pointer_create(NULL, &RNA_Main, CTX_data_main(C), ptr);
- iterprop= RNA_struct_iterator_property(ptr);
+ iterprop= RNA_struct_iterator_property(ptr->type);
RNA_property_collection_begin(ptr, iterprop, &iter);
*prop= NULL;
@@ -1441,10 +1441,10 @@ static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, Prope
iprop= iter.ptr.data;
/* if it's a collection and has same pointer type, we've got it */
- if(RNA_property_type(ptr, iprop) == PROP_COLLECTION) {
- srna= RNA_property_pointer_type(ptr, iprop);
+ if(RNA_property_type(iprop) == PROP_COLLECTION) {
+ srna= RNA_property_pointer_type(iprop);
- if(RNA_property_pointer_type(&but->rnapoin, but->rnaprop) == srna) {
+ if(RNA_property_pointer_type(but->rnaprop) == srna) {
*prop= iprop;
break;
}
@@ -1475,7 +1475,7 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but)
/* loop over items in collection */
for(; iter.valid; RNA_property_collection_next(&iter)) {
- if(iter.ptr.data && (nameprop = RNA_struct_name_property(&iter.ptr))) {
+ if(iter.ptr.data && (nameprop = RNA_struct_name_property(iter.ptr.type))) {
name= RNA_property_string_get_alloc(&iter.ptr, nameprop, NULL, 0);
if(name) {
@@ -1496,7 +1496,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
if(RNA_property_editable(&but->rnapoin, but->rnaprop)) {
PropertyType type;
- type= RNA_property_type(&but->rnapoin, but->rnaprop);
+ type= RNA_property_type(but->rnaprop);
if(type == PROP_STRING) {
/* RNA string */
@@ -1593,7 +1593,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
double softmin, softmax, step, precision;
if(but->rnaprop) {
- type= RNA_property_type(&but->rnapoin, but->rnaprop);
+ type= RNA_property_type(but->rnaprop);
if(type == PROP_INT) {
int imin, imax, istep;
@@ -1885,7 +1885,7 @@ void ui_check_but(uiBut *but)
}
if(but->rnaprop) {
- PropertySubType pstype = RNA_property_subtype(&but->rnapoin, but->rnaprop);
+ PropertySubType pstype = RNA_property_subtype(but->rnaprop);
if (pstype == PROP_PERCENTAGE)
strcat(but->drawstr, "%");
@@ -2243,7 +2243,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
prop= RNA_struct_find_property(ptr, propname);
if(prop) {
- proptype= RNA_property_type(ptr, prop);
+ proptype= RNA_property_type(prop);
/* use rna values if parameters are not specified */
if(!str) {
@@ -2255,7 +2255,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
RNA_property_enum_items(ptr, prop, &item, &totitem);
dynstr= BLI_dynstr_new();
- BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(ptr, prop));
+ BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
for(i=0; i<totitem; i++)
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
str= BLI_dynstr_get_cstring(dynstr);
@@ -2273,10 +2273,10 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
str= (char*)item[i].name;
if(!str)
- str= (char*)RNA_property_ui_name(ptr, prop);
+ str= (char*)RNA_property_ui_name(prop);
}
else
- str= (char*)RNA_property_ui_name(ptr, prop);
+ str= (char*)RNA_property_ui_name(prop);
}
if(!tip) {
@@ -2297,7 +2297,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
}
if(!tip)
- tip= (char*)RNA_property_ui_description(ptr, prop);
+ tip= (char*)RNA_property_ui_description(prop);
if(min == max || a1 == -1 || a2 == -1) {
if(proptype == PROP_INT) {
@@ -2332,7 +2332,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
}
else if(proptype == PROP_STRING) {
min= 0;
- max= RNA_property_string_maxlength(ptr, prop);
+ max= RNA_property_string_maxlength(prop);
if(max == 0) /* interface code should ideally support unlimited length */
max= UI_MAX_DRAW_STR;
}
@@ -2348,7 +2348,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
but->rnapoin= *ptr;
but->rnaprop= prop;
- if(RNA_property_array_length(&but->rnapoin, but->rnaprop))
+ if(RNA_property_array_length(but->rnaprop))
but->rnaindex= index;
else
but->rnaindex= 0;
@@ -2767,7 +2767,7 @@ uiBut *uiDefMenuTogR(uiBlock *block, PointerRNA *ptr, char *propname, char *prop
prop= RNA_struct_find_property(ptr, propname);
if(prop) {
- type= RNA_property_type(ptr, prop);
+ type= RNA_property_type(prop);
if(type == PROP_BOOLEAN) {
if(RNA_property_boolean_get(ptr, prop))
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 3b89fbddebc..6775a639597 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -118,9 +118,9 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
int length;
if(but->rnapoin.data && but->rnaprop) {
- head= uiPupMenuBegin(RNA_property_ui_name(&but->rnapoin, but->rnaprop), 0);
+ head= uiPupMenuBegin(RNA_property_ui_name(but->rnaprop), 0);
- length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+ length= RNA_property_array_length(but->rnaprop);
if(but->flag & UI_BUT_ANIMATED_KEY) {
if(length) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 795483ac177..7d27934f691 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -191,14 +191,14 @@ static void ui_item_array(uiBlock *block, uiItemRNA *rnaitem, int len, int x, in
int a;
/* retrieve type and subtype */
- type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
- subtype= RNA_property_subtype(&rnaitem->ptr, rnaitem->prop);
+ type= RNA_property_type(rnaitem->prop);
+ subtype= RNA_property_subtype(rnaitem->prop);
/* create label */
if(rnaitem->item.name)
name= (char*)rnaitem->item.name;
else
- name= (char*)RNA_property_ui_name(&rnaitem->ptr, rnaitem->prop);
+ name= (char*)RNA_property_ui_name(rnaitem->prop);
if(strcmp(name, "") != 0)
uiDefBut(block, LABEL, 0, name, x, y + h - EM_UNIT_Y, w, EM_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
@@ -289,7 +289,7 @@ static void ui_item_enum_row(uiBlock *block, uiItemRNA *rnaitem, int x, int y, i
int a, totitem, pos, itemw;
const char *propname;
- propname= RNA_property_identifier(&rnaitem->ptr, rnaitem->prop);
+ propname= RNA_property_identifier(rnaitem->prop);
RNA_property_enum_items(&rnaitem->ptr, rnaitem->prop, &item, &totitem);
uiBlockBeginAlign(block);
@@ -310,7 +310,7 @@ static void ui_item_with_label(uiBlock *block, uiItemRNA *rnaitem, int x, int y,
if(rnaitem->item.name)
name= (char*)rnaitem->item.name;
else
- name= (char*)RNA_property_ui_name(&rnaitem->ptr, rnaitem->prop);
+ name= (char*)RNA_property_ui_name(rnaitem->prop);
if(strcmp(name, "") != 0) {
w= w/2;
@@ -331,8 +331,8 @@ static void ui_item_buts(uiBlock *block, uiItem *item, int x, int y, int w, int
int len;
/* retrieve info */
- type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
- len= RNA_property_array_length(&rnaitem->ptr, rnaitem->prop);
+ type= RNA_property_type(rnaitem->prop);
+ len= RNA_property_array_length(rnaitem->prop);
/* array property */
if(rnaitem->index == RNA_NO_INDEX && len > 0)
@@ -416,9 +416,9 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h)
h= EM_UNIT_Y;
/* arbitrary extended width by type */
- type= RNA_property_type(&rnaitem->ptr, rnaitem->prop);
- subtype= RNA_property_subtype(&rnaitem->ptr, rnaitem->prop);
- len= RNA_property_array_length(&rnaitem->ptr, rnaitem->prop);
+ type= RNA_property_type(rnaitem->prop);
+ subtype= RNA_property_subtype(rnaitem->prop);
+ len= RNA_property_array_length(rnaitem->prop);
if(type == PROP_STRING)
w += 10*EM_UNIT_X;
@@ -506,7 +506,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
prop= RNA_struct_find_property(&ptr, propname);
- if(prop && RNA_property_type(&ptr, prop) == PROP_ENUM) {
+ if(prop && RNA_property_type(prop) == PROP_ENUM) {
const EnumPropertyItem *item;
int totitem, i;
@@ -1214,7 +1214,7 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
if(!pt->context || strcmp(context, pt->context) != 0)
continue;
- if(pt->draw && (!pt->poll || pt->poll(C))) {
+ if(pt->draw && (!pt->poll || pt->poll(C, pt))) {
block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
panel= uiBeginPanel(ar, block, pt);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 42033a40624..7d1f8d59552 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -158,8 +158,8 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
Panel *uiBeginPanel(ARegion *ar, uiBlock *block, PanelType *pt)
{
Panel *pa, *patab, *palast, *panext;
- char *panelname= pt->name;
- char *tabname= pt->name;
+ char *panelname= pt->label;
+ char *tabname= pt->label;
char *hookname= NULL;
int newpanel;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 47afd03d051..73fdb7fd83c 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1861,7 +1861,7 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
else if(item->type==MENU_ITEM_RNA_BOOL) {
PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
- if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_BOOLEAN) {
+ if(prop && RNA_property_type(prop) == PROP_BOOLEAN) {
icon= (RNA_property_boolean_get(&item->rnapoin, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
uiDefIconTextButR(block, TOG, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, 0, 0, 0, NULL);
}
@@ -1876,7 +1876,7 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
else if(item->type==MENU_ITEM_RNA_ENUM) {
PropertyRNA *prop= RNA_struct_find_property(&item->rnapoin, item->propname);
- if(prop && RNA_property_type(&item->rnapoin, prop) == PROP_ENUM) {
+ if(prop && RNA_property_type(prop) == PROP_ENUM) {
icon= (RNA_property_enum_get(&item->rnapoin, prop) == item->enumval)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
uiDefIconTextButR(block, ROW, 0, icon, NULL, x1, y1, width+16, MENU_BUTTON_HEIGHT-1, &item->rnapoin, item->propname, 0, 0, item->enumval, 0, 0, NULL);
}
@@ -2074,7 +2074,7 @@ void uiMenuItemsEnumO(uiMenuItem *head, char *opname, char *propname)
RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
prop= RNA_struct_find_property(&ptr, propname);
- if(prop && RNA_property_type(&ptr, prop) == PROP_ENUM) {
+ if(prop && RNA_property_type(prop) == PROP_ENUM) {
const EnumPropertyItem *item;
int totitem, i;
@@ -2112,7 +2112,7 @@ void uiMenuItemsEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
prop= RNA_struct_find_property(ptr, propname);
- if(prop && RNA_property_type(ptr, prop) == PROP_ENUM) {
+ if(prop && RNA_property_type(prop) == PROP_ENUM) {
const EnumPropertyItem *item;
int totitem, i;
@@ -2156,7 +2156,7 @@ void uiMenuLevelEnumR(uiMenuItem *head, PointerRNA *ptr, char *propname)
item->type = MENU_ITEM_LEVEL_RNA_ENUM;
prop= RNA_struct_find_property(ptr, propname);
if(prop)
- BLI_strncpy(item->name, RNA_property_ui_name(ptr, prop), MAX_MENU_STR);
+ BLI_strncpy(item->name, RNA_property_ui_name(prop), MAX_MENU_STR);
item->rnapoin= *ptr;
item->propname= propname; // static!
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 884e5bee615..5ef1e68bd59 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -220,17 +220,17 @@ int UI_GetIconRNA(PointerRNA *ptr)
uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2)
{
uiBut *but=NULL;
- const char *propname= RNA_property_identifier(ptr, prop);
- int arraylen= RNA_property_array_length(ptr, prop);
+ const char *propname= RNA_property_identifier(prop);
+ int arraylen= RNA_property_array_length(prop);
- switch(RNA_property_type(ptr, prop)) {
+ switch(RNA_property_type(prop)) {
case PROP_BOOLEAN: {
int value, length;
if(arraylen && index == -1)
return NULL;
- length= RNA_property_array_length(ptr, prop);
+ length= RNA_property_array_length(prop);
if(length)
value= RNA_property_boolean_get_index(ptr, prop, index);
@@ -248,10 +248,10 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
case PROP_INT:
case PROP_FLOAT:
if(arraylen && index == -1) {
- if(RNA_property_subtype(ptr, prop) == PROP_COLOR)
+ if(RNA_property_subtype(prop) == PROP_COLOR)
but= uiDefButR(block, COL, 0, name, x1, y1, x2, y2, ptr, propname, 0, 0, 0, -1, -1, NULL);
}
- else if(RNA_property_subtype(ptr, prop) == PROP_PERCENTAGE)
+ else if(RNA_property_subtype(prop) == PROP_PERCENTAGE)
but= uiDefButR(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
else
but= uiDefButR(block, NUM, 0, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
@@ -268,7 +268,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
pptr= RNA_property_pointer_get(ptr, prop);
if(!pptr.type)
- pptr.type= RNA_property_pointer_type(ptr, prop);
+ pptr.type= RNA_property_pointer_type(prop);
icon= UI_GetIconRNA(&pptr);
but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
@@ -300,20 +300,20 @@ int uiDefAutoButsRNA(const bContext *C, uiBlock *block, PointerRNA *ptr)
layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, x, y, DEF_BUT_WIDTH*2, 20);
uiLayoutColumn(layout);
- uiItemL(layout, (char*)RNA_struct_ui_name(ptr), 0);
+ uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0);
- iterprop= RNA_struct_iterator_property(ptr);
+ iterprop= RNA_struct_iterator_property(ptr->type);
RNA_property_collection_begin(ptr, iterprop, &iter);
for(; iter.valid; RNA_property_collection_next(&iter)) {
prop= iter.ptr.data;
- if(strcmp(RNA_property_identifier(ptr, prop), "rna_type") == 0)
+ if(strcmp(RNA_property_identifier(prop), "rna_type") == 0)
continue;
uiLayoutSplit(layout, 2, 0);
- name= (char*)RNA_property_ui_name(ptr, prop);
+ name= (char*)RNA_property_ui_name(prop);
uiLayoutColumn(uiLayoutSub(layout, 0));
uiItemL(uiLayoutSub(layout, 0), name, 0);
uiLayoutColumn(uiLayoutSub(layout, 1));
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 46f8bc77149..b03d938843f 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1042,20 +1042,20 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(type == TSE_RNA_STRUCT) {
/* struct */
- nameprop= RNA_struct_name_property(ptr);
+ nameprop= RNA_struct_name_property(ptr->type);
if(nameprop) {
te->name= RNA_property_string_get_alloc(ptr, nameprop, NULL, 0);
te->flag |= TE_FREE_NAME;
}
else
- te->name= (char*)RNA_struct_ui_name(ptr);
+ te->name= (char*)RNA_struct_ui_name(ptr->type);
- iterprop= RNA_struct_iterator_property(ptr);
+ iterprop= RNA_struct_iterator_property(ptr->type);
tot= RNA_property_collection_length(ptr, iterprop);
/* auto open these cases */
- if(!parent || (RNA_property_type(&parent->rnaptr, parent->directdata)) == PROP_POINTER)
+ if(!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
if(!tselem->used)
tselem->flag &= ~TSE_CLOSED;
@@ -1070,13 +1070,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
}
else if(type == TSE_RNA_PROPERTY) {
/* property */
- iterprop= RNA_struct_iterator_property(ptr);
+ iterprop= RNA_struct_iterator_property(ptr->type);
RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
prop= propptr.data;
- proptype= RNA_property_type(ptr, prop);
+ proptype= RNA_property_type(prop);
- te->name= (char*)RNA_property_ui_name(ptr, prop);
+ te->name= (char*)RNA_property_ui_name(prop);
te->directdata= prop;
te->rnaptr= *ptr;
@@ -1103,7 +1103,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->flag |= TE_LAZY_CLOSED;
}
else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
- tot= RNA_property_array_length(ptr, prop);
+ tot= RNA_property_array_length(prop);
if(!(tselem->flag & TSE_CLOSED)) {
for(a=0; a<tot; a++)
@@ -1120,9 +1120,9 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
static char *coloritem[4]= {" r", " g", " b", " a"};
prop= parent->directdata;
- proptype= RNA_property_type(ptr, prop);
- propsubtype= RNA_property_subtype(ptr, prop);
- tot= RNA_property_array_length(ptr, prop);
+ proptype= RNA_property_type(prop);
+ propsubtype= RNA_property_subtype(prop);
+ tot= RNA_property_array_length(prop);
te->directdata= prop;
te->rnaptr= *ptr;
@@ -3146,16 +3146,16 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
* - to prevent memory leaks, we must write to newpath not path, then free old path + swap them
*/
if(tse->type == TSE_RNA_PROPERTY) {
- if(RNA_property_type(ptr, prop) == PROP_POINTER) {
+ if(RNA_property_type(prop) == PROP_POINTER) {
/* for pointer we just append property name */
newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
}
- else if(RNA_property_type(ptr, prop) == PROP_COLLECTION) {
+ else if(RNA_property_type(prop) == PROP_COLLECTION) {
temnext= (TreeElement*)(ld->next->data);
tsenext= TREESTORE(temnext);
nextptr= &temnext->rnaptr;
- nameprop= RNA_struct_name_property(nextptr);
+ nameprop= RNA_struct_name_property(nextptr->type);
if(nameprop) {
/* if possible, use name as a key in the path */
@@ -3192,7 +3192,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
/* no ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock to extract info from */
if (tse->type == TSE_RNA_STRUCT) {
/* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */
- if(RNA_struct_is_ID(ptr)) {
+ if(RNA_struct_is_ID(ptr->type)) {
*id= (ID *)ptr->data;
/* clear path */
@@ -3216,7 +3216,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
/* item is part of an array, so must set the array_index */
*array_index= te->index;
}
- else if (RNA_property_array_length(ptr, prop)) {
+ else if (RNA_property_array_length(prop)) {
/* entire array was selected, so keyframe all */
*flag |= KSP_FLAG_WHOLE_ARRAY;
}
@@ -4203,7 +4203,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
ptr= &te->rnaptr;
prop= te->directdata;
- if(!(RNA_property_type(ptr, prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
+ if(!(RNA_property_type(prop) == PROP_POINTER && (tselem->flag & TSE_CLOSED)==0))
uiDefAutoButR(block, ptr, prop, -1, "", 0, sizex, (int)te->ys, OL_RNA_COL_SIZEX, OL_H-1);
}
else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index be3a57afbf5..b2069b14d06 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -487,15 +487,15 @@ void text_properties_register(ARegionType *art)
/* panels: properties */
pt= MEM_callocN(sizeof(PanelType), "spacetype text panel");
- pt->idname= "TEXT_PT_properties";
- pt->name= "Properties";
+ strcpy(pt->idname, "TEXT_PT_properties");
+ strcpy(pt->label, "Properties");
pt->draw= text_properties_panel_draw;
BLI_addtail(&art->paneltypes, pt);
/* panels: find */
pt= MEM_callocN(sizeof(PanelType), "spacetype text panel");
- pt->idname= "TEXT_PT_find";
- pt->name= "Find";
+ strcpy(pt->idname, "TEXT_PT_find");
+ strcpy(pt->label, "Find");
pt->draw= text_find_panel_draw;
BLI_addtail(&art->paneltypes, pt);
}