本文整理汇总了C++中RNA_int_set函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_int_set函数的具体用法?C++ RNA_int_set怎么用?C++ RNA_int_set使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_int_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nlaedit_select_leftright_invoke
static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
bAnimContext ac;
short leftright = RNA_enum_get(op->ptr, "mode");
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* handle mode-based testing */
if (leftright == NLAEDIT_LRSEL_TEST) {
Scene *scene = ac.scene;
ARegion *ar = ac.ar;
View2D *v2d = &ar->v2d;
float x;
/* determine which side of the current frame mouse is on */
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
if (x < CFRA)
RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT);
else
RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
}
/* perform selection */
return nlaedit_select_leftright_exec(C, op);
}
示例2: node_select_invoke
static int node_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
return node_select_exec(C, op);
}
示例3: ED_view3d_operator_properties_viewmat_set
void ED_view3d_operator_properties_viewmat_set(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
if (!RNA_struct_property_is_set(op->ptr, "region_width"))
RNA_int_set(op->ptr, "region_width", ar->winx);
if (!RNA_struct_property_is_set(op->ptr, "region_height"))
RNA_int_set(op->ptr, "region_height", ar->winy);
if (!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
RNA_float_set_array(op->ptr, "perspective_matrix", (float *)rv3d->persmat);
}
示例4: graphview_cursor_setprops
/* set the operator properties from the initial event */
static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
float viewx, viewy;
int frame;
/* abort if not active region (should not really be possible) */
if (ar == NULL)
return;
/* convert from region coordinates to View2D 'tot' space */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
/* frame is rounded to the nearest int, since frames are ints */
frame = iroundf(viewx);
if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
CLAMP(frame, PSFRA, PEFRA);
}
/* store the values in the operator properties */
RNA_int_set(op->ptr, "frame", frame);
RNA_float_set(op->ptr, "value", viewy);
}
示例5: change_frame_modal
/* Modal event handling of frame changing */
static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
/* execute the events */
switch (event->type) {
case ESCKEY:
return OPERATOR_FINISHED;
case MOUSEMOVE:
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
change_frame_apply(C, op);
break;
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE:
/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
* the modal op) doesn't work for some reason
*/
if (event->val == KM_RELEASE)
return OPERATOR_FINISHED;
break;
}
return OPERATOR_RUNNING_MODAL;
}
示例6: ed_marker_move_cancel
/* only for modal */
static void ed_marker_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "frames", 0);
ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
}
示例7: ed_marker_move_cancel
/* only for modal */
static int ed_marker_move_cancel(bContext *C, wmOperator *op)
{
RNA_int_set(op->ptr, "frames", 0);
ed_marker_move_apply(C, op);
ed_marker_move_exit(C, op);
return OPERATOR_CANCELLED;
}
示例8: actkeys_duplicate_invoke
static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
actkeys_duplicate_exec(C, op);
RNA_int_set(op->ptr, "mode", TFM_TIME_TRANSLATE);
WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
return OPERATOR_FINISHED;
}
示例9: wm_alembic_export_draw
static void wm_alembic_export_draw(bContext *C, wmOperator *op)
{
PointerRNA ptr;
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
/* Conveniently set start and end frame to match the scene's frame range. */
Scene *scene = CTX_data_scene(C);
if (scene != NULL && RNA_boolean_get(&ptr, "init_scene_frame_range")) {
RNA_int_set(&ptr, "start", SFRA);
RNA_int_set(&ptr, "end", EFRA);
RNA_boolean_set(&ptr, "init_scene_frame_range", false);
}
ui_alembic_export_settings(op->layout, &ptr);
}
示例10: gp_convert_set_end_frame
/* Check end_frame is always > start frame! */
static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UNUSED(scene), struct PointerRNA *ptr)
{
int start_frame = RNA_int_get(ptr, "start_frame");
int end_frame = RNA_int_get(ptr, "end_frame");
if (end_frame <= start_frame) {
RNA_int_set(ptr, "end_frame", start_frame + 1);
}
}
示例11: pose_groups_menu_invoke
/* invoke callback which presents a list of bone-groups for the user to choose from */
static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
Object *ob = ED_pose_object_from_context(C);
bPose *pose;
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "type");
uiPopupMenu *pup;
uiLayout *layout;
bActionGroup *grp;
int i;
/* only continue if there's an object, and a pose there too */
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
pose = ob->pose;
/* If group index is set, try to use it! */
if (RNA_property_is_set(op->ptr, prop)) {
const int num_groups = BLI_listbase_count(&pose->agroups);
const int group = RNA_property_int_get(op->ptr, prop);
/* just use the active group index, and call the exec callback for the calling operator */
if (group > 0 && group <= num_groups) {
return op->type->exec(C, op);
}
}
/* if there's no active group (or active is invalid), create a new menu to find it */
if (pose->active_group <= 0) {
/* create a new menu, and start populating it with group names */
pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
layout = UI_popup_menu_layout(pup);
/* special entry - allow to create new group, then use that
* (not to be used for removing though)
*/
if (strstr(op->idname, "assign")) {
uiItemIntO(layout, "New Group", ICON_NONE, op->idname, "type", 0);
uiItemS(layout);
}
/* add entries for each group */
for (grp = pose->agroups.first, i = 1; grp; grp = grp->next, i++)
uiItemIntO(layout, grp->name, ICON_NONE, op->idname, "type", i);
/* finish building the menu, and process it (should result in calling self again) */
UI_popup_menu_end(C, pup);
return OPERATOR_INTERFACE;
}
else {
/* just use the active group index, and call the exec callback for the calling operator */
RNA_int_set(op->ptr, "type", pose->active_group);
return op->type->exec(C, op);
}
}
示例12: pose_calculate_paths_invoke
/* show popup to determine settings */
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
/* set default settings from existing/stored settings */
{
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
RNA_int_set(op->ptr, "start_frame", avs->path_sf);
RNA_int_set(op->ptr, "end_frame", avs->path_ef);
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
}
/* show popup dialog to allow editing of range... */
// FIXME: hardcoded dimensions here are just arbitrary
return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
}
示例13: change_frame_invoke
/* Modal Operator init */
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
/* Change to frame that mouse is over before adding modal handler,
* as user could click on a single frame (jump to frame) as well as
* click-dragging over a range (modal scrubbing).
*/
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
change_frame_apply(C, op);
/* add temp handler */
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
}
示例14: view3d_layers_invoke
/* the local per-keymap-entry keymap will solve it */
static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(event->ctrl || event->oskey)
return OPERATOR_PASS_THROUGH;
if(event->shift)
RNA_boolean_set(op->ptr, "extend", 1);
if(event->alt) {
int nr= RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
view3d_layers_exec(C, op);
return OPERATOR_FINISHED;
}
示例15: select_report_pick_invoke
static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceInfo *sinfo = CTX_wm_space_info(C);
ARegion *ar = CTX_wm_region(C);
ReportList *reports = CTX_wm_reports(C);
Report *report;
/* uses opengl */
wmSubWindowSet(CTX_wm_window(C), ar->swinid);
report = info_text_pick(sinfo, ar, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
return select_report_pick_exec(C, op);
}