Blender
V3.3
|
#include "DNA_ID_enums.h"
#include "DNA_space_types.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BLI_math_base.h"
#include "BLI_rect.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "RNA_prototypes.h"
#include "ED_select_utils.h"
#include "WM_api.h"
#include "WM_types.h"
Go to the source code of this file.
Generic re-usable property definitions and accessors for operators to share. (WM_operator_properties_*
functions).
Definition in file wm_operator_props.c.
void WM_operator_properties_border | ( | wmOperatorType * | ot | ) |
Definition at line 380 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_int(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ANIM_OT_previewrange_set(), IMAGE_OT_render_border(), PAINT_OT_hide_show(), PAINT_OT_mask_box_gesture(), SCULPT_OT_face_set_box_gesture(), SCULPT_OT_trim_box_gesture(), VIEW3D_OT_clip_border(), VIEW3D_OT_render_border(), WM_operator_properties_gesture_box_ex(), and WM_operator_properties_gesture_box_zoom().
void WM_operator_properties_border_to_rctf | ( | struct wmOperator * | op, |
rctf * | rect | ||
) |
Definition at line 405 of file wm_operator_props.c.
References BLI_rctf_rcti_copy(), and WM_operator_properties_border_to_rcti().
Referenced by box_select_graph_exec(), ed_marker_box_select_exec(), image_view_zoom_border_exec(), blender::ed::space_node::node_box_select_exec(), outliner_box_select_exec(), render_border_exec(), sequencer_box_select_exec(), uv_box_select_exec(), view_borderzoom_exec(), and view_ghost_border_exec().
void WM_operator_properties_border_to_rcti | ( | struct wmOperator * | op, |
rcti * | rect | ||
) |
Definition at line 397 of file wm_operator_props.c.
References wmOperator::ptr, RNA_int_get(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by actkeys_box_select_exec(), animchannels_box_select_exec(), box_select_exec(), file_box_select_exec(), file_box_select_modal(), gpencil_box_select_exec(), graphkeys_box_select_exec(), nlaedit_box_select_exec(), previewrange_define_exec(), render_border_exec(), sculpt_gesture_init_from_box(), view3d_box_select_exec(), view3d_clipping_exec(), view3d_zoom_border_exec(), blender::ed::space_node::viewer_border_exec(), and WM_operator_properties_border_to_rctf().
void WM_operator_properties_checker_interval | ( | struct wmOperatorType * | ot, |
bool | nth_can_disable | ||
) |
nth_can_disable | Enable if we want to be able to select no interval at all. |
Definition at line 603 of file wm_operator_props.c.
References min_ii(), ot, RNA_def_int(), and wmOperatorType::srna.
Referenced by CURVE_OT_select_nth(), MESH_OT_select_nth(), and path_select_properties().
void WM_operator_properties_checker_interval_from_op | ( | struct wmOperator * | op, |
struct CheckerIntervalParams * | op_params | ||
) |
Definition at line 636 of file wm_operator_props.c.
References mod_i(), CheckerIntervalParams::nth, offset, CheckerIntervalParams::offset, wmOperator::ptr, RNA_int_get(), and CheckerIntervalParams::skip.
Referenced by edbm_select_nth_exec(), path_select_params_from_op(), and select_nth_exec().
bool WM_operator_properties_checker_interval_test | ( | const struct CheckerIntervalParams * | op_params, |
int | depth | ||
) |
Definition at line 650 of file wm_operator_props.c.
References CheckerIntervalParams::nth, CheckerIntervalParams::offset, and CheckerIntervalParams::skip.
Referenced by mouse_mesh_shortest_path_edge(), mouse_mesh_shortest_path_face(), mouse_mesh_shortest_path_vert(), mouse_mesh_uv_shortest_path_edge(), mouse_mesh_uv_shortest_path_face(), mouse_mesh_uv_shortest_path_vert(), select_nth_bezt(), select_nth_bp(), and walker_deselect_nth().
void WM_operator_properties_confirm_or_exec | ( | wmOperatorType * | ot | ) |
Definition at line 32 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ACTION_OT_delete(), FILE_OT_directory_new(), GRAPH_OT_delete(), MARKER_OT_delete(), and OBJECT_OT_delete().
void WM_operator_properties_filesel | ( | struct wmOperatorType * | ot, |
int | filter, | ||
short | type, | ||
eFileSel_Action | action, | ||
eFileSel_Flag | flag, | ||
short | display, | ||
short | sort | ||
) |
Default properties for file-select.
Definition at line 64 of file wm_operator_props.c.
References DummyRNA_NULL_items, FILE_DEFAULTDISPLAY, FILE_HORIZONTALDISPLAY, FILE_IMGDISPLAY, FILE_LOADLIB, FILE_MAX, FILE_SAVE, FILE_SPECIAL, FILE_TYPE_ALEMBIC, FILE_TYPE_ARCHIVE, FILE_TYPE_BLENDER, FILE_TYPE_BLENDER_BACKUP, FILE_TYPE_BLENDERLIB, FILE_TYPE_BTX, FILE_TYPE_COLLADA, FILE_TYPE_FOLDER, FILE_TYPE_FTFONT, FILE_TYPE_IMAGE, FILE_TYPE_MOVIE, FILE_TYPE_OBJECT_IO, FILE_TYPE_PYSCRIPT, FILE_TYPE_SOUND, FILE_TYPE_TEXT, FILE_TYPE_USD, FILE_TYPE_VOLUME, FILE_VERTICALDISPLAY, filter(), NULL, ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_collection_runtime(), RNA_def_enum(), RNA_def_enum_funcs(), RNA_def_int(), RNA_def_property_flag(), RNA_def_string_dir_path(), RNA_def_string_file_name(), RNA_def_string_file_path(), sort(), wmOperatorType::srna, type, WM_FILESEL_DIRECTORY, WM_FILESEL_FILENAME, WM_FILESEL_FILEPATH, WM_FILESEL_FILES, WM_FILESEL_RELPATH, WM_FILESEL_SHOW_PROPS, and wm_operator_properties_filesel_sort_items_itemf().
Referenced by ASSET_OT_bundle_install(), BUTTONS_OT_directory_browse(), BUTTONS_OT_file_browse(), CACHEFILE_OT_layer_add(), CACHEFILE_OT_open(), CLIP_OT_open(), ED_OT_lib_id_load_custom_preview(), FILE_OT_find_missing_files(), FONT_OT_open(), FONT_OT_text_paste_from_file(), GRAPH_OT_sound_bake(), IMAGE_OT_file_browse(), IMAGE_OT_open(), IMAGE_OT_replace(), IMAGE_OT_save_as(), blender::ed::space_node::NODE_OT_add_file(), OBJECT_OT_multires_external_save(), OBJECT_OT_volume_import(), PREFERENCES_OT_asset_library_add(), RIGIDBODY_OT_world_export(), screen_screenshot_impl(), SEQUENCER_OT_change_path(), SEQUENCER_OT_export_subtitles(), SEQUENCER_OT_image_strip_add(), SEQUENCER_OT_movie_strip_add(), SEQUENCER_OT_sound_strip_add(), SOUND_OT_mixdown(), SOUND_OT_open(), SOUND_OT_open_mono(), TEXT_OT_open(), TEXT_OT_save_as(), VIEW3D_OT_background_image_add(), WM_OT_append(), WM_OT_lib_reload(), WM_OT_lib_relocate(), WM_OT_link(), WM_OT_open_mainfile(), WM_OT_recover_auto_save(), WM_OT_save_as_mainfile(), and WM_OT_save_mainfile().
|
static |
Extends rna_enum_fileselect_params_sort_items with a default item for operators to use.
Definition at line 43 of file wm_operator_props.c.
References FILE_SORT_DEFAULT, rna_enum_fileselect_params_sort_items, RNA_enum_item_add(), RNA_enum_item_end(), and RNA_enum_items_add().
Referenced by WM_operator_properties_filesel().
void WM_operator_properties_generic_select | ( | struct wmOperatorType * | ot | ) |
Selecting and tweaking items are overlapping operations. Getting both to work without conflicts requires special care. See https://wiki.blender.org/wiki/Human_Interface_Guidelines/Selection#Select-tweaking for the desired behavior.
For default click selection (with no modifier keys held), the select operators can do the following:
This utility, together with WM_generic_select_invoke() and WM_generic_select_modal() should help getting the wanted behavior to work. Most generic logic should be handled in these, so that the select operators only have to care for the case dependent handling.
Every select operator has slightly different requirements, e.g. sequencer strip selection also needs to account for handle selection. This should be the baseline behavior though.
Definition at line 497 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_int(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ACTION_OT_clickselect(), FILE_OT_select(), GRAPH_OT_clickselect(), MARKER_OT_select(), NLA_OT_click_select(), and SEQUENCER_OT_select().
void WM_operator_properties_gesture_box | ( | wmOperatorType * | ot | ) |
Definition at line 447 of file wm_operator_props.c.
References ot, and WM_operator_properties_gesture_box_ex().
Referenced by ACTION_OT_select_box(), CLIP_OT_select_box(), FILE_OT_select_box(), GPENCIL_OT_select_box(), GRAPH_OT_select_box(), INFO_OT_select_box(), MARKER_OT_select_box(), MASK_OT_select_box(), NLA_OT_select_box(), blender::ed::space_node::NODE_OT_select_box(), blender::ed::space_node::NODE_OT_viewer_border(), OUTLINER_OT_select_box(), SEQUENCER_OT_select_box(), SEQUENCER_OT_view_ghost_border(), UV_OT_select_box(), VIEW2D_OT_smoothview(), and VIEW3D_OT_select_box().
void WM_operator_properties_gesture_box_ex | ( | struct wmOperatorType * | ot, |
bool | deselect, | ||
bool | extend | ||
) |
Use with WM_gesture_box_invoke
Definition at line 412 of file wm_operator_props.c.
References ot, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), wmOperatorType::srna, and WM_operator_properties_border().
Referenced by WM_operator_properties_gesture_box(), and WM_operator_properties_gesture_box_select().
void WM_operator_properties_gesture_box_select | ( | wmOperatorType * | ot | ) |
Definition at line 443 of file wm_operator_props.c.
References ot, and WM_operator_properties_gesture_box_ex().
Referenced by ANIM_OT_channels_select_box(), and CLIP_OT_graph_select_box().
void WM_operator_properties_gesture_box_zoom | ( | wmOperatorType * | ot | ) |
Definition at line 512 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), wmOperatorType::srna, and WM_operator_properties_border().
Referenced by IMAGE_OT_view_zoom_border(), VIEW2D_OT_zoom_border(), and VIEW3D_OT_zoom_border().
void WM_operator_properties_gesture_circle | ( | struct wmOperatorType * | ot | ) |
Use with WM_gesture_circle_invoke
Definition at line 557 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_int(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ACTION_OT_select_circle(), CLIP_OT_select_circle(), GPENCIL_OT_select_circle(), GRAPH_OT_select_circle(), MASK_OT_select_circle(), blender::ed::space_node::NODE_OT_select_circle(), UV_OT_select_circle(), and VIEW3D_OT_select_circle().
void WM_operator_properties_gesture_lasso | ( | struct wmOperatorType * | ot | ) |
Use with WM_gesture_lasso_invoke
Definition at line 521 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_collection_runtime(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by ACTION_OT_select_lasso(), CLIP_OT_select_lasso(), GPENCIL_OT_select_lasso(), GPENCIL_OT_stroke_cutter(), GRAPH_OT_select_lasso(), MASK_OT_select_lasso(), blender::ed::space_node::NODE_OT_select_lasso(), PAINT_OT_mask_lasso_gesture(), SCULPT_OT_face_set_lasso_gesture(), SCULPT_OT_trim_lasso_gesture(), UV_OT_select_lasso(), and VIEW3D_OT_select_lasso().
void WM_operator_properties_gesture_straightline | ( | struct wmOperatorType * | ot, |
int | cursor | ||
) |
Use with WM_gesture_straightline_invoke
Definition at line 528 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_int(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by IMAGE_OT_sample_line(), MESH_OT_bisect(), PAINT_OT_mask_line_gesture(), PAINT_OT_weight_gradient(), and SCULPT_OT_project_line_gesture().
void WM_operator_properties_id_lookup | ( | wmOperatorType * | ot, |
const bool | add_name_prop | ||
) |
Adds "name" and "session_uuid" properties so the caller can tell the operator which ID to act on. See WM_operator_properties_id_lookup_from_name_or_session_uuid(). Both properties will be hidden in the UI and not be saved over consecutive operator calls.
Definition at line 271 of file wm_operator_props.c.
References INT32_MAX, INT32_MIN, MAX_ID_NAME, NULL, ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_int(), RNA_def_property_flag(), RNA_def_string(), and wmOperatorType::srna.
Referenced by blender::ed::space_node::NODE_OT_add_collection(), blender::ed::space_node::NODE_OT_add_file(), blender::ed::space_node::NODE_OT_add_group(), blender::ed::space_node::NODE_OT_add_mask(), blender::ed::space_node::NODE_OT_add_object(), OBJECT_OT_add_named(), OBJECT_OT_collection_external_asset_drop(), OBJECT_OT_collection_instance_add(), OBJECT_OT_data_instance_add(), OBJECT_OT_drop_named_image(), OBJECT_OT_drop_named_material(), UI_OT_drop_material(), VIEW3D_OT_background_image_add(), and VIEW3D_OT_drop_world().
ID* WM_operator_properties_id_lookup_from_name_or_session_uuid | ( | struct Main * | bmain, |
PointerRNA * | ptr, | ||
enum ID_Type | type | ||
) |
Tries to find an ID in bmain. There needs to be either a "session_uuid" int or "name" string property defined and set. The former has priority. See WM_operator_properties_id_lookup() for a helper to add the properties.
Definition at line 245 of file wm_operator_props.c.
References BKE_libblock_find_name(), BKE_libblock_find_session_uuid(), MAX_ID_NAME, NULL, ptr, RNA_property_int_get(), RNA_property_is_set(), RNA_property_string_get(), RNA_struct_find_property(), and type.
Referenced by collection_add_info_get_from_op(), drop_named_material_invoke(), drop_world_exec(), blender::ed::space_node::node_add_collection_exec(), blender::ed::space_node::node_add_group_get_and_poll_group_node_tree(), blender::ed::space_node::node_add_mask_exec(), blender::ed::space_node::node_add_object_exec(), object_add_named_exec(), object_data_instance_add_exec(), object_transform_to_mouse_exec(), ui_drop_material_exec(), WM_drag_free_imported_drag_ID(), and WM_operator_drop_load_path().
bool WM_operator_properties_id_lookup_is_set | ( | PointerRNA * | ptr | ) |
Check if either the "session_uuid" or "name" property is set inside ptr. If this is the case the ID can be looked up by WM_operator_properties_id_lookup_from_name_or_session_uuid().
Definition at line 265 of file wm_operator_props.c.
References ptr, and RNA_struct_property_is_set().
Referenced by blender::ed::space_node::node_add_file_invoke(), object_instance_add_invoke(), and WM_operator_drop_load_path().
void WM_operator_properties_id_lookup_set_from_id | ( | PointerRNA * | ptr, |
const ID * | id | ||
) |
Tries to pass id to an operator via either a "session_uuid" or a "name" property defined in the properties of ptr. The former is preferred, since it works properly with linking and library overrides (which may both result in multiple IDs with the same name and type).
Also see WM_operator_properties_id_lookup() and WM_operator_properties_id_lookup_from_name_or_session_uuid()
Definition at line 229 of file wm_operator_props.c.
References BLI_assert_unreachable, id, ID::name, ptr, RNA_int_set(), RNA_string_set(), RNA_struct_find_property(), and ID::session_uuid.
Referenced by view3d_id_drop_copy(), view3d_id_drop_copy_with_type(), and view3d_id_path_drop_copy().
void WM_operator_properties_mouse_select | ( | struct wmOperatorType * | ot | ) |
See ED_select_pick_params_from_operator to initialize parameters defined here.
Definition at line 572 of file wm_operator_props.c.
References ot, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by CURVE_OT_pen(), GIZMOGROUP_OT_gizmo_select(), GPENCIL_OT_select(), MASK_OT_select(), blender::ed::space_node::NODE_OT_select(), SEQUENCER_OT_select(), UV_OT_select(), and VIEW3D_OT_select().
void WM_operator_properties_select_action | ( | wmOperatorType * | ot, |
int | default_action, | ||
bool | hide_gui | ||
) |
Definition at line 311 of file wm_operator_props.c.
References NULL, ot, SEL_DESELECT, SEL_INVERT, SEL_SELECT, SEL_TOGGLE, and wm_operator_properties_select_action_ex().
Referenced by INFO_OT_select_all(), PARTICLE_OT_select_roots(), PARTICLE_OT_select_tips(), and WM_operator_properties_select_all().
|
static |
Definition at line 297 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_enum(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by WM_operator_properties_select_action(), and WM_operator_properties_select_action_simple().
void WM_operator_properties_select_action_simple | ( | struct wmOperatorType * | ot, |
int | default_action, | ||
bool | hide_gui | ||
) |
Definition at line 324 of file wm_operator_props.c.
References NULL, ot, SEL_DESELECT, SEL_SELECT, and wm_operator_properties_select_action_ex().
Referenced by WM_operator_properties_select_random().
void WM_operator_properties_select_all | ( | wmOperatorType * | ot | ) |
Definition at line 375 of file wm_operator_props.c.
References ot, SEL_TOGGLE, and WM_operator_properties_select_action().
Referenced by ACTION_OT_select_all(), ANIM_OT_channels_select_all(), ARMATURE_OT_select_all(), CLIP_OT_graph_select_all_markers(), CLIP_OT_select_all(), CURVE_OT_select_all(), FILE_OT_select_all(), GPENCIL_OT_select_all(), GRAPH_OT_select_all(), LATTICE_OT_select_all(), MARKER_OT_select_all(), MASK_OT_select_all(), MBALL_OT_select_all(), MESH_OT_select_all(), NLA_OT_select_all(), blender::ed::space_node::NODE_OT_select_all(), OBJECT_OT_select_all(), OUTLINER_OT_select_all(), PAINT_OT_face_select_all(), PAINT_OT_vert_select_all(), PARTICLE_OT_select_all(), POSE_OT_select_all(), blender::ed::curves::SCULPT_CURVES_OT_select_all(), SEQUENCER_OT_select_all(), and UV_OT_select_all().
void WM_operator_properties_select_operation | ( | wmOperatorType * | ot | ) |
Definition at line 452 of file wm_operator_props.c.
References NULL, ot, PROP_SKIP_SAVE, RNA_def_enum(), RNA_def_property_flag(), SEL_OP_ADD, SEL_OP_AND, SEL_OP_SET, SEL_OP_SUB, SEL_OP_XOR, and wmOperatorType::srna.
Referenced by GPENCIL_OT_select_box(), GPENCIL_OT_select_lasso(), VIEW3D_OT_select_box(), and VIEW3D_OT_select_lasso().
void WM_operator_properties_select_operation_simple | ( | struct wmOperatorType * | ot | ) |
Definition at line 466 of file wm_operator_props.c.
References NULL, ot, PROP_SKIP_SAVE, RNA_def_enum(), RNA_def_property_flag(), SEL_OP_ADD, SEL_OP_SET, SEL_OP_SUB, and wmOperatorType::srna.
Referenced by ACTION_OT_select_box(), ACTION_OT_select_circle(), ACTION_OT_select_lasso(), CLIP_OT_select_box(), CLIP_OT_select_circle(), CLIP_OT_select_lasso(), FILE_OT_select_box(), GPENCIL_OT_select_circle(), GRAPH_OT_select_box(), GRAPH_OT_select_circle(), GRAPH_OT_select_lasso(), INFO_OT_select_box(), MARKER_OT_select_box(), MASK_OT_select_box(), MASK_OT_select_circle(), MASK_OT_select_lasso(), NLA_OT_select_box(), blender::ed::space_node::NODE_OT_select_box(), blender::ed::space_node::NODE_OT_select_circle(), blender::ed::space_node::NODE_OT_select_lasso(), OUTLINER_OT_select_box(), SEQUENCER_OT_select_box(), UV_OT_select_box(), UV_OT_select_circle(), UV_OT_select_lasso(), and VIEW3D_OT_select_circle().
void WM_operator_properties_select_random | ( | struct wmOperatorType * | ot | ) |
Use for all select random operators. Adds properties: percent, seed, action.
Definition at line 337 of file wm_operator_props.c.
References ot, RNA_def_float_factor(), RNA_def_int(), SEL_SELECT, wmOperatorType::srna, and WM_operator_properties_select_action_simple().
Referenced by CURVE_OT_select_random(), GPENCIL_OT_select_random(), LATTICE_OT_select_random(), MBALL_OT_select_random_metaelems(), MESH_OT_select_random(), OBJECT_OT_select_random(), and PARTICLE_OT_select_random().
int WM_operator_properties_select_random_seed_increment_get | ( | wmOperator * | op | ) |
Definition at line 361 of file wm_operator_props.c.
References wmOperator::flag, OP_IS_INVOKE, wmOperator::ptr, RNA_property_int_get(), RNA_property_int_set(), RNA_property_is_set(), and RNA_struct_find_property().
Referenced by curve_select_random_exec(), edbm_select_random_exec(), gpencil_select_random_exec(), lattice_select_random_exec(), object_select_random_exec(), select_random_exec(), and select_random_metaelems_exec().
void WM_operator_properties_select_walk_direction | ( | wmOperatorType * | ot | ) |
Definition at line 478 of file wm_operator_props.c.
References NULL, ot, PROP_SKIP_SAVE, RNA_def_enum(), RNA_def_property_flag(), wmOperatorType::srna, UI_SELECT_WALK_DOWN, UI_SELECT_WALK_LEFT, UI_SELECT_WALK_RIGHT, and UI_SELECT_WALK_UP.
Referenced by FILE_OT_select_walk(), and OUTLINER_OT_select_walk().
void WM_operator_properties_use_cursor_init | ( | struct wmOperatorType * | ot | ) |
Disable using cursor position, use when view operators are initialized from buttons.
Definition at line 433 of file wm_operator_props.c.
References ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by CLIP_OT_view_zoom(), IMAGE_OT_view_zoom(), VIEW2D_OT_zoom(), and view3d_operator_properties_common().