Blender  V3.3
Classes | Macros | Enumerations | Functions
view3d_buttons.c File Reference
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#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.h"
#include "BLI_array_utils.h"
#include "BLI_bitmap.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_object.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_prototypes.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "view3d_intern.h"

Go to the source code of this file.

Classes

struct  TransformMedian_Generic
 
struct  TransformMedian_Mesh
 
struct  TransformMedian_Curve
 
struct  TransformMedian_Lattice
 
union  TransformMedian
 
struct  TransformProperties
 

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 void v3d_editvertex_buts (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 *UNUSED(arg), int event)
 
static bool view3d_panel_vgroup_poll (const bContext *C, PanelType *UNUSED(pt))
 
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 *UNUSED(index), int event)
 
static bool view3d_panel_transform_poll (const bContext *C, PanelType *UNUSED(pt))
 
static void view3d_panel_transform (const bContext *C, Panel *panel)
 
static void hide_collections_menu_draw (const bContext *C, Menu *menu)
 
void view3d_buttons_register (ARegionType *art)
 
static int view3d_object_mode_menu (bContext *C, wmOperator *op)
 
void VIEW3D_OT_object_mode_pie_or_toggle (wmOperatorType *ot)
 
Edit Mesh Partial Updates
static voideditmesh_partial_update_begin_fn (struct bContext *UNUSED(C), const struct uiBlockInteraction_Params *params, void *arg1)
 
static void editmesh_partial_update_end_fn (struct bContext *UNUSED(C), const struct uiBlockInteraction_Params *UNUSED(params), void *UNUSED(arg1), void *user_data)
 
static void editmesh_partial_update_update_fn (struct bContext *C, const struct uiBlockInteraction_Params *UNUSED(params), void *arg1, void *user_data)
 

Macro Definition Documentation

◆ B_VGRP_PNL_EDIT_SINGLE

#define B_VGRP_PNL_EDIT_SINGLE   8 /* or greater */

Definition at line 1267 of file view3d_buttons.c.

◆ TRANSFORM_MEDIAN_ARRAY_LEN

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

Definition at line 105 of file view3d_buttons.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
B_REDR 
B_TRANSFORM_PANEL_MEDIAN 
B_TRANSFORM_PANEL_DIMS 

Definition at line 62 of file view3d_buttons.c.

Function Documentation

◆ apply_raw_diff()

static 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 T37327).

Definition at line 227 of file view3d_buttons.c.

Referenced by v3d_editvertex_buts().

◆ apply_raw_diff_v3()

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

Definition at line 232 of file view3d_buttons.c.

References add_v3_v3(), and copy_v3_v3().

Referenced by v3d_editvertex_buts().

◆ apply_scale_factor()

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

Definition at line 245 of file view3d_buttons.c.

Referenced by v3d_editvertex_buts().

◆ apply_scale_factor_clamp()

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

Definition at line 256 of file view3d_buttons.c.

References CLAMP, and ELEM.

Referenced by v3d_editvertex_buts().

◆ compute_scale_factor()

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

Definition at line 195 of file view3d_buttons.c.

References CLAMP.

Referenced by v3d_editvertex_buts().

◆ do_view3d_region_buttons()

static void do_view3d_region_buttons ( bContext C,
void UNUSEDindex,
int  event 
)
static

◆ do_view3d_vgroup_buttons()

static void do_view3d_vgroup_buttons ( bContext C,
void UNUSEDarg,
int  event 
)
static

◆ editmesh_partial_update_begin_fn()

static void* editmesh_partial_update_begin_fn ( struct bContext UNUSEDC,
const struct uiBlockInteraction_Params params,
void arg1 
)
static

◆ editmesh_partial_update_end_fn()

static void editmesh_partial_update_end_fn ( struct bContext UNUSEDC,
const struct uiBlockInteraction_Params UNUSEDparams,
void UNUSEDarg1,
void user_data 
)
static

Definition at line 153 of file view3d_buttons.c.

References BM_mesh_partial_destroy(), NULL, and user_data.

Referenced by v3d_editvertex_buts().

◆ editmesh_partial_update_update_fn()

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

◆ hide_collections_menu_draw()

static void hide_collections_menu_draw ( const bContext C,
Menu menu 
)
static

Definition at line 1760 of file view3d_buttons.c.

References C, ED_collection_hide_menu_draw(), and Menu::layout.

Referenced by view3d_buttons_register().

◆ v3d_editarmature_buts()

static void v3d_editarmature_buts ( uiLayout layout,
Object ob 
)
static

◆ v3d_editmetaball_buts()

static void v3d_editmetaball_buts ( uiLayout layout,
Object ob 
)
static

◆ v3d_editvertex_buts()

static void v3d_editvertex_buts ( uiLayout layout,
View3D v3d,
Object ob,
float  lim 
)
static

Definition at line 284 of file view3d_buttons.c.

References Freestyle::a, add_v2_v2(), add_v3_v3(), apply_raw_diff(), apply_raw_diff_v3(), apply_scale_factor(), apply_scale_factor_clamp(), B_REDR, B_TRANSFORM_PANEL_MEDIAN, TransformMedian_Curve::b_weight, TransformMedian_Mesh::be_weight, BKE_curve_editNurbs_get(), BKE_nurb_handles_test(), BKE_nurb_project_2d(), BLI_assert, BMEditMesh::bm, bm, 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_mesh_cd_flag_ensure(), BM_VERTS_OF_MESH, TransformMedian_Mesh::bv_weight, Freestyle::c, CD_BWEIGHT, CD_CREASE, CD_MVERT_SKIN, BMVert::co, compute_scale_factor(), copy_vn_fl(), CU_BEZIER, CU_IS_2D, TransformMedian::curve, CustomData_get_offset(), Object::data, Lattice::def, DEG2RADF, TransformMedian_Mesh::e_crease, BMesh::edata, Mesh::edit_mesh, Lattice::editlatt, editmesh_partial_update_begin_fn(), editmesh_partial_update_end_fn(), editmesh_partial_update_update_fn(), ELEM, BezTriple::f1, BPoint::f1, BezTriple::f2, BezTriple::f3, View3D::flag, float(), TransformMedian::generic, Curve::id, Lattice::id, IFACE_, Object::imat, invert_m4_m4(), EditLatt::latt, TransformMedian::lattice, len_squared_v3(), LISTBASE_FOREACH, TransformMedian_Generic::location, TransformMedian_Mesh::location, TransformMedian_Curve::location, TransformMedian_Lattice::location, ME_CDFLAG_EDGE_BWEIGHT, ME_CDFLAG_EDGE_CREASE, ME_CDFLAG_VERT_BWEIGHT, ME_CDFLAG_VERT_CREASE, TransformMedian::mesh, mul_m4_v3(), mul_v3_fl(), NULL, OB_CURVES_LEGACY, OB_LATTICE, OB_MESH, OB_SURF, Object::obmat, Lattice::pntsu, Lattice::pntsv, Lattice::pntsw, PROP_UNIT_LENGTH, PROP_UNIT_ROTATION, TransformMedian_Curve::radius, BezTriple::radius, BPoint::radius, MVertSkin::radius, RNA_pointer_create(), RNA_TRANSLATION_PREC_DEFAULT, SELECT, TransformMedian_Mesh::skin, sub_vn_vnvn(), TransformProperties::tag_for_update, TransformMedian_Curve::tilt, BezTriple::tilt, BPoint::tilt, tilt_limit, TIP_, BMesh::totedgesel, BMesh::totvertsel, TRANSFORM_MEDIAN_ARRAY_LEN, Object::type, UI_block_align_begin(), UI_block_align_end(), UI_block_interaction_set(), UI_BTYPE_LABEL, UI_BTYPE_NUM, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_but_number_precision_set(), UI_but_number_step_size_set(), UI_but_unit_type_set(), UI_DPI_FAC, uiDefBut(), uiDefButBitS(), uiDefButF(), uiDefButR(), uiLayoutAbsoluteBlock(), V3D_GLOBAL_STATS, v3d_transform_props_ensure(), TransformMedian_Mesh::v_crease, BMesh::vdata, TransformProperties::ve_median, BezTriple::vec, BPoint::vec, TransformMedian_Curve::weight, TransformMedian_Lattice::weight, BezTriple::weight, and BPoint::weight.

Referenced by do_view3d_region_buttons(), and view3d_panel_transform().

◆ v3d_object_dimension_buts()

static void v3d_object_dimension_buts ( bContext C,
uiLayout layout,
View3D v3d,
Object ob 
)
static

◆ v3d_posearmature_buts()

static void v3d_posearmature_buts ( uiLayout layout,
Object ob 
)
static

◆ v3d_transform_butsR()

static void v3d_transform_butsR ( uiLayout layout,
PointerRNA ptr 
)
static

◆ v3d_transform_props_ensure()

static TransformProperties * v3d_transform_props_ensure ( View3D v3d)
static

◆ view3d_buttons_register()

void view3d_buttons_register ( ARegionType art)

◆ view3d_object_mode_menu()

static int view3d_object_mode_menu ( bContext C,
wmOperator op 
)
static

◆ VIEW3D_OT_object_mode_pie_or_toggle()

void VIEW3D_OT_object_mode_pie_or_toggle ( wmOperatorType ot)

◆ view3d_panel_transform()

static void view3d_panel_transform ( const bContext C,
Panel panel 
)
static

◆ view3d_panel_transform_poll()

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

Definition at line 1711 of file view3d_buttons.c.

References ViewLayer::basact, C, CTX_data_view_layer(), and NULL.

Referenced by view3d_buttons_register().

◆ view3d_panel_vgroup()

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

◆ view3d_panel_vgroup_poll()

static bool view3d_panel_vgroup_poll ( const bContext C,
PanelType UNUSEDpt 
)
static