From c1cf33c8aa1d9fd5f8d36231f4a28da63ce0e5e0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 16 Jan 2009 23:53:11 +0000 Subject: RNA * Added more compact property definitions, with a single function. Only used by operators at the moment, would need to tweak regular expressions a bit more to use it also for other RNA definitions. * The operator properties defined now were completed a bit more but still have many issues that need to be adressed, specifically; * Some properties that should be booleans or enums are defined as ints, note that ints are only for numeric values, not bitflags or multiple choice. * Soft/hard limits and default values of many properties are not well defined still, * Inconsistent naming, especially for example mouse locations or bounds are named differently in different places. Also mouse locations and other vector like properties should become a single vector property instead of multiple X/Y properties. * Almost no properties have descriptions, these would be good to have for docs and tooltips. So, please verify that the properties of the operators you wrote are well defined. --- source/blender/editors/animation/anim_channels.c | 69 ++----- source/blender/editors/animation/anim_markers.c | 33 ++- source/blender/editors/animation/anim_ops.c | 12 +- source/blender/editors/interface/view2d_ops.c | 44 ++-- source/blender/editors/mesh/editmesh_add.c | 118 ++++------- source/blender/editors/mesh/editmesh_mods.c | 16 +- source/blender/editors/mesh/editmesh_tools.c | 20 +- source/blender/editors/object/object_edit.c | 64 ++---- source/blender/editors/screen/screen_ops.c | 81 +++----- source/blender/editors/sculpt/sculpt.c | 21 +- source/blender/editors/space_action/action_edit.c | 30 +-- .../blender/editors/space_action/action_select.c | 28 +-- source/blender/editors/space_image/image_ops.c | 19 +- source/blender/editors/space_node/node_select.c | 51 ++--- source/blender/editors/space_node/node_state.c | 16 +- source/blender/editors/space_script/script_edit.c | 4 +- source/blender/editors/space_view3d/view3d_edit.c | 52 ++--- .../blender/editors/space_view3d/view3d_select.c | 43 ++-- source/blender/editors/transform/transform_ops.c | 17 +- source/blender/editors/uvedit/uvedit_ops.c | 23 +-- source/blender/makesrna/RNA_define.h | 46 ++++- source/blender/makesrna/intern/rna_define.c | 224 +++++++++++++++++++++ 22 files changed, 535 insertions(+), 496 deletions(-) diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index af12ccd0b18..b87a8ad7181 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -572,7 +572,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; /* get mode, then rearrange channels */ - mode= RNA_enum_get(op->ptr, "dir"); + mode= RNA_enum_get(op->ptr, "direction"); rearrange_action_channels(&ac, mode); /* set notifier tha things have changed */ @@ -584,8 +584,6 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) void ANIM_OT_channels_move_up (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Move Channel(s) Up"; ot->idname= "ANIM_OT_channels_move_up"; @@ -598,15 +596,11 @@ void ANIM_OT_channels_move_up (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - // xxx add enum for this... - RNA_def_property_enum_default(prop, REARRANGE_ACTCHAN_UP); + RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_UP, "Direction", ""); } void ANIM_OT_channels_move_down (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Move Channel(s) Down"; ot->idname= "ANIM_OT_channels_move_down"; @@ -619,15 +613,11 @@ void ANIM_OT_channels_move_down (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - // xxx add enum for this... - RNA_def_property_enum_default(prop, REARRANGE_ACTCHAN_DOWN); + RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_DOWN, "Direction", ""); } void ANIM_OT_channels_move_top (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Move Channel(s) to Top"; ot->idname= "ANIM_OT_channels_move_to_top"; @@ -640,15 +630,11 @@ void ANIM_OT_channels_move_top (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - // xxx add enum for this... - RNA_def_property_enum_default(prop, REARRANGE_ACTCHAN_TOP); + RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_TOP, "Direction", ""); } void ANIM_OT_channels_move_bottom (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Move Channel(s) to Bottom"; ot->idname= "ANIM_OT_channels_move_to_bottom"; @@ -661,9 +647,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - // xxx add enum for this... - RNA_def_property_enum_default(prop, REARRANGE_ACTCHAN_BOTTOM); + RNA_def_enum(ot->srna, "direction", NULL /* XXX add enum for this */, REARRANGE_ACTCHAN_BOTTOM, "Direction", ""); } @@ -825,8 +809,6 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op) void ANIM_OT_channels_enable_setting (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Enable Channel Setting"; ot->idname= "ANIM_OT_channels_enable_setting"; @@ -841,18 +823,13 @@ void ANIM_OT_channels_enable_setting (wmOperatorType *ot) /* props */ /* flag-setting mode */ - prop= RNA_def_property(ot->srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_setflag_types); - RNA_def_property_enum_default(prop, ACHANNEL_SETFLAG_ADD); + RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", ""); /* setting to set */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_settings_types); + RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } void ANIM_OT_channels_disable_setting (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Disable Channel Setting"; ot->idname= "ANIM_OT_channels_disable_setting"; @@ -867,18 +844,13 @@ void ANIM_OT_channels_disable_setting (wmOperatorType *ot) /* props */ /* flag-setting mode */ - prop= RNA_def_property(ot->srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_setflag_types); - RNA_def_property_enum_default(prop, ACHANNEL_SETFLAG_CLEAR); + RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", ""); /* setting to set */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_settings_types); + RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } void ANIM_OT_channels_toggle_setting (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Toggle Channel Setting"; ot->idname= "ANIM_OT_channels_toggle_setting"; @@ -893,12 +865,9 @@ void ANIM_OT_channels_toggle_setting (wmOperatorType *ot) /* props */ /* flag-setting mode */ - prop= RNA_def_property(ot->srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_setflag_types); - RNA_def_property_enum_default(prop, ACHANNEL_SETFLAG_TOGGLE); + RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", ""); /* setting to set */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_animchannel_settings_types); + RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } /* ********************** Select All Operator *********************** */ @@ -937,7 +906,7 @@ void ANIM_OT_channels_deselectall (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property(ot->srna, "invert", PROP_BOOLEAN, PROP_NONE); + RNA_def_boolean(ot->srna, "invert", 0, "Invert", ""); } /* ******************** Borderselect Operator *********************** */ @@ -1083,11 +1052,11 @@ void ANIM_OT_channels_borderselect(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ******************** Mouse-Click Operator *********************** */ @@ -1486,8 +1455,8 @@ void ANIM_OT_channels_mouseclick (wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* id-props */ - RNA_def_property(ot->srna, "extend_select", PROP_BOOLEAN, PROP_NONE); // SHIFTKEY - RNA_def_property(ot->srna, "select_children_only", PROP_BOOLEAN, PROP_NONE); // CTRLKEY|SHIFTKEY + RNA_def_boolean(ot->srna, "extend_select", 0, "Extend Select", ""); // SHIFTKEY + RNA_def_boolean(ot->srna, "select_children_only", 0, "Select Children Only", ""); // CTRLKEY|SHIFTKEY } /* ************************************************************************** */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index d0f691693ec..2bd91ec9e6a 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -304,7 +304,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op); /* reset frs delta */ - RNA_int_set(op->ptr, "frs", 0); + RNA_int_set(op->ptr, "frames", 0); return OPERATOR_RUNNING_MODAL; } @@ -319,7 +319,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) TimeMarker *marker; int a, offs; - offs= RNA_int_get(op->ptr, "frs"); + offs= RNA_int_get(op->ptr, "frames"); for (a=0, marker= mm->markers->first; marker; marker= marker->next) { if (marker->flag & SELECT) { marker->frame= mm->oldframe[a] + offs; @@ -331,8 +331,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) /* only for modal */ static void ed_marker_move_cancel(bContext *C, wmOperator *op) { - - RNA_int_set(op->ptr, "frs", 0); + RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(C, op); ed_marker_move_exit(C, op); @@ -383,7 +382,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); offs= (int)fac; - RNA_int_set(op->ptr, "frs", offs); + RNA_int_set(op->ptr, "frames", offs); ed_marker_move_apply(C, op); /* cruft below is for header print */ @@ -468,7 +467,7 @@ static void MARKER_OT_move(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna storage */ - RNA_def_property(ot->srna, "frs", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX); } /* ************************** duplicate markers *************************** */ @@ -542,7 +541,7 @@ static void MARKER_OT_duplicate(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna storage */ - RNA_def_property(ot->srna, "frs", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX); } /* ************************** selection ************************************/ @@ -717,12 +716,11 @@ static void MARKER_OT_border_select(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); - + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* *********************** (de)select all ***************** */ @@ -733,7 +731,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op) TimeMarker *marker; int select= RNA_int_get(op->ptr, "select_type"); - if(RNA_int_get(op->ptr, "select_swap")) { + if(RNA_boolean_get(op->ptr, "select_swap")) { for(marker= markers->first; marker; marker= marker->next) { if(marker->flag & SELECT) break; @@ -758,7 +756,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op) static int ed_marker_select_all_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - RNA_int_set(op->ptr, "select_swap", 1); + RNA_boolean_set(op->ptr, "select_swap", 1); return ed_marker_select_all_exec(C, op); } @@ -775,9 +773,8 @@ static void MARKER_OT_select_all(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna */ - RNA_def_property(ot->srna, "select_swap", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "select_type", PROP_INT, PROP_NONE); - + RNA_def_boolean(ot->srna, "select_swap", 0, "Select Swap", ""); + RNA_def_int(ot->srna, "select_type", 0, INT_MIN, INT_MAX, "Select Type", "", INT_MIN, INT_MAX); } /* ******************************* remove marker ***************** */ diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9e99be49419..503e083d061 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -189,8 +189,6 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event) void ANIM_OT_change_frame(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Change frame"; ot->idname= "ANIM_OT_change_frame"; @@ -202,7 +200,7 @@ void ANIM_OT_change_frame(wmOperatorType *ot) ot->modal= change_frame_modal; /* rna */ - prop= RNA_def_property(ot->srna, "frame", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "frame", 0, 1, MAXFRAME, "Frame", "", 1, MAXFRAME); } /* ****************** set preview range operator ****************************/ @@ -251,11 +249,11 @@ void ANIM_OT_previewrange_define(wmOperatorType *ot) /* rna */ /* used to define frame range */ - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); /* these are not used, but are needed by borderselect gesture operator stuff */ - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ****************** clear preview range operator ****************************/ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index ef3a9f760c8..d7f887e9e55 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -254,8 +254,8 @@ void View2D_OT_view_pan(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "deltax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); } /* ------------------ Scrollwheel Versions (2) ---------------------- */ @@ -300,8 +300,8 @@ void View2D_OT_view_scrollright(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "deltax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); } @@ -346,8 +346,8 @@ void View2D_OT_view_scrollleft(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "deltax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); } @@ -391,8 +391,8 @@ void View2D_OT_view_scrolldown(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "deltax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); } @@ -437,8 +437,8 @@ void View2D_OT_view_scrollup(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "deltax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "deltay", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX); } /* ********************************************************* */ @@ -537,8 +537,8 @@ void View2D_OT_view_zoomin(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "zoomfacx", PROP_FLOAT, PROP_NONE); - RNA_def_property(ot->srna, "zoomfacy", PROP_FLOAT, PROP_NONE); + RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "zoomfacy", 0, -FLT_MAX, FLT_MAX, "Zoom Factor Y", "", -FLT_MAX, FLT_MAX); } @@ -573,8 +573,8 @@ void View2D_OT_view_zoomout(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - RNA_def_property(ot->srna, "zoomfacx", PROP_FLOAT, PROP_NONE); - RNA_def_property(ot->srna, "zoomfacy", PROP_FLOAT, PROP_NONE); + RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "zoomfacy", 0, -FLT_MAX, FLT_MAX, "Zoom Factor Y", "", -FLT_MAX, FLT_MAX); } /* ********************************************************* */ @@ -796,8 +796,6 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) void View2D_OT_view_zoom(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Zoom View"; ot->idname= "View2D_OT_view_zoom"; @@ -811,8 +809,8 @@ void View2D_OT_view_zoom(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna - must keep these in sync with the other operators */ - prop= RNA_def_property(ot->srna, "deltax", PROP_FLOAT, PROP_NONE); - prop= RNA_def_property(ot->srna, "deltay", PROP_FLOAT, PROP_NONE); + RNA_def_float(ot->srna, "deltax", 0, -FLT_MAX, FLT_MAX, "Delta X", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "deltay", 0, -FLT_MAX, FLT_MAX, "Delta Y", "", -FLT_MAX, FLT_MAX); } /* ********************************************************* */ @@ -908,11 +906,11 @@ void View2D_OT_view_borderzoom(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ********************************************************* */ diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 10a2e533be3..355fd5e2b33 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1497,10 +1497,10 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia *= RNA_float_get(op->ptr,"Radius"); + dia *= RNA_float_get(op->ptr,"radius"); - make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr,"Vertices"), 0, 0, dia, 0.0f, 0, - RNA_boolean_get(op->ptr, "Fill")); + make_prim(obedit, PRIM_CIRCLE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, 0.0f, 0, + RNA_boolean_get(op->ptr, "fill")); ED_undo_push(C, "Add Circle"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1510,8 +1510,6 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_circle(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Circle"; ot->idname= "MESH_OT_add_primitive_circle"; @@ -1524,12 +1522,9 @@ void MESH_OT_add_primitive_circle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "Vertices", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 32); - prop= RNA_def_property(ot->srna, "Radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); - prop= RNA_def_property(ot->srna, "Fill", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_default(prop, 0); + RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "radius", 1.0f, -FLT_MAX, FLT_MAX, "Radius", "", -FLT_MAX, FLT_MAX); + RNA_def_boolean(ot->srna, "fill", 0, "Fill", ""); } static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) @@ -1538,10 +1533,10 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia *= RNA_float_get(op->ptr,"Radius"); + dia *= RNA_float_get(op->ptr, "radius"); - make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr,"Vertices"), 0, 0, dia, - RNA_float_get(op->ptr,"Depth"), 1, 1); + make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, + RNA_float_get(op->ptr, "depth"), 1, 1); ED_undo_push(C, "Add Cylinder"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1551,8 +1546,6 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_cylinder(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Cylinder"; ot->idname= "MESH_OT_add_primitive_cylinder"; @@ -1565,12 +1558,9 @@ void MESH_OT_add_primitive_cylinder(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "Vertices", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 32); - prop= RNA_def_property(ot->srna, "Radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); - prop= RNA_def_property(ot->srna, "Depth", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "radius", 1.0f, -FLT_MAX, FLT_MAX, "Radius", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "depth", 1.0f, -FLT_MAX, FLT_MAX, "Depth", "", -FLT_MAX, FLT_MAX); } static int add_primitive_tube_exec(bContext *C, wmOperator *op) @@ -1579,10 +1569,10 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia *= RNA_float_get(op->ptr,"Radius"); + dia *= RNA_float_get(op->ptr, "radius"); - make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr,"Vertices"), 0, 0, dia, - RNA_float_get(op->ptr,"Depth"), 1, 0); + make_prim(obedit, PRIM_CYLINDER, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, + RNA_float_get(op->ptr, "depth"), 1, 0); ED_undo_push(C, "Add Tube"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1592,8 +1582,6 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_tube(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Tube"; ot->idname= "MESH_OT_add_primitive_tube"; @@ -1606,12 +1594,9 @@ void MESH_OT_add_primitive_tube(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "Vertices", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 32); - prop= RNA_def_property(ot->srna, "Radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); - prop= RNA_def_property(ot->srna, "Depth", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "radius", 1.0f, -FLT_MAX, FLT_MAX, "Radius", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "depth", 1.0f, -FLT_MAX, FLT_MAX, "Depth", "", -FLT_MAX, FLT_MAX); } static int add_primitive_cone_exec(bContext *C, wmOperator *op) @@ -1620,10 +1605,10 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia *= RNA_float_get(op->ptr,"Radius"); + dia *= RNA_float_get(op->ptr, "radius"); - make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr,"Vertices"), 0, 0, dia, - RNA_float_get(op->ptr,"Depth"), 0, RNA_int_get(op->ptr,"Cap_end")); + make_prim(obedit, PRIM_CONE, mat, RNA_int_get(op->ptr, "vertices"), 0, 0, dia, + RNA_float_get(op->ptr, "depth"), 0, RNA_int_get(op->ptr, "cap_end")); ED_undo_push(C, "Add Cone"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1633,8 +1618,6 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_cone(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Cone"; ot->idname= "MESH_OT_add_primitive_cone"; @@ -1647,14 +1630,10 @@ void MESH_OT_add_primitive_cone(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "Vertices", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 32); - prop= RNA_def_property(ot->srna, "Radius", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); - prop= RNA_def_property(ot->srna, "Depth", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); - prop= RNA_def_property(ot->srna, "Cap_end", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 1); + RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "radius", 1.0f, -FLT_MAX, FLT_MAX, "Radius", "", -FLT_MAX, FLT_MAX); + RNA_def_float(ot->srna, "depth", 1.0f, -FLT_MAX, FLT_MAX, "Depth", "", -FLT_MAX, FLT_MAX); + RNA_def_int(ot->srna, "cap_end", 1, INT_MIN, INT_MAX, "Cap End", "", INT_MIN, INT_MAX); } static int add_primitive_grid_exec(bContext *C, wmOperator *op) @@ -1663,10 +1642,10 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia*= RNA_float_get(op->ptr, "Size"); + dia*= RNA_float_get(op->ptr, "size"); - make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "X_Subdiv"), - RNA_int_get(op->ptr, "Y_Subdiv"), 0, dia, 0.0f, 0, 1); + make_prim(obedit, PRIM_GRID, mat, RNA_int_get(op->ptr, "x_subdivisions"), + RNA_int_get(op->ptr, "y_subdivisions"), 0, dia, 0.0f, 0, 1); ED_undo_push(C, "Add Grid"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1676,8 +1655,6 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_grid(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Grid"; ot->idname= "MESH_OT_add_primitive_grid"; @@ -1690,12 +1667,9 @@ void MESH_OT_add_primitive_grid(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* props */ - prop= RNA_def_property(ot->srna, "X_Subdiv", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 10); - prop= RNA_def_property(ot->srna, "Y_Subdiv", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 10); - prop= RNA_def_property(ot->srna, "Size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_int(ot->srna, "x_subdivisions", 10, INT_MIN, INT_MAX, "X Subdivisions", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "y_subdivisions", 10, INT_MIN, INT_MAX, "Y Subdivisons", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "size", 1.0f, -FLT_MAX, FLT_MAX, "Size", "", -FLT_MAX, FLT_MAX); } static int add_primitive_monkey_exec(bContext *C, wmOperator *op) @@ -1733,10 +1707,10 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia*= RNA_float_get(op->ptr, "Size"); + dia*= RNA_float_get(op->ptr, "size"); - make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "Rings"), - RNA_int_get(op->ptr, "Segments"), 0, dia, 0.0f, 0, 0); + make_prim(obedit, PRIM_UVSPHERE, mat, RNA_int_get(op->ptr, "rings"), + RNA_int_get(op->ptr, "segments"), 0, dia, 0.0f, 0, 0); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1745,8 +1719,6 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_uv_sphere(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add UV Sphere"; ot->idname= "MESH_OT_add_primitive_uv_sphere"; @@ -1759,12 +1731,9 @@ void MESH_OT_add_primitive_uv_sphere(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* props */ - prop= RNA_def_property(ot->srna, "Segments", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 32); - prop= RNA_def_property(ot->srna, "Rings", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 24); - prop= RNA_def_property(ot->srna, "Size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_int(ot->srna, "segments", 32, INT_MIN, INT_MAX, "Segments", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "rings", 24, INT_MIN, INT_MAX, "Rings", "", INT_MIN, INT_MAX); + RNA_def_float(ot->srna, "size", 1.0f, -FLT_MAX, FLT_MAX, "Size", "", -FLT_MAX, FLT_MAX); } static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) @@ -1773,10 +1742,10 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) float dia, mat[4][4]; dia= new_primitive_matrix(C, mat); - dia*= RNA_float_get(op->ptr, "Size"); + dia*= RNA_float_get(op->ptr, "size"); make_prim(obedit, PRIM_ICOSPHERE, mat, 0, 0, - RNA_int_get(op->ptr, "Subdivision"), dia, 0.0f, 0, 0); + RNA_int_get(op->ptr, "subdivisions"), dia, 0.0f, 0, 0); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -1785,8 +1754,6 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) void MESH_OT_add_primitive_ico_sphere(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Ico Sphere"; ot->idname= "MESH_OT_add_primitive_ico_sphere"; @@ -1799,10 +1766,7 @@ void MESH_OT_add_primitive_ico_sphere(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* props */ - prop= RNA_def_property(ot->srna, "Subdivision", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, 2); - RNA_def_property_range(prop, 0.0, 6.0); - prop= RNA_def_property(ot->srna, "Size", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_int(ot->srna, "subdivisions", 2, 0, 6, "Subdivisions", "", 0, INT_MAX); + RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, FLT_MAX); } diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index fe96cf21f18..ea3f44c63c8 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2506,7 +2506,7 @@ void MESH_OT_hide_mesh(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property(ot->srna, "swap", PROP_BOOLEAN, PROP_NONE); + RNA_def_boolean(ot->srna, "swap", 0, "Swap", ""); } void reveal_mesh(EditMesh *em) @@ -2936,7 +2936,7 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ // XXX we need a message here - for 1 its recalculate normals inside, for 2 its outside - righthandfaces(em,RNA_float_get(op->ptr, "fsharpness")); + righthandfaces(em, RNA_float_get(op->ptr, "sharpness")); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ? return OPERATOR_FINISHED; @@ -2955,8 +2955,8 @@ void MESH_OT_select_sharp_edges(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; - /* props */ - RNA_def_property(ot->srna, "fsharpness", PROP_FLOAT, PROP_NONE); + /* props XXX figure out? */ + RNA_def_float(ot->srna, "sharpness", 0.01f, 0.0f, FLT_MAX, "sharpness", "", 0.0f, FLT_MAX); } @@ -3108,7 +3108,7 @@ static int select_linked_flat_faces_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - select_linked_flat_faces(em,RNA_float_get(op->ptr, "fsharpness")); + select_linked_flat_faces(em, RNA_float_get(op->ptr, "sharpness")); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); return OPERATOR_FINISHED; @@ -3128,7 +3128,7 @@ void MESH_OT_select_linked_flat_faces(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property(ot->srna, "fsharpness", PROP_FLOAT, PROP_NONE); + RNA_def_float(ot->srna, "sharpness", 0.0f, 0.0f, FLT_MAX, "sharpness", "", 0.0f, FLT_MAX); } void select_non_manifold(EditMesh *em) @@ -4028,7 +4028,7 @@ static int righthandfaces_exec(bContext *C, wmOperator *op) /* 'standard' behaviour - check if selected, then apply relevant selection */ // XXX we need a message here - for 1 its recalculate normals inside, for 2 its outside - righthandfaces(em,RNA_int_get(op->ptr, "select")); + righthandfaces(em, RNA_int_get(op->ptr, "select")); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); //TODO is this needed ? return OPERATOR_FINISHED; @@ -4048,7 +4048,7 @@ void MESH_OT_righthandfaces(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property(ot->srna, "select", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "select", 0, INT_MIN, INT_MAX, "Select", "", INT_MIN, INT_MAX); } /* ********** ALIGN WITH VIEW **************** */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e801210102d..ad56ebd5f50 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -6317,7 +6317,7 @@ static int subdivide_multi_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"Number_of_cuts"), 0); + esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0); ED_undo_push(C, "Subdivide Multi"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6341,7 +6341,7 @@ void MESH_OT_subdivide_multi(wmOperatorType *ot) /* props */ - RNA_def_property_int_default(RNA_def_property(ot->srna, "Number_of_cuts", PROP_INT, PROP_NONE), 4); + RNA_def_int(ot->srna, "number_cuts", 4, 0, 100, "Number of Cuts", "", 0, INT_MAX); } static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op) @@ -6350,7 +6350,7 @@ static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr,"Rand_fac")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"Number_of_cuts"), 0); + esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0); ED_undo_push(C, "Subdivide Multi Fractal"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6371,11 +6371,9 @@ void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; - /* props */ - - RNA_def_property_int_default(RNA_def_property(ot->srna, "Number_of_cuts", PROP_INT, PROP_NONE), 4); - RNA_def_property_float_default(RNA_def_property(ot->srna, "Rand_fac", PROP_FLOAT, PROP_NONE), 5.0); - + /* properties */ + RNA_def_int(ot->srna, "number_cuts", 4, 0, 100, "Number of Cuts", "", 0, INT_MAX); + RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f); } static int subdivide_smooth_exec(bContext *C, wmOperator *op) @@ -6384,7 +6382,7 @@ static int subdivide_smooth_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; - esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr,"Smooth"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); + esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); ED_undo_push(C, "Subdivide Smooth"); // Note this will become depricated WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -6406,5 +6404,5 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property_float_default(RNA_def_property(ot->srna, "Smooth", PROP_FLOAT, PROP_NONE), 5.0); -} \ No newline at end of file + RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX); +} diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a4af7a6ae59..7aab8bf8365 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -320,8 +320,6 @@ static int object_add_exec(bContext *C, wmOperator *op) void OBJECT_OT_object_add(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Add Object"; ot->idname= "OBJECT_OT_object_add"; @@ -333,8 +331,7 @@ void OBJECT_OT_object_add(wmOperatorType *ot) ot->poll= ED_operator_scene_editable; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_object_types); + RNA_def_enum(ot->srna, "type", prop_object_types, 0, "Type", ""); } @@ -1090,8 +1087,6 @@ static int clear_parent_exec(bContext *C, wmOperator *op) void OBJECT_OT_clear_parent(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Clear parent"; ot->idname= "OBJECT_OT_clear_parent"; @@ -1103,8 +1098,7 @@ void OBJECT_OT_clear_parent(wmOperatorType *ot) ot->poll= ED_operator_object_active; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_clear_parent_types); + RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", ""); } /* ******************** clear track operator ******************* */ @@ -1143,8 +1137,6 @@ static int object_clear_track_exec(bContext *C, wmOperator *op) void OBJECT_OT_clear_track(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Clear track"; ot->idname= "OBJECT_OT_clear_track"; @@ -1156,8 +1148,7 @@ void OBJECT_OT_clear_track(wmOperatorType *ot) ot->poll= ED_operator_scene_editable; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_clear_track_types); + RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", ""); } @@ -1185,8 +1176,6 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_by_type(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Select By Type"; ot->idname= "OBJECT_OT_select_by_type"; @@ -1196,8 +1185,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot) ot->exec= object_select_by_type_exec; ot->poll= ED_operator_scene_editable; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_object_types); + RNA_def_enum(ot->srna, "type", prop_object_types, 0, "Type", ""); } /* ****** selection by links *******/ @@ -1332,8 +1320,6 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_linked(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Select Linked"; ot->idname= "OBJECT_OT_select_linked"; @@ -1343,8 +1329,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot) ot->exec= object_select_linked_exec; ot->poll= ED_operator_scene_editable; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_linked_types); + RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", ""); } /* ****** selection by layer *******/ @@ -1369,8 +1354,6 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_by_layer(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Selection by layer"; ot->idname= "OBJECT_OT_select_by_layer"; @@ -1380,11 +1363,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) ot->exec= object_select_by_layer_exec; ot->poll= ED_operator_scene_editable; - prop = RNA_def_property(ot->srna, "layer", PROP_INT, PROP_UNSIGNED); - RNA_def_property_ui_range(prop, 1, 20,1, 1); - RNA_def_property_ui_text(prop, "layer", "The layer to select objects in"); - RNA_def_property_int_default(prop, 2); - + RNA_def_int(ot->srna, "layer", 1, 1, 20, "Layer", "", 1, 20); } /* ****** invert selection *******/ @@ -1462,9 +1441,9 @@ void OBJECT_OT_de_select_all(wmOperatorType *ot) static int object_select_random_exec(bContext *C, wmOperator *op) { - int percent; + float percent; - percent = RNA_int_get(op->ptr, "percent"); + percent = RNA_float_get(op->ptr, "percent"); CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if ((!base->flag & SELECT && (BLI_frand() * 100) < percent)) { @@ -1481,8 +1460,6 @@ static int object_select_random_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_random(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Random selection"; ot->idname= "OBJECT_OT_select_random"; @@ -1492,10 +1469,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot) ot->exec = object_select_random_exec; ot->poll= ED_operator_scene_editable; - prop = RNA_def_property(ot->srna, "percent", PROP_INT, PROP_NONE); - RNA_def_property_ui_range(prop, 1, 100,1, 1); - RNA_def_property_ui_text(prop, "Percent", "Max persentage that will be selected"); - RNA_def_property_int_default(prop, 50); + RNA_def_float(ot->srna, "percent", 50.0f, 0.0f, FLT_MAX, "Percent", "1", 0.01f, 100.0f); } /* ******** Clear object Translation *********** */ @@ -1788,8 +1762,6 @@ static int object_set_restrictview_exec(bContext *C, wmOperator *op) void OBJECT_OT_set_restrictview(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Set restrict view"; ot->idname= "OBJECT_OT_set_restrictview"; @@ -1799,8 +1771,7 @@ void OBJECT_OT_set_restrictview(wmOperatorType *ot) ot->exec= object_set_restrictview_exec; ot->poll= ED_operator_view3d_active; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_set_restrictview_types); + RNA_def_enum(ot->srna, "type", prop_set_restrictview_types, 0, "Type", ""); } /* ************* Slow Parent ******************* */ @@ -2302,8 +2273,6 @@ static int make_parent_invoke(bContext *C, wmOperator *op, wmEvent *event) void OBJECT_OT_make_parent(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Make parent"; ot->idname= "OBJECT_OT_make_parent"; @@ -2315,8 +2284,7 @@ void OBJECT_OT_make_parent(wmOperatorType *ot) ot->poll= ED_operator_object_active; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_make_parent_types); + RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", ""); } /* *** make track ***** */ @@ -2408,8 +2376,6 @@ static int make_track_exec(bContext *C, wmOperator *op) void OBJECT_OT_make_track(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Make Track"; ot->idname= "OBJECT_OT_make_track"; @@ -2421,8 +2387,7 @@ void OBJECT_OT_make_track(wmOperatorType *ot) ot->poll= ED_operator_scene_editable; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_make_track_types); + RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", ""); } /* ************* Make Dupli Real ********* */ @@ -2844,8 +2809,6 @@ if (tot_change) { } void OBJECT_OT_set_center(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Set Center"; ot->idname= "OBJECT_OT_set_center"; @@ -2857,8 +2820,7 @@ void OBJECT_OT_set_center(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_set_center_types); + RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); } /* ******************* toggle editmode operator ***************** */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 79921e8758d..ca057cd0b4d 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -618,8 +618,6 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event) void SCREEN_OT_area_move(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Move area edges"; ot->idname= "SCREEN_OT_area_move"; @@ -632,9 +630,9 @@ void SCREEN_OT_area_move(wmOperatorType *ot) ot->poll= ED_operator_screen_mainwinactive; /* when mouse is over area-edge */ /* rna */ - prop= RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE); - prop= RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE); - prop= RNA_def_property(ot->srna, "delta", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } /* ************** split area operator *********************************** */ @@ -702,7 +700,7 @@ static int area_split_init(bContext *C, wmOperator *op) if(sa==NULL) return 0; /* required properties */ - dir= RNA_enum_get(op->ptr, "dir"); + dir= RNA_enum_get(op->ptr, "direction"); /* minimal size */ if(dir=='v' && sa->winx < 2*AREAMINX) return 0; @@ -757,8 +755,8 @@ static int area_split_apply(bContext *C, wmOperator *op) float fac; int dir; - fac= RNA_float_get(op->ptr, "fac"); - dir= RNA_enum_get(op->ptr, "dir"); + fac= RNA_float_get(op->ptr, "factor"); + dir= RNA_enum_get(op->ptr, "direction"); sd->narea= area_split(CTX_wm_window(C), sc, sd->sarea, dir, fac); @@ -820,13 +818,13 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event) /* prepare operator state vars */ if(sad->gesture_dir==AZONE_N || sad->gesture_dir==AZONE_S) { dir= 'h'; - RNA_float_set(op->ptr, "fac", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx); + RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx); } else { dir= 'v'; - RNA_float_set(op->ptr, "fac", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); + RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); } - RNA_enum_set(op->ptr, "dir", dir); + RNA_enum_set(op->ptr, "direction", dir); /* general init, also non-UI case, adds customdata, sets area and defaults */ if(!area_split_init(C, op)) @@ -895,13 +893,13 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event) /* execute the events */ switch(event->type) { case MOUSEMOVE: - dir= RNA_enum_get(op->ptr, "dir"); + dir= RNA_enum_get(op->ptr, "direction"); 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); fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin; - RNA_float_set(op->ptr, "fac", fac / (float)sd->origsize); + RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize); WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); break; @@ -927,8 +925,6 @@ static EnumPropertyItem prop_direction_items[] = { void SCREEN_OT_area_split(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Split area"; ot->idname = "SCREEN_OT_area_split"; @@ -940,13 +936,8 @@ void SCREEN_OT_area_split(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna */ - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_direction_items); - RNA_def_property_enum_default(prop, 'h'); - - prop= RNA_def_property(ot->srna, "fac", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0, 1.0); - RNA_def_property_float_default(prop, 0.5f); + RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", ""); + RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0); } /* ************** frame change operator ***************************** */ @@ -976,7 +967,7 @@ void SCREEN_OT_frame_offset(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER; /* rna */ - RNA_def_property(ot->srna, "delta", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } /* ************** switch screen operator ***************************** */ @@ -1020,8 +1011,8 @@ void SCREEN_OT_screen_set(wmOperatorType *ot) ot->poll= ED_operator_screenactive; /* rna */ - RNA_def_property(ot->srna, "screen", PROP_POINTER, PROP_NONE); - RNA_def_property(ot->srna, "delta", PROP_INT, PROP_NONE); + RNA_def_pointer_runtime(ot->srna, "screen", &RNA_Screen, "Screen", ""); + RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } /* ************** screen full-area operator ***************************** */ @@ -1302,8 +1293,6 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) /* Operator for joining two areas (space types) */ void SCREEN_OT_area_join(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Join area"; ot->idname= "SCREEN_OT_area_join"; @@ -1316,14 +1305,10 @@ void SCREEN_OT_area_join(wmOperatorType *ot) ot->poll= ED_operator_screenactive; /* rna */ - prop= RNA_def_property(ot->srna, "x1", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, -100); - prop= RNA_def_property(ot->srna, "y1", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, -100); - prop= RNA_def_property(ot->srna, "x2", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, -100); - prop= RNA_def_property(ot->srna, "y2", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, -100); + RNA_def_int(ot->srna, "x1", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "y1", -100, INT_MIN, INT_MAX, "Y 1", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "x2", -100, INT_MIN, INT_MAX, "X 2", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "y2", -100, INT_MIN, INT_MAX, "Y 2", "", INT_MIN, INT_MAX); } /* ************** repeat last operator ***************************** */ @@ -1399,8 +1384,6 @@ static int repeat_history_exec(bContext *C, wmOperator *op) void SCREEN_OT_repeat_history(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Repeat History"; ot->idname= "SCREEN_OT_repeat_history"; @@ -1411,7 +1394,7 @@ void SCREEN_OT_repeat_history(wmOperatorType *ot) ot->poll= ED_operator_screenactive; - prop= RNA_def_property(ot->srna, "index", PROP_ENUM, PROP_NONE); + RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000); } /* ************** region split operator ***************************** */ @@ -1422,7 +1405,7 @@ static int region_split_exec(bContext *C, wmOperator *op) ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); ARegion *newar= BKE_area_region_copy(ar); - int dir= RNA_enum_get(op->ptr, "dir"); + int dir= RNA_enum_get(op->ptr, "direction"); BLI_insertlinkafter(&sa->regionbase, CTX_wm_region(C), newar); @@ -1440,8 +1423,6 @@ static int region_split_exec(bContext *C, wmOperator *op) void SCREEN_OT_region_split(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Split Region"; ot->idname= "SCREEN_OT_region_split"; @@ -1451,9 +1432,7 @@ void SCREEN_OT_region_split(wmOperatorType *ot) ot->exec= region_split_exec; ot->poll= ED_operator_areaactive; - prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_direction_items); - RNA_def_property_enum_default(prop, 'h'); + RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", ""); } /* ************** region flip operator ***************************** */ @@ -1579,11 +1558,11 @@ void SCREEN_OT_border_select(wmOperatorType *ot) ot->poll= ED_operator_areaactive; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } #endif @@ -1637,8 +1616,8 @@ void ED_keymap_screen(wmWindowManager *wm) WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* tests */ - RNA_enum_set(WM_keymap_add_item(keymap, "SCREEN_OT_region_split", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "dir", 'h'); - RNA_enum_set(WM_keymap_add_item(keymap, "SCREEN_OT_region_split", SKEY, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0)->ptr, "dir", 'v'); + RNA_enum_set(WM_keymap_add_item(keymap, "SCREEN_OT_region_split", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "direction", 'h'); + RNA_enum_set(WM_keymap_add_item(keymap, "SCREEN_OT_region_split", SKEY, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0)->ptr, "direction", 'v'); /*frame offsets*/ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", TIMER0, KM_ANY, KM_ANY, 0); diff --git a/source/blender/editors/sculpt/sculpt.c b/source/blender/editors/sculpt/sculpt.c index 0161a90c788..3ed12a379dd 100644 --- a/source/blender/editors/sculpt/sculpt.c +++ b/source/blender/editors/sculpt/sculpt.c @@ -1818,7 +1818,6 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op) static void SCULPT_OT_brush_stroke(wmOperatorType *ot) { - PropertyRNA *prop; float vec3f_def[] = {0,0,0}; int vec2i_def[] = {0,0}; @@ -1835,30 +1834,22 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) ot->poll= sculpt_brush_stroke_poll; /* properties */ - prop= RNA_def_property(ot->srna, "stroke", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorStrokeElement); + RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); /* If the object has a scaling factor, brushes also need to be scaled to work as expected. */ - prop= RNA_def_property(ot->srna, "scale", PROP_FLOAT, PROP_VECTOR); - RNA_def_property_array(prop, 3); - RNA_def_property_float_array_default(prop, vec3f_def); + RNA_def_float_vector(ot->srna, "scale", 3, vec3f_def, 0.0f, FLT_MAX, "Scale", "", 0.0f, 1000.0f); - prop= RNA_def_property(ot->srna, "flag", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "flag", 0, 0, INT_MAX, "flag", "", 0, INT_MAX); /* For mirror modifiers */ - prop= RNA_def_property(ot->srna, "clip_tolerance", PROP_FLOAT, PROP_VECTOR); - RNA_def_property_array(prop, 3); - RNA_def_property_float_array_default(prop, vec3f_def); + RNA_def_float_vector(ot->srna, "clip_tolerance", 3, vec3f_def, 0.0f, FLT_MAX, "clip_tolerance", "", 0.0f, 1000.0f); /* The initial 2D location of the mouse */ - prop= RNA_def_property(ot->srna, "initial_mouse", PROP_INT, PROP_VECTOR); - RNA_def_property_array(prop, 2); - RNA_def_property_int_array_default(prop, vec2i_def); + RNA_def_int_vector(ot->srna, "initial_mouse", 2, vec2i_def, INT_MIN, INT_MAX, "initial_mouse", "", INT_MIN, INT_MAX); /* The initial screen depth of the mouse */ - prop= RNA_def_property(ot->srna, "depth", PROP_FLOAT, PROP_NONE); - + RNA_def_float(ot->srna, "depth", 0.0f, 0.0f, FLT_MAX, "depth", "", 0.0f, FLT_MAX); } /**** Toggle operator for turning sculpt mode on or off ****/ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index c17e926559f..a1d4c09b9eb 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -693,8 +693,6 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_clean (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Clean Keyframes"; ot->idname= "ACT_OT_keyframes_clean"; @@ -708,8 +706,7 @@ void ACT_OT_keyframes_clean (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* properties */ - prop= RNA_def_property(ot->srna, "threshold", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 0.001f); + RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f); } /* ******************** Sample Keyframes Operator *********************** */ @@ -897,8 +894,6 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_expotype (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Set Keyframe Extrapolation"; ot->idname= "ACT_OT_keyframes_expotype"; @@ -912,8 +907,7 @@ void ACT_OT_keyframes_expotype (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* id-props */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_actkeys_expo_types); + RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", ""); } /* ******************** Set Interpolation-Type Operator *********************** */ @@ -978,8 +972,6 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_ipotype (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Set Keyframe Interpolation"; ot->idname= "ACT_OT_keyframes_ipotype"; @@ -993,8 +985,7 @@ void ACT_OT_keyframes_ipotype (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* id-props */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_actkeys_ipo_types); + RNA_def_enum(ot->srna, "type", prop_actkeys_ipo_types, 0, "Type", ""); } /* ******************** Set Handle-Type Operator *********************** */ @@ -1079,8 +1070,6 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_handletype (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Set Keyframe Handle Type"; ot->idname= "ACT_OT_keyframes_handletype"; @@ -1094,8 +1083,7 @@ void ACT_OT_keyframes_handletype (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* id-props */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_actkeys_handletype_types); + RNA_def_enum(ot->srna, "type", prop_actkeys_handletype_types, 0, "Type", ""); } /* ************************************************************************** */ @@ -1249,8 +1237,6 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_snap (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Snap Keys"; ot->idname= "ACT_OT_keyframes_snap"; @@ -1264,8 +1250,7 @@ void ACT_OT_keyframes_snap (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* id-props */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_actkeys_snap_types); + RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", ""); } /* ******************** Mirror Keyframes Operator *********************** */ @@ -1367,8 +1352,6 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_mirror (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Mirror Keys"; ot->idname= "ACT_OT_keyframes_mirror"; @@ -1382,8 +1365,7 @@ void ACT_OT_keyframes_mirror (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* id-props */ - prop= RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_actkeys_mirror_types); + RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", ""); } /* ************************************************************************** */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 0247b656923..7932690e1ff 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -338,7 +338,7 @@ void ACT_OT_keyframes_deselectall (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - RNA_def_property(ot->srna, "invert", PROP_BOOLEAN, PROP_NONE); + RNA_def_boolean(ot->srna, "invert", 0, "Invert", ""); } /* ******************** Border Select Operator **************************** */ @@ -507,13 +507,13 @@ void ACT_OT_keyframes_borderselect(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); - RNA_def_property(ot->srna, "axis_range", PROP_BOOLEAN, PROP_NONE); + RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } /* ******************** Column Select Operator **************************** */ @@ -728,8 +728,6 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op) void ACT_OT_keyframes_columnselect (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Select All"; ot->idname= "ACT_OT_keyframes_columnselect"; @@ -742,8 +740,7 @@ void ACT_OT_keyframes_columnselect (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; /* props */ - prop= RNA_def_property(ot->srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_column_select_types); + RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", ""); } /* ******************** Mouse-Click Select Operator *********************** */ @@ -1115,8 +1112,6 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even void ACT_OT_keyframes_clickselect (wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Mouse Select Keys"; ot->idname= "ACT_OT_keyframes_clickselect"; @@ -1127,10 +1122,9 @@ void ACT_OT_keyframes_clickselect (wmOperatorType *ot) /* id-props */ // XXX should we make this into separate operators? - prop= RNA_def_property(ot->srna, "left_right", PROP_ENUM, PROP_NONE); // ALTKEY - //RNA_def_property_enum_items(prop, prop_actkeys_clickselect_items); - prop= RNA_def_property(ot->srna, "extend_select", PROP_BOOLEAN, PROP_NONE); // SHIFTKEY - prop= RNA_def_property(ot->srna, "column_select", PROP_BOOLEAN, PROP_NONE); // CTRLKEY + RNA_def_enum(ot->srna, "left_right", NULL /* XXX prop_actkeys_clickselect_items */, 0, "Left Right", ""); // ALTKEY + RNA_def_boolean(ot->srna, "extend_select", 0, "Extend Select", ""); // SHIFTKEY + RNA_def_boolean(ot->srna, "column_select", 0, "Column Select", ""); // CTRLKEY } /* ************************************************************************** */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0205f9b85cf..c1d212e261f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -256,8 +256,6 @@ static int view_pan_cancel(bContext *C, wmOperator *op) void IMAGE_OT_view_pan(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "View Pan"; ot->idname= "IMAGE_OT_view_pan"; @@ -270,9 +268,8 @@ void IMAGE_OT_view_pan(wmOperatorType *ot) ot->poll= space_image_main_area_poll; /* properties */ - prop= RNA_def_property(ot->srna, "offset", PROP_FLOAT, PROP_VECTOR); - RNA_def_property_array(prop, 2); - RNA_def_property_ui_text(prop, "Offset", "Offset in floating point units, 1.0 is the width and height of the image."); + RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX, + "Offset", "Offset in floating point units, 1.0 is the width and height of the image.", -FLT_MAX, FLT_MAX); } /********************** view zoom operator *********************/ @@ -371,8 +368,6 @@ static int view_zoom_cancel(bContext *C, wmOperator *op) void IMAGE_OT_view_zoom(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "View Zoom"; ot->idname= "IMAGE_OT_view_zoom"; @@ -385,8 +380,8 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) ot->poll= space_image_main_area_poll; /* properties */ - prop= RNA_def_property(ot->srna, "factor", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_ui_text(prop, "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out."); + RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX, + "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out.", -FLT_MAX, FLT_MAX); } /********************** view all operator *********************/ @@ -582,8 +577,6 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op) void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "View Zoom Ratio"; ot->idname= "IMAGE_OT_view_zoom_ratio"; @@ -593,8 +586,8 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) ot->poll= space_image_main_area_poll; /* properties */ - prop= RNA_def_property(ot->srna, "ratio", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_ui_text(prop, "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out."); + RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX, + "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out.", -FLT_MAX, FLT_MAX); } /* Image functions */ diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index cad19982b20..ae07c76b4f6 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -117,9 +117,9 @@ static int node_select_exec(bContext *C, wmOperator *op) switch (select_type) { case NODE_SELECT_MOUSE: - mval[0] = RNA_int_get(op->ptr, "mx"); - mval[1] = RNA_int_get(op->ptr, "my"); - extend = RNA_int_get(op->ptr, "extend"); + mval[0] = RNA_int_get(op->ptr, "mouse_x"); + mval[1] = RNA_int_get(op->ptr, "mouse_y"); + extend = RNA_boolean_get(op->ptr, "extend"); node_mouse_select(snode, ar, mval, extend); break; } @@ -160,15 +160,15 @@ static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event) mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; - RNA_int_set(op->ptr, "mx", mval[0]); - RNA_int_set(op->ptr, "my", mval[1]); + RNA_int_set(op->ptr, "mouse_x", mval[0]); + RNA_int_set(op->ptr, "mouse_y", mval[1]); return node_select_exec(C,op); } static int node_extend_select_invoke(bContext *C, wmOperator *op, wmEvent *event) { - RNA_int_set(op->ptr, "extend", KM_SHIFT); + RNA_boolean_set(op->ptr, "extend", KM_SHIFT); return node_select_invoke(C, op, event); } @@ -181,8 +181,6 @@ static EnumPropertyItem prop_select_items[] = { void NODE_OT_extend_select(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Activate/Select (Shift)"; ot->idname= "NODE_OT_extend_select"; @@ -191,18 +189,15 @@ void NODE_OT_extend_select(wmOperatorType *ot) ot->invoke= node_extend_select_invoke; ot->poll= ED_operator_node_active; - prop = RNA_def_property(ot->srna, "select_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_items); + RNA_def_enum(ot->srna, "select_type", prop_select_items, 0, "Select Type", ""); - prop = RNA_def_property(ot->srna, "mx", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "my", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "extend", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "mouse_y", 0, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX); + RNA_def_boolean(ot->srna, "extend", 0, "Extend", ""); } void NODE_OT_select(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Activate/Select"; ot->idname= "NODE_OT_select"; @@ -212,12 +207,11 @@ void NODE_OT_select(wmOperatorType *ot) ot->poll= ED_operator_node_active; ot->modal= node_select_modal; - prop = RNA_def_property(ot->srna, "select_type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_items); + RNA_def_enum(ot->srna, "select_type", prop_select_items, 0, "Select Type", ""); - prop = RNA_def_property(ot->srna, "mx", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "my", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "extend", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "mouse_y", 0, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX); + RNA_def_boolean(ot->srna, "extend", 0, "Extend", ""); } /* ****** Border Select ****** */ @@ -263,8 +257,6 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) void NODE_OT_border_select(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Border Select"; ot->idname= "NODE_OT_border_select"; @@ -277,12 +269,11 @@ void NODE_OT_border_select(wmOperatorType *ot) ot->poll= ED_operator_node_active; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_types); -} \ No newline at end of file + RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", ""); +} diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index 3472cc77dcd..ea1d3e74305 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -158,8 +158,8 @@ static int node_toggle_visibility_exec(bContext *C, wmOperator *op) ARegion *ar= CTX_wm_region(C); short mval[2]; - mval[0] = RNA_int_get(op->ptr, "mx"); - mval[1] = RNA_int_get(op->ptr, "my"); + mval[0] = RNA_int_get(op->ptr, "mouse_x"); + mval[1] = RNA_int_get(op->ptr, "mouse_y"); node_toggle_visibility(snode, ar, mval); return OPERATOR_FINISHED; @@ -173,16 +173,14 @@ static int node_toggle_visibility_invoke(bContext *C, wmOperator *op, wmEvent *e mval[0]= event->x - ar->winrct.xmin; mval[1]= event->y - ar->winrct.ymin; - RNA_int_set(op->ptr, "mx", mval[0]); - RNA_int_set(op->ptr, "my", mval[1]); + RNA_int_set(op->ptr, "mouse_x", mval[0]); + RNA_int_set(op->ptr, "mouse_y", mval[1]); return node_toggle_visibility_exec(C,op); } void NODE_OT_toggle_visibility(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Toggle Visibility"; ot->idname= "NODE_OT_toggle_visibility"; @@ -191,8 +189,8 @@ void NODE_OT_toggle_visibility(wmOperatorType *ot) ot->invoke= node_toggle_visibility_invoke; ot->poll= ED_operator_node_active; - prop = RNA_def_property(ot->srna, "mx", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "my", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "mouse_y", 0, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX); } static int node_fit_all_exec(bContext *C, wmOperator *op) @@ -214,4 +212,4 @@ void NODE_OT_fit_all(wmOperatorType *ot) /* api callbacks */ ot->exec= node_fit_all_exec; ot->poll= ED_operator_node_active; -} \ No newline at end of file +} diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index cf3f1ca07da..1194d4b254c 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -75,7 +75,6 @@ static int run_pyfile_exec(bContext *C, wmOperator *op) void SCRIPT_OT_run_pyfile(wmOperatorType *ot) { - /* identifiers */ ot->name= "Run python file"; ot->idname= "SCRIPT_OT_run_pyfile"; @@ -84,5 +83,6 @@ void SCRIPT_OT_run_pyfile(wmOperatorType *ot) ot->exec= run_pyfile_exec; ot->poll= ED_operator_areaactive; - RNA_def_property(ot->srna, "filename", PROP_STRING, PROP_FILEPATH); + RNA_def_string_file_path(ot->srna, "filename", "", 512, "Filename", ""); } + diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 45226f93d93..a83621b48e9 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -660,7 +660,6 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event) void VIEW3D_OT_viewzoom(wmOperatorType *ot) { - /* identifiers */ ot->name= "Rotate view"; ot->idname= "VIEW3D_OT_viewzoom"; @@ -671,7 +670,7 @@ void VIEW3D_OT_viewzoom(wmOperatorType *ot) ot->modal= viewzoom_modal; ot->poll= ED_operator_view3d_active; - RNA_def_property(ot->srna, "delta", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ @@ -737,7 +736,6 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2. void VIEW3D_OT_viewhome(wmOperatorType *ot) { - /* identifiers */ ot->name= "View home"; ot->idname= "VIEW3D_OT_viewhome"; @@ -746,7 +744,7 @@ void VIEW3D_OT_viewhome(wmOperatorType *ot) ot->exec= viewhome_exec; ot->poll= ED_operator_view3d_active; - RNA_def_property(ot->srna, "center", PROP_BOOLEAN, PROP_NONE); + RNA_def_boolean(ot->srna, "center", 0, "Center", ""); } static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */ @@ -936,7 +934,6 @@ static int view3d_render_border_invoke(bContext *C, wmOperator *op, wmEvent *eve void VIEW3D_OT_render_border(wmOperatorType *ot) { - /* identifiers */ ot->name= "Set Render Border"; ot->idname= "VIEW3D_OT_render_border"; @@ -949,10 +946,10 @@ void VIEW3D_OT_render_border(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* rna */ - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ********************* Border Zoom operator ****************** */ @@ -1112,10 +1109,10 @@ void VIEW3D_OT_border_zoom(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* rna */ - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ********************* Changing view operator ****************** */ @@ -1176,7 +1173,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) static int perspo=V3D_PERSP; int viewnum; - viewnum = RNA_enum_get(op->ptr, "viewnum"); + viewnum = RNA_enum_get(op->ptr, "view"); /* Use this to test if we started out with a camera */ @@ -1328,9 +1325,6 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) void VIEW3D_OT_viewnumpad(wmOperatorType *ot) { - - PropertyRNA *prop; - /* identifiers */ ot->name= "View numpad"; ot->idname= "VIEW3D_OT_viewnumpad"; @@ -1340,8 +1334,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; ot->flag= OPTYPE_REGISTER; - prop = RNA_def_property(ot->srna, "viewnum", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_view_items); + RNA_def_enum(ot->srna, "view", prop_view_items, 0, "View", ""); } /* ********************* set clipping operator ****************** */ @@ -1442,10 +1435,10 @@ void VIEW3D_OT_clipping(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* rna */ - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); } /* ********************* draw type operator ****************** */ @@ -1456,8 +1449,8 @@ static int view3d_drawtype_exec(bContext *C, wmOperator *op) View3D *v3d= sa->spacedata.first; int dt, dt_alt; - dt = RNA_int_get(op->ptr, "drawtype"); - dt_alt = RNA_int_get(op->ptr, "drawtype_alt"); + dt = RNA_int_get(op->ptr, "draw_type"); + dt_alt = RNA_int_get(op->ptr, "draw_type_alternate"); if (dt_alt != -1) { @@ -1488,8 +1481,6 @@ static int view3d_drawtype_invoke(bContext *C, wmOperator *op, wmEvent *event) /* toggles */ void VIEW3D_OT_drawtype(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Change draw type"; ot->idname= "VIEW3D_OT_drawtype"; @@ -1500,10 +1491,9 @@ void VIEW3D_OT_drawtype(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; - /* rna */ - RNA_def_property(ot->srna, "drawtype", PROP_INT, PROP_NONE); - prop = RNA_def_property(ot->srna, "drawtype_alt", PROP_INT, PROP_NONE); - RNA_def_property_int_default(prop, -1); + /* rna XXX should become enum */ + RNA_def_int(ot->srna, "draw_type", 0, INT_MIN, INT_MAX, "Draw Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "draw_type_alternate", -1, INT_MIN, INT_MAX, "Draw Type Alternate", "", INT_MIN, INT_MAX); } /* ***************** 3d cursor cursor op ******************* */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 0d95ff2f7eb..4f86c5e0c36 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -711,23 +711,16 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op) void VIEW3D_OT_lasso_select(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name= "Lasso Select"; ot->idname= "VIEW3D_OT_lasso_select"; ot->invoke= WM_gesture_lasso_invoke; ot->modal= WM_gesture_lasso_modal; ot->exec= view3d_lasso_select_exec; - ot->poll= WM_operator_winactive; - prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); - - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, lasso_select_types); - + RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_enum(ot->srna, "type", lasso_select_types, 0, "Type", ""); } @@ -1499,8 +1492,6 @@ static EnumPropertyItem prop_select_types[] = { /* ****** Border Select ****** */ void VIEW3D_OT_borderselect(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Border Select"; ot->idname= "VIEW3D_OT_borderselect"; @@ -1513,14 +1504,13 @@ void VIEW3D_OT_borderselect(wmOperatorType *ot) ot->poll= ED_operator_view3d_active; /* rna */ - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "xmax", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymin", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "ymax", PROP_INT, PROP_NONE); - - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_types); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); + + RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", ""); } /* ****** Mouse Select ****** */ @@ -1558,8 +1548,6 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) void VIEW3D_OT_select(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Activate/Select"; ot->idname= "VIEW3D_OT_select"; @@ -1568,8 +1556,8 @@ void VIEW3D_OT_select(wmOperatorType *ot) ot->invoke= view3d_select_invoke; ot->poll= ED_operator_view3d_active; - prop = RNA_def_property(ot->srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_select_types); + /* properties */ + RNA_def_enum(ot->srna, "type", prop_select_types, 0, "Type", ""); } @@ -1795,9 +1783,8 @@ void VIEW3D_OT_circle_select(wmOperatorType *ot) ot->exec= view3d_circle_select_exec; ot->poll= ED_operator_view3d_active; - RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "radius", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "event_type", PROP_INT, PROP_NONE); - + RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "radius", 0, INT_MIN, INT_MAX, "Radius", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 5028440e1db..2eec6252c18 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -134,7 +134,6 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event) void TFM_OT_transform(struct wmOperatorType *ot) { - PropertyRNA *prop; static const float value[4] = {0, 0, 0}; static const float mtx[3][3] = {{1, 0, 0},{0, 1, 0},{0, 0, 1}}; @@ -150,19 +149,15 @@ void TFM_OT_transform(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_areaactive; - RNA_def_property(ot->srna, "mode", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "options", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "mode", 0, INT_MIN, INT_MAX, "Mode", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "options", 0, INT_MIN, INT_MAX, "Options", "", INT_MIN, INT_MAX); - prop = RNA_def_property(ot->srna, "values", PROP_FLOAT, PROP_VECTOR); - RNA_def_property_array(prop, 4); - RNA_def_property_float_array_default(prop, value); + RNA_def_float_vector(ot->srna, "values", 4, value, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); - RNA_def_property(ot->srna, "constraint_orientation", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "constraint_mode", PROP_INT, PROP_NONE); + RNA_def_int(ot->srna, "constraint_orientation", 0, INT_MIN, INT_MAX, "Constraint Orientation", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "constraint_mode", 0, INT_MIN, INT_MAX, "Constraint Mode", "", INT_MIN, INT_MAX); - prop = RNA_def_property(ot->srna, "constraint_matrix", PROP_FLOAT, PROP_MATRIX); - RNA_def_property_array(prop, 9); - RNA_def_property_float_array_default(prop, mtx[0]); + RNA_def_float_matrix(ot->srna, "constraint_matrix", 9, mtx[0], -FLT_MAX, FLT_MAX, "Constraint Matrix", "", -FLT_MAX, FLT_MAX); } void transform_operatortypes(void) diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 7dc4b6919e9..e097511e466 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -477,7 +477,6 @@ static int mirror_exec(bContext *C, wmOperator *op) void UV_OT_mirror(wmOperatorType *ot) { - PropertyRNA *prop; static EnumPropertyItem axis_items[] = { {'x', "MIRROR_X", "Mirror X", "Mirror UVs over X axis."}, {'y', "MIRROR_Y", "Mirror Y", "Mirror UVs over Y axis."}, @@ -493,10 +492,7 @@ void UV_OT_mirror(wmOperatorType *ot) ot->poll= ED_operator_uvedit; /* properties */ - prop= RNA_def_property(ot->srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, axis_items); - RNA_def_property_enum_default(prop, 'x'); - RNA_def_property_ui_text(prop, "Axis", "Axis to mirror UV locations over."); + RNA_def_enum(ot->srna, "axis", axis_items, 'x', "Axis", "Axis to mirror UV locations over."); } /* ******************** align operator **************** */ @@ -600,7 +596,6 @@ static int align_exec(bContext *C, wmOperator *op) void UV_OT_align(wmOperatorType *ot) { - PropertyRNA *prop; static EnumPropertyItem axis_items[] = { {'a', "ALIGN_AUTO", "Align Auto", "Automatically choose the axis on which there is most alignment already."}, {'x', "ALIGN_X", "Align X", "Align UVs on X axis."}, @@ -617,10 +612,7 @@ void UV_OT_align(wmOperatorType *ot) ot->poll= ED_operator_uvedit; /* properties */ - prop= RNA_def_property(ot->srna, "axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, axis_items); - RNA_def_property_enum_default(prop, 'a'); - RNA_def_property_ui_text(prop, "Axis", "Axis to align UV locations on."); + RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on."); } /* ******************** weld operator **************** */ @@ -817,8 +809,6 @@ static int stitch_exec(bContext *C, wmOperator *op) void UV_OT_stitch(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name= "Stitch"; ot->idname= "UV_OT_stitch"; @@ -829,13 +819,8 @@ void UV_OT_stitch(wmOperatorType *ot) ot->poll= ED_operator_uvedit; /* properties */ - prop= RNA_def_property(ot->srna, "use_limit", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_default(prop, 1); - RNA_def_property_ui_text(prop, "Use Limit", "Stitch UVs within a specified limit distance."); - - prop= RNA_def_property(ot->srna, "limit", PROP_FLOAT, PROP_UNSIGNED); - RNA_def_property_float_default(prop, 20.0); - RNA_def_property_ui_text(prop, "Limit", "Limit distance in image pixels."); + RNA_def_boolean(ot->srna, "use_limit", 1, "Use Limit", "Stitch UVs within a specified limit distance."); + RNA_def_float(ot->srna, "limit", 20.0, 0.0f, FLT_MAX, "Limit", "Limit distance in image pixels.", -FLT_MAX, FLT_MAX); } /* ******************** (de)select all operator **************** */ diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 0ea769088bc..270533cb5f7 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -27,6 +27,9 @@ /* Functions used during preprocess and runtime, for defining the RNA. */ +#include +#include + #include "DNA_listBase.h" #include "RNA_types.h" @@ -50,7 +53,48 @@ void RNA_def_struct_identifier(StructRNA *srna, const char *identifier); void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description); void RNA_struct_free(BlenderRNA *brna, StructRNA *srna); -/* Property */ +/* Compact Property Definitions */ + +PropertyRNA *RNA_def_boolean(StructRNA *srna, const char *identifier, int default_value, + const char *ui_name, const char *ui_description); + +PropertyRNA *RNA_def_int(StructRNA *srna, const char *identifier, int default_value, int hardmin, int hardmax, + const char *ui_name, const char *ui_description, int softmin, int softmax); +PropertyRNA *RNA_def_int_vector(StructRNA *srna, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, + const char *ui_name, const char *ui_description, int softmin, int softmax); +PropertyRNA *RNA_def_int_array(StructRNA *srna, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, + const char *ui_name, const char *ui_description, int softmin, int softmax); + +PropertyRNA *RNA_def_string(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_string_file_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_string_dir_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description); + +PropertyRNA *RNA_def_enum(StructRNA *srna, const char *identifier, EnumPropertyItem *items, int default_value, + const char *ui_name, const char *ui_description); + +PropertyRNA *RNA_def_float(StructRNA *srna, const char *identifier, float default_value, float hardmin, float hardmax, + const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_vector(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_color(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_matrix(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_rotation(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_array(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax); + +PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description); + +PropertyRNA *RNA_def_collection_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description); + +/* Extended Property Definitions */ PropertyRNA *RNA_def_property(StructRNA *srna, const char *identifier, int type, int subtype); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 844f3ea5451..7dab55ee4f5 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1548,3 +1548,227 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con } } +/* Compact definitions */ + +PropertyRNA *RNA_def_boolean(StructRNA *srna, const char *identifier, int default_value, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_int(StructRNA *srna, const char *identifier, int default_value, int hardmin, int hardmax, + const char *ui_name, const char *ui_description, int softmin, int softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_NONE); + RNA_def_property_int_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_int_vector(StructRNA *srna, const char *identifier, int len, const int *default_value, + int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_VECTOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_int_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_int_array(StructRNA *srna, const char *identifier, int len, const int *default_value, + int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_INT, PROP_NONE); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_int_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_string(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_NONE); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_string_file_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_FILEPATH); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_string_dir_path(StructRNA *srna, const char *identifier, const char *default_value, int maxlen, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_STRING, PROP_DIRPATH); + if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen); + RNA_def_property_string_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_enum(StructRNA *srna, const char *identifier, EnumPropertyItem *items, int default_value, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, items); + RNA_def_property_enum_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_float(StructRNA *srna, const char *identifier, float default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_NONE); + RNA_def_property_float_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_vector(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_VECTOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_color(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_COLOR); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + + +PropertyRNA *RNA_def_float_matrix(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_MATRIX); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_rotation(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_ROTATION); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_float_array(StructRNA *srna, const char *identifier, int len, const float *default_value, + float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_FLOAT, PROP_NONE); + if(len != 0) RNA_def_property_array(prop, len); + RNA_def_property_float_array_default(prop, default_value); + if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); + RNA_def_property_ui_text(prop, ui_name, ui_description); + RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + + return prop; +} + +PropertyRNA *RNA_def_pointer_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_POINTER, PROP_NONE); + RNA_def_property_struct_runtime(prop, type); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_collection_runtime(StructRNA *srna, const char *identifier, StructRNA *type, + const char *ui_name, const char *ui_description) +{ + PropertyRNA *prop; + + prop= RNA_def_property(srna, identifier, PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_runtime(prop, type); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + -- cgit v1.2.3