Blender V5.0
view3d_buttons.cc File Reference
#include <cfloat>
#include <cstring>
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
#include "BLT_translation.hh"
#include "BLI_array_utils.h"
#include "BLI_bit_vector.hh"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BLI_vector.hh"
#include "BKE_action.hh"
#include "BKE_armature.hh"
#include "BKE_context.hh"
#include "BKE_curve.hh"
#include "BKE_curves.hh"
#include "BKE_curves_utils.hh"
#include "BKE_customdata.hh"
#include "BKE_deform.hh"
#include "BKE_editmesh.hh"
#include "BKE_layer.hh"
#include "BKE_library.hh"
#include "BKE_mesh_types.hh"
#include "BKE_object.hh"
#include "BKE_object_deform.h"
#include "BKE_object_types.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "DEG_depsgraph.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "ED_curves.hh"
#include "ED_grease_pencil.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_screen.hh"
#include "ANIM_bone_collections.hh"
#include "UI_interface.hh"
#include "UI_interface_layout.hh"
#include "UI_resources.hh"
#include "view3d_intern.hh"

Go to the source code of this file.

Classes

struct  TransformMedian_Generic
struct  TransformMedian_Mesh
struct  TransformMedian_Curve
struct  TransformMedian_Lattice
struct  TransformMedian_Curves
union  TransformMedian
struct  CurvesDataPanelState
struct  TransformProperties
struct  CurvesPointSelectionStatus
struct  CurvesSelectionStatus

Macros

#define TRANSFORM_MEDIAN_ARRAY_LEN   (sizeof(TransformMedian) / sizeof(float))
#define B_VGRP_PNL_EDIT_SINGLE   8 /* or greater */

Enumerations

enum  { B_REDR = 2 , B_TRANSFORM_PANEL_MEDIAN = 1008 , B_TRANSFORM_PANEL_DIMS = 1009 }

Functions

static TransformPropertiesv3d_transform_props_ensure (View3D *v3d)
static float compute_scale_factor (const float ve_median, const float median)
static void apply_raw_diff (float *val, const int tot, const float ve_median, const float median)
static void apply_raw_diff_v3 (float val[3], const int tot, const float ve_median[3], const float median[3])
static void apply_scale_factor (float *val, const int tot, const float ve_median, const float median, const float sca)
static void apply_scale_factor_clamp (float *val, const int tot, const float ve_median, const float sca)
static CurvesPointSelectionStatus init_curves_point_selection_status (const blender::bke::CurvesGeometry &curves)
static bool apply_to_curves_point_selection (const int tot, const TransformMedian_Curves &median, const TransformMedian_Curves &ve_median, blender::bke::CurvesGeometry &curves)
static CurvesSelectionStatus init_curves_selection_status (const blender::bke::CurvesGeometry &curves)
static void v3d_editvertex_buts (const bContext *C, uiLayout *layout, View3D *v3d, Object *ob, float lim)
static void v3d_object_dimension_buts (bContext *C, uiLayout *layout, View3D *v3d, Object *ob)
static void do_view3d_vgroup_buttons (bContext *C, void *, int event)
static bool view3d_panel_vgroup_poll (const bContext *C, PanelType *)
static void update_active_vertex_weight (bContext *C, void *arg1, void *)
static void view3d_panel_vgroup (const bContext *C, Panel *panel)
static void v3d_transform_butsR (uiLayout *layout, PointerRNA *ptr)
static void v3d_posearmature_buts (uiLayout *layout, Object *ob)
static void v3d_editarmature_buts (uiLayout *layout, Object *ob)
static void v3d_editmetaball_buts (uiLayout *layout, Object *ob)
static void do_view3d_region_buttons (bContext *C, void *, int event)
static bool view3d_panel_transform_poll (const bContext *C, PanelType *)
static void view3d_panel_transform (const bContext *C, Panel *panel)
static bool view3d_panel_curve_data_poll (const bContext *C, PanelType *)
static void apply_to_active_object (bContext *C, blender::FunctionRef< void(const CurvesDataPanelState &modified_state, const blender::IndexMask &selection, blender::bke::CurvesGeometry &curves)> curves_geometry_handler)
static void handle_curves_cyclic (bContext *C, void *, void *)
static void update_custom_knots (const blender::OffsetIndices< int > &src_custom_knots_by_curve, const blender::Span< int8_t > src_knot_modes, const blender::Span< float > src_custom_knots, blender::bke::CurvesGeometry &curves)
static void handle_curves_knot_mode (bContext *C, void *, void *)
static void handle_curves_order (bContext *C, void *, void *)
static void handle_curves_resolution (bContext *C, void *, void *)
static void knot_modes_menu (bContext *, uiLayout *layout, void *knot_mode_p)
static void view3d_panel_curve_data (const bContext *C, Panel *panel)
void view3d_buttons_register (ARegionType *art)
static wmOperatorStatus view3d_object_mode_menu_exec (bContext *C, wmOperator *op)
void VIEW3D_OT_object_mode_pie_or_toggle (wmOperatorType *ot)
Edit Mesh Partial Updates
static void * editmesh_partial_update_begin_fn (bContext *, const uiBlockInteraction_Params *params, void *arg1)
static void editmesh_partial_update_end_fn (bContext *, const uiBlockInteraction_Params *, void *, void *user_data)
static void editmesh_partial_update_update_fn (bContext *C, const uiBlockInteraction_Params *, void *arg1, void *user_data)

Variables

constexpr std::array< EnumPropertyItem, 5 > enum_curve_knot_mode_items

Macro Definition Documentation

◆ B_VGRP_PNL_EDIT_SINGLE

#define B_VGRP_PNL_EDIT_SINGLE   8 /* or greater */

Definition at line 1671 of file view3d_buttons.cc.

Referenced by do_view3d_vgroup_buttons(), and view3d_panel_vgroup().

◆ TRANSFORM_MEDIAN_ARRAY_LEN

#define TRANSFORM_MEDIAN_ARRAY_LEN   (sizeof(TransformMedian) / sizeof(float))

Definition at line 136 of file view3d_buttons.cc.

Referenced by v3d_editvertex_buts().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
B_REDR 
B_TRANSFORM_PANEL_MEDIAN 
B_TRANSFORM_PANEL_DIMS 

Definition at line 77 of file view3d_buttons.cc.

Function Documentation

◆ apply_raw_diff()

void apply_raw_diff ( float * val,
const int tot,
const float ve_median,
const float median )
static

Apply helpers.

Note
In case we only have one element, copy directly the value instead of applying the diff or scale factor. Avoids some glitches when going e.g. from 3 to 0.0001 (see #37327).

Definition at line 253 of file view3d_buttons.cc.

Referenced by v3d_editvertex_buts().

◆ apply_raw_diff_v3()

void apply_raw_diff_v3 ( float val[3],
const int tot,
const float ve_median[3],
const float median[3] )
static

Definition at line 258 of file view3d_buttons.cc.

References add_v3_v3(), and copy_v3_v3().

Referenced by v3d_editvertex_buts().

◆ apply_scale_factor()

void apply_scale_factor ( float * val,
const int tot,
const float ve_median,
const float median,
const float sca )
static

Definition at line 271 of file view3d_buttons.cc.

Referenced by v3d_editvertex_buts().

◆ apply_scale_factor_clamp()

void apply_scale_factor_clamp ( float * val,
const int tot,
const float ve_median,
const float sca )
static

Definition at line 282 of file view3d_buttons.cc.

References CLAMP, and ELEM.

Referenced by v3d_editvertex_buts().

◆ apply_to_active_object()

◆ apply_to_curves_point_selection()

◆ compute_scale_factor()

float compute_scale_factor ( const float ve_median,
const float median )
static

Definition at line 221 of file view3d_buttons.cc.

References CLAMP.

Referenced by v3d_editvertex_buts().

◆ do_view3d_region_buttons()

◆ do_view3d_vgroup_buttons()

◆ editmesh_partial_update_begin_fn()

◆ editmesh_partial_update_end_fn()

void editmesh_partial_update_end_fn ( bContext * ,
const uiBlockInteraction_Params * ,
void * ,
void * user_data )
static

Definition at line 180 of file view3d_buttons.cc.

References BM_mesh_partial_destroy().

Referenced by v3d_editvertex_buts().

◆ editmesh_partial_update_update_fn()

void editmesh_partial_update_update_fn ( bContext * C,
const uiBlockInteraction_Params * ,
void * arg1,
void * user_data )
static

◆ handle_curves_cyclic()

void handle_curves_cyclic ( bContext * C,
void * ,
void *  )
static

◆ handle_curves_knot_mode()

◆ handle_curves_order()

◆ handle_curves_resolution()

void handle_curves_resolution ( bContext * C,
void * ,
void *  )
static

◆ init_curves_point_selection_status()

◆ init_curves_selection_status()

◆ knot_modes_menu()

void knot_modes_menu ( bContext * ,
uiLayout * layout,
void * knot_mode_p )
static

◆ update_active_vertex_weight()

◆ update_custom_knots()

◆ v3d_editarmature_buts()

◆ v3d_editmetaball_buts()

◆ v3d_editvertex_buts()

void v3d_editvertex_buts ( const bContext * C,
uiLayout * layout,
View3D * v3d,
Object * ob,
float lim )
static

Definition at line 591 of file view3d_buttons.cc.

References uiLayout::absolute_block(), add_v2_v2(), add_v3_v3(), apply_raw_diff(), apply_raw_diff_v3(), apply_scale_factor(), apply_scale_factor_clamp(), apply_to_curves_point_selection(), uiBlockInteraction_CallbackData::arg1, B_REDR, B_TRANSFORM_PANEL_MEDIAN, TransformMedian_Curve::b_weight, TransformMedian_Mesh::be_weight, uiBlockInteraction_CallbackData::begin_fn, BKE_curve_editNurbs_get(), BKE_nurb_handles_test(), BKE_nurb_project_2d(), BLI_assert, bm, BMEditMesh::bm, BM_data_layer_add_named(), BM_EDGES_OF_MESH, BM_ELEM_CD_GET_FLOAT, BM_ELEM_CD_GET_VOID_P, BM_elem_flag_test, BM_ELEM_SELECT, BM_ITER_MESH, BM_VERTS_OF_MESH, TransformMedian_Mesh::bv_weight, C, CD_MVERT_SKIN, CD_PROP_FLOAT, BMVert::co, compute_scale_factor(), copy_vn_fl(), CTX_data_scene(), CU_BEZIER, CU_IS_2D, TransformMedian::curve, TransformMedian::curves, CustomData_get_offset(), CustomData_get_offset_named(), CustomData_has_layer_named(), Object::data, Lattice::def, DEG2RADF, TransformMedian_Mesh::e_crease, Lattice::editlatt, editmesh_partial_update_begin_fn(), editmesh_partial_update_end_fn(), editmesh_partial_update_update_fn(), ELEM, uiBlockInteraction_CallbackData::end_fn, BezTriple::f1, BPoint::f1, BezTriple::f2, BezTriple::f3, View3D::flag, float, TransformMedian::generic, Curves::geometry, i, Curve::id, Lattice::id, IFACE_, Vector< T, InlineBufferCapacity, Allocator >::index_range(), init_curves_point_selection_status(), invert_m4_m4(), Label, EditLatt::latt, TransformMedian::lattice, len_squared_v3(), LISTBASE_FOREACH, TransformMedian_Curve::location, TransformMedian_Generic::location, TransformMedian_Lattice::location, TransformMedian_Mesh::location, TransformMedian::mesh, mul_m4_v3(), mul_v3_fl(), Num, NURB_HANDLE_TEST_EACH, TransformMedian_Curves::nurbs_weight, OB_CURVES, OB_CURVES_LEGACY, OB_GREASE_PENCIL, OB_LATTICE, OB_MESH, OB_SURF, blender::threading::parallel_for_each(), blender::threading::parallel_reduce(), Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, PROP_UNIT_LENGTH, PROP_UNIT_ROTATION, BezTriple::radius, BPoint::radius, MVertSkin::radius, TransformMedian_Curve::radius, TransformMedian_Curves::radius, RNA_pointer_create_discrete(), RNA_TRANSLATION_PREC_DEFAULT, Mesh::runtime, Object::runtime, SELECT, TransformMedian_Mesh::skin, status, sub_vn_vnvn(), CurvesPointSelectionStatus::sum(), TransformProperties::tag_for_update, blender::bke::CurvesGeometry::tag_positions_changed(), BezTriple::tilt, BPoint::tilt, TransformMedian_Curve::tilt, TransformMedian_Curves::tilt, tilt_limit, TIP_, Toggle, ToggleN, TRANSFORM_MEDIAN_ARRAY_LEN, Object::type, UI_block_align_begin(), UI_block_align_end(), UI_block_interaction_set(), UI_but_number_precision_set(), UI_but_number_step_size_set(), UI_but_unit_type_set(), UI_SCALE_FAC, uiDefBut(), uiDefButBitS(), uiDefButF(), uiDefButR(), uiBlockInteraction_CallbackData::update_fn, V3D_GLOBAL_STATS, v3d_transform_props_ensure(), TransformMedian_Mesh::v_crease, TransformProperties::ve_median, BezTriple::vec, BPoint::vec, BezTriple::weight, BPoint::weight, TransformMedian_Curve::weight, and TransformMedian_Lattice::weight.

Referenced by do_view3d_region_buttons(), and view3d_panel_transform().

◆ v3d_object_dimension_buts()

◆ v3d_posearmature_buts()

◆ v3d_transform_butsR()

◆ v3d_transform_props_ensure()

◆ view3d_buttons_register()

◆ view3d_object_mode_menu_exec()

◆ VIEW3D_OT_object_mode_pie_or_toggle()

void VIEW3D_OT_object_mode_pie_or_toggle ( wmOperatorType * ot)

Definition at line 2590 of file view3d_buttons.cc.

References ED_operator_view3d_active(), ot, and view3d_object_mode_menu_exec().

Referenced by view3d_operatortypes().

◆ view3d_panel_curve_data()

◆ view3d_panel_curve_data_poll()

◆ view3d_panel_transform()

◆ view3d_panel_transform_poll()

bool view3d_panel_transform_poll ( const bContext * C,
PanelType *  )
static

◆ view3d_panel_vgroup()

void view3d_panel_vgroup ( const bContext * C,
Panel * panel )
static

Definition at line 1717 of file view3d_buttons.cc.

References uiLayout::absolute_block(), B_VGRP_PNL_EDIT_SINGLE, BKE_defvert_find_index(), BKE_object_defgroup_active_index_get(), BKE_object_defgroup_list(), BKE_object_defgroup_subset_from_select_type(), BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), BLI_listbase_count(), But, C, col, uiLayout::column(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_view3d(), DG_LOCK_WEIGHT, do_view3d_vgroup_buttons(), ED_mesh_active_dvert_get_only(), uiLayout::enabled_set(), blender::wm::ExecDefault, ListBase::first, bDeformGroup::flag, i, IFACE_, blender::wm::InvokeDefault, Panel::layout, MEM_freeN(), bDeformGroup::name, bDeformGroup::next, Num, uiLayout::op(), ot, POINTER_FROM_INT, uiLayout::prop(), Vector< T, InlineBufferCapacity, Allocator >::resize(), RNA_int_set(), RNA_pointer_create_discrete(), uiLayout::row(), split(), TIP_, Scene::toolsettings, MDeformVert::totweight, UI_block_func_handle_set(), UI_BUT_DISABLED, UI_but_drawflag_enable(), UI_but_flag_enable(), UI_but_func_set(), UI_BUT_INACTIVE, UI_but_number_precision_set(), UI_but_number_step_size_set(), UI_but_operator_ptr_ensure(), UI_BUT_TEXT_LEFT, UI_BUT_TEXT_RIGHT, UI_ITEM_NONE, UI_ITEM_R_EXPAND, UI_UNIT_X, UI_UNIT_Y, uiDefButF(), uiDefButO_ptr(), update_active_vertex_weight(), v3d_transform_props_ensure(), TransformProperties::vertex_weights, ToolSettings::vgroupsubset, MDeformWeight::weight, WM_operatortype_find(), and x.

Referenced by view3d_buttons_register().

◆ view3d_panel_vgroup_poll()

Variable Documentation

◆ enum_curve_knot_mode_items

std::array<EnumPropertyItem, 5> enum_curve_knot_mode_items
constexpr
Initial value:
{{
{NURBS_KNOT_MODE_NORMAL, "NORMAL", ICON_NONE, "Normal", ""},
{NURBS_KNOT_MODE_ENDPOINT, "ENDPOINT", ICON_NONE, "Endpoint", ""},
{NURBS_KNOT_MODE_BEZIER, "BEZIER", ICON_NONE, "Bezier", ""},
{NURBS_KNOT_MODE_ENDPOINT_BEZIER, "ENDPOINT_BEZIER", ICON_NONE, "Endpoint Bezier", ""},
{NURBS_KNOT_MODE_CUSTOM, "CUSTOM", ICON_NONE, "Custom", ""},
}}
@ NURBS_KNOT_MODE_ENDPOINT
@ NURBS_KNOT_MODE_NORMAL
@ NURBS_KNOT_MODE_BEZIER
@ NURBS_KNOT_MODE_ENDPOINT_BEZIER
@ NURBS_KNOT_MODE_CUSTOM

Definition at line 2376 of file view3d_buttons.cc.

Referenced by knot_modes_menu().