Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_scene.h"
#include "ED_gizmo_library.h"
#include "ED_gizmo_utils.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_undo.h"
#include "ED_view3d.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_resources.h"
#include "BLT_translation.h"
#include "mesh_intern.h"
Go to the source code of this file.
Classes | |
struct | GizmoPlacementGroup |
Functions | |
Helper Functions | |
static void | calc_initial_placement_point_from_view (bContext *C, const float mval[2], float r_location[3], float r_rotation[3][3]) |
Add Cube Gizmo-Operator | |
For now we use a separate operator to add a cube, we can try to merge then however they are invoked differently and share the same BMesh creation code. | |
static int | add_primitive_cube_gizmo_exec (bContext *C, wmOperator *op) |
static int | add_primitive_cube_gizmo_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) |
void | MESH_OT_primitive_cube_add_gizmo (wmOperatorType *ot) |
Placement Gizmo | |
typedef struct GizmoPlacementGroup | GizmoPlacementGroup |
static void | gizmo_placement_exec (GizmoPlacementGroup *ggd) |
static void | gizmo_mesh_placement_update_from_op (GizmoPlacementGroup *ggd) |
static void | gizmo_placement_prop_matrix_get (const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p) |
static void | gizmo_placement_prop_matrix_set (const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value) |
static bool | gizmo_mesh_placement_poll (const bContext *C, wmGizmoGroupType *gzgt) |
static void | gizmo_mesh_placement_modal_from_setup (const bContext *C, wmGizmoGroup *gzgroup) |
static void | gizmo_mesh_placement_setup (const bContext *C, wmGizmoGroup *gzgroup) |
static void | gizmo_mesh_placement_draw_prepare (const bContext *UNUSED(C), wmGizmoGroup *gzgroup) |
static void | MESH_GGT_add_bounds (struct wmGizmoGroupType *gzgt) |
Creation gizmos.
Definition in file editmesh_add_gizmo.c.
typedef struct GizmoPlacementGroup GizmoPlacementGroup |
|
static |
Definition at line 308 of file editmesh_add_gizmo.c.
References BKE_editmesh_from_object(), C, CTX_data_edit_object(), Object::data, ED_mesh_uv_ensure(), EDBM_op_call_and_selectf(), EDBM_selectmode_flush_ex(), EDBM_update(), Object::imat, invert_m4_m4(), mul_m4_m4m4(), NULL, Object::obmat, GizmoPlacementGroup::op, OPERATOR_CANCELLED, OPERATOR_FINISHED, GizmoPlacementGroup::prop_matrix, wmOperator::ptr, RNA_boolean_get(), RNA_property_float_get_array(), RNA_property_is_set(), RNA_struct_find_property(), and SCE_SELECT_VERTEX.
Referenced by add_primitive_cube_gizmo_invoke(), and MESH_OT_primitive_cube_add_gizmo().
|
static |
Definition at line 356 of file editmesh_add_gizmo.c.
References add_primitive_cube_gizmo_exec(), C, CTX_data_main(), CTX_wm_view3d(), View3D::gizmo_flag, GizmoPlacementGroup::op, OPERATOR_FINISHED, ret, V3D_GIZMO_HIDE, WM_gizmo_group_type_ensure_ptr(), WM_gizmo_group_type_reinit_ptr(), and WM_gizmogrouptype_find().
Referenced by MESH_OT_primitive_cube_add_gizmo().
|
static |
When we place a shape, pick a plane.
We may base this choice on context, for now pick the "ground" based on the 3D cursor's dominant plane pointing down relative to the view.
Definition at line 51 of file editmesh_add_gizmo.c.
References axis_dominant_v3_single(), BKE_scene_cursor_to_mat4(), C, copy_m3_m3(), copy_v3_v3(), CTX_data_scene(), CTX_wm_region(), Scene::cursor, dot_v3v3(), ED_view3d_win_to_3d_on_plane(), is_negative_m3(), negate_v3(), plane_from_point_normal_v3(), ARegion::regiondata, scene, swap_v3_v3(), and RegionView3D::viewinv.
Referenced by gizmo_mesh_placement_modal_from_setup().
|
static |
Definition at line 274 of file editmesh_add_gizmo.c.
References GizmoPlacementGroup::context, wmGizmoGroup::customdata, GizmoPlacementGroup::data, gizmo_mesh_placement_update_from_op(), wmOperator::next, GizmoPlacementGroup::op, and WM_operator_last_redo().
Referenced by MESH_GGT_add_bounds().
|
static |
Definition at line 182 of file editmesh_add_gizmo.c.
References C, GizmoPlacementGroup::cage, calc_initial_placement_point_from_view(), copy_m4_m3(), copy_v3_v3(), CTX_wm_region(), CTX_wm_window(), wmGizmoGroup::customdata, ED_GIZMO_CAGE3D_PART_SCALE_MAX_X_MAX_Y_MAX_Z, wmWindow::eventstate, wmGizmo::matrix_basis, wmGizmo::matrix_offset, wmGizmoGroup::parent_gzmap, ARegion::winrct, WM_gizmo_modal_set_from_setup(), rcti::xmin, wmEvent::xy, rcti::ymin, and zero_m4().
Referenced by gizmo_mesh_placement_setup().
|
static |
Definition at line 176 of file editmesh_add_gizmo.c.
References C, and ED_gizmo_poll_or_unlink_delayed_from_operator().
Referenced by MESH_GGT_add_bounds().
|
static |
Definition at line 229 of file editmesh_add_gizmo.c.
References C, GizmoPlacementGroup::cage, wmGizmo::color, GizmoPlacementGroup::context, wmGizmoGroup::customdata, GizmoPlacementGroup::data, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE, ED_GIZMO_CAGE2D_XFORM_FLAG_SCALE_SIGNED, ED_GIZMO_CAGE2D_XFORM_FLAG_TRANSLATE, gizmo_mesh_placement_modal_from_setup(), gizmo_mesh_placement_update_from_op(), wmOperatorType::idname, MEM_callocN, NULL, GizmoPlacementGroup::op, GizmoPlacementGroup::prop_matrix, wmOperator::ptr, wmGizmo::ptr, RNA_enum_set(), RNA_struct_find_property(), STREQ, TH_GIZMO_PRIMARY, wmOperator::type, UI_GetThemeColor3fv(), WM_GIZMO_DRAW_VALUE, WM_gizmo_new_ptr(), WM_gizmo_set_flag(), WM_gizmo_target_property_def_func(), WM_gizmotype_find(), and WM_operator_last_redo().
Referenced by MESH_GGT_add_bounds().
|
static |
Definition at line 127 of file editmesh_add_gizmo.c.
References GizmoPlacementGroup::cage, GizmoPlacementGroup::data, wmGizmo::matrix_offset, GizmoPlacementGroup::op, GizmoPlacementGroup::prop_matrix, wmOperator::ptr, RNA_property_float_get_array(), and UNUSED_VARS.
Referenced by gizmo_mesh_placement_draw_prepare(), and gizmo_mesh_placement_setup().
|
static |
Definition at line 119 of file editmesh_add_gizmo.c.
References GizmoPlacementGroup::context, GizmoPlacementGroup::data, ED_undo_operator_repeat(), GizmoPlacementGroup::op, and WM_operator_last_redo().
Referenced by gizmo_placement_prop_matrix_set().
|
static |
Definition at line 138 of file editmesh_add_gizmo.c.
References wmGizmoPropertyType::array_length, BLI_assert, GizmoPlacementGroup::cage, wmGizmoGroup::customdata, GizmoPlacementGroup::data, wmGizmo::matrix_basis, wmGizmo::matrix_offset, mul_m4_m4m4(), GizmoPlacementGroup::op, wmGizmo::parent_gzgroup, GizmoPlacementGroup::prop_matrix, wmOperator::ptr, RNA_property_float_get_array(), wmGizmoProperty::type, and UNUSED_VARS_NDEBUG.
|
static |
Definition at line 154 of file editmesh_add_gizmo.c.
References wmGizmoPropertyType::array_length, BLI_assert, GizmoPlacementGroup::cage, wmGizmoGroup::customdata, GizmoPlacementGroup::data, gizmo_placement_exec(), is_negative_m4(), wmGizmo::matrix_basis, mul_m4_m4m4(), negate_mat3_m4(), GizmoPlacementGroup::op, wmGizmo::parent_gzgroup, GizmoPlacementGroup::prop_matrix, wmOperator::ptr, RNA_property_float_set_array(), wmGizmoProperty::type, and UNUSED_VARS_NDEBUG.
|
static |
Definition at line 283 of file editmesh_add_gizmo.c.
References wmGizmoGroupType::draw_prepare, wmGizmoGroupType::flag, gizmo_mesh_placement_draw_prepare(), gizmo_mesh_placement_poll(), gizmo_mesh_placement_setup(), wmGizmoGroupType::gzmap_params, wmGizmoGroupType::idname, wmGizmoGroupType::name, wmGizmoGroupType::poll, wmGizmoMapType_Params::regionid, RGN_TYPE_WINDOW, wmGizmoGroupType::setup, SPACE_VIEW3D, wmGizmoMapType_Params::spaceid, and WM_GIZMOGROUPTYPE_3D.
Referenced by MESH_OT_primitive_cube_add_gizmo().
void MESH_OT_primitive_cube_add_gizmo | ( | wmOperatorType * | ot | ) |
Definition at line 377 of file editmesh_add_gizmo.c.
References add_primitive_cube_gizmo_exec(), add_primitive_cube_gizmo_invoke(), wmOperatorType::description, ED_object_add_generic_props(), ED_object_add_mesh_props(), ED_operator_editmesh_view3d(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, MESH_GGT_add_bounds(), wmOperatorType::name, NULL, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_float_matrix(), RNA_def_property_flag(), wmOperatorType::srna, and WM_gizmogrouptype_append().
Referenced by ED_operatortypes_mesh().