RNA
* Disable editable pointers for now, difficult to support well. * Swap parameters in RNA_access.h functions to make it more consistent. * Rename rna members for operators to wmOperatorType.srna, and wmOperator.ptr, to make the distincton a bit clearer. • Removed the RNA_int_default and similar functions, they're too confusing. RNA_property_is_set can still be used to achieve the same goal. * Add functions to create RNA pointers. Some example code for RNA data access and operator properties: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNAExampleCode
This commit is contained in:
@@ -1058,7 +1058,7 @@ int ui_is_but_float(uiBut *but)
|
|||||||
if(but->pointype==FLO && but->poin)
|
if(but->pointype==FLO && but->poin)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if(but->rnaprop && RNA_property_type(but->rnaprop, &but->rnapoin) == PROP_FLOAT)
|
if(but->rnaprop && RNA_property_type(&but->rnapoin, but->rnaprop) == PROP_FLOAT)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1075,27 +1075,27 @@ double ui_get_but_val(uiBut *but)
|
|||||||
if(but->rnaprop) {
|
if(but->rnaprop) {
|
||||||
prop= but->rnaprop;
|
prop= but->rnaprop;
|
||||||
|
|
||||||
switch(RNA_property_type(prop, &but->rnapoin)) {
|
switch(RNA_property_type(&but->rnapoin, prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
value= RNA_property_boolean_get_array(prop, &but->rnapoin, but->rnaindex);
|
value= RNA_property_boolean_get_array(&but->rnapoin, prop, but->rnaindex);
|
||||||
else
|
else
|
||||||
value= RNA_property_boolean_get(prop, &but->rnapoin);
|
value= RNA_property_boolean_get(&but->rnapoin, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
value= RNA_property_int_get_array(prop, &but->rnapoin, but->rnaindex);
|
value= RNA_property_int_get_array(&but->rnapoin, prop, but->rnaindex);
|
||||||
else
|
else
|
||||||
value= RNA_property_int_get(prop, &but->rnapoin);
|
value= RNA_property_int_get(&but->rnapoin, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
value= RNA_property_float_get_array(prop, &but->rnapoin, but->rnaindex);
|
value= RNA_property_float_get_array(&but->rnapoin, prop, but->rnaindex);
|
||||||
else
|
else
|
||||||
value= RNA_property_float_get(prop, &but->rnapoin);
|
value= RNA_property_float_get(&but->rnapoin, prop);
|
||||||
break;
|
break;
|
||||||
case PROP_ENUM:
|
case PROP_ENUM:
|
||||||
value= RNA_property_enum_get(prop, &but->rnapoin);
|
value= RNA_property_enum_get(&but->rnapoin, prop);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value= 0.0;
|
value= 0.0;
|
||||||
@@ -1138,28 +1138,28 @@ void ui_set_but_val(uiBut *but, double value)
|
|||||||
if(but->rnaprop) {
|
if(but->rnaprop) {
|
||||||
prop= but->rnaprop;
|
prop= but->rnaprop;
|
||||||
|
|
||||||
if(RNA_property_editable(prop, &but->rnapoin)) {
|
if(RNA_property_editable(&but->rnapoin, prop)) {
|
||||||
switch(RNA_property_type(prop, &but->rnapoin)) {
|
switch(RNA_property_type(&but->rnapoin, prop)) {
|
||||||
case PROP_BOOLEAN:
|
case PROP_BOOLEAN:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
RNA_property_boolean_set_array(prop, &but->rnapoin, but->rnaindex, value);
|
RNA_property_boolean_set_array(&but->rnapoin, prop, but->rnaindex, value);
|
||||||
else
|
else
|
||||||
RNA_property_boolean_set(prop, &but->rnapoin, value);
|
RNA_property_boolean_set(&but->rnapoin, prop, value);
|
||||||
break;
|
break;
|
||||||
case PROP_INT:
|
case PROP_INT:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
RNA_property_int_set_array(prop, &but->rnapoin, but->rnaindex, value);
|
RNA_property_int_set_array(&but->rnapoin, prop, but->rnaindex, value);
|
||||||
else
|
else
|
||||||
RNA_property_int_set(prop, &but->rnapoin, value);
|
RNA_property_int_set(&but->rnapoin, prop, value);
|
||||||
break;
|
break;
|
||||||
case PROP_FLOAT:
|
case PROP_FLOAT:
|
||||||
if(RNA_property_array_length(prop, &but->rnapoin))
|
if(RNA_property_array_length(&but->rnapoin, prop))
|
||||||
RNA_property_float_set_array(prop, &but->rnapoin, but->rnaindex, value);
|
RNA_property_float_set_array(&but->rnapoin, prop, but->rnaindex, value);
|
||||||
else
|
else
|
||||||
RNA_property_float_set(prop, &but->rnapoin, value);
|
RNA_property_float_set(&but->rnapoin, prop, value);
|
||||||
break;
|
break;
|
||||||
case PROP_ENUM:
|
case PROP_ENUM:
|
||||||
RNA_property_enum_set(prop, &but->rnapoin, value);
|
RNA_property_enum_set(&but->rnapoin, prop, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1225,7 +1225,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
|
|||||||
if(but->rnaprop) {
|
if(but->rnaprop) {
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf= RNA_property_string_get_alloc(but->rnaprop, &but->rnapoin, str, maxlen);
|
buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen);
|
||||||
|
|
||||||
if(buf != str) {
|
if(buf != str) {
|
||||||
/* string was too long, we have to truncate */
|
/* string was too long, we have to truncate */
|
||||||
@@ -1241,7 +1241,7 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
|
|||||||
void ui_set_but_string(uiBut *but, const char *str)
|
void ui_set_but_string(uiBut *but, const char *str)
|
||||||
{
|
{
|
||||||
if(but->rnaprop)
|
if(but->rnaprop)
|
||||||
RNA_property_string_set(but->rnaprop, &but->rnapoin, str);
|
RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
|
||||||
else
|
else
|
||||||
BLI_strncpy(but->poin, str, but->max);
|
BLI_strncpy(but->poin, str, but->max);
|
||||||
}
|
}
|
||||||
@@ -2237,32 +2237,32 @@ uiBut *uiDefRNABut(uiBlock *block, int retval, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
{
|
{
|
||||||
uiBut *but;
|
uiBut *but;
|
||||||
|
|
||||||
switch(RNA_property_type(prop, ptr)) {
|
switch(RNA_property_type(ptr, prop)) {
|
||||||
case PROP_BOOLEAN: {
|
case PROP_BOOLEAN: {
|
||||||
int value, length;
|
int value, length;
|
||||||
|
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
|
|
||||||
if(length)
|
if(length)
|
||||||
value= RNA_property_boolean_get_array(prop, ptr, index);
|
value= RNA_property_boolean_get_array(ptr, prop, index);
|
||||||
else
|
else
|
||||||
value= RNA_property_boolean_get(prop, ptr);
|
value= RNA_property_boolean_get(ptr, prop);
|
||||||
|
|
||||||
but= ui_def_but(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, TOG, 0, (value)? "True": "False", x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_INT: {
|
case PROP_INT: {
|
||||||
int softmin, softmax, step;
|
int softmin, softmax, step;
|
||||||
|
|
||||||
RNA_property_int_ui_range(prop, ptr, &softmin, &softmax, &step);
|
RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
|
||||||
but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, 0, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, 0, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_FLOAT: {
|
case PROP_FLOAT: {
|
||||||
float softmin, softmax, step, precision;
|
float softmin, softmax, step, precision;
|
||||||
|
|
||||||
RNA_property_float_ui_range(prop, ptr, &softmin, &softmax, &step, &precision);
|
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
|
||||||
but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, precision, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, NUM, 0, "", x1, y1, x2, y2, NULL, softmin, softmax, step, precision, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_ENUM: {
|
case PROP_ENUM: {
|
||||||
@@ -2271,28 +2271,28 @@ uiBut *uiDefRNABut(uiBlock *block, int retval, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
char *menu;
|
char *menu;
|
||||||
int i, totitem;
|
int i, totitem;
|
||||||
|
|
||||||
RNA_property_enum_items(prop, ptr, &item, &totitem);
|
RNA_property_enum_items(ptr, prop, &item, &totitem);
|
||||||
|
|
||||||
dynstr= BLI_dynstr_new();
|
dynstr= BLI_dynstr_new();
|
||||||
BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop, ptr));
|
BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(ptr, prop));
|
||||||
for(i=0; i<totitem; i++)
|
for(i=0; i<totitem; i++)
|
||||||
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
|
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
|
||||||
menu= BLI_dynstr_get_cstring(dynstr);
|
menu= BLI_dynstr_get_cstring(dynstr);
|
||||||
BLI_dynstr_free(dynstr);
|
BLI_dynstr_free(dynstr);
|
||||||
|
|
||||||
but= ui_def_but(block, MENU, 0, menu, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, MENU, 0, menu, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
MEM_freeN(menu);
|
MEM_freeN(menu);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_STRING: {
|
case PROP_STRING: {
|
||||||
int maxlength;
|
int maxlength;
|
||||||
|
|
||||||
maxlength= RNA_property_string_maxlength(prop, ptr);
|
maxlength= RNA_property_string_maxlength(ptr, prop);
|
||||||
if(maxlength == 0)
|
if(maxlength == 0)
|
||||||
/* interface code should ideally support unlimited length */
|
/* interface code should ideally support unlimited length */
|
||||||
maxlength= UI_MAX_DRAW_STR;
|
maxlength= UI_MAX_DRAW_STR;
|
||||||
|
|
||||||
but= ui_def_but(block, TEX, 0, "", x1, y1, x2, y2, NULL, 0, maxlength, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, TEX, 0, "", x1, y1, x2, y2, NULL, 0, maxlength, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_POINTER: {
|
case PROP_POINTER: {
|
||||||
@@ -2300,17 +2300,17 @@ uiBut *uiDefRNABut(uiBlock *block, int retval, PointerRNA *ptr, PropertyRNA *pro
|
|||||||
PropertyRNA *nameprop;
|
PropertyRNA *nameprop;
|
||||||
char name[256]= "", *nameptr= name;
|
char name[256]= "", *nameptr= name;
|
||||||
|
|
||||||
RNA_property_pointer_get(prop, ptr, &pptr);
|
RNA_property_pointer_get(ptr, prop, &pptr);
|
||||||
|
|
||||||
if(pptr.data) {
|
if(pptr.data) {
|
||||||
nameprop= RNA_struct_name_property(&pptr);
|
nameprop= RNA_struct_name_property(&pptr);
|
||||||
if(pptr.type && nameprop)
|
if(pptr.type && nameprop)
|
||||||
nameptr= RNA_property_string_get_alloc(nameprop, &pptr, name, sizeof(name));
|
nameptr= RNA_property_string_get_alloc(&pptr, nameprop, name, sizeof(name));
|
||||||
else
|
else
|
||||||
strcpy(nameptr, "->");
|
strcpy(nameptr, "->");
|
||||||
}
|
}
|
||||||
|
|
||||||
but= ui_def_but(block, BUT, 0, nameptr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, ptr));
|
but= ui_def_but(block, BUT, 0, nameptr, x1, y1, x2, y2, NULL, 0, 0, 0, 0, (char*)RNA_property_ui_description(ptr, prop));
|
||||||
but->flag |= UI_TEXT_LEFT;
|
but->flag |= UI_TEXT_LEFT;
|
||||||
|
|
||||||
if(nameptr != name)
|
if(nameptr != name)
|
||||||
|
|||||||
@@ -466,8 +466,8 @@ static int area_move_init (bContext *C, wmOperator *op)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
/* required properties */
|
/* required properties */
|
||||||
x= RNA_int_get(op->rna, "x");
|
x= RNA_int_get(op->ptr, "x");
|
||||||
y= RNA_int_get(op->rna, "y");
|
y= RNA_int_get(op->ptr, "y");
|
||||||
|
|
||||||
/* setup */
|
/* setup */
|
||||||
actedge= screen_find_active_scredge(C->screen, x, y);
|
actedge= screen_find_active_scredge(C->screen, x, y);
|
||||||
@@ -523,7 +523,7 @@ static void area_move_apply(bContext *C, wmOperator *op)
|
|||||||
sAreaMoveData *md= op->customdata;
|
sAreaMoveData *md= op->customdata;
|
||||||
int delta;
|
int delta;
|
||||||
|
|
||||||
delta= RNA_int_get(op->rna, "delta");
|
delta= RNA_int_get(op->ptr, "delta");
|
||||||
area_move_apply_do(C, md->origval, delta, md->dir, md->bigger, md->smaller);
|
area_move_apply_do(C, md->origval, delta, md->dir, md->bigger, md->smaller);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,8 +552,8 @@ static int area_move_exec(bContext *C, wmOperator *op)
|
|||||||
/* interaction callback */
|
/* interaction callback */
|
||||||
static int area_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
static int area_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||||
{
|
{
|
||||||
RNA_int_default(op->rna, "x", event->x);
|
RNA_int_set(op->ptr, "x", event->x);
|
||||||
RNA_int_default(op->rna, "y", event->y);
|
RNA_int_set(op->ptr, "y", event->y);
|
||||||
|
|
||||||
if(!area_move_init(C, op))
|
if(!area_move_init(C, op))
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
@@ -568,7 +568,7 @@ static int area_move_cancel(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
WM_event_remove_modal_handler(&C->window->handlers, op);
|
WM_event_remove_modal_handler(&C->window->handlers, op);
|
||||||
|
|
||||||
RNA_int_set(op->rna, "delta", 0);
|
RNA_int_set(op->ptr, "delta", 0);
|
||||||
area_move_apply(C, op);
|
area_move_apply(C, op);
|
||||||
area_move_exit(C, op);
|
area_move_exit(C, op);
|
||||||
|
|
||||||
@@ -583,14 +583,14 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
|
|
||||||
md= op->customdata;
|
md= op->customdata;
|
||||||
|
|
||||||
x= RNA_int_get(op->rna, "x");
|
x= RNA_int_get(op->ptr, "x");
|
||||||
y= RNA_int_get(op->rna, "y");
|
y= RNA_int_get(op->ptr, "y");
|
||||||
|
|
||||||
/* execute the events */
|
/* execute the events */
|
||||||
switch(event->type) {
|
switch(event->type) {
|
||||||
case MOUSEMOVE:
|
case MOUSEMOVE:
|
||||||
delta= (md->dir == 'v')? event->x - x: event->y - y;
|
delta= (md->dir == 'v')? event->x - x: event->y - y;
|
||||||
RNA_int_set(op->rna, "delta", delta);
|
RNA_int_set(op->ptr, "delta", delta);
|
||||||
|
|
||||||
area_move_apply(C, op);
|
area_move_apply(C, op);
|
||||||
break;
|
break;
|
||||||
@@ -626,9 +626,9 @@ void ED_SCR_OT_area_move(wmOperatorType *ot)
|
|||||||
ot->poll= ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
|
ot->poll= ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
|
||||||
|
|
||||||
/* rna */
|
/* rna */
|
||||||
prop= RNA_def_property(ot->rna, "x", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
|
||||||
prop= RNA_def_property(ot->rna, "y", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
|
||||||
prop= RNA_def_property(ot->rna, "delta", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "delta", PROP_INT, PROP_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************** split area operator *********************************** */
|
/* ************** split area operator *********************************** */
|
||||||
@@ -694,7 +694,7 @@ static int area_split_init(bContext *C, wmOperator *op)
|
|||||||
if(C->area==NULL) return 0;
|
if(C->area==NULL) return 0;
|
||||||
|
|
||||||
/* required properties */
|
/* required properties */
|
||||||
dir= RNA_enum_get(op->rna, "dir");
|
dir= RNA_enum_get(op->ptr, "dir");
|
||||||
|
|
||||||
/* minimal size */
|
/* minimal size */
|
||||||
if(dir=='v' && C->area->winx < 2*AREAMINX) return 0;
|
if(dir=='v' && C->area->winx < 2*AREAMINX) return 0;
|
||||||
@@ -746,8 +746,8 @@ static void area_split_apply(bContext *C, wmOperator *op)
|
|||||||
float fac;
|
float fac;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
fac= RNA_float_get(op->rna, "fac");
|
fac= RNA_float_get(op->ptr, "fac");
|
||||||
dir= RNA_enum_get(op->rna, "dir");
|
dir= RNA_enum_get(op->ptr, "dir");
|
||||||
|
|
||||||
sd->narea= area_split(C->window, C->screen, sd->sarea, dir, fac);
|
sd->narea= area_split(C->window, C->screen, sd->sarea, dir, fac);
|
||||||
|
|
||||||
@@ -807,13 +807,13 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
/* prepare operator state vars */
|
/* prepare operator state vars */
|
||||||
if(sad->gesture_dir==AZONE_N || sad->gesture_dir==AZONE_S) {
|
if(sad->gesture_dir==AZONE_N || sad->gesture_dir==AZONE_S) {
|
||||||
dir= 'h';
|
dir= 'h';
|
||||||
RNA_float_set(op->rna, "fac", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
|
RNA_float_set(op->ptr, "fac", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dir= 'v';
|
dir= 'v';
|
||||||
RNA_float_set(op->rna, "fac", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy);
|
RNA_float_set(op->ptr, "fac", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy);
|
||||||
}
|
}
|
||||||
RNA_enum_set(op->rna, "dir", dir);
|
RNA_enum_set(op->ptr, "dir", dir);
|
||||||
|
|
||||||
/* general init, also non-UI case, adds customdata, sets area and defaults */
|
/* general init, also non-UI case, adds customdata, sets area and defaults */
|
||||||
if(!area_split_init(C, op))
|
if(!area_split_init(C, op))
|
||||||
@@ -881,7 +881,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
/* execute the events */
|
/* execute the events */
|
||||||
switch(event->type) {
|
switch(event->type) {
|
||||||
case MOUSEMOVE:
|
case MOUSEMOVE:
|
||||||
dir= RNA_enum_get(op->rna, "dir");
|
dir= RNA_enum_get(op->ptr, "dir");
|
||||||
|
|
||||||
sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
|
sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
|
||||||
area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
|
area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
|
||||||
@@ -922,11 +922,11 @@ void ED_SCR_OT_area_split(wmOperatorType *ot)
|
|||||||
ot->poll= ED_operator_areaactive;
|
ot->poll= ED_operator_areaactive;
|
||||||
|
|
||||||
/* rna */
|
/* rna */
|
||||||
prop= RNA_def_property(ot->rna, "dir", PROP_ENUM, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE);
|
||||||
RNA_def_property_enum_items(prop, prop_direction_items);
|
RNA_def_property_enum_items(prop, prop_direction_items);
|
||||||
RNA_def_property_enum_default(prop, 'h');
|
RNA_def_property_enum_default(prop, 'h');
|
||||||
|
|
||||||
prop= RNA_def_property(ot->rna, "fac", PROP_FLOAT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "fac", PROP_FLOAT, PROP_NONE);
|
||||||
RNA_def_property_range(prop, 0.0, 1.0);
|
RNA_def_property_range(prop, 0.0, 1.0);
|
||||||
RNA_def_property_float_default(prop, 0.5f);
|
RNA_def_property_float_default(prop, 0.5f);
|
||||||
}
|
}
|
||||||
@@ -981,10 +981,10 @@ static int area_join_init(bContext *C, wmOperator *op)
|
|||||||
int x2, y2;
|
int x2, y2;
|
||||||
|
|
||||||
/* required properties, make negative to get return 0 if not set by caller */
|
/* required properties, make negative to get return 0 if not set by caller */
|
||||||
x1= RNA_int_get(op->rna, "x1");
|
x1= RNA_int_get(op->ptr, "x1");
|
||||||
y1= RNA_int_get(op->rna, "y1");
|
y1= RNA_int_get(op->ptr, "y1");
|
||||||
x2= RNA_int_get(op->rna, "x2");
|
x2= RNA_int_get(op->ptr, "x2");
|
||||||
y2= RNA_int_get(op->rna, "y2");
|
y2= RNA_int_get(op->ptr, "y2");
|
||||||
|
|
||||||
sa1 = screen_areahascursor(C->screen, x1, y1);
|
sa1 = screen_areahascursor(C->screen, x1, y1);
|
||||||
sa2 = screen_areahascursor(C->screen, x2, y2);
|
sa2 = screen_areahascursor(C->screen, x2, y2);
|
||||||
@@ -1060,10 +1060,10 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
|
|
||||||
/* prepare operator state vars */
|
/* prepare operator state vars */
|
||||||
RNA_int_set(op->rna, "x1", sad->x);
|
RNA_int_set(op->ptr, "x1", sad->x);
|
||||||
RNA_int_set(op->rna, "y1", sad->y);
|
RNA_int_set(op->ptr, "y1", sad->y);
|
||||||
RNA_int_set(op->rna, "x2", event->x);
|
RNA_int_set(op->ptr, "x2", event->x);
|
||||||
RNA_int_set(op->rna, "y2", event->y);
|
RNA_int_set(op->ptr, "y2", event->y);
|
||||||
|
|
||||||
if(!area_join_init(C, op))
|
if(!area_join_init(C, op))
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
@@ -1202,13 +1202,13 @@ void ED_SCR_OT_area_join(wmOperatorType *ot)
|
|||||||
ot->poll= ED_operator_screenactive;
|
ot->poll= ED_operator_screenactive;
|
||||||
|
|
||||||
/* rna */
|
/* rna */
|
||||||
prop= RNA_def_property(ot->rna, "x1", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "x1", PROP_INT, PROP_NONE);
|
||||||
RNA_def_property_int_default(prop, -100);
|
RNA_def_property_int_default(prop, -100);
|
||||||
prop= RNA_def_property(ot->rna, "y1", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "y1", PROP_INT, PROP_NONE);
|
||||||
RNA_def_property_int_default(prop, -100);
|
RNA_def_property_int_default(prop, -100);
|
||||||
prop= RNA_def_property(ot->rna, "x2", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "x2", PROP_INT, PROP_NONE);
|
||||||
RNA_def_property_int_default(prop, -100);
|
RNA_def_property_int_default(prop, -100);
|
||||||
prop= RNA_def_property(ot->rna, "y2", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "y2", PROP_INT, PROP_NONE);
|
||||||
RNA_def_property_int_default(prop, -100);
|
RNA_def_property_int_default(prop, -100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1235,7 +1235,7 @@ callbacks:
|
|||||||
|
|
||||||
static int border_select_do(bContext *C, wmOperator *op)
|
static int border_select_do(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
int event_type= RNA_int_get(op->rna, "event_type");
|
int event_type= RNA_int_get(op->ptr, "event_type");
|
||||||
|
|
||||||
if(event_type==LEFTMOUSE)
|
if(event_type==LEFTMOUSE)
|
||||||
printf("border select do select\n");
|
printf("border select do select\n");
|
||||||
@@ -1261,7 +1261,7 @@ void ED_SCR_OT_border_select(wmOperatorType *ot)
|
|||||||
ot->poll= ED_operator_areaactive;
|
ot->poll= ED_operator_areaactive;
|
||||||
|
|
||||||
/* rna */
|
/* rna */
|
||||||
RNA_def_property(ot->rna, "event_type", PROP_INT, PROP_NONE);
|
RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ typedef struct CellRNA {
|
|||||||
int lastrow, index;
|
int lastrow, index;
|
||||||
|
|
||||||
CollectionPropertyIterator iter;
|
CollectionPropertyIterator iter;
|
||||||
PropertyRNA *iterprop;
|
|
||||||
} CellRNA;
|
} CellRNA;
|
||||||
|
|
||||||
static void rna_back_cb(void *arg_buts, void *arg_unused)
|
static void rna_back_cb(void *arg_buts, void *arg_unused)
|
||||||
@@ -192,12 +191,12 @@ static void rna_label(CellRNA *cell, rcti *rct, uiBlock *block)
|
|||||||
int arraylength;
|
int arraylength;
|
||||||
|
|
||||||
prop= cell->prop;
|
prop= cell->prop;
|
||||||
type= RNA_property_type(prop, &cell->ptr);
|
type= RNA_property_type(&cell->ptr, prop);
|
||||||
subtype= RNA_property_subtype(prop, &cell->ptr);
|
subtype= RNA_property_subtype(&cell->ptr, prop);
|
||||||
arraylength= RNA_property_array_length(prop, &cell->ptr);
|
arraylength= RNA_property_array_length(&cell->ptr, prop);
|
||||||
|
|
||||||
if(cell->index == -1) {
|
if(cell->index == -1) {
|
||||||
uiDefBut(block, LABEL, 0, (char*)RNA_property_ui_name(prop, &cell->ptr), rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, (char*)RNA_property_ui_description(prop, &cell->ptr));
|
uiDefBut(block, LABEL, 0, (char*)RNA_property_ui_name(&cell->ptr, prop), rct->xmin, rct->ymin, rct->xmax-rct->xmin, rct->ymax-rct->ymin, 0, 0, 0, 0, 0, (char*)RNA_property_ui_description(&cell->ptr, prop));
|
||||||
}
|
}
|
||||||
else if (type != PROP_COLLECTION) {
|
else if (type != PROP_COLLECTION) {
|
||||||
if(arraylength == 4 && subtype == PROP_ROTATION)
|
if(arraylength == 4 && subtype == PROP_ROTATION)
|
||||||
@@ -220,13 +219,13 @@ static void rna_collection_but(CellRNA *cell, rcti *rct, uiBlock *block)
|
|||||||
PropertyRNA *nameprop;
|
PropertyRNA *nameprop;
|
||||||
char name[256]= "", *nameptr= name;
|
char name[256]= "", *nameptr= name;
|
||||||
|
|
||||||
RNA_property_collection_lookup_int(cell->prop, &cell->ptr, cell->index, &lookup);
|
RNA_property_collection_lookup_int(&cell->ptr, cell->prop, cell->index, &lookup);
|
||||||
|
|
||||||
if(lookup.data) {
|
if(lookup.data) {
|
||||||
nameprop= RNA_struct_name_property(&lookup);
|
nameprop= RNA_struct_name_property(&lookup);
|
||||||
|
|
||||||
if(nameprop)
|
if(nameprop)
|
||||||
nameptr= RNA_property_string_get_alloc(nameprop, &lookup, name, sizeof(name));
|
nameptr= RNA_property_string_get_alloc(&lookup, nameprop, name, sizeof(name));
|
||||||
else
|
else
|
||||||
sprintf(nameptr, "%d", cell->index+1);
|
sprintf(nameptr, "%d", cell->index+1);
|
||||||
}
|
}
|
||||||
@@ -248,8 +247,8 @@ static void rna_but(CellRNA *cell, rcti *rct, uiBlock *block)
|
|||||||
int arraylength, index;
|
int arraylength, index;
|
||||||
|
|
||||||
prop= cell->prop;
|
prop= cell->prop;
|
||||||
type= RNA_property_type(prop, &cell->ptr);
|
type= RNA_property_type(&cell->ptr, prop);
|
||||||
arraylength= RNA_property_array_length(prop, &cell->ptr);
|
arraylength= RNA_property_array_length(&cell->ptr, prop);
|
||||||
|
|
||||||
if(type == PROP_COLLECTION) {
|
if(type == PROP_COLLECTION) {
|
||||||
/* item in a collection */
|
/* item in a collection */
|
||||||
@@ -297,17 +296,17 @@ static void rna_table_cell_func(void *userdata, int row, int col, rcti *rct, uiB
|
|||||||
if(cell->prop) {
|
if(cell->prop) {
|
||||||
cell->index++;
|
cell->index++;
|
||||||
|
|
||||||
type= RNA_property_type(cell->prop, &cell->ptr);
|
type= RNA_property_type(&cell->ptr, cell->prop);
|
||||||
if(type == PROP_COLLECTION)
|
if(type == PROP_COLLECTION)
|
||||||
length= RNA_property_collection_length(cell->prop, &cell->ptr);
|
length= RNA_property_collection_length(&cell->ptr, cell->prop);
|
||||||
else
|
else
|
||||||
length= RNA_property_array_length(cell->prop, &cell->ptr);
|
length= RNA_property_array_length(&cell->ptr, cell->prop);
|
||||||
|
|
||||||
/* verify if we need to go to the next property */
|
/* verify if we need to go to the next property */
|
||||||
if(type == PROP_COLLECTION && cell->index < length);
|
if(type == PROP_COLLECTION && cell->index < length);
|
||||||
else if(length && cell->index < length);
|
else if(length && cell->index < length);
|
||||||
else {
|
else {
|
||||||
RNA_property_collection_next(cell->iterprop, &cell->iter);
|
RNA_property_collection_next(&cell->iter);
|
||||||
cell->prop= cell->iter.ptr.data;
|
cell->prop= cell->iter.ptr.data;
|
||||||
cell->index= -1;
|
cell->index= -1;
|
||||||
}
|
}
|
||||||
@@ -333,7 +332,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
|
|||||||
uiTable *table;
|
uiTable *table;
|
||||||
rcti rct;
|
rcti rct;
|
||||||
CellRNA cell;
|
CellRNA cell;
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop, *iterprop;
|
||||||
PointerRNA newptr;
|
PointerRNA newptr;
|
||||||
float col[3];
|
float col[3];
|
||||||
int rows, cols, width, height;
|
int rows, cols, width, height;
|
||||||
@@ -355,7 +354,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
|
|||||||
|
|
||||||
cell.space= soutliner;
|
cell.space= soutliner;
|
||||||
cell.lastrow= -1;
|
cell.lastrow= -1;
|
||||||
RNA_pointer_main_get(G.main, &cell.ptr);
|
RNA_main_pointer_create(G.main, &cell.ptr);
|
||||||
cell.prop= NULL;
|
cell.prop= NULL;
|
||||||
|
|
||||||
/* solve RNA path or reset if fails */
|
/* solve RNA path or reset if fails */
|
||||||
@@ -378,25 +377,25 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar)
|
|||||||
rows= 1;
|
rows= 1;
|
||||||
cols= 2;
|
cols= 2;
|
||||||
|
|
||||||
cell.iterprop= RNA_struct_iterator_property(&cell.ptr);
|
iterprop= RNA_struct_iterator_property(&cell.ptr);
|
||||||
RNA_property_collection_begin(cell.iterprop, &cell.iter, &cell.ptr);
|
RNA_property_collection_begin(&cell.ptr, iterprop, &cell.iter);
|
||||||
|
|
||||||
for(; cell.iter.valid; RNA_property_collection_next(cell.iterprop, &cell.iter)) {
|
for(; cell.iter.valid; RNA_property_collection_next(&cell.iter)) {
|
||||||
prop= cell.iter.ptr.data;
|
prop= cell.iter.ptr.data;
|
||||||
|
|
||||||
rows += 1 + RNA_property_array_length(prop, &cell.ptr);
|
rows += 1 + RNA_property_array_length(&cell.ptr, prop);
|
||||||
if(RNA_property_type(prop, &cell.ptr) == PROP_COLLECTION)
|
if(RNA_property_type(&cell.ptr, prop) == PROP_COLLECTION)
|
||||||
rows += RNA_property_collection_length(prop, &cell.ptr);
|
rows += RNA_property_collection_length(&cell.ptr, prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_property_collection_end(cell.iterprop, &cell.iter);
|
RNA_property_collection_end(&cell.iter);
|
||||||
|
|
||||||
/* create and draw table */
|
/* create and draw table */
|
||||||
table= UI_table_create(rows, 2, &rct, rna_table_cell_func, &cell);
|
table= UI_table_create(rows, 2, &rct, rna_table_cell_func, &cell);
|
||||||
|
|
||||||
RNA_property_collection_begin(cell.iterprop, &cell.iter, &cell.ptr);
|
RNA_property_collection_begin(&cell.ptr, iterprop, &cell.iter);
|
||||||
UI_table_draw(C->window, ar, table);
|
UI_table_draw(C->window, ar, table);
|
||||||
RNA_property_collection_end(cell.iterprop, &cell.iter);
|
RNA_property_collection_end(&cell.iter);
|
||||||
|
|
||||||
UI_table_free(table);
|
UI_table_free(table);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
int cfra;
|
int cfra;
|
||||||
|
|
||||||
cfra= RNA_int_get(op->rna, "frame");
|
cfra= RNA_int_get(op->ptr, "frame");
|
||||||
|
|
||||||
if(cfra < MINFRAME)
|
if(cfra < MINFRAME)
|
||||||
cfra= MINFRAME;
|
cfra= MINFRAME;
|
||||||
@@ -119,7 +119,7 @@ static int frame_from_event(bContext *C, wmEvent *event)
|
|||||||
|
|
||||||
static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||||
{
|
{
|
||||||
RNA_int_default(op->rna, "frame", frame_from_event(C, event));
|
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
|
||||||
change_frame_init(C, op);
|
change_frame_init(C, op);
|
||||||
change_frame_apply(C, op);
|
change_frame_apply(C, op);
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
|
|||||||
/* execute the events */
|
/* execute the events */
|
||||||
switch(event->type) {
|
switch(event->type) {
|
||||||
case MOUSEMOVE:
|
case MOUSEMOVE:
|
||||||
RNA_int_set(op->rna, "frame", frame_from_event(C, event));
|
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
|
||||||
change_frame_apply(C, op);
|
change_frame_apply(C, op);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ void ED_TIME_OT_change_frame(wmOperatorType *ot)
|
|||||||
ot->modal= change_frame_modal;
|
ot->modal= change_frame_modal;
|
||||||
|
|
||||||
/* rna */
|
/* rna */
|
||||||
prop= RNA_def_property(ot->rna, "frame", PROP_INT, PROP_NONE);
|
prop= RNA_def_property(ot->srna, "frame", PROP_INT, PROP_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************** registration **********************************/
|
/* ************************** registration **********************************/
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ typedef struct wmOperatorType {
|
|||||||
void *(*uiBlock)(struct wmOperator *);
|
void *(*uiBlock)(struct wmOperator *);
|
||||||
|
|
||||||
/* rna for properties */
|
/* rna for properties */
|
||||||
struct StructRNA *rna;
|
struct StructRNA *srna;
|
||||||
|
|
||||||
short flag;
|
short flag;
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ typedef struct wmOperator {
|
|||||||
IDProperty *properties;
|
IDProperty *properties;
|
||||||
|
|
||||||
/* runtime */
|
/* runtime */
|
||||||
struct PointerRNA *rna;
|
struct PointerRNA *ptr;
|
||||||
ListBase *modallist;
|
ListBase *modallist;
|
||||||
} wmOperator;
|
} wmOperator;
|
||||||
|
|
||||||
|
|||||||
@@ -28,16 +28,62 @@
|
|||||||
#include "RNA_types.h"
|
#include "RNA_types.h"
|
||||||
|
|
||||||
struct bContext;
|
struct bContext;
|
||||||
|
struct ID;
|
||||||
struct Main;
|
struct Main;
|
||||||
|
|
||||||
|
/* Types */
|
||||||
|
|
||||||
extern BlenderRNA BLENDER_RNA;
|
extern BlenderRNA BLENDER_RNA;
|
||||||
|
|
||||||
|
extern StructRNA RNA_ID;
|
||||||
|
extern StructRNA RNA_IDProperty;
|
||||||
|
extern StructRNA RNA_IDPropertyGroup;
|
||||||
|
extern StructRNA RNA_Main;
|
||||||
|
extern StructRNA RNA_Mesh;
|
||||||
|
extern StructRNA RNA_MVert;
|
||||||
|
extern StructRNA RNA_MVertGroup;
|
||||||
|
extern StructRNA RNA_MEdge;
|
||||||
|
extern StructRNA RNA_MFace;
|
||||||
|
extern StructRNA RNA_MTFace;
|
||||||
|
extern StructRNA RNA_MTFaceLayer;
|
||||||
|
extern StructRNA RNA_MSticky;
|
||||||
|
extern StructRNA RNA_MCol;
|
||||||
|
extern StructRNA RNA_MColLayer;
|
||||||
|
extern StructRNA RNA_MFloatProperty;
|
||||||
|
extern StructRNA RNA_MFloatPropertyLayer;
|
||||||
|
extern StructRNA RNA_MIntProperty;
|
||||||
|
extern StructRNA RNA_MIntPropertyLayer;
|
||||||
|
extern StructRNA RNA_MStringProperty;
|
||||||
|
extern StructRNA RNA_MStringPropertyLayer;
|
||||||
|
extern StructRNA RNA_MMultires;
|
||||||
|
extern StructRNA RNA_Object;
|
||||||
|
extern StructRNA RNA_Struct;
|
||||||
|
extern StructRNA RNA_Property;
|
||||||
|
extern StructRNA RNA_BooleanProperty;
|
||||||
|
extern StructRNA RNA_IntProperty;
|
||||||
|
extern StructRNA RNA_FloatProperty;
|
||||||
|
extern StructRNA RNA_StringProperty;
|
||||||
|
extern StructRNA RNA_EnumProperty;
|
||||||
|
extern StructRNA RNA_EnumPropertyItem;
|
||||||
|
extern StructRNA RNA_PointerProperty;
|
||||||
|
extern StructRNA RNA_CollectionProperty;
|
||||||
|
extern StructRNA RNA_Scene;
|
||||||
|
extern StructRNA RNA_Lamp;
|
||||||
|
extern StructRNA RNA_Operator;
|
||||||
|
extern StructRNA RNA_WindowManager;
|
||||||
|
|
||||||
/* Pointer
|
/* Pointer
|
||||||
*
|
*
|
||||||
* Currently only an RNA pointer to Main can be obtained, this
|
* These functions will fill in RNA pointers, this can be done in three ways:
|
||||||
* should be extended to allow making other pointers as well. */
|
* - a pointer Main is created by just passing the data pointer
|
||||||
|
* - a pointer to a datablock can be created with the type and id data pointer
|
||||||
|
* - a pointer to data contained in a datablock can be created with the id type
|
||||||
|
* and id data pointer, and the data type and pointer to the struct itself.
|
||||||
|
*/
|
||||||
|
|
||||||
void RNA_pointer_main_get(struct Main *main, PointerRNA *r_ptr);
|
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr);
|
||||||
|
void RNA_id_pointer_create(StructRNA *idtype, struct ID *id, PointerRNA *r_ptr);
|
||||||
|
void RNA_pointer_create(StructRNA *idtype, struct ID *id, StructRNA *type, void *data, PointerRNA *r_ptr);
|
||||||
|
|
||||||
/* Structs */
|
/* Structs */
|
||||||
|
|
||||||
@@ -56,64 +102,64 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier);
|
|||||||
|
|
||||||
/* Property Information */
|
/* Property Information */
|
||||||
|
|
||||||
const char *RNA_property_identifier(PropertyRNA *prop, PointerRNA *ptr);
|
const char *RNA_property_identifier(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
PropertyType RNA_property_type(PropertyRNA *prop, PointerRNA *ptr);
|
PropertyType RNA_property_type(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
PropertySubType RNA_property_subtype(PropertyRNA *prop, PointerRNA *ptr);
|
PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
|
|
||||||
int RNA_property_array_length(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
|
|
||||||
void RNA_property_int_range(PropertyRNA *prop, PointerRNA *ptr, int *hardmin, int *hardmax);
|
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax);
|
||||||
void RNA_property_int_ui_range(PropertyRNA *prop, PointerRNA *ptr, int *softmin, int *softmax, int *step);
|
void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step);
|
||||||
|
|
||||||
void RNA_property_float_range(PropertyRNA *prop, PointerRNA *ptr, float *hardmin, float *hardmax);
|
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax);
|
||||||
void RNA_property_float_ui_range(PropertyRNA *prop, PointerRNA *ptr, float *softmin, float *softmax, float *step, float *precision);
|
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision);
|
||||||
|
|
||||||
int RNA_property_string_maxlength(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_string_maxlength(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
|
|
||||||
void RNA_property_enum_items(PropertyRNA *prop, PointerRNA *ptr, const EnumPropertyItem **item, int *totitem);
|
void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem);
|
||||||
|
|
||||||
const char *RNA_property_ui_name(PropertyRNA *prop, PointerRNA *ptr);
|
const char *RNA_property_ui_name(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
const char *RNA_property_ui_description(PropertyRNA *prop, PointerRNA *ptr);
|
const char *RNA_property_ui_description(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
|
|
||||||
int RNA_property_editable(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
int RNA_property_evaluated(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_evaluated(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
|
|
||||||
void RNA_property_notify(PropertyRNA *prop, struct bContext *C, PointerRNA *ptr);
|
void RNA_property_notify(PropertyRNA *prop, struct bContext *C, PointerRNA *ptr);
|
||||||
|
|
||||||
/* Property Data */
|
/* Property Data */
|
||||||
|
|
||||||
int RNA_property_boolean_get(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
void RNA_property_boolean_set(PropertyRNA *prop, PointerRNA *ptr, int value);
|
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value);
|
||||||
int RNA_property_boolean_get_array(PropertyRNA *prop, PointerRNA *ptr, int index);
|
int RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||||
void RNA_property_boolean_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, int value);
|
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
|
||||||
|
|
||||||
int RNA_property_int_get(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
void RNA_property_int_set(PropertyRNA *prop, PointerRNA *ptr, int value);
|
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value);
|
||||||
int RNA_property_int_get_array(PropertyRNA *prop, PointerRNA *ptr, int index);
|
int RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||||
void RNA_property_int_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, int value);
|
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
|
||||||
|
|
||||||
float RNA_property_float_get(PropertyRNA *prop, PointerRNA *ptr);
|
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
void RNA_property_float_set(PropertyRNA *prop, PointerRNA *ptr, float value);
|
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value);
|
||||||
float RNA_property_float_get_array(PropertyRNA *prop, PointerRNA *ptr, int index);
|
float RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
|
||||||
void RNA_property_float_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, float value);
|
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, float value);
|
||||||
|
|
||||||
void RNA_property_string_get(PropertyRNA *prop, PointerRNA *ptr, char *value);
|
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value);
|
||||||
char *RNA_property_string_get_alloc(PropertyRNA *prop, PointerRNA *ptr, char *fixedbuf, int fixedlen);
|
char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen);
|
||||||
int RNA_property_string_length(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
void RNA_property_string_set(PropertyRNA *prop, PointerRNA *ptr, const char *value);
|
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value);
|
||||||
|
|
||||||
int RNA_property_enum_get(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
void RNA_property_enum_set(PropertyRNA *prop, PointerRNA *ptr, int value);
|
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value);
|
||||||
|
|
||||||
void RNA_property_pointer_get(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *r_ptr);
|
void RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr);
|
||||||
void RNA_property_pointer_set(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *ptr_value);
|
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_value);
|
||||||
|
|
||||||
void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *ptr);
|
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter);
|
||||||
void RNA_property_collection_next(PropertyRNA *prop, CollectionPropertyIterator *iter);
|
void RNA_property_collection_next(CollectionPropertyIterator *iter);
|
||||||
void RNA_property_collection_end(PropertyRNA *prop, CollectionPropertyIterator *iter);
|
void RNA_property_collection_end(CollectionPropertyIterator *iter);
|
||||||
int RNA_property_collection_length(PropertyRNA *prop, PointerRNA *ptr);
|
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop);
|
||||||
int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int key, PointerRNA *r_ptr);
|
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr);
|
||||||
int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, const char *key, PointerRNA *r_ptr);
|
int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr);
|
||||||
|
|
||||||
/* Path
|
/* Path
|
||||||
*
|
*
|
||||||
@@ -151,45 +197,31 @@ void RNA_generate_dependencies(PointerRNA *mainptr, void *udata, PropDependencyC
|
|||||||
* call RNA_struct_find_property. The names have to exist as RNA properties
|
* call RNA_struct_find_property. The names have to exist as RNA properties
|
||||||
* for the type in the pointer, if they do not exist an error will be printed.
|
* for the type in the pointer, if they do not exist an error will be printed.
|
||||||
*
|
*
|
||||||
* The get and set functions work like the corresponding functions above, the
|
|
||||||
* default functions are intended to be used for runtime / id properties
|
|
||||||
* specifically. They will set the value only if the id property does not yet
|
|
||||||
* exist, and return the current value. This is useful to set inputs in an
|
|
||||||
* operator, avoiding to overwrite them if they were specified by the caller.
|
|
||||||
*
|
|
||||||
* There is no support for pointers and collections here yet, these can be
|
* There is no support for pointers and collections here yet, these can be
|
||||||
* added when ID properties support them. */
|
* added when ID properties support them. */
|
||||||
|
|
||||||
int RNA_boolean_get(PointerRNA *ptr, const char *name);
|
int RNA_boolean_get(PointerRNA *ptr, const char *name);
|
||||||
void RNA_boolean_set(PointerRNA *ptr, const char *name, int value);
|
void RNA_boolean_set(PointerRNA *ptr, const char *name, int value);
|
||||||
int RNA_boolean_default(PointerRNA *ptr, const char *name, int value);
|
|
||||||
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values);
|
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values);
|
||||||
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values);
|
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values);
|
||||||
void RNA_boolean_default_array(PointerRNA *ptr, const char *name, int *values);
|
|
||||||
|
|
||||||
int RNA_int_get(PointerRNA *ptr, const char *name);
|
int RNA_int_get(PointerRNA *ptr, const char *name);
|
||||||
void RNA_int_set(PointerRNA *ptr, const char *name, int value);
|
void RNA_int_set(PointerRNA *ptr, const char *name, int value);
|
||||||
int RNA_int_default(PointerRNA *ptr, const char *name, int value);
|
|
||||||
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values);
|
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values);
|
||||||
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values);
|
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values);
|
||||||
void RNA_int_default_array(PointerRNA *ptr, const char *name, int *values);
|
|
||||||
|
|
||||||
float RNA_float_get(PointerRNA *ptr, const char *name);
|
float RNA_float_get(PointerRNA *ptr, const char *name);
|
||||||
void RNA_float_set(PointerRNA *ptr, const char *name, float value);
|
void RNA_float_set(PointerRNA *ptr, const char *name, float value);
|
||||||
float RNA_float_default(PointerRNA *ptr, const char *name, float value);
|
|
||||||
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values);
|
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values);
|
||||||
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values);
|
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values);
|
||||||
void RNA_float_default_array(PointerRNA *ptr, const char *name, float *values);
|
|
||||||
|
|
||||||
int RNA_enum_get(PointerRNA *ptr, const char *name);
|
int RNA_enum_get(PointerRNA *ptr, const char *name);
|
||||||
void RNA_enum_set(PointerRNA *ptr, const char *name, int value);
|
void RNA_enum_set(PointerRNA *ptr, const char *name, int value);
|
||||||
int RNA_enum_default(PointerRNA *ptr, const char *name, int value);
|
|
||||||
|
|
||||||
void RNA_string_get(PointerRNA *ptr, const char *name, char *value);
|
void RNA_string_get(PointerRNA *ptr, const char *name, char *value);
|
||||||
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen);
|
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen);
|
||||||
int RNA_string_length(PointerRNA *ptr, const char *name);
|
int RNA_string_length(PointerRNA *ptr, const char *name);
|
||||||
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value);
|
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value);
|
||||||
void RNA_string_default(PointerRNA *ptr, const char *name, const char *value);
|
|
||||||
|
|
||||||
/* check if the idproperty exists, for operators */
|
/* check if the idproperty exists, for operators */
|
||||||
int RNA_property_is_set(PointerRNA *ptr, const char *name);
|
int RNA_property_is_set(PointerRNA *ptr, const char *name);
|
||||||
|
|||||||
@@ -25,6 +25,10 @@
|
|||||||
#ifndef RNA_TYPES
|
#ifndef RNA_TYPES
|
||||||
#define RNA_TYPES
|
#define RNA_TYPES
|
||||||
|
|
||||||
|
struct PropertyRNA;
|
||||||
|
struct StructRNA;
|
||||||
|
struct BlenderRNA;
|
||||||
|
|
||||||
/* Pointer
|
/* Pointer
|
||||||
*
|
*
|
||||||
* RNA pointers are not a single C pointer but include the type,
|
* RNA pointers are not a single C pointer but include the type,
|
||||||
@@ -103,6 +107,7 @@ typedef enum PropertyFlag {
|
|||||||
|
|
||||||
typedef struct CollectionPropertyIterator {
|
typedef struct CollectionPropertyIterator {
|
||||||
PointerRNA parent;
|
PointerRNA parent;
|
||||||
|
struct PropertyRNA *prop;
|
||||||
void *internal;
|
void *internal;
|
||||||
|
|
||||||
int valid;
|
int valid;
|
||||||
@@ -116,7 +121,6 @@ typedef struct EnumPropertyItem {
|
|||||||
const char *description;
|
const char *description;
|
||||||
} EnumPropertyItem;
|
} EnumPropertyItem;
|
||||||
|
|
||||||
struct PropertyRNA;
|
|
||||||
typedef struct PropertyRNA PropertyRNA;
|
typedef struct PropertyRNA PropertyRNA;
|
||||||
|
|
||||||
/* Struct */
|
/* Struct */
|
||||||
@@ -129,14 +133,12 @@ typedef enum StructFlag {
|
|||||||
STRUCT_RUNTIME = 2
|
STRUCT_RUNTIME = 2
|
||||||
} StructFlag;
|
} StructFlag;
|
||||||
|
|
||||||
struct StructRNA;
|
|
||||||
typedef struct StructRNA StructRNA;
|
typedef struct StructRNA StructRNA;
|
||||||
|
|
||||||
/* Blender RNA
|
/* Blender RNA
|
||||||
*
|
*
|
||||||
* Root RNA data structure that lists all struct types. */
|
* Root RNA data structure that lists all struct types. */
|
||||||
|
|
||||||
struct BlenderRNA;
|
|
||||||
typedef struct BlenderRNA BlenderRNA;
|
typedef struct BlenderRNA BlenderRNA;
|
||||||
|
|
||||||
#endif /* RNA_TYPES */
|
#endif /* RNA_TYPES */
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
Import ('env')
|
Import ('env')
|
||||||
cflags = ''
|
cflags = '-Wall'
|
||||||
defines = []
|
defines = []
|
||||||
root_build_dir=env['BF_BUILDDIR']
|
root_build_dir=env['BF_BUILDDIR']
|
||||||
|
|
||||||
|
|||||||
@@ -51,12 +51,28 @@ void RNA_exit()
|
|||||||
|
|
||||||
/* Pointer */
|
/* Pointer */
|
||||||
|
|
||||||
void RNA_pointer_main_get(struct Main *main, struct PointerRNA *r_ptr)
|
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
|
||||||
{
|
{
|
||||||
r_ptr->data= main;
|
|
||||||
r_ptr->type= &RNA_Main;
|
|
||||||
r_ptr->id.data= NULL;
|
|
||||||
r_ptr->id.type= NULL;
|
r_ptr->id.type= NULL;
|
||||||
|
r_ptr->id.data= NULL;
|
||||||
|
r_ptr->type= &RNA_Main;
|
||||||
|
r_ptr->data= main;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RNA_id_pointer_create(StructRNA *idtype, ID *id, PointerRNA *r_ptr)
|
||||||
|
{
|
||||||
|
r_ptr->id.type= idtype;
|
||||||
|
r_ptr->id.data= id;
|
||||||
|
r_ptr->type= idtype;
|
||||||
|
r_ptr->data= id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RNA_pointer_create(StructRNA *idtype, ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
|
||||||
|
{
|
||||||
|
r_ptr->id.type= idtype;
|
||||||
|
r_ptr->id.data= id;
|
||||||
|
r_ptr->type= type;
|
||||||
|
r_ptr->data= data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_pointer_inherit_id(PointerRNA *parent, PointerRNA *ptr)
|
static void rna_pointer_inherit_id(PointerRNA *parent, PointerRNA *ptr)
|
||||||
@@ -233,24 +249,24 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
iterprop= RNA_struct_iterator_property(ptr);
|
iterprop= RNA_struct_iterator_property(ptr);
|
||||||
RNA_property_collection_begin(iterprop, &iter, ptr);
|
RNA_property_collection_begin(ptr, iterprop, &iter);
|
||||||
prop= NULL;
|
prop= NULL;
|
||||||
|
|
||||||
for(; iter.valid; RNA_property_collection_next(iterprop, &iter), i++) {
|
for(; iter.valid; RNA_property_collection_next(&iter), i++) {
|
||||||
if(strcmp(identifier, RNA_property_identifier(iter.ptr.data, &iter.ptr)) == 0) {
|
if(strcmp(identifier, RNA_property_identifier(&iter.ptr, iter.ptr.data)) == 0) {
|
||||||
prop= iter.ptr.data;
|
prop= iter.ptr.data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_property_collection_end(iterprop, &iter);
|
RNA_property_collection_end(&iter);
|
||||||
|
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Property Information */
|
/* Property Information */
|
||||||
|
|
||||||
const char *RNA_property_identifier(PropertyRNA *prop, PointerRNA *ptr)
|
const char *RNA_property_identifier(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
@@ -260,21 +276,21 @@ const char *RNA_property_identifier(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return prop->identifier;
|
return prop->identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertyType RNA_property_type(PropertyRNA *prop, PointerRNA *ptr)
|
PropertyType RNA_property_type(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
rna_idproperty_check(&prop, ptr);
|
rna_idproperty_check(&prop, ptr);
|
||||||
|
|
||||||
return prop->type;
|
return prop->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertySubType RNA_property_subtype(PropertyRNA *prop, PointerRNA *ptr)
|
PropertySubType RNA_property_subtype(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
rna_idproperty_check(&prop, ptr);
|
rna_idproperty_check(&prop, ptr);
|
||||||
|
|
||||||
return prop->subtype;
|
return prop->subtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_array_length(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
|
|
||||||
@@ -284,7 +300,7 @@ int RNA_property_array_length(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return prop->arraylength;
|
return prop->arraylength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_int_range(PropertyRNA *prop, PointerRNA *ptr, int *hardmin, int *hardmax)
|
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop;
|
IntPropertyRNA *iprop;
|
||||||
|
|
||||||
@@ -300,7 +316,7 @@ void RNA_property_int_range(PropertyRNA *prop, PointerRNA *ptr, int *hardmin, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_int_ui_range(PropertyRNA *prop, PointerRNA *ptr, int *softmin, int *softmax, int *step)
|
void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop;
|
IntPropertyRNA *iprop;
|
||||||
int hardmin, hardmax;
|
int hardmin, hardmax;
|
||||||
@@ -321,7 +337,7 @@ void RNA_property_int_ui_range(PropertyRNA *prop, PointerRNA *ptr, int *softmin,
|
|||||||
*step= iprop->step;
|
*step= iprop->step;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_float_range(PropertyRNA *prop, PointerRNA *ptr, float *hardmin, float *hardmax)
|
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop;
|
FloatPropertyRNA *fprop;
|
||||||
|
|
||||||
@@ -337,7 +353,7 @@ void RNA_property_float_range(PropertyRNA *prop, PointerRNA *ptr, float *hardmin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_float_ui_range(PropertyRNA *prop, PointerRNA *ptr, float *softmin, float *softmax, float *step, float *precision)
|
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop;
|
FloatPropertyRNA *fprop;
|
||||||
float hardmin, hardmax;
|
float hardmin, hardmax;
|
||||||
@@ -359,7 +375,7 @@ void RNA_property_float_ui_range(PropertyRNA *prop, PointerRNA *ptr, float *soft
|
|||||||
*precision= fprop->precision;
|
*precision= fprop->precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_string_maxlength(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_string_maxlength(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
StringPropertyRNA *sprop;
|
StringPropertyRNA *sprop;
|
||||||
|
|
||||||
@@ -369,7 +385,7 @@ int RNA_property_string_maxlength(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return sprop->maxlength;
|
return sprop->maxlength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_enum_items(PropertyRNA *prop, PointerRNA *ptr, const EnumPropertyItem **item, int *totitem)
|
void RNA_property_enum_items(PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **item, int *totitem)
|
||||||
{
|
{
|
||||||
EnumPropertyRNA *eprop;
|
EnumPropertyRNA *eprop;
|
||||||
|
|
||||||
@@ -380,7 +396,7 @@ void RNA_property_enum_items(PropertyRNA *prop, PointerRNA *ptr, const EnumPrope
|
|||||||
*totitem= eprop->totitem;
|
*totitem= eprop->totitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *RNA_property_ui_name(PropertyRNA *prop, PointerRNA *ptr)
|
const char *RNA_property_ui_name(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
PropertyRNA *oldprop= prop;
|
PropertyRNA *oldprop= prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -391,7 +407,7 @@ const char *RNA_property_ui_name(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return prop->name;
|
return prop->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *RNA_property_ui_description(PropertyRNA *prop, PointerRNA *ptr)
|
const char *RNA_property_ui_description(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
PropertyRNA *oldprop= prop;
|
PropertyRNA *oldprop= prop;
|
||||||
|
|
||||||
@@ -401,7 +417,7 @@ const char *RNA_property_ui_description(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return prop->description;
|
return prop->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_editable(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
@@ -415,7 +431,7 @@ int RNA_property_editable(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return !(flag & PROP_NOT_EDITABLE);
|
return !(flag & PROP_NOT_EDITABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_evaluated(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_evaluated(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
@@ -439,7 +455,7 @@ void RNA_property_notify(PropertyRNA *prop, struct bContext *C, PointerRNA *ptr)
|
|||||||
|
|
||||||
/* Property Data */
|
/* Property Data */
|
||||||
|
|
||||||
int RNA_property_boolean_get(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -452,7 +468,7 @@ int RNA_property_boolean_get(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return bprop->defaultvalue;
|
return bprop->defaultvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_boolean_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||||
{
|
{
|
||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -473,7 +489,7 @@ void RNA_property_boolean_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_boolean_get_array(PropertyRNA *prop, PointerRNA *ptr, int index)
|
int RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
|
||||||
{
|
{
|
||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -486,7 +502,7 @@ int RNA_property_boolean_get_array(PropertyRNA *prop, PointerRNA *ptr, int index
|
|||||||
return bprop->defaultarray[index];
|
return bprop->defaultarray[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_boolean_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, int value)
|
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
|
||||||
{
|
{
|
||||||
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -512,7 +528,7 @@ void RNA_property_boolean_set_array(PropertyRNA *prop, PointerRNA *ptr, int inde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_int_get(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -525,7 +541,7 @@ int RNA_property_int_get(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return iprop->defaultvalue;
|
return iprop->defaultvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_int_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -546,7 +562,7 @@ void RNA_property_int_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_int_get_array(PropertyRNA *prop, PointerRNA *ptr, int index)
|
int RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -559,7 +575,7 @@ int RNA_property_int_get_array(PropertyRNA *prop, PointerRNA *ptr, int index)
|
|||||||
return iprop->defaultarray[index];
|
return iprop->defaultarray[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_int_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, int value)
|
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
|
||||||
{
|
{
|
||||||
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -585,7 +601,7 @@ void RNA_property_int_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float RNA_property_float_get(PropertyRNA *prop, PointerRNA *ptr)
|
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -602,7 +618,7 @@ float RNA_property_float_get(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return fprop->defaultvalue;
|
return fprop->defaultvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_float_set(PropertyRNA *prop, PointerRNA *ptr, float value)
|
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -628,7 +644,7 @@ void RNA_property_float_set(PropertyRNA *prop, PointerRNA *ptr, float value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float RNA_property_float_get_array(PropertyRNA *prop, PointerRNA *ptr, int index)
|
float RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -645,7 +661,7 @@ float RNA_property_float_get_array(PropertyRNA *prop, PointerRNA *ptr, int index
|
|||||||
return fprop->defaultarray[index];
|
return fprop->defaultarray[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_float_set_array(PropertyRNA *prop, PointerRNA *ptr, int index, float value)
|
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
|
||||||
{
|
{
|
||||||
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -676,7 +692,7 @@ void RNA_property_float_set_array(PropertyRNA *prop, PointerRNA *ptr, int index,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_string_get(PropertyRNA *prop, PointerRNA *ptr, char *value)
|
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
|
||||||
{
|
{
|
||||||
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -689,24 +705,24 @@ void RNA_property_string_get(PropertyRNA *prop, PointerRNA *ptr, char *value)
|
|||||||
strcpy(value, sprop->defaultvalue);
|
strcpy(value, sprop->defaultvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *RNA_property_string_get_alloc(PropertyRNA *prop, PointerRNA *ptr, char *fixedbuf, int fixedlen)
|
char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
length= RNA_property_string_length(prop, ptr);
|
length= RNA_property_string_length(ptr, prop);
|
||||||
|
|
||||||
if(length+1 < fixedlen)
|
if(length+1 < fixedlen)
|
||||||
buf= fixedbuf;
|
buf= fixedbuf;
|
||||||
else
|
else
|
||||||
buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
|
buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
|
||||||
|
|
||||||
RNA_property_string_get(prop, ptr, buf);
|
RNA_property_string_get(ptr, prop, buf);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_string_length(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -719,7 +735,7 @@ int RNA_property_string_length(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return strlen(sprop->defaultvalue);
|
return strlen(sprop->defaultvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_string_set(PropertyRNA *prop, PointerRNA *ptr, const char *value)
|
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
|
||||||
{
|
{
|
||||||
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -730,7 +746,7 @@ void RNA_property_string_set(PropertyRNA *prop, PointerRNA *ptr, const char *val
|
|||||||
sprop->set(ptr, value);
|
sprop->set(ptr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_enum_get(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
|
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -743,7 +759,7 @@ int RNA_property_enum_get(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
return eprop->defaultvalue;
|
return eprop->defaultvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_enum_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
|
||||||
{
|
{
|
||||||
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
|
EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -765,7 +781,7 @@ void RNA_property_enum_set(PropertyRNA *prop, PointerRNA *ptr, int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_property_pointer_type(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *r_ptr)
|
static StructRNA *rna_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
|
||||||
{
|
{
|
||||||
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
||||||
StructRNA *type;
|
StructRNA *type;
|
||||||
@@ -782,7 +798,7 @@ static StructRNA *rna_property_pointer_type(PropertyRNA *prop, PointerRNA *ptr,
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_pointer_get(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *r_ptr)
|
void RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
|
||||||
{
|
{
|
||||||
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
||||||
IDProperty *idprop;
|
IDProperty *idprop;
|
||||||
@@ -794,13 +810,13 @@ void RNA_property_pointer_get(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *r_
|
|||||||
else
|
else
|
||||||
r_ptr->data= NULL;
|
r_ptr->data= NULL;
|
||||||
|
|
||||||
if(r_ptr->data && rna_property_pointer_type(prop, ptr, r_ptr))
|
if(r_ptr->data && rna_property_pointer_type(ptr, prop, r_ptr))
|
||||||
rna_pointer_inherit_id(ptr, r_ptr);
|
rna_pointer_inherit_id(ptr, r_ptr);
|
||||||
else
|
else
|
||||||
memset(r_ptr, 0, sizeof(*r_ptr));
|
memset(r_ptr, 0, sizeof(*r_ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_pointer_set(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *ptr_value)
|
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_value)
|
||||||
{
|
{
|
||||||
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
|
||||||
|
|
||||||
@@ -808,9 +824,9 @@ void RNA_property_pointer_set(PropertyRNA *prop, PointerRNA *ptr, PointerRNA *pt
|
|||||||
pprop->set(ptr, ptr_value->data);
|
pprop->set(ptr, ptr_value->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_property_collection_type(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *r_ptr)
|
static StructRNA *rna_property_collection_type(CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
|
||||||
StructRNA *type;
|
StructRNA *type;
|
||||||
|
|
||||||
if(cprop->type)
|
if(cprop->type)
|
||||||
@@ -819,34 +835,35 @@ static StructRNA *rna_property_collection_type(PropertyRNA *prop, CollectionProp
|
|||||||
type= cprop->structtype;
|
type= cprop->structtype;
|
||||||
|
|
||||||
if(type->refine)
|
if(type->refine)
|
||||||
type= type->refine(r_ptr);
|
type= type->refine(&iter->ptr);
|
||||||
|
|
||||||
r_ptr->type= type;
|
iter->ptr.type= type;
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_property_collection_get(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *r_ptr)
|
static void rna_property_collection_get(CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
|
||||||
|
|
||||||
r_ptr->data= cprop->get(iter);
|
iter->ptr.data= cprop->get(iter);
|
||||||
|
|
||||||
if(r_ptr->data && rna_property_collection_type(prop, iter, r_ptr))
|
if(iter->ptr.data && rna_property_collection_type(iter))
|
||||||
rna_pointer_inherit_id(&iter->parent, r_ptr);
|
rna_pointer_inherit_id(&iter->parent, &iter->ptr);
|
||||||
else
|
else
|
||||||
memset(r_ptr, 0, sizeof(*r_ptr));
|
memset(&iter->ptr, 0, sizeof(iter->ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator *iter, PointerRNA *ptr)
|
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
||||||
|
|
||||||
if(cprop->begin) {
|
if(cprop->begin) {
|
||||||
iter->parent= *ptr;
|
iter->parent= *ptr;
|
||||||
|
iter->prop= prop;
|
||||||
cprop->begin(iter, ptr);
|
cprop->begin(iter, ptr);
|
||||||
|
|
||||||
if(iter->valid)
|
if(iter->valid)
|
||||||
rna_property_collection_get(prop, iter, &iter->ptr);
|
rna_property_collection_get(iter);
|
||||||
else
|
else
|
||||||
memset(&iter->ptr, 0, sizeof(iter->ptr));
|
memset(&iter->ptr, 0, sizeof(iter->ptr));
|
||||||
}
|
}
|
||||||
@@ -854,27 +871,27 @@ void RNA_property_collection_begin(PropertyRNA *prop, CollectionPropertyIterator
|
|||||||
memset(&iter, 0, sizeof(*iter));
|
memset(&iter, 0, sizeof(*iter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_collection_next(PropertyRNA *prop, CollectionPropertyIterator *iter)
|
void RNA_property_collection_next(CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
|
||||||
|
|
||||||
cprop->next(iter);
|
cprop->next(iter);
|
||||||
|
|
||||||
if(iter->valid)
|
if(iter->valid)
|
||||||
rna_property_collection_get(prop, iter, &iter->ptr);
|
rna_property_collection_get(iter);
|
||||||
else
|
else
|
||||||
memset(&iter->ptr, 0, sizeof(iter->ptr));
|
memset(&iter->ptr, 0, sizeof(iter->ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_property_collection_end(PropertyRNA *prop, CollectionPropertyIterator *iter)
|
void RNA_property_collection_end(CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
|
||||||
|
|
||||||
if(cprop->end)
|
if(cprop->end)
|
||||||
cprop->end(iter);
|
cprop->end(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_collection_length(PropertyRNA *prop, PointerRNA *ptr)
|
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
||||||
|
|
||||||
@@ -885,16 +902,16 @@ int RNA_property_collection_length(PropertyRNA *prop, PointerRNA *ptr)
|
|||||||
CollectionPropertyIterator iter;
|
CollectionPropertyIterator iter;
|
||||||
int length= 0;
|
int length= 0;
|
||||||
|
|
||||||
RNA_property_collection_begin(prop, &iter, ptr);
|
RNA_property_collection_begin(ptr, prop, &iter);
|
||||||
for(; iter.valid; RNA_property_collection_next(prop, &iter))
|
for(; iter.valid; RNA_property_collection_next(&iter))
|
||||||
length++;
|
length++;
|
||||||
RNA_property_collection_end(prop, &iter);
|
RNA_property_collection_end(&iter);
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int key, PointerRNA *r_ptr)
|
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
||||||
|
|
||||||
@@ -919,14 +936,14 @@ int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int k
|
|||||||
CollectionPropertyIterator iter;
|
CollectionPropertyIterator iter;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
RNA_property_collection_begin(prop, &iter, ptr);
|
RNA_property_collection_begin(ptr, prop, &iter);
|
||||||
for(i=0; iter.valid; RNA_property_collection_next(prop, &iter), i++) {
|
for(i=0; iter.valid; RNA_property_collection_next(&iter), i++) {
|
||||||
if(i == key) {
|
if(i == key) {
|
||||||
*r_ptr= iter.ptr;
|
*r_ptr= iter.ptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RNA_property_collection_end(prop, &iter);
|
RNA_property_collection_end(&iter);
|
||||||
|
|
||||||
if(!iter.valid)
|
if(!iter.valid)
|
||||||
memset(r_ptr, 0, sizeof(*r_ptr));
|
memset(r_ptr, 0, sizeof(*r_ptr));
|
||||||
@@ -935,7 +952,7 @@ int RNA_property_collection_lookup_int(PropertyRNA *prop, PointerRNA *ptr, int k
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
|
int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
|
||||||
{
|
{
|
||||||
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
|
||||||
|
|
||||||
@@ -962,12 +979,12 @@ int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, co
|
|||||||
char name[256], *nameptr;
|
char name[256], *nameptr;
|
||||||
int length, alloc, found= 0;
|
int length, alloc, found= 0;
|
||||||
|
|
||||||
RNA_property_collection_begin(prop, &iter, ptr);
|
RNA_property_collection_begin(ptr, prop, &iter);
|
||||||
for(; iter.valid; RNA_property_collection_next(prop, &iter)) {
|
for(; iter.valid; RNA_property_collection_next(&iter)) {
|
||||||
if(iter.ptr.data && iter.ptr.type->nameproperty) {
|
if(iter.ptr.data && iter.ptr.type->nameproperty) {
|
||||||
nameprop= iter.ptr.type->nameproperty;
|
nameprop= iter.ptr.type->nameproperty;
|
||||||
|
|
||||||
length= RNA_property_string_length(nameprop, &iter.ptr);
|
length= RNA_property_string_length(&iter.ptr, nameprop);
|
||||||
|
|
||||||
if(sizeof(name)-1 < length) {
|
if(sizeof(name)-1 < length) {
|
||||||
nameptr= name;
|
nameptr= name;
|
||||||
@@ -978,7 +995,7 @@ int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, co
|
|||||||
alloc= 1;
|
alloc= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_property_string_get(nameprop, &iter.ptr, nameptr);
|
RNA_property_string_get(&iter.ptr, nameprop, nameptr);
|
||||||
|
|
||||||
if(strcmp(nameptr, key) == 0) {
|
if(strcmp(nameptr, key) == 0) {
|
||||||
*r_ptr= iter.ptr;
|
*r_ptr= iter.ptr;
|
||||||
@@ -992,7 +1009,7 @@ int RNA_property_collection_lookup_string(PropertyRNA *prop, PointerRNA *ptr, co
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RNA_property_collection_end(prop, &iter);
|
RNA_property_collection_end(&iter);
|
||||||
|
|
||||||
if(!iter.valid)
|
if(!iter.valid)
|
||||||
memset(r_ptr, 0, sizeof(*r_ptr));
|
memset(r_ptr, 0, sizeof(*r_ptr));
|
||||||
@@ -1175,17 +1192,17 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
iterprop= RNA_struct_iterator_property(&curptr);
|
iterprop= RNA_struct_iterator_property(&curptr);
|
||||||
RNA_property_collection_begin(iterprop, &iter, &curptr);
|
RNA_property_collection_begin(&curptr, iterprop, &iter);
|
||||||
prop= NULL;
|
prop= NULL;
|
||||||
|
|
||||||
for(; iter.valid; RNA_property_collection_next(iterprop, &iter)) {
|
for(; iter.valid; RNA_property_collection_next(&iter)) {
|
||||||
if(strcmp(token, RNA_property_identifier(iter.ptr.data, &iter.ptr)) == 0) {
|
if(strcmp(token, RNA_property_identifier(&iter.ptr, iter.ptr.data)) == 0) {
|
||||||
prop= iter.ptr.data;
|
prop= iter.ptr.data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_property_collection_end(iterprop, &iter);
|
RNA_property_collection_end(&iter);
|
||||||
|
|
||||||
if(token != fixedbuf)
|
if(token != fixedbuf)
|
||||||
MEM_freeN(token);
|
MEM_freeN(token);
|
||||||
@@ -1196,15 +1213,15 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
|
|||||||
/* now look up the value of this property if it is a pointer or
|
/* now look up the value of this property if it is a pointer or
|
||||||
* collection, otherwise return the property rna so that the
|
* collection, otherwise return the property rna so that the
|
||||||
* caller can read the value of the property itself */
|
* caller can read the value of the property itself */
|
||||||
if(RNA_property_type(prop, &curptr) == PROP_POINTER) {
|
if(RNA_property_type(&curptr, prop) == PROP_POINTER) {
|
||||||
RNA_property_pointer_get(prop, &curptr, &nextptr);
|
RNA_property_pointer_get(&curptr, prop, &nextptr);
|
||||||
|
|
||||||
if(nextptr.data)
|
if(nextptr.data)
|
||||||
curptr= nextptr;
|
curptr= nextptr;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(RNA_property_type(prop, &curptr) == PROP_COLLECTION && *path) {
|
else if(RNA_property_type(&curptr, prop) == PROP_COLLECTION && *path) {
|
||||||
/* resolve the lookup with [] brackets */
|
/* resolve the lookup with [] brackets */
|
||||||
token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
|
token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
|
||||||
|
|
||||||
@@ -1217,12 +1234,12 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
|
|||||||
if(len >= 2 && *token == '"' && token[len-2] == '"') {
|
if(len >= 2 && *token == '"' && token[len-2] == '"') {
|
||||||
/* strip away "" */
|
/* strip away "" */
|
||||||
token[len-2]= 0;
|
token[len-2]= 0;
|
||||||
RNA_property_collection_lookup_string(prop, &curptr, token+1, &nextptr);
|
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* otherwise do int lookup */
|
/* otherwise do int lookup */
|
||||||
intkey= atoi(token);
|
intkey= atoi(token);
|
||||||
RNA_property_collection_lookup_int(prop, &curptr, intkey, &nextptr);
|
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(token != fixedbuf)
|
if(token != fixedbuf)
|
||||||
@@ -1256,9 +1273,9 @@ char *RNA_path_append(const char *path, PointerRNA *ptr, PropertyRNA *prop, int
|
|||||||
BLI_dynstr_append(dynstr, ".");
|
BLI_dynstr_append(dynstr, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_dynstr_append(dynstr, (char*)RNA_property_identifier(prop, ptr));
|
BLI_dynstr_append(dynstr, (char*)RNA_property_identifier(ptr, prop));
|
||||||
|
|
||||||
if(RNA_property_type(prop, ptr) == PROP_COLLECTION) {
|
if(RNA_property_type(ptr, prop) == PROP_COLLECTION) {
|
||||||
/* add ["strkey"] or [intkey] */
|
/* add ["strkey"] or [intkey] */
|
||||||
BLI_dynstr_append(dynstr, "[");
|
BLI_dynstr_append(dynstr, "[");
|
||||||
|
|
||||||
@@ -1346,7 +1363,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_boolean_get(prop, ptr);
|
return RNA_property_boolean_get(ptr, prop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_boolean_get: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_boolean_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1359,36 +1376,20 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_boolean_set(prop, ptr, value);
|
RNA_property_boolean_set(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_boolean_set: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_boolean_set: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_boolean_default(PointerRNA *ptr, const char *name, int value)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name))
|
|
||||||
RNA_property_boolean_set(prop, ptr, value);
|
|
||||||
|
|
||||||
return RNA_property_boolean_get(prop, ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("RNA_boolean_default: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
|
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
values[i]= RNA_property_boolean_get_array(prop, ptr, i);
|
values[i]= RNA_property_boolean_get_array(ptr, prop, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_boolean_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_boolean_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1400,38 +1401,20 @@ void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
|
|||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
RNA_property_boolean_set_array(prop, ptr, i, values[i]);
|
RNA_property_boolean_set_array(ptr, prop, i, values[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_boolean_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_boolean_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_boolean_default_array(PointerRNA *ptr, const char *name, int *values)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
int i, length;
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name)) {
|
|
||||||
length= RNA_property_array_length(prop, ptr);
|
|
||||||
for(i=0; i<length; i++)
|
|
||||||
RNA_property_boolean_set_array(prop, ptr, i, values[i]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RNA_boolean_get_array(ptr, name, values);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("RNA_boolean_default_array: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int RNA_int_get(PointerRNA *ptr, const char *name)
|
int RNA_int_get(PointerRNA *ptr, const char *name)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_int_get(prop, ptr);
|
return RNA_property_int_get(ptr, prop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_int_get: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_int_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1444,36 +1427,20 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_int_set(prop, ptr, value);
|
RNA_property_int_set(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_int_set: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_int_set: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_int_default(PointerRNA *ptr, const char *name, int value)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name))
|
|
||||||
RNA_property_int_set(prop, ptr, value);
|
|
||||||
|
|
||||||
return RNA_property_int_get(prop, ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("RNA_int_default: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
|
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
values[i]= RNA_property_int_get_array(prop, ptr, i);
|
values[i]= RNA_property_int_get_array(ptr, prop, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_int_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_int_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1485,38 +1452,20 @@ void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
|
|||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
RNA_property_int_set_array(prop, ptr, i, values[i]);
|
RNA_property_int_set_array(ptr, prop, i, values[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_int_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_int_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_int_default_array(PointerRNA *ptr, const char *name, int *values)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
int i, length;
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name)) {
|
|
||||||
length= RNA_property_array_length(prop, ptr);
|
|
||||||
for(i=0; i<length; i++)
|
|
||||||
RNA_property_int_set_array(prop, ptr, i, values[i]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RNA_int_get_array(ptr, name, values);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("RNA_int_default_array: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
float RNA_float_get(PointerRNA *ptr, const char *name)
|
float RNA_float_get(PointerRNA *ptr, const char *name)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_float_get(prop, ptr);
|
return RNA_property_float_get(ptr, prop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_float_get: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_float_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1529,36 +1478,20 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_float_set(prop, ptr, value);
|
RNA_property_float_set(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_float_set: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_float_set: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
float RNA_float_default(PointerRNA *ptr, const char *name, float value)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name))
|
|
||||||
RNA_property_float_set(prop, ptr, value);
|
|
||||||
|
|
||||||
return RNA_property_float_get(prop, ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("RNA_float_default: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
|
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
values[i]= RNA_property_float_get_array(prop, ptr, i);
|
values[i]= RNA_property_float_get_array(ptr, prop, i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_float_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_float_get_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1570,38 +1503,20 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
|
|||||||
int i, length;
|
int i, length;
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
length= RNA_property_array_length(prop, ptr);
|
length= RNA_property_array_length(ptr, prop);
|
||||||
for(i=0; i<length; i++)
|
for(i=0; i<length; i++)
|
||||||
RNA_property_float_set_array(prop, ptr, i, values[i]);
|
RNA_property_float_set_array(ptr, prop, i, values[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("RNA_float_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_float_set_array: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_float_default_array(PointerRNA *ptr, const char *name, float *values)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
int i, length;
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name)) {
|
|
||||||
length= RNA_property_array_length(prop, ptr);
|
|
||||||
for(i=0; i<length; i++)
|
|
||||||
RNA_property_float_set_array(prop, ptr, i, values[i]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
RNA_float_get_array(ptr, name, values);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("RNA_float_default_array: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int RNA_enum_get(PointerRNA *ptr, const char *name)
|
int RNA_enum_get(PointerRNA *ptr, const char *name)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_enum_get(prop, ptr);
|
return RNA_property_enum_get(ptr, prop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_enum_get: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_enum_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1614,33 +1529,17 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_enum_set(prop, ptr, value);
|
RNA_property_enum_set(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_enum_set: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_enum_set: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RNA_enum_default(PointerRNA *ptr, const char *name, int value)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name))
|
|
||||||
RNA_property_enum_set(prop, ptr, value);
|
|
||||||
|
|
||||||
return RNA_property_enum_get(prop, ptr);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("RNA_enum_default: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
|
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_string_get(prop, ptr, value);
|
RNA_property_string_get(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_string_get: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_string_get: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
@@ -1650,7 +1549,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_string_get_alloc(prop, ptr, fixedbuf, fixedlen);
|
return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_string_get_alloc: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_string_get_alloc: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1663,7 +1562,7 @@ int RNA_string_length(PointerRNA *ptr, const char *name)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop) {
|
if(prop) {
|
||||||
return RNA_property_string_length(prop, ptr);
|
return RNA_property_string_length(ptr, prop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("RNA_string_length: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_string_length: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
@@ -1676,23 +1575,11 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
|
|||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|
||||||
if(prop)
|
if(prop)
|
||||||
RNA_property_string_set(prop, ptr, value);
|
RNA_property_string_set(ptr, prop, value);
|
||||||
else
|
else
|
||||||
printf("RNA_string_set: %s.%s not found.\n", ptr->type->identifier, name);
|
printf("RNA_string_set: %s.%s not found.\n", ptr->type->identifier, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_string_default(PointerRNA *ptr, const char *name, const char *value)
|
|
||||||
{
|
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
|
||||||
|
|
||||||
if(prop) {
|
|
||||||
if(!rna_idproperty_find(ptr, name))
|
|
||||||
RNA_property_string_set(prop, ptr, value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
printf("RNA_string_default: %s.%s not found.\n", ptr->type->identifier, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int RNA_property_is_set(PointerRNA *ptr, const char *name)
|
int RNA_property_is_set(PointerRNA *ptr, const char *name)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
PropertyRNA *prop= RNA_struct_find_property(ptr, name);
|
||||||
|
|||||||
@@ -483,10 +483,8 @@ PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type,
|
|||||||
prop->name= identifier;
|
prop->name= identifier;
|
||||||
prop->description= "";
|
prop->description= "";
|
||||||
|
|
||||||
if(type == PROP_COLLECTION)
|
if(type == PROP_COLLECTION || type == PROP_POINTER)
|
||||||
prop->flag= PROP_NOT_EDITABLE|PROP_NOT_DRIVEABLE;
|
prop->flag= PROP_NOT_EDITABLE|PROP_NOT_DRIVEABLE;
|
||||||
else if(type == PROP_POINTER)
|
|
||||||
prop->flag= PROP_NOT_DRIVEABLE;
|
|
||||||
|
|
||||||
if(DefRNA.preprocess) {
|
if(DefRNA.preprocess) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ static void rna_generate_deps(RNAGenDeps *gen, PointerRNA *ptr, PointerRNA *idpt
|
|||||||
|
|
||||||
for(prop=ptr->type->properties.first; prop; prop=prop->next) {
|
for(prop=ptr->type->properties.first; prop; prop=prop->next) {
|
||||||
if(prop->type == PROP_POINTER) {
|
if(prop->type == PROP_POINTER) {
|
||||||
RNA_property_pointer_get(prop, ptr, &pptr);
|
RNA_property_pointer_get(ptr, prop, &pptr);
|
||||||
|
|
||||||
if(pptr.data && pptr.type) {
|
if(pptr.data && pptr.type) {
|
||||||
if(idptr && (pptr.type->flag & STRUCT_ID)) {
|
if(idptr && (pptr.type->flag & STRUCT_ID)) {
|
||||||
@@ -39,10 +39,10 @@ static void rna_generate_deps(RNAGenDeps *gen, PointerRNA *ptr, PointerRNA *idpt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(prop->type == PROP_COLLECTION) {
|
else if(prop->type == PROP_COLLECTION) {
|
||||||
RNA_property_collection_begin(prop, &iter, ptr);
|
RNA_property_collection_begin(ptr, prop, &iter);
|
||||||
|
|
||||||
while(iter.valid) {
|
while(iter.valid) {
|
||||||
RNA_property_collection_get(prop, &iter, &pptr);
|
RNA_property_collection_get(&pptr, prop, &iter);
|
||||||
|
|
||||||
if(pptr.data && pptr.type) {
|
if(pptr.data && pptr.type) {
|
||||||
if(idptr && (pptr.type->flag & STRUCT_ID)) {
|
if(idptr && (pptr.type->flag & STRUCT_ID)) {
|
||||||
|
|||||||
@@ -78,16 +78,6 @@ extern BlenderDefRNA DefRNA;
|
|||||||
|
|
||||||
extern BlenderRNA BLENDER_RNA;
|
extern BlenderRNA BLENDER_RNA;
|
||||||
|
|
||||||
extern StructRNA RNA_Lamp;
|
|
||||||
extern StructRNA RNA_Main;
|
|
||||||
extern StructRNA RNA_Mesh;
|
|
||||||
extern StructRNA RNA_Object;
|
|
||||||
extern StructRNA RNA_Operator;
|
|
||||||
extern StructRNA RNA_Property;
|
|
||||||
extern StructRNA RNA_Scene;
|
|
||||||
extern StructRNA RNA_Struct;
|
|
||||||
extern StructRNA RNA_WindowManager;
|
|
||||||
|
|
||||||
void RNA_def_ID(struct BlenderRNA *brna);
|
void RNA_def_ID(struct BlenderRNA *brna);
|
||||||
void RNA_def_lamp(struct BlenderRNA *brna);
|
void RNA_def_lamp(struct BlenderRNA *brna);
|
||||||
void RNA_def_main(struct BlenderRNA *brna);
|
void RNA_def_main(struct BlenderRNA *brna);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
static StructRNA *rna_Operator_refine(PointerRNA *ptr)
|
static StructRNA *rna_Operator_refine(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
wmOperator *op= (wmOperator*)ptr->data;
|
wmOperator *op= (wmOperator*)ptr->data;
|
||||||
return op->type->rna;
|
return op->type->srna;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Operator_name_get(PointerRNA *ptr, char *value)
|
static void rna_Operator_name_get(PointerRNA *ptr, char *value)
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ void wm_operator_free(wmOperator *op)
|
|||||||
op->properties= NULL;
|
op->properties= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(op->rna)
|
if(op->ptr)
|
||||||
MEM_freeN(op->rna);
|
MEM_freeN(op->ptr);
|
||||||
|
|
||||||
MEM_freeN(op);
|
MEM_freeN(op);
|
||||||
}
|
}
|
||||||
@@ -74,9 +74,9 @@ void wm_operator_register(wmWindowManager *wm, wmOperator *op)
|
|||||||
{
|
{
|
||||||
int tot;
|
int tot;
|
||||||
|
|
||||||
if(op->rna) {
|
if(op->ptr) {
|
||||||
MEM_freeN(op->rna);
|
MEM_freeN(op->ptr);
|
||||||
op->rna= NULL;
|
op->ptr= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_addtail(&wm->operators, op);
|
BLI_addtail(&wm->operators, op);
|
||||||
|
|||||||
@@ -299,9 +299,8 @@ int WM_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event)
|
|||||||
|
|
||||||
op->type= ot;
|
op->type= ot;
|
||||||
|
|
||||||
op->rna= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
|
op->ptr= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
|
||||||
op->rna->type= op->type->rna;
|
RNA_pointer_create(&RNA_WindowManager, &C->wm->id, ot->srna, op, op->ptr);
|
||||||
op->rna->data= op;
|
|
||||||
|
|
||||||
if(op->type->invoke)
|
if(op->type->invoke)
|
||||||
retval= (*op->type->invoke)(C, op, event);
|
retval= (*op->type->invoke)(C, op, event);
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
|
|||||||
wmOperatorType *ot;
|
wmOperatorType *ot;
|
||||||
|
|
||||||
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
|
ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
|
||||||
ot->rna= RNA_def_struct(&BLENDER_RNA, "", "Operator", "");
|
ot->srna= RNA_def_struct(&BLENDER_RNA, "", "Operator", "");
|
||||||
opfunc(ot);
|
opfunc(ot);
|
||||||
RNA_def_struct_identifier(ot->rna, ot->idname, ot->name);
|
RNA_def_struct_identifier(ot->srna, ot->idname, ot->name);
|
||||||
BLI_addtail(&global_ops, ot);
|
BLI_addtail(&global_ops, ot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,12 +159,12 @@ static void border_select_apply(bContext *C, wmOperator *op, int event_type)
|
|||||||
rcti *rect= gesture->customdata;
|
rcti *rect= gesture->customdata;
|
||||||
|
|
||||||
/* operator arguments and storage. */
|
/* operator arguments and storage. */
|
||||||
RNA_int_default(op->rna, "xmin", rect->xmin);
|
RNA_int_set(op->ptr, "xmin", rect->xmin);
|
||||||
RNA_int_default(op->rna, "ymin", rect->ymin);
|
RNA_int_set(op->ptr, "ymin", rect->ymin);
|
||||||
RNA_int_default(op->rna, "xmax", rect->xmax);
|
RNA_int_set(op->ptr, "xmax", rect->xmax);
|
||||||
RNA_int_default(op->rna, "ymax", rect->ymax);
|
RNA_int_set(op->ptr, "ymax", rect->ymax);
|
||||||
|
|
||||||
RNA_int_default(op->rna, "event_type", event_type);
|
RNA_int_set(op->ptr, "event_type", event_type);
|
||||||
|
|
||||||
op->type->exec(C, op);
|
op->type->exec(C, op);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user