Merge branch 'master' into xr-dev

This commit is contained in:
Peter Kim 2022-04-04 16:34:36 +09:00
commit b0825be786
131 changed files with 3061 additions and 539 deletions

View File

@ -205,6 +205,7 @@ ForEachMacros:
- FOREACH_SCENE_COLLECTION_BEGIN
- FOREACH_SCENE_OBJECT_BEGIN
- FOREACH_SELECTED_BASE_BEGIN
- FOREACH_SELECTED_BEZT_BEGIN
- FOREACH_SELECTED_EDITABLE_OBJECT_BEGIN
- FOREACH_SELECTED_OBJECT_BEGIN
- FOREACH_TRANS_DATA_CONTAINER
@ -268,6 +269,7 @@ ForEachMacros:
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD
- ccl_gpu_kernel_postfix
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"

View File

@ -97,7 +97,7 @@ ccl_device_inline float mat22_determinant(const float4 m)
}
/* Inverse of a 2x2 matrix encoded in a row-major order float4 */
ccl_device_inline float mat22_inverse(const float4 m, ccl_private float4& m_inverse)
ccl_device_inline float mat22_inverse(const float4 m, ccl_private float4 &m_inverse)
{
float det = mat22_determinant(m);
if (fabsf(det) < MNEE_MIN_DETERMINANT)
@ -276,7 +276,7 @@ ccl_device_forceinline void mnee_setup_manifold_vertex(KernelGlobals kg,
object_normal_transform_auto(kg, sd_vtx, &normals[2]);
}
/* Tangent space (position derivatives) wrt barycentric (u, v). */
/* Tangent space (position derivatives) WRT barycentric (u, v). */
vtx->dp_du = verts[0] - verts[2];
vtx->dp_dv = verts[1] - verts[2];
@ -297,7 +297,7 @@ ccl_device_forceinline void mnee_setup_manifold_vertex(KernelGlobals kg,
normals[2] * (1.0f - sd_vtx->u - sd_vtx->v),
&n_len);
/* Shading normal derivatives wrt barycentric (u, v)
/* Shading normal derivatives WRT barycentric (u, v)
* we calculate the derivative of n = |u*n0 + v*n1 + (1-u-v)*n2| using:
* d/du [f(u)/|f(u)|] = [d/du f(u)]/|f(u)| - f(u)/|f(u)|^3 <f(u), d/du f(u)>. */
const float inv_n_len = 1.f / n_len;
@ -340,13 +340,13 @@ ccl_device_forceinline void mnee_setup_manifold_vertex(KernelGlobals kg,
if (det != 0.f) {
const float inv_det = 1.f / det;
/* Tangent space (position derivatives) wrt texture (u, v). */
/* Tangent space (position derivatives) WRT texture (u, v). */
const float3 dp_du = vtx->dp_du;
const float3 dp_dv = vtx->dp_dv;
vtx->dp_du = (duv1.y * dp_du - duv0.y * dp_dv) * inv_det;
vtx->dp_dv = (-duv1.x * dp_du + duv0.x * dp_dv) * inv_det;
/* Shading normal derivatives wrt texture (u, v). */
/* Shading normal derivatives WRT texture (u, v). */
const float3 dn_du = vtx->dn_du;
const float3 dn_dv = vtx->dn_dv;
vtx->dn_du = (duv1.y * dn_du - duv0.y * dn_dv) * inv_det;
@ -434,7 +434,7 @@ ccl_device_forceinline bool mnee_compute_constraint_derivatives(
float3 dH_du, dH_dv;
/* Constraint derivatives wrt previous vertex. */
/* Constraint derivatives WRT previous vertex. */
if (vi > 0) {
ccl_private ManifoldVertex &v_prev = vertices[vi - 1];
dH_du = (v_prev.dp_du - wi * dot(wi, v_prev.dp_du)) * ili;
@ -447,7 +447,7 @@ ccl_device_forceinline bool mnee_compute_constraint_derivatives(
v.a = make_float4(dot(dH_du, s), dot(dH_dv, s), dot(dH_du, t), dot(dH_dv, t));
}
/* Constraint derivatives wrt current vertex. */
/* Constraint derivatives WRT current vertex. */
if (vi == vertex_count - 1 && light_fixed_direction) {
dH_du = ili * (-v.dp_du + wi * dot(wi, v.dp_du));
dH_dv = ili * (-v.dp_dv + wi * dot(wi, v.dp_dv));
@ -475,7 +475,7 @@ ccl_device_forceinline bool mnee_compute_constraint_derivatives(
dot(dH_du, t) + dot(H, dt_du),
dot(dH_dv, t) + dot(H, dt_dv));
/* Constraint derivatives wrt next vertex. */
/* Constraint derivatives WRT next vertex. */
if (vi < vertex_count - 1) {
ccl_private ManifoldVertex &v_next = vertices[vi + 1];
dH_du = (v_next.dp_du - wo * dot(wo, v_next.dp_du)) * ilo;
@ -488,7 +488,7 @@ ccl_device_forceinline bool mnee_compute_constraint_derivatives(
v.c = make_float4(dot(dH_du, s), dot(dH_dv, s), dot(dH_du, t), dot(dH_dv, t));
}
/* Constraint vector wrt. the local shading frame. */
/* Constraint vector WRT. the local shading frame. */
v.constraint = make_float2(dot(s, H), dot(t, H)) - v.n_offset;
}
return true;
@ -561,7 +561,7 @@ ccl_device_forceinline bool mnee_newton_solver(KernelGlobals kg,
bool resolve_constraint = true;
for (int iteration = 0; iteration < MNEE_MAX_ITERATIONS; iteration++) {
if (resolve_constraint) {
/* Calculate constraintand its derivatives for vertices. */
/* Calculate constraint and its derivatives for vertices. */
if (!mnee_compute_constraint_derivatives(
vertex_count, vertices, sd->P, light_fixed_direction, light_sample))
return false;
@ -797,7 +797,7 @@ ccl_device_forceinline bool mnee_compute_transfer_matrix(ccl_private const Shade
det_dh_dx *= Lk_det;
}
/* Fill out constraint derivatives wrt light vertex param. */
/* Fill out constraint derivatives WRT light vertex param. */
/* Local shading frame at last free vertex. */
int mi = vertex_count - 1;
@ -845,7 +845,7 @@ ccl_device_forceinline bool mnee_compute_transfer_matrix(ccl_private const Shade
dH_dtheta -= H * dot(dH_dtheta, H);
dH_dphi -= H * dot(dH_dphi, H);
/* constraint derivatives wrt light direction expressed
/* Constraint derivatives WRT light direction expressed
* in spherical coordinates (theta, phi). */
dc_dlight = make_float4(
dot(dH_dtheta, s), dot(dH_dphi, s), dot(dH_dtheta, t), dot(dH_dphi, t));
@ -909,7 +909,7 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
* and keep pdf in vertex area measure */
mnee_update_light_sample(kg, vertices[vertex_count - 1].p, ls);
/* Evaluate light sam.ple
/* Evaluate light sample
* in case the light has a node-based shader:
* 1. sd_mnee will be used to store light data, which is why we need to do
* this evaluation here. sd_mnee needs to contain the solution's last
@ -952,7 +952,7 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg,
for (int vi = 0; vi < vertex_count; vi++) {
ccl_private const ManifoldVertex &v = vertices[vi];
/* Check visiblity. */
/* Check visibility. */
probe_ray.D = normalize_len(v.p - probe_ray.P, &probe_ray.t);
if (scene_intersect(kg, &probe_ray, PATH_RAY_TRANSMIT, &probe_isect)) {
int hit_object = (probe_isect.object == OBJECT_NONE) ?

Binary file not shown.

@ -1 +1 @@
Subproject commit 2a5095eed3028e91624d27ca93e4c65f572b809d
Subproject commit 716dc02ec30c0810513f7b4adc4ae865ae50c4e6

@ -1 +1 @@
Subproject commit 67f1fbca1482d9d9362a4001332e785c3fd5d230
Subproject commit 787ea78f7fa6f0373d80ba1247768402df93f8ad

View File

@ -100,6 +100,7 @@ _km_hierarchy = [
('Paint Stroke Modal', 'EMPTY', 'WINDOW', []),
('Sculpt Expand Modal', 'EMPTY', 'WINDOW', []),
('Paint Curve', 'EMPTY', 'WINDOW', []),
('Curve Pen Modal Map', 'EMPTY', 'WINDOW', []),
('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change

View File

@ -133,6 +133,7 @@ class Params:
self.tool_maybe_tweak_value = 'PRESS'
else:
self.tool_maybe_tweak_value = 'CLICK_DRAG'
self.use_tweak_tool_lmb_interaction = use_tweak_tool_lmb_interaction
self.context_menu_event = {"type": 'W', "value": 'PRESS'}
@ -574,18 +575,18 @@ def km_window(params):
{"type": k, "value": 'PRESS', "shift": True},
{"properties": [("space_type", t)]})
for k, t in (
('F1', 'FILE_BROWSER'),
('F2', 'CLIP_EDITOR'),
('F3', 'NODE_EDITOR'),
('F4', 'CONSOLE'),
('F5', 'VIEW_3D'),
('F6', 'GRAPH_EDITOR'),
('F7', 'PROPERTIES'),
('F8', 'SEQUENCE_EDITOR'),
('F9', 'OUTLINER'),
('F10', 'IMAGE_EDITOR'),
('F11', 'TEXT_EDITOR'),
('F12', 'DOPESHEET_EDITOR'),
('F1', 'FILE_BROWSER'),
('F2', 'CLIP_EDITOR'),
('F3', 'NODE_EDITOR'),
('F4', 'CONSOLE'),
('F5', 'VIEW_3D'),
('F6', 'GRAPH_EDITOR'),
('F7', 'PROPERTIES'),
('F8', 'SEQUENCE_EDITOR'),
('F9', 'OUTLINER'),
('F10', 'IMAGE_EDITOR'),
('F11', 'TEXT_EDITOR'),
('F12', 'DOPESHEET_EDITOR'),
)
),
@ -2136,7 +2137,7 @@ def km_node_editor(params):
("wm.context_menu_enum", {"type": 'TAB', "value": 'PRESS', "shift": True, "ctrl": True},
{"properties": [("data_path", 'tool_settings.snap_node_element')]}),
("wm.context_toggle", {"type": 'Z', "value": 'PRESS', "alt": True, "shift": True},
{"properties": [("data_path", "space_data.overlay.show_overlays")]}),
{"properties": [("data_path", "space_data.overlay.show_overlays")]}),
*_template_items_context_menu("NODE_MT_context_menu", params.context_menu_event),
])
@ -6158,6 +6159,25 @@ def km_sculpt_expand_modal(_params):
return keymap
def km_curve_pen_modal_map(_params):
items = []
keymap = (
"Curve Pen Modal Map",
{"space_type": 'EMPTY', "region_type": 'WINDOW', "modal": True},
{"items": items},
)
items.extend([
("FREE_ALIGN_TOGGLE", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, None),
("MOVE_ADJACENT", {"type": 'LEFT_CTRL', "value": 'ANY', "any": True}, None),
("MOVE_ENTIRE", {"type": 'SPACE', "value": 'ANY', "any": True}, None),
("LOCK_ANGLE", {"type": 'LEFT_ALT', "value": 'ANY', "any": True}, None),
("LINK_HANDLES", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None),
])
return keymap
# Fallback for gizmos that don't have custom a custom key-map.
def km_generic_gizmo(_params):
keymap = (
@ -7078,6 +7098,27 @@ def km_3d_view_tool_edit_curve_draw(params):
)
def km_3d_view_tool_edit_curve_pen(params):
return (
"3D View Tool: Edit Curve, Curve Pen",
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
{"items": [
("curve.pen", {"type": params.tool_mouse, "value": 'PRESS'},
{"properties": [
("extrude_point", True),
("move_segment", True),
("select_point", True),
("move_point", True),
("close_spline_method", "ON_CLICK"),
]}),
("curve.pen", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True},
{"properties": [("insert_point", True), ("delete_point", True)]}),
("curve.pen", {"type": params.tool_mouse, "value": 'DOUBLE_CLICK'},
{"properties": [("toggle_vector", True), ("cycle_handle_type", True),]}),
]},
)
def km_3d_view_tool_edit_curve_tilt(params):
return (
"3D View Tool: Edit Curve, Tilt",
@ -7882,6 +7923,7 @@ def generate_keymaps(params=None):
km_view3d_dolly_modal(params),
km_paint_stroke_modal(params),
km_sculpt_expand_modal(params),
km_curve_pen_modal_map(params),
# Gizmos.
km_generic_gizmo(params),
@ -7960,6 +8002,7 @@ def generate_keymaps(params=None):
km_3d_view_tool_edit_mesh_rip_region(params),
km_3d_view_tool_edit_mesh_rip_edge(params),
km_3d_view_tool_edit_curve_draw(params),
km_3d_view_tool_edit_curve_pen(params),
km_3d_view_tool_edit_curve_radius(params),
km_3d_view_tool_edit_curve_tilt(params),
km_3d_view_tool_edit_curve_randomize(params),

View File

@ -1201,6 +1201,22 @@ class _defs_edit_curve:
keymap=(),
)
@ToolDef.from_fn
def pen():
def draw_settings(_context, layout, tool):
props = tool.operator_properties("curve.pen")
layout.prop(props, "close_spline")
layout.prop(props, "extrude_handle")
return dict(
idname="builtin.pen",
label="Curve Pen",
cursor='CROSSHAIR',
icon="ops.curve.pen",
widget=None,
keymap=(),
draw_settings=draw_settings,
)
@ToolDef.from_fn
def tilt():
return dict(
@ -2881,6 +2897,7 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
*_tools_default,
None,
_defs_edit_curve.draw,
_defs_edit_curve.pen,
(
_defs_edit_curve.extrude,
_defs_edit_curve.extrude_cursor,

View File

@ -137,6 +137,7 @@ void blf_glyph_draw(
#ifdef WIN32
/* blf_font_win32_compat.c */
# ifdef FT_FREETYPE_H
extern FT_Error FT_New_Face__win32_compat(FT_Library library,
const char *pathname,

View File

@ -371,6 +371,7 @@ void BKE_pose_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, s
void BKE_pose_blend_read_expand(struct BlendExpander *expander, struct bPose *pose);
/* action_mirror.c */
void BKE_action_flip_with_pose(struct bAction *act, struct Object *ob_arm);
#ifdef __cplusplus

View File

@ -552,4 +552,100 @@ Curves *curves_new_nomain(int points_num, int curves_num);
*/
Curves *curves_new_nomain_single(int points_num, CurveType type);
/** \} */
/* -------------------------------------------------------------------- */
/** \name #CurvesGeometry Inline Methods
* \{ */
inline int CurvesGeometry::points_num() const
{
return this->point_size;
}
inline int CurvesGeometry::curves_num() const
{
return this->curve_size;
}
inline IndexRange CurvesGeometry::points_range() const
{
return IndexRange(this->points_num());
}
inline IndexRange CurvesGeometry::curves_range() const
{
return IndexRange(this->curves_num());
}
inline IndexRange CurvesGeometry::points_for_curve(const int index) const
{
/* Offsets are not allocated when there are no curves. */
BLI_assert(this->curve_size > 0);
BLI_assert(this->curve_offsets != nullptr);
const int offset = this->curve_offsets[index];
const int offset_next = this->curve_offsets[index + 1];
return {offset, offset_next - offset};
}
inline IndexRange CurvesGeometry::points_for_curves(const IndexRange curves) const
{
/* Offsets are not allocated when there are no curves. */
BLI_assert(this->curve_size > 0);
BLI_assert(this->curve_offsets != nullptr);
const int offset = this->curve_offsets[curves.start()];
const int offset_next = this->curve_offsets[curves.one_after_last()];
return {offset, offset_next - offset};
}
inline int CurvesGeometry::evaluated_points_num() const
{
/* This could avoid calculating offsets in the future in simple circumstances. */
return this->evaluated_offsets().last();
}
inline IndexRange CurvesGeometry::evaluated_points_for_curve(int index) const
{
BLI_assert(!this->runtime->offsets_cache_dirty);
return offsets_to_range(this->runtime->evaluated_offsets_cache.as_span(), index);
}
inline IndexRange CurvesGeometry::evaluated_points_for_curves(const IndexRange curves) const
{
BLI_assert(!this->runtime->offsets_cache_dirty);
BLI_assert(this->curve_size > 0);
const int offset = this->runtime->evaluated_offsets_cache[curves.start()];
const int offset_next = this->runtime->evaluated_offsets_cache[curves.one_after_last()];
return {offset, offset_next - offset};
}
inline Span<int> CurvesGeometry::bezier_evaluated_offsets_for_curve(const int curve_index) const
{
const IndexRange points = this->points_for_curve(curve_index);
return this->runtime->bezier_evaluated_offsets.as_span().slice(points);
}
inline IndexRange CurvesGeometry::lengths_range_for_curve(const int curve_index,
const bool cyclic) const
{
BLI_assert(cyclic == this->cyclic()[curve_index]);
const IndexRange points = this->evaluated_points_for_curve(curve_index);
const int start = points.start() + curve_index;
const int size = curves::curve_segment_size(points.size(), cyclic);
return {start, size};
}
inline Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_index,
const bool cyclic) const
{
BLI_assert(!this->runtime->length_cache_dirty);
const IndexRange range = this->lengths_range_for_curve(curve_index, cyclic);
return this->runtime->evaluated_length_cache.as_span().slice(range);
}
inline float CurvesGeometry::evaluated_length_total_for_curve(const int curve_index,
const bool cyclic) const
{
return this->evaluated_lengths_for_curve(curve_index, cyclic).last();
}
/** \} */
} // namespace blender::bke

View File

@ -70,6 +70,7 @@ typedef struct BMEditMesh {
} BMEditMesh;
/* editmesh.c */
void BKE_editmesh_looptri_calc_ex(BMEditMesh *em,
const struct BMeshCalcTessellation_Params *params);
void BKE_editmesh_looptri_calc(BMEditMesh *em);

View File

@ -27,6 +27,7 @@ struct MovieClip;
struct MovieClipUser;
/* mask_ops.c */
typedef enum {
MASK_WHICH_HANDLE_NONE = 0,
MASK_WHICH_HANDLE_STICK = 1,

View File

@ -1067,6 +1067,7 @@ extern void (*BKE_mesh_batch_cache_dirty_tag_cb)(struct Mesh *me, eMeshBatchDirt
extern void (*BKE_mesh_batch_cache_free_cb)(struct Mesh *me);
/* mesh_debug.c */
#ifndef NDEBUG
char *BKE_mesh_debug_info(const struct Mesh *me)
ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;

View File

@ -150,41 +150,6 @@ CurvesGeometry::~CurvesGeometry()
/** \name Accessors
* \{ */
int CurvesGeometry::points_num() const
{
return this->point_size;
}
int CurvesGeometry::curves_num() const
{
return this->curve_size;
}
IndexRange CurvesGeometry::points_range() const
{
return IndexRange(this->points_num());
}
IndexRange CurvesGeometry::curves_range() const
{
return IndexRange(this->curves_num());
}
IndexRange CurvesGeometry::points_for_curve(const int index) const
{
BLI_assert(this->curve_size > 0);
BLI_assert(this->curve_offsets != nullptr);
const int offset = this->curve_offsets[index];
const int offset_next = this->curve_offsets[index + 1];
return {offset, offset_next - offset};
}
IndexRange CurvesGeometry::points_for_curves(const IndexRange curves) const
{
BLI_assert(this->curve_size > 0);
BLI_assert(this->curve_offsets != nullptr);
const int offset = this->curve_offsets[curves.start()];
const int offset_next = this->curve_offsets[curves.one_after_last()];
return {offset, offset_next - offset};
}
static int domain_size(const CurvesGeometry &curves, const AttributeDomain domain)
{
return domain == ATTR_DOMAIN_POINT ? curves.points_num() : curves.curves_num();
@ -492,27 +457,6 @@ static void calculate_evaluated_offsets(const CurvesGeometry &curves,
});
}
int CurvesGeometry::evaluated_points_num() const
{
/* This could avoid calculating offsets in the future in simple circumstances. */
return this->evaluated_offsets().last();
}
IndexRange CurvesGeometry::evaluated_points_for_curve(int index) const
{
BLI_assert(!this->runtime->offsets_cache_dirty);
return offsets_to_range(this->runtime->evaluated_offsets_cache.as_span(), index);
}
IndexRange CurvesGeometry::evaluated_points_for_curves(const IndexRange curves) const
{
BLI_assert(!this->runtime->offsets_cache_dirty);
BLI_assert(this->curve_size > 0);
const int offset = this->runtime->evaluated_offsets_cache[curves.start()];
const int offset_next = this->runtime->evaluated_offsets_cache[curves.one_after_last()];
return {offset, offset_next - offset};
}
void CurvesGeometry::ensure_evaluated_offsets() const
{
if (!this->runtime->offsets_cache_dirty) {
@ -548,12 +492,6 @@ Span<int> CurvesGeometry::evaluated_offsets() const
return this->runtime->evaluated_offsets_cache;
}
Span<int> CurvesGeometry::bezier_evaluated_offsets_for_curve(const int curve_index) const
{
const IndexRange points = this->points_for_curve(curve_index);
return this->runtime->bezier_evaluated_offsets.as_span().slice(points);
}
IndexMask CurvesGeometry::indices_for_curve_type(const CurveType type,
Vector<int64_t> &r_indices) const
{
@ -728,15 +666,6 @@ void CurvesGeometry::interpolate_to_evaluated(const int curve_index,
BLI_assert_unreachable();
}
IndexRange CurvesGeometry::lengths_range_for_curve(const int curve_index, const bool cyclic) const
{
BLI_assert(cyclic == this->cyclic()[curve_index]);
const IndexRange points = this->evaluated_points_for_curve(curve_index);
const int start = points.start() + curve_index;
const int size = curves::curve_segment_size(points.size(), cyclic);
return {start, size};
}
void CurvesGeometry::ensure_evaluated_lengths() const
{
if (!this->runtime->length_cache_dirty) {
@ -777,20 +706,6 @@ void CurvesGeometry::ensure_evaluated_lengths() const
this->runtime->length_cache_dirty = false;
}
Span<float> CurvesGeometry::evaluated_lengths_for_curve(const int curve_index,
const bool cyclic) const
{
BLI_assert(!this->runtime->length_cache_dirty);
const IndexRange range = this->lengths_range_for_curve(curve_index, cyclic);
return this->runtime->evaluated_length_cache.as_span().slice(range);
}
float CurvesGeometry::evaluated_length_total_for_curve(const int curve_index,
const bool cyclic) const
{
return this->evaluated_lengths_for_curve(curve_index, cyclic).last();
}
/** \} */
/* -------------------------------------------------------------------- */
@ -857,6 +772,10 @@ void CurvesGeometry::calculate_bezier_auto_handles()
if (types.is_single() && types.get_internal_single() != CURVE_TYPE_BEZIER) {
return;
}
if (std::as_const(*this).handle_positions_left().is_empty() ||
std::as_const(*this).handle_positions_right().is_empty()) {
return;
}
const VArray<bool> cyclic = std::as_const(*this).cyclic();
const Span<int8_t> types_left = this->handle_types_left();
const Span<int8_t> types_right = this->handle_types_right();

View File

@ -1308,7 +1308,7 @@ void BKE_gpencil_stroke_smooth(bGPDstroke *gps,
/* Smooth stroke. */
for (int i = 0; i < gps->totpoints; i++) {
float val = influence;
if (weights != NULL) {
if (weights != nullptr) {
val *= weights[i];
if (val <= 0.0f) {
continue;

View File

@ -11,7 +11,7 @@
#ifndef NDEBUG
# include <stdio.h>
# include <cstdio>
# include "MEM_guardedalloc.h"

View File

@ -168,6 +168,7 @@ struct PBVH {
};
/* pbvh.c */
void BB_reset(BB *bb);
/**
* Expand the bounding box to include a new coordinate.
@ -216,6 +217,7 @@ bool ray_face_nearest_tri(const float ray_start[3],
void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag);
/* pbvh_bmesh.c */
bool pbvh_bmesh_node_raycast(PBVHNode *node,
const float ray_start[3],
const float ray_normal[3],

View File

@ -1413,6 +1413,7 @@ void EEVEE_cryptomatte_store_metadata(EEVEE_Data *vedata, struct RenderResult *r
void EEVEE_cryptomatte_free(EEVEE_Data *vedata);
/* eevee_occlusion.c */
int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata,
EEVEE_Data *vedata,
@ -1424,6 +1425,7 @@ void EEVEE_occlusion_draw_debug(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
void EEVEE_occlusion_free(void);
/* eevee_screen_raytrace.c */
int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_screen_raytrace_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_refraction_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
@ -1434,6 +1436,7 @@ void EEVEE_reflection_output_init(EEVEE_ViewLayerData *sldata,
void EEVEE_reflection_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
/* eevee_subsurface.c */
void EEVEE_subsurface_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_subsurface_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
@ -1450,6 +1453,7 @@ void EEVEE_subsurface_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_subsurface_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
/* eevee_motion_blur.c */
int EEVEE_motion_blur_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_motion_blur_step_set(EEVEE_Data *vedata, int step);
void EEVEE_motion_blur_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
@ -1464,10 +1468,12 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata);
void EEVEE_motion_blur_draw(EEVEE_Data *vedata);
/* eevee_mist.c */
void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
void EEVEE_mist_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
/* eevee_renderpasses.c */
void EEVEE_renderpasses_init(EEVEE_Data *vedata);
void EEVEE_renderpasses_output_init(EEVEE_ViewLayerData *sldata,
EEVEE_Data *vedata,
@ -1501,6 +1507,7 @@ bool EEVEE_renderpasses_only_first_sample_pass_active(EEVEE_Data *vedata);
int EEVEE_renderpasses_aov_hash(const ViewLayerAOV *aov);
/* eevee_temporal_sampling.c */
void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata);
void EEVEE_temporal_sampling_create_view(EEVEE_Data *vedata);
int EEVEE_temporal_sampling_sample_count_get(const Scene *scene, const EEVEE_StorageList *stl);

View File

@ -56,6 +56,7 @@ class AbstractDrawingMode {
};
/* image_shader.c */
GPUShader *IMAGE_shader_image_get();
GPUShader *IMAGE_shader_depth_get();
void IMAGE_shader_free();

View File

@ -8,11 +8,13 @@
#pragma once
/* select_engine.c */
extern DrawEngineType draw_engine_select_type;
extern RenderEngineType DRW_engine_viewport_select_type;
#ifdef WITH_DRAW_DEBUG
/* select_debug_engine.c */
extern DrawEngineType draw_engine_debug_select_type;
#endif

View File

@ -52,6 +52,7 @@ typedef struct SELECTID_PrivateData {
} SELECTID_PrivateData; /* Transient data */
/* select_draw_utils.c */
void select_id_object_min_max(struct Object *obj, float r_min[3], float r_max[3]);
short select_id_get_object_select_mode(Scene *scene, Object *ob);
void select_id_draw_object(void *vedata,

View File

@ -393,10 +393,12 @@ BLI_INLINE bool workbench_is_specular_highlight_enabled(WORKBENCH_PrivateData *w
}
/* workbench_opaque.c */
void workbench_opaque_engine_init(WORKBENCH_Data *data);
void workbench_opaque_cache_init(WORKBENCH_Data *data);
/* workbench_transparent.c */
void workbench_transparent_engine_init(WORKBENCH_Data *data);
void workbench_transparent_cache_init(WORKBENCH_Data *data);
/**
@ -406,11 +408,13 @@ void workbench_transparent_cache_init(WORKBENCH_Data *data);
void workbench_transparent_draw_depth_pass(WORKBENCH_Data *data);
/* workbench_shadow.c */
void workbench_shadow_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd);
void workbench_shadow_cache_init(WORKBENCH_Data *data);
void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, bool has_transp_mat);
/* workbench_shader.c */
GPUShader *workbench_shader_opaque_get(WORKBENCH_PrivateData *wpd, eWORKBENCH_DataType data);
GPUShader *workbench_shader_opaque_image_get(WORKBENCH_PrivateData *wpd,
eWORKBENCH_DataType data,
@ -447,6 +451,7 @@ void workbench_shader_depth_of_field_get(GPUShader **prepare_sh,
void workbench_shader_free(void);
/* workbench_effect_antialiasing.c */
int workbench_antialiasing_sample_count_get(WORKBENCH_PrivateData *wpd);
void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata);
void workbench_antialiasing_cache_init(WORKBENCH_Data *vedata);
@ -458,18 +463,22 @@ bool workbench_antialiasing_setup(WORKBENCH_Data *vedata);
void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata);
/* workbench_effect_cavity.c */
void workbench_cavity_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd);
void workbench_cavity_samples_ubo_ensure(WORKBENCH_PrivateData *wpd);
void workbench_cavity_cache_init(WORKBENCH_Data *data);
/* workbench_effect_outline.c */
void workbench_outline_cache_init(WORKBENCH_Data *data);
/* workbench_effect_dof.c */
void workbench_dof_engine_init(WORKBENCH_Data *vedata);
void workbench_dof_cache_init(WORKBENCH_Data *vedata);
void workbench_dof_draw_pass(WORKBENCH_Data *vedata);
/* workbench_materials.c */
void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd,
Object *ob,
Material *mat,
@ -507,6 +516,7 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd,
workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, interp, WORKBENCH_DATATYPE_HAIR)
/* workbench_data.c */
void workbench_private_data_alloc(WORKBENCH_StorageList *stl);
void workbench_private_data_init(WORKBENCH_PrivateData *wpd);
void workbench_update_world_ubo(WORKBENCH_PrivateData *wpd);
@ -514,6 +524,7 @@ void workbench_update_material_ubos(WORKBENCH_PrivateData *wpd);
struct GPUUniformBuf *workbench_material_ubo_alloc(WORKBENCH_PrivateData *wpd);
/* workbench_volume.c */
void workbench_volume_engine_init(WORKBENCH_Data *vedata);
void workbench_volume_cache_init(WORKBENCH_Data *vedata);
void workbench_volume_cache_populate(WORKBENCH_Data *vedata,
@ -525,6 +536,7 @@ void workbench_volume_draw_pass(WORKBENCH_Data *vedata);
void workbench_volume_draw_finish(WORKBENCH_Data *vedata);
/* workbench_engine.c */
void workbench_engine_init(void *ved);
void workbench_cache_init(void *ved);
void workbench_cache_populate(void *ved, Object *ob);
@ -537,6 +549,7 @@ void workbench_draw_sample(void *ved);
void workbench_draw_finish(void *ved);
/* workbench_render.c */
void workbench_render(void *ved,
struct RenderEngine *engine,
struct RenderLayer *render_layer,

View File

@ -167,8 +167,8 @@ void workbench_shadow_cache_init(WORKBENCH_Data *data)
}
static const BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
Object *ob,
WORKBENCH_ObjectData *oed)
{
if (oed->shadow_bbox_dirty || wpd->shadow_changed) {
float tmp_mat[4][4];

View File

@ -614,7 +614,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
drw_call_calc_orco(ob, ob_infos->orcotexfac);
/* Random float value. */
uint random = (DST.dupli_source) ?
DST.dupli_source->random_id :
DST.dupli_source->random_id :
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
* put it in ob->runtime and make depsgraph ensure it is up to date. */
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);

View File

@ -22,6 +22,7 @@ typedef enum eParticleRefineShaderType {
} eParticleRefineShaderType;
/* draw_shader.c */
struct GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement,
eParticleRefineShaderType sh_type);
void DRW_shaders_free(void);

View File

@ -290,6 +290,7 @@ void mesh_render_data_update_looptris(MeshRenderData *mr,
eMRDataType data_flag);
/* draw_cache_extract_mesh_extractors.c */
typedef struct EditLoopData {
uchar v_flag;
uchar e_flag;

View File

@ -233,7 +233,7 @@ static void extract_pos_nor_init_subdiv(const DRWSubdivCache *subdiv_cache,
Mesh *coarse_mesh = subdiv_cache->mesh;
float(*lnors)[3] = static_cast<float(*)[3]>(
CustomData_get_layer(&coarse_mesh->ldata, CD_NORMAL));
BLI_assert(lnors != NULL);
BLI_assert(lnors != nullptr);
GPUVertBuf *src_custom_normals = GPU_vertbuf_calloc();
GPU_vertbuf_init_with_format(src_custom_normals, get_custom_normals_format());

View File

@ -217,6 +217,7 @@ void POSELIB_OT_browse_interactive(struct wmOperatorType *ot);
void POSELIB_OT_apply_pose(struct wmOperatorType *ot);
/* pose_lib_2.c */
void POSELIB_OT_apply_pose_asset(struct wmOperatorType *ot);
void POSELIB_OT_blend_pose_asset(struct wmOperatorType *ot);

View File

@ -25,6 +25,7 @@ set(SRC
editcurve_paint.c
editcurve_query.c
editcurve_select.c
editcurve_pen.c
editcurve_undo.c
editfont.c
editfont_undo.c

View File

@ -16,6 +16,7 @@ struct ViewContext;
struct wmOperatorType;
/* editfont.c */
enum {
DEL_NEXT_CHAR,
DEL_PREV_CHAR,
@ -93,6 +94,7 @@ void FONT_OT_textbox_add(struct wmOperatorType *ot);
void FONT_OT_textbox_remove(struct wmOperatorType *ot);
/* editcurve.c */
void CURVE_OT_hide(struct wmOperatorType *ot);
void CURVE_OT_reveal(struct wmOperatorType *ot);
@ -128,9 +130,21 @@ void CURVE_OT_cyclic_toggle(struct wmOperatorType *ot);
void CURVE_OT_match_texture_space(struct wmOperatorType *ot);
/* exported for editcurve_undo.c */
struct GHash *ED_curve_keyindex_hash_duplicate(struct GHash *keyindex);
void ED_curve_keyindex_update_nurb(struct EditNurb *editnurb, struct Nurb *nu, struct Nurb *newnu);
/* exported for editcurve_pen.c */
int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const float location_init[3]);
bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction);
void ed_dissolve_bez_segment(BezTriple *bezt_prev,
BezTriple *bezt_next,
const Nurb *nu,
const Curve *cu,
const uint span_len,
const uint span_step[2]);
/* helper functions */
void ed_editnurb_translate_flag(struct ListBase *editnurb,
uint8_t flag,
@ -151,6 +165,7 @@ bool ed_editnurb_spin(float viewmat[4][4],
const float cent[3]);
/* editcurve_select.c */
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
void CURVE_OT_select_all(struct wmOperatorType *ot);
@ -167,6 +182,7 @@ void CURVE_OT_select_similar(struct wmOperatorType *ot);
void CURVE_OT_shortest_path_pick(struct wmOperatorType *ot);
/* editcurve_add.c */
void CURVE_OT_primitive_bezier_curve_add(struct wmOperatorType *ot);
void CURVE_OT_primitive_bezier_circle_add(struct wmOperatorType *ot);
void CURVE_OT_primitive_nurbs_curve_add(struct wmOperatorType *ot);
@ -189,8 +205,25 @@ bool ED_curve_pick_vert(struct ViewContext *vc,
struct BPoint **r_bp,
short *r_handle,
struct Base **r_base);
/**
* \param sel_dist_mul: A multiplier on the default select distance.
*/
bool ED_curve_pick_vert_ex(struct ViewContext *vc,
short sel,
int dist_px,
struct Nurb **r_nurb,
struct BezTriple **r_bezt,
struct BPoint **r_bp,
short *r_handle,
struct Base **r_base);
void ED_curve_nurb_vert_selected_find(
Curve *cu, View3D *v3d, Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp);
/* editcurve_paint.c */
void CURVE_OT_draw(struct wmOperatorType *ot);
/* editcurve_pen.c */
void CURVE_OT_pen(struct wmOperatorType *ot);
struct wmKeyMap *curve_pen_modal_keymap(struct wmKeyConfig *keyconf);

View File

@ -111,6 +111,7 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(CURVE_OT_spin);
WM_operatortype_append(CURVE_OT_vertex_add);
WM_operatortype_append(CURVE_OT_draw);
WM_operatortype_append(CURVE_OT_pen);
WM_operatortype_append(CURVE_OT_extrude);
WM_operatortype_append(CURVE_OT_cyclic_toggle);
@ -150,4 +151,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
/* only set in editmode curve, by space_view3d listener */
keymap = WM_keymap_ensure(keyconf, "Curve", 0, 0);
keymap->poll = ED_operator_editsurfcurve;
curve_pen_modal_keymap(keyconf);
}

View File

@ -4725,6 +4725,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
bool ED_curve_editnurb_select_pick(bContext *C,
const int mval[2],
const int dist_px,
const struct SelectPick_Params *params)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
@ -4740,7 +4741,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
ED_view3d_viewcontext_init(C, &vc, depsgraph);
copy_v2_v2_int(vc.mval, mval);
bool found = ED_curve_pick_vert(&vc, 1, &nu, &bezt, &bp, &hand, &basact);
bool found = ED_curve_pick_vert_ex(&vc, 1, dist_px, &nu, &bezt, &bp, &hand, &basact);
if (params->sel_op == SEL_OP_SET) {
if ((found && params->select_passthrough) &&
@ -5344,10 +5345,7 @@ static bool ed_editcurve_extrude(Curve *cu, EditNurb *editnurb, View3D *v3d)
/** \name Add Vertex Operator
* \{ */
static int ed_editcurve_addvert(Curve *cu,
EditNurb *editnurb,
View3D *v3d,
const float location_init[3])
int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const float location_init[3])
{
float center[3];
float temp[3];
@ -5719,7 +5717,7 @@ void CURVE_OT_extrude(wmOperatorType *ot)
/** \name Make Cyclic Operator
* \{ */
static bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
{
BezTriple *bezt;
BPoint *bp;
@ -6502,6 +6500,70 @@ static bool test_bezt_is_sel_any(const void *bezt_v, void *user_data)
return BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt);
}
void ed_dissolve_bez_segment(BezTriple *bezt_prev,
BezTriple *bezt_next,
const Nurb *nu,
const Curve *cu,
const uint span_len,
const uint span_step[2])
{
int i_span_edge_len = span_len + 1;
const int dims = 3;
const int points_len = ((cu->resolu - 1) * i_span_edge_len) + 1;
float *points = MEM_mallocN(points_len * dims * sizeof(float), __func__);
float *points_stride = points;
const int points_stride_len = (cu->resolu - 1);
for (int segment = 0; segment < i_span_edge_len; segment++) {
BezTriple *bezt_a = &nu->bezt[mod_i((span_step[0] + segment) - 1, nu->pntsu)];
BezTriple *bezt_b = &nu->bezt[mod_i((span_step[0] + segment), nu->pntsu)];
for (int axis = 0; axis < dims; axis++) {
BKE_curve_forward_diff_bezier(bezt_a->vec[1][axis],
bezt_a->vec[2][axis],
bezt_b->vec[0][axis],
bezt_b->vec[1][axis],
points_stride + axis,
points_stride_len,
dims * sizeof(float));
}
points_stride += dims * points_stride_len;
}
BLI_assert(points_stride + dims == points + (points_len * dims));
float tan_l[3], tan_r[3], error_sq_dummy;
uint error_index_dummy;
sub_v3_v3v3(tan_l, bezt_prev->vec[1], bezt_prev->vec[2]);
normalize_v3(tan_l);
sub_v3_v3v3(tan_r, bezt_next->vec[0], bezt_next->vec[1]);
normalize_v3(tan_r);
curve_fit_cubic_to_points_single_fl(points,
points_len,
NULL,
dims,
FLT_EPSILON,
tan_l,
tan_r,
bezt_prev->vec[2],
bezt_next->vec[0],
&error_sq_dummy,
&error_index_dummy);
if (!ELEM(bezt_prev->h2, HD_FREE, HD_ALIGN)) {
bezt_prev->h2 = (bezt_prev->h2 == HD_VECT) ? HD_FREE : HD_ALIGN;
}
if (!ELEM(bezt_next->h1, HD_FREE, HD_ALIGN)) {
bezt_next->h1 = (bezt_next->h1 == HD_VECT) ? HD_FREE : HD_ALIGN;
}
MEM_freeN(points);
}
static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
@ -6537,61 +6599,7 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op))
BezTriple *bezt_prev = &nu->bezt[mod_i(span_step[0] - 1, nu->pntsu)];
BezTriple *bezt_next = &nu->bezt[mod_i(span_step[1] + 1, nu->pntsu)];
int i_span_edge_len = span_len + 1;
const uint dims = 3;
const uint points_len = ((cu->resolu - 1) * i_span_edge_len) + 1;
float *points = MEM_mallocN(points_len * dims * sizeof(float), __func__);
float *points_stride = points;
const int points_stride_len = (cu->resolu - 1);
for (int segment = 0; segment < i_span_edge_len; segment++) {
BezTriple *bezt_a = &nu->bezt[mod_i((span_step[0] + segment) - 1, nu->pntsu)];
BezTriple *bezt_b = &nu->bezt[mod_i((span_step[0] + segment), nu->pntsu)];
for (int axis = 0; axis < dims; axis++) {
BKE_curve_forward_diff_bezier(bezt_a->vec[1][axis],
bezt_a->vec[2][axis],
bezt_b->vec[0][axis],
bezt_b->vec[1][axis],
points_stride + axis,
points_stride_len,
dims * sizeof(float));
}
points_stride += dims * points_stride_len;
}
BLI_assert(points_stride + dims == points + (points_len * dims));
float tan_l[3], tan_r[3], error_sq_dummy;
uint error_index_dummy;
sub_v3_v3v3(tan_l, bezt_prev->vec[1], bezt_prev->vec[2]);
normalize_v3(tan_l);
sub_v3_v3v3(tan_r, bezt_next->vec[0], bezt_next->vec[1]);
normalize_v3(tan_r);
curve_fit_cubic_to_points_single_fl(points,
points_len,
NULL,
dims,
FLT_EPSILON,
tan_l,
tan_r,
bezt_prev->vec[2],
bezt_next->vec[0],
&error_sq_dummy,
&error_index_dummy);
if (!ELEM(bezt_prev->h2, HD_FREE, HD_ALIGN)) {
bezt_prev->h2 = (bezt_prev->h2 == HD_VECT) ? HD_FREE : HD_ALIGN;
}
if (!ELEM(bezt_next->h1, HD_FREE, HD_ALIGN)) {
bezt_next->h1 = (bezt_next->h1 == HD_VECT) ? HD_FREE : HD_ALIGN;
}
MEM_freeN(points);
ed_dissolve_bez_segment(bezt_prev, bezt_next, nu, cu, span_len, span_step);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -88,13 +88,14 @@ static void ED_curve_pick_vert__do_closest(void *userData,
UNUSED_VARS_NDEBUG(handles_visible);
}
bool ED_curve_pick_vert(ViewContext *vc,
short sel,
Nurb **r_nurb,
BezTriple **r_bezt,
BPoint **r_bp,
short *r_handle,
Base **r_base)
bool ED_curve_pick_vert_ex(ViewContext *vc,
short sel,
const int dist_px,
Nurb **r_nurb,
BezTriple **r_bezt,
BPoint **r_bp,
short *r_handle,
Base **r_base)
{
/* (sel == 1): selected gets a disadvantage */
/* in nurb and bezt or bp the nearest is written */
@ -109,7 +110,7 @@ bool ED_curve_pick_vert(ViewContext *vc,
bool is_changed;
} data = {NULL};
data.dist = ED_view3d_select_dist_px();
data.dist = dist_px;
data.hpoint = 0;
data.select = sel;
data.mval_fl[0] = vc->mval[0];
@ -143,6 +144,18 @@ bool ED_curve_pick_vert(ViewContext *vc,
return (data.bezt || data.bp);
}
bool ED_curve_pick_vert(ViewContext *vc,
short sel,
Nurb **r_nurb,
BezTriple **r_bezt,
BPoint **r_bp,
short *r_handle,
Base **r_base)
{
return ED_curve_pick_vert_ex(
vc, sel, ED_view3d_select_dist_px(), r_nurb, r_bezt, r_bp, r_handle, r_base);
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -254,7 +254,7 @@ static int curves_convert_to_particle_system_exec(bContext *C, wmOperator *UNUSE
}
CTX_DATA_END;
WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, nullptr);
return OPERATOR_FINISHED;
}

View File

@ -765,6 +765,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
ops.armature.extrude_cursor
ops.armature.extrude_move
ops.curve.draw
ops.curve.pen
ops.curve.extrude_cursor
ops.curve.extrude_move
ops.curve.radius

View File

@ -282,6 +282,7 @@ void ED_armature_ebone_selectflag_enable(struct EditBone *ebone, int flag);
void ED_armature_ebone_selectflag_disable(struct EditBone *ebone, int flag);
/* pose_edit.c */
struct Object *ED_pose_object_from_context(struct bContext *C);
bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
@ -357,6 +358,7 @@ void ED_pose_bone_select_tag_update(struct Object *ob);
void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
/* meshlaplacian.c */
void ED_mesh_deform_bind_callback(struct Object *object,
struct MeshDeformModifierData *mmd,
struct Mesh *cagemesh,

View File

@ -48,10 +48,11 @@ void ED_curve_editnurb_make(struct Object *obedit);
void ED_curve_editnurb_free(struct Object *obedit);
/**
* \return True when pick finds an element or the selection changed.
* \param dist_px: Maximum distance to pick (in pixels).
*/
bool ED_curve_editnurb_select_pick(struct bContext *C,
const int mval[2],
int dist_px,
const struct SelectPick_Params *params);
struct Nurb *ED_curve_add_nurbs_primitive(

View File

@ -39,6 +39,7 @@ struct wmWindowManager;
*/
/* gizmo_library_presets.c */
void ED_gizmo_draw_preset_box(const struct wmGizmo *gz, float mat[4][4], int select_id);
void ED_gizmo_draw_preset_arrow(const struct wmGizmo *gz,
float mat[4][4],
@ -223,6 +224,7 @@ enum {
/* Specific gizmos utils */
/* dial3d_gizmo.c */
struct Dial3dParams {
int draw_options;
float angle_ofs;
@ -240,6 +242,7 @@ void ED_gizmotypes_dial_3d_draw_util(const float matrix_basis[4][4],
struct Dial3dParams *params);
/* snap3d_gizmo.c */
struct SnapObjectContext *ED_gizmotypes_snap_3d_context_ensure(struct Scene *scene,
struct wmGizmo *gz);

View File

@ -28,6 +28,7 @@ struct wmOperator;
struct wmWindowManager;
/* image_draw.c */
float ED_space_image_zoom_level(const struct View2D *v2d, int grid_dimension);
void ED_space_image_grid_steps(struct SpaceImage *sima,
float grid_steps[SI_GRID_STEPS_LEN],
@ -162,6 +163,7 @@ int ED_image_save_all_modified_info(const struct Main *bmain, struct ReportList
bool ED_image_save_all_modified(const struct bContext *C, struct ReportList *reports);
/* image_sequence.c */
typedef struct ImageFrameRange {
struct ImageFrameRange *next, *prev;

View File

@ -15,6 +15,7 @@ struct Main;
struct wmWindowManager;
/* info_stats.c */
void ED_info_stats_clear(struct wmWindowManager *wm, struct ViewLayer *view_layer);
const char *ED_info_statusbar_string(struct Main *bmain,
struct Scene *scene,

View File

@ -335,6 +335,7 @@ bool EDBM_selectmode_disable_multi(struct bContext *C,
short selectmode_fallback);
/* editmesh_preselect_edgering.c */
struct EditMesh_PreSelEdgeRing;
struct EditMesh_PreSelEdgeRing *EDBM_preselect_edgering_create(void);
void EDBM_preselect_edgering_destroy(struct EditMesh_PreSelEdgeRing *psel);
@ -347,6 +348,7 @@ void EDBM_preselect_edgering_update_from_edge(struct EditMesh_PreSelEdgeRing *ps
const float (*coords)[3]);
/* editmesh_preselect_elem.c */
struct EditMesh_PreSelElem;
typedef enum eEditMesh_PreSelPreviewAction {
PRESELECT_ACTION_TRANSFORM = 1,
@ -441,6 +443,7 @@ void ED_mesh_mirrtopo_init(struct BMEditMesh *em,
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
/* object_vgroup.c */
#define WEIGHT_REPLACE 1
#define WEIGHT_ADD 2
#define WEIGHT_SUBTRACT 3

View File

@ -66,6 +66,7 @@ Object **ED_object_array_in_mode_or_selected(struct bContext *C,
uint *r_objects_len);
/* object_utils.c */
bool ED_object_calc_active_center_for_editmode(struct Object *obedit,
bool select_only,
float r_center[3]);
@ -126,6 +127,7 @@ void ED_object_xform_skip_child_container_item_ensure(struct XFormObjectSkipChil
void ED_object_xform_array_m4(struct Object **objects, uint objects_len, const float matrix[4][4]);
/* object_ops.c */
void ED_operatortypes_object(void);
void ED_operatormacros_object(void);
void ED_keymap_object(struct wmKeyConfig *keyconf);
@ -581,6 +583,7 @@ bool ED_object_iter_other(struct Main *bmain,
bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
/* object_greasepencil_modifier.c */
struct GpencilModifierData *ED_object_gpencil_modifier_add(struct ReportList *reports,
struct Main *bmain,
struct Scene *scene,
@ -615,6 +618,7 @@ void ED_object_gpencil_modifier_copy_to_object(struct Object *ob_dst,
struct GpencilModifierData *md);
/* object_shader_fx.c */
struct ShaderFxData *ED_object_shaderfx_add(struct ReportList *reports,
struct Main *bmain,
struct Scene *scene,
@ -640,6 +644,7 @@ void ED_object_shaderfx_link(struct Object *dst, struct Object *src);
void ED_object_shaderfx_copy(struct Object *dst, struct ShaderFxData *fx);
/* object_select.c */
void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(
@ -690,6 +695,7 @@ void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int fa
void ED_object_facemap_face_remove(struct Object *ob, struct bFaceMap *fmap, int facenum);
/* object_data_transform.c */
struct XFormObjectData *ED_object_data_xform_create_ex(struct ID *id, bool is_edit_mode);
struct XFormObjectData *ED_object_data_xform_create(struct ID *id);
struct XFormObjectData *ED_object_data_xform_create_from_edit_mode(ID *id);

View File

@ -20,11 +20,13 @@ struct wmKeyConfig;
struct wmOperator;
/* paint_ops.c */
void ED_operatortypes_paint(void);
void ED_operatormacros_paint(void);
void ED_keymap_paint(struct wmKeyConfig *keyconf);
/* paint_image.c */
void ED_imapaint_clear_partial_redraw(void);
void ED_imapaint_dirty_region(struct Image *ima,
struct ImBuf *ibuf,

View File

@ -19,11 +19,13 @@ struct Object;
struct Scene;
/* particle_edit.c */
bool PE_poll(struct bContext *C);
bool PE_hair_poll(struct bContext *C);
bool PE_poll_view3d(struct bContext *C);
/* rigidbody_object.c */
bool ED_rigidbody_object_add(struct Main *bmain,
struct Scene *scene,
struct Object *ob,
@ -32,6 +34,7 @@ bool ED_rigidbody_object_add(struct Main *bmain,
void ED_rigidbody_object_remove(struct Main *bmain, struct Scene *scene, struct Object *ob);
/* rigidbody_constraint.c */
bool ED_rigidbody_constraint_add(struct Main *bmain,
struct Scene *scene,
struct Object *ob,

View File

@ -134,6 +134,7 @@ void ED_region_visibility_change_update(struct bContext *C,
struct ScrArea *area,
struct ARegion *region);
/* screen_ops.c */
/**
* \note Assumes that \a region itself is not a split version from previous region.
*/
@ -650,6 +651,7 @@ void ED_region_generic_tools_region_message_subscribe(
int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis);
/* area_query.c */
bool ED_region_overlap_isect_x(const ARegion *region, int event_x);
bool ED_region_overlap_isect_y(const ARegion *region, int event_y);
bool ED_region_overlap_isect_xy(const ARegion *region, const int event_xy[2]);

View File

@ -42,6 +42,7 @@ void ED_text_undosys_type(struct UndoType *ut);
struct UndoStep *ED_text_undo_push_init(struct bContext *C);
/* text_format.c */
bool ED_text_is_syntax_highlight_supported(struct Text *text);
#ifdef __cplusplus

View File

@ -22,6 +22,7 @@ struct wmOperator;
struct wmOperatorType;
/* undo.c */
/**
* Run from the main event loop, basic checks that undo is left in a correct state.
*/
@ -91,7 +92,8 @@ struct Base **ED_undo_editmode_bases_from_view_layer(struct ViewLayer *view_laye
*/
struct UndoStack *ED_undo_stack_get(void);
/* helpers */
/* Helpers. */
void ED_undo_object_set_active_or_warn(struct Scene *scene,
struct ViewLayer *view_layer,
struct Object *ob,

View File

@ -20,6 +20,7 @@ struct wmEvent;
struct wmOperator;
/* ed_util_imbuf.c */
void ED_imbuf_sample_draw(const struct bContext *C, struct ARegion *region, void *arg_info);
void ED_imbuf_sample_exit(struct bContext *C, struct wmOperator *op);
int ED_imbuf_sample_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);

View File

@ -263,11 +263,13 @@ typedef enum {
V3D_PROJ_TEST_CLIP_WIN)
/* view3d_snap.c */
bool ED_view3d_snap_selected_to_location(struct bContext *C,
const float snap_target_global[3],
int pivot_point);
/* view3d_cursor_snap.c */
#define USE_SNAP_DETECT_FROM_KEYMAP_HACK
typedef enum {
V3D_SNAPCURSOR_TOGGLE_ALWAYS_TRUE = 1 << 0,
@ -939,6 +941,7 @@ int view3d_opengl_select_with_id_filter(struct ViewContext *vc,
uint select_id);
/* view3d_select.c */
float ED_view3d_select_dist_px(void);
void ED_view3d_viewcontext_init(struct bContext *C,
struct ViewContext *vc,

View File

@ -598,6 +598,7 @@ typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
typedef void (*uiFreeArgFunc)(void *arg);
/* interface_query.c */
bool UI_but_has_tooltip_label(const uiBut *but);
bool UI_but_is_tool(const uiBut *but);
/* file selectors are exempt from utf-8 checks */
@ -611,6 +612,7 @@ bool UI_block_can_add_separator(const uiBlock *block);
struct uiList *UI_list_find_mouse_over(const struct ARegion *region, const struct wmEvent *event);
/* interface_region_menu_popup.c */
/**
* Popup Menus
*
@ -676,6 +678,7 @@ struct uiLayout *UI_popover_layout(uiPopover *pup);
void UI_popover_once_clear(uiPopover *pup);
/* interface_region_menu_pie.c */
/* Pie menus */
typedef struct uiPieMenu uiPieMenu;

View File

@ -69,11 +69,11 @@ set(SRC
interface_widgets.c
resources.c
tree_view.cc
view2d.c
view2d_draw.c
view2d_edge_pan.c
view2d_gizmo_navigate.c
view2d_ops.c
view2d.cc
view2d_draw.cc
view2d_edge_pan.cc
view2d_gizmo_navigate.cc
view2d_ops.cc
interface_eyedropper_intern.h
interface_intern.h

View File

@ -202,7 +202,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
/* XXX this guess_opname can potentially return a different keymap
* than being found on adding later... */
wmKeyMap *km = WM_keymap_guess_opname(C, idname);
wmKeyMapItem *kmi = WM_keymap_add_item(km, idname, EVT_AKEY, KM_PRESS, 0, 0, KM_ANY);
wmKeyMapItem *kmi = WM_keymap_add_item(km,
idname,
&(const KeyMapItem_Params){
.type = EVT_AKEY,
.value = KM_PRESS,
.modifier = 0,
.direction = KM_ANY,
});
const int kmi_id = kmi->id;
/* This takes ownership of prop, or prop can be NULL for reset. */

View File

@ -850,6 +850,7 @@ struct uiPopupBlockHandle {
/* exposed as public API in UI_interface.h */
/* interface_region_color_picker.c */
void ui_color_picker_rgb_to_hsv_compat(const float rgb[3], float r_cp[3]);
void ui_color_picker_rgb_to_hsv(const float rgb[3], float r_cp[3]);
void ui_color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3]);
@ -1514,6 +1515,7 @@ uiButTreeRow *ui_block_view_find_treerow_in_old_block(const uiBlock *new_block,
const uiTreeViewItemHandle *new_item_handle);
/* interface_templates.c */
struct uiListType *UI_UL_cache_file_layers(void);
#ifdef __cplusplus

View File

@ -303,7 +303,7 @@ int UI_pie_menu_invoke_from_rna_enum(struct bContext *C,
* - Julian (Feb 2016)
* \{ */
struct PieMenuLevelData {
struct PieMenuLevelData {
char title[UI_MAX_NAME_STR]; /* parent pie title, copied for level */
int icon; /* parent pie icon, copied for level */
int totitem; /* total count of *remaining* items */
@ -313,7 +313,7 @@ int UI_pie_menu_invoke_from_rna_enum(struct bContext *C,
const char *propname;
IDProperty *properties;
wmOperatorCallContext context, flag;
} ;
};
/**
* Invokes a new pie menu for a new level.

View File

@ -13,6 +13,7 @@ extern "C" {
#endif
/* interface_region_menu_popup.c */
uint ui_popup_menu_hash(const char *str);
/* interface_regions_intern.h */

View File

@ -489,7 +489,7 @@ static bool add_collection_search_item(CollItemSearch *cis,
cis->name,
cis->data,
cis->iconid,
cis->has_sep_char ? UI_BUT_HAS_SEP_CHAR : 0,
cis->has_sep_char ? (int)UI_BUT_HAS_SEP_CHAR : 0,
name_prefix_offset);
}

View File

@ -5,10 +5,10 @@
* \ingroup edinterface
*/
#include <float.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstring>
#include "MEM_guardedalloc.h"
@ -123,7 +123,7 @@ static void view2d_masks(View2D *v2d, const rcti *mask_scroll)
/* mask - view frame */
UI_view2d_mask_from_win(v2d, &v2d->mask);
if (mask_scroll == NULL) {
if (mask_scroll == nullptr) {
mask_scroll = &v2d->mask;
}
@ -356,7 +356,7 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->winx = winx;
v2d->winy = winy;
view2d_masks(v2d, NULL);
view2d_masks(v2d, nullptr);
if (do_init) {
/* Visible by default. */
@ -820,7 +820,7 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
}
/* set masks */
view2d_masks(v2d, NULL);
view2d_masks(v2d, nullptr);
}
void UI_view2d_curRect_validate(View2D *v2d)
@ -834,7 +834,7 @@ void UI_view2d_curRect_changed(const bContext *C, View2D *v2d)
ARegion *region = CTX_wm_region(C);
if (region->type->on_view2d_changed != NULL) {
if (region->type->on_view2d_changed != nullptr) {
region->type->on_view2d_changed(C, region);
}
}
@ -1662,7 +1662,8 @@ void UI_view2d_region_to_view(
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
const float mask_size[2] = {BLI_rcti_size_x(&v2d->mask), BLI_rcti_size_y(&v2d->mask)};
const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
(float)BLI_rcti_size_y(&v2d->mask)};
rect_dst->xmin = (v2d->cur.xmin +
(cur_size[0] * (rect_src->xmin - v2d->mask.xmin) / mask_size[0]));
@ -1737,7 +1738,8 @@ void UI_view2d_view_to_region_fl(
void UI_view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
const float mask_size[2] = {BLI_rcti_size_x(&v2d->mask), BLI_rcti_size_y(&v2d->mask)};
const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
(float)BLI_rcti_size_y(&v2d->mask)};
rctf rect_tmp;
/* Step 1: express given coordinates as proportional values. */
@ -1766,7 +1768,8 @@ void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4])
bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
const float mask_size[2] = {BLI_rcti_size_x(&v2d->mask), BLI_rcti_size_y(&v2d->mask)};
const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
(float)BLI_rcti_size_y(&v2d->mask)};
rctf rect_tmp;
BLI_assert(rect_src->xmin <= rect_src->xmax && rect_src->ymin <= rect_src->ymax);
@ -1805,11 +1808,11 @@ View2D *UI_view2d_fromcontext(const bContext *C)
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
if (area == NULL) {
return NULL;
if (area == nullptr) {
return nullptr;
}
if (region == NULL) {
return NULL;
if (region == nullptr) {
return nullptr;
}
return &(region->v2d);
}
@ -1819,15 +1822,15 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
ScrArea *area = CTX_wm_area(C);
ARegion *region = CTX_wm_region(C);
if (area == NULL) {
return NULL;
if (area == nullptr) {
return nullptr;
}
if (region == NULL) {
return NULL;
if (region == nullptr) {
return nullptr;
}
if (region->regiontype != RGN_TYPE_WINDOW) {
ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
return region_win ? &(region_win->v2d) : NULL;
return region_win ? &(region_win->v2d) : nullptr;
}
return &(region->v2d);
}
@ -1997,7 +2000,7 @@ char UI_view2d_rect_in_scrollers(const ARegion *region, const View2D *v2d, const
/** \name View2D Text Drawing Cache
* \{ */
typedef struct View2DString {
struct View2DString {
struct View2DString *next;
union {
uchar ub[4];
@ -2008,11 +2011,11 @@ typedef struct View2DString {
/* str is allocated past the end */
char str[0];
} View2DString;
};
/* assumes caches are used correctly, so for time being no local storage in v2d */
static MemArena *g_v2d_strings_arena = NULL;
static View2DString *g_v2d_strings = NULL;
static MemArena *g_v2d_strings_arena = nullptr;
static View2DString *g_v2d_strings = nullptr;
void UI_view2d_text_cache_add(
View2D *v2d, float x, float y, const char *str, size_t str_len, const uchar col[4])
@ -2023,13 +2026,13 @@ void UI_view2d_text_cache_add(
if (UI_view2d_view_to_region_clip(v2d, x, y, &mval[0], &mval[1])) {
const int alloc_len = str_len + 1;
View2DString *v2s;
if (g_v2d_strings_arena == NULL) {
if (g_v2d_strings_arena == nullptr) {
g_v2d_strings_arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 14), __func__);
}
v2s = BLI_memarena_alloc(g_v2d_strings_arena, sizeof(View2DString) + alloc_len);
View2DString *v2s = static_cast<View2DString *>(
BLI_memarena_alloc(g_v2d_strings_arena, sizeof(View2DString) + alloc_len));
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
@ -2053,13 +2056,13 @@ void UI_view2d_text_cache_add_rectf(
if (UI_view2d_view_to_region_rcti_clip(v2d, rect_view, &rect)) {
const int alloc_len = str_len + 1;
View2DString *v2s;
if (g_v2d_strings_arena == NULL) {
if (g_v2d_strings_arena == nullptr) {
g_v2d_strings_arena = BLI_memarena_new(MEM_SIZE_OPTIMAL(1 << 14), __func__);
}
v2s = BLI_memarena_alloc(g_v2d_strings_arena, sizeof(View2DString) + alloc_len);
View2DString *v2s = static_cast<View2DString *>(
BLI_memarena_alloc(g_v2d_strings_arena, sizeof(View2DString) + alloc_len));
BLI_LINKS_PREPEND(g_v2d_strings, v2s);
@ -2116,11 +2119,11 @@ void UI_view2d_text_cache_draw(ARegion *region)
BLF_disable(font_id, BLF_CLIPPING);
}
}
g_v2d_strings = NULL;
g_v2d_strings = nullptr;
if (g_v2d_strings_arena) {
BLI_memarena_free(g_v2d_strings_arena);
g_v2d_strings_arena = NULL;
g_v2d_strings_arena = nullptr;
}
}

View File

@ -5,22 +5,22 @@
* \ingroup edinterface
*/
#include <float.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_timecode.h"
#include "BLI_utildefines.h"
#include "BLI_vector.hh"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
@ -97,40 +97,38 @@ static float view2d_major_step_x__time(const View2D *v2d, const Scene *scene)
{
const double fps = FPS;
float *possible_distances = NULL;
BLI_array_staticdeclare(possible_distances, 32);
blender::Vector<float, 32> possible_distances;
for (uint step = 1; step < fps; step *= 2) {
BLI_array_append(possible_distances, step);
for (int step = 1; step < fps; step *= 2) {
possible_distances.append(step);
}
BLI_array_append(possible_distances, fps);
BLI_array_append(possible_distances, 2 * fps);
BLI_array_append(possible_distances, 5 * fps);
BLI_array_append(possible_distances, 10 * fps);
BLI_array_append(possible_distances, 30 * fps);
BLI_array_append(possible_distances, 60 * fps);
BLI_array_append(possible_distances, 2 * 60 * fps);
BLI_array_append(possible_distances, 5 * 60 * fps);
BLI_array_append(possible_distances, 10 * 60 * fps);
BLI_array_append(possible_distances, 30 * 60 * fps);
BLI_array_append(possible_distances, 60 * 60 * fps);
possible_distances.append(fps);
possible_distances.append(2 * fps);
possible_distances.append(5 * fps);
possible_distances.append(10 * fps);
possible_distances.append(30 * fps);
possible_distances.append(60 * fps);
possible_distances.append(2 * 60 * fps);
possible_distances.append(5 * 60 * fps);
possible_distances.append(10 * 60 * fps);
possible_distances.append(30 * 60 * fps);
possible_distances.append(60 * 60 * fps);
float distance = select_major_distance(possible_distances,
BLI_array_len(possible_distances),
float distance = select_major_distance(possible_distances.data(),
possible_distances.size(),
BLI_rcti_size_x(&v2d->mask),
BLI_rctf_size_x(&v2d->cur));
BLI_array_free(possible_distances);
return distance;
}
/* Draw parallel lines
************************************/
typedef struct ParallelLinesSet {
struct ParallelLinesSet {
float offset;
float distance;
} ParallelLinesSet;
};
static void get_parallel_lines_draw_steps(const ParallelLinesSet *lines,
float region_start,
@ -266,8 +264,8 @@ static void view2d_draw_lines(const View2D *v2d,
/* Scale indicator text drawing
**************************************************/
typedef void (*PositionToString)(
void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str);
using PositionToString =
void (*)(void *user_data, float v2d_pos, float v2d_step, uint max_len, char *r_str);
static void draw_horizontal_scale_indicators(const ARegion *region,
const View2D *v2d,
@ -530,7 +528,7 @@ static void UI_view2d_draw_scale_x__discrete_values(const ARegion *region,
{
const float number_step = view2d_major_step_x__discrete(v2d);
draw_horizontal_scale_indicators(
region, v2d, number_step, rect, view_to_string__frame_number, NULL, colorid);
region, v2d, number_step, rect, view_to_string__frame_number, nullptr, colorid);
}
static void UI_view2d_draw_scale_x__discrete_time(
@ -547,7 +545,8 @@ static void UI_view2d_draw_scale_x__values(const ARegion *region,
int colorid)
{
const float step = view2d_major_step_x__continuous(v2d);
draw_horizontal_scale_indicators(region, v2d, step, rect, view_to_string__value, NULL, colorid);
draw_horizontal_scale_indicators(
region, v2d, step, rect, view_to_string__value, nullptr, colorid);
}
void UI_view2d_draw_scale_y__values(const ARegion *region,
@ -557,7 +556,7 @@ void UI_view2d_draw_scale_y__values(const ARegion *region,
{
const float step = view2d_major_step_y__continuous(v2d);
draw_vertical_scale_indicators(
region, v2d, step, 0.0f, rect, view_to_string__value, NULL, colorid);
region, v2d, step, 0.0f, rect, view_to_string__value, nullptr, colorid);
}
void UI_view2d_draw_scale_y__block(const ARegion *region,
@ -566,7 +565,7 @@ void UI_view2d_draw_scale_y__block(const ARegion *region,
int colorid)
{
draw_vertical_scale_indicators(
region, v2d, 1.0f, 0.5f, rect, view_to_string__value, NULL, colorid);
region, v2d, 1.0f, 0.5f, rect, view_to_string__value, nullptr, colorid);
}
void UI_view2d_draw_scale_x__discrete_frames_or_seconds(const struct ARegion *region,

View File

@ -34,7 +34,7 @@ bool UI_view2d_edge_pan_poll(bContext *C)
ARegion *region = CTX_wm_region(C);
/* Check if there's a region in context to work with. */
if (region == NULL) {
if (region == nullptr) {
return false;
}

View File

@ -54,39 +54,39 @@ struct NavigateGizmoInfo {
static struct NavigateGizmoInfo g_navigate_params_for_space_image[GZ_INDEX_TOTAL] = {
{
.opname = "IMAGE_OT_view_pan",
.gizmo = "GIZMO_GT_button_2d",
"IMAGE_OT_view_pan",
"GIZMO_GT_button_2d",
ICON_VIEW_PAN,
},
{
.opname = "IMAGE_OT_view_zoom",
.gizmo = "GIZMO_GT_button_2d",
"IMAGE_OT_view_zoom",
"GIZMO_GT_button_2d",
ICON_VIEW_ZOOM,
},
};
static struct NavigateGizmoInfo g_navigate_params_for_space_clip[GZ_INDEX_TOTAL] = {
{
.opname = "CLIP_OT_view_pan",
.gizmo = "GIZMO_GT_button_2d",
"CLIP_OT_view_pan",
"GIZMO_GT_button_2d",
ICON_VIEW_PAN,
},
{
.opname = "CLIP_OT_view_zoom",
.gizmo = "GIZMO_GT_button_2d",
"CLIP_OT_view_zoom",
"GIZMO_GT_button_2d",
ICON_VIEW_ZOOM,
},
};
static struct NavigateGizmoInfo g_navigate_params_for_view2d[GZ_INDEX_TOTAL] = {
{
.opname = "VIEW2D_OT_pan",
.gizmo = "GIZMO_GT_button_2d",
"VIEW2D_OT_pan",
"GIZMO_GT_button_2d",
ICON_VIEW_PAN,
},
{
.opname = "VIEW2D_OT_zoom",
.gizmo = "GIZMO_GT_button_2d",
"VIEW2D_OT_zoom",
"GIZMO_GT_button_2d",
ICON_VIEW_ZOOM,
},
};
@ -119,12 +119,12 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
return false;
}
ScrArea *area = CTX_wm_area(C);
if (area == NULL) {
if (area == nullptr) {
return false;
}
switch (area->spacetype) {
case SPACE_SEQ: {
const SpaceSeq *sseq = area->spacedata.first;
const SpaceSeq *sseq = static_cast<const SpaceSeq *>(area->spacedata.first);
if (sseq->gizmo_flag & (SEQ_GIZMO_HIDE | SEQ_GIZMO_HIDE_NAVIGATE)) {
return false;
}
@ -136,7 +136,7 @@ static bool WIDGETGROUP_navigate_poll(const bContext *C, wmGizmoGroupType *UNUSE
static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
{
struct NavigateWidgetGroup *navgroup = MEM_callocN(sizeof(struct NavigateWidgetGroup), __func__);
NavigateWidgetGroup *navgroup = MEM_cnew<NavigateWidgetGroup>(__func__);
navgroup->region_size[0] = -1;
navgroup->region_size[1] = -1;
@ -146,7 +146,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
for (int i = 0; i < GZ_INDEX_TOTAL; i++) {
const struct NavigateGizmoInfo *info = &navigate_params[i];
navgroup->gz_array[i] = WM_gizmo_new(info->gizmo, gzgroup, NULL);
navgroup->gz_array[i] = WM_gizmo_new(info->gizmo, gzgroup, nullptr);
wmGizmo *gz = navgroup->gz_array[i];
gz->flag |= WM_GIZMO_MOVE_CURSOR | WM_GIZMO_DRAW_MODAL;
@ -180,7 +180,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
}
wmOperatorType *ot = WM_operatortype_find(info->opname, true);
WM_gizmo_operator_set(gz, 0, ot, NULL);
WM_gizmo_operator_set(gz, 0, ot, nullptr);
}
/* Modal operators, don't use initial mouse location since we're clicking on a button. */
@ -198,7 +198,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmGizmoGroup *
static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
{
struct NavigateWidgetGroup *navgroup = gzgroup->customdata;
NavigateWidgetGroup *navgroup = static_cast<NavigateWidgetGroup *>(gzgroup->customdata);
ARegion *region = CTX_wm_region(C);
const rcti *rect_visible = ED_region_visible_rect(region);

View File

@ -5,7 +5,7 @@
* \ingroup edinterface
*/
#include <math.h>
#include <cmath>
#include "MEM_guardedalloc.h"
@ -40,7 +40,7 @@ static bool view2d_poll(bContext *C)
{
ARegion *region = CTX_wm_region(C);
return (region != NULL) && (region->v2d.flag & V2D_IS_INIT);
return (region != nullptr) && (region->v2d.flag & V2D_IS_INIT);
}
/** \} */
@ -61,7 +61,7 @@ static bool view2d_poll(bContext *C)
/**
* Temporary custom-data for operator.
*/
typedef struct v2dViewPanData {
struct v2dViewPanData {
/** screen where view pan was initiated */
bScreen *screen;
/** area where view pan was initiated */
@ -88,14 +88,14 @@ typedef struct v2dViewPanData {
/* View2D Edge Panning */
double edge_pan_last_time;
double edge_pan_start_time_x, edge_pan_start_time_y;
} v2dViewPanData;
};
static bool view_pan_poll(bContext *C)
{
ARegion *region = CTX_wm_region(C);
/* check if there's a region in context to work with */
if (region == NULL) {
if (region == nullptr) {
return false;
}
@ -117,7 +117,7 @@ static void view_pan_init(bContext *C, wmOperator *op)
BLI_assert(view_pan_poll(C));
/* set custom-data for operator */
v2dViewPanData *vpd = MEM_callocN(sizeof(v2dViewPanData), "v2dViewPanData");
v2dViewPanData *vpd = MEM_cnew<v2dViewPanData>(__func__);
op->customdata = vpd;
/* set pointers to owners */
@ -168,7 +168,7 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float
static void view_pan_apply(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
view_pan_apply_ex(C, vpd, RNA_int_get(op->ptr, "deltax"), RNA_int_get(op->ptr, "deltay"));
}
@ -176,7 +176,7 @@ static void view_pan_apply(bContext *C, wmOperator *op)
/* Cleanup temp custom-data. */
static void view_pan_exit(wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
MEM_SAFE_FREE(op->customdata);
}
@ -204,7 +204,7 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* set up customdata */
view_pan_init(C, op);
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
View2D *v2d = vpd->v2d;
/* set initial settings */
@ -244,7 +244,7 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
* need to be done here, not in the apply callback! */
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
/* execute the events */
switch (event->type) {
@ -270,7 +270,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
view_pan_exit(op);
WM_cursor_modal_restore(CTX_wm_window(C));
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL, event);
WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, nullptr, event);
return OPERATOR_FINISHED;
}
#endif
@ -333,7 +333,7 @@ static void VIEW2D_OT_pan(wmOperatorType *ot)
static int view_edge_pan_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
op->customdata = MEM_callocN(sizeof(View2DEdgePanData), "View2DEdgePanData");
View2DEdgePanData *vpd = op->customdata;
View2DEdgePanData *vpd = static_cast<View2DEdgePanData *>(op->customdata);
UI_view2d_edge_pan_operator_init(C, vpd, op);
WM_event_add_modal_handler(C, op);
@ -343,7 +343,7 @@ static int view_edge_pan_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
static int view_edge_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
View2DEdgePanData *vpd = op->customdata;
View2DEdgePanData *vpd = static_cast<View2DEdgePanData *>(op->customdata);
if (event->val == KM_RELEASE || event->type == EVT_ESCKEY) {
vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
@ -360,7 +360,7 @@ static int view_edge_pan_modal(bContext *C, wmOperator *op, const wmEvent *event
static void view_edge_pan_cancel(bContext *UNUSED(C), wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
vpd->v2d->flag &= ~V2D_IS_NAVIGATING;
MEM_SAFE_FREE(op->customdata);
}
@ -392,13 +392,11 @@ static void VIEW2D_OT_edge_pan(wmOperatorType *ot)
/* this operator only needs this single callback, where it calls the view_pan_*() methods */
static int view_scrollright_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
view_pan_init(C, op);
/* also, check if can pan in horizontal axis */
vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
@ -434,13 +432,11 @@ static void VIEW2D_OT_scroll_right(wmOperatorType *ot)
/* this operator only needs this single callback, where it calls the view_pan_*() methods */
static int view_scrollleft_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
view_pan_init(C, op);
/* also, check if can pan in horizontal axis */
vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
@ -476,13 +472,11 @@ static void VIEW2D_OT_scroll_left(wmOperatorType *ot)
/* this operator only needs this single callback, where it calls the view_pan_*() methods */
static int view_scrolldown_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
view_pan_init(C, op);
/* also, check if can pan in vertical axis */
vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
@ -519,19 +513,17 @@ static void VIEW2D_OT_scroll_down(wmOperatorType *ot)
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX);
RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll down one page");
RNA_def_boolean(ot->srna, "page", false, "Page", "Scroll down one page");
}
/* this operator only needs this single callback, where it calls the view_pan_*() methods */
static int view_scrollup_exec(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd;
/* initialize default settings (and validate if ok to run) */
view_pan_init(C, op);
/* also, check if can pan in vertical axis */
vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
view_pan_exit(op);
return OPERATOR_PASS_THROUGH;
@ -568,7 +560,7 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX);
RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll up one page");
RNA_def_boolean(ot->srna, "page", false, "Page", "Scroll up one page");
}
/** \} */
@ -594,7 +586,7 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
/**
* Temporary custom-data for operator.
*/
typedef struct v2dViewZoomData {
struct v2dViewZoomData {
View2D *v2d; /* view2d we're operating in */
ARegion *region;
@ -607,7 +599,7 @@ typedef struct v2dViewZoomData {
float dx, dy; /* running tally of previous delta values (for obtaining final zoom) */
float mx_2d, my_2d; /* initial mouse location in v2d coords */
bool zoom_to_mouse_pos;
} v2dViewZoomData;
};
/**
* Clamp by convention rather than locking flags,
@ -636,7 +628,7 @@ static bool view_zoom_poll(bContext *C)
ARegion *region = CTX_wm_region(C);
/* check if there's a region in context to work with */
if (region == NULL) {
if (region == nullptr) {
return false;
}
@ -663,7 +655,7 @@ static void view_zoomdrag_init(bContext *C, wmOperator *op)
BLI_assert(view_zoom_poll(C));
/* set custom-data for operator */
v2dViewZoomData *vzd = MEM_callocN(sizeof(v2dViewZoomData), "v2dViewZoomData");
v2dViewZoomData *vzd = MEM_cnew<v2dViewZoomData>(__func__);
op->customdata = vzd;
/* set pointers to owners */
@ -777,7 +769,7 @@ static void view_zoomstep_apply_ex(bContext *C,
if (ED_region_snap_size_apply(region, snap_test)) {
ScrArea *area = CTX_wm_area(C);
ED_area_tag_redraw(area);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, nullptr);
}
/* request updates to be done... */
@ -787,7 +779,7 @@ static void view_zoomstep_apply_ex(bContext *C,
static void view_zoomstep_apply(bContext *C, wmOperator *op)
{
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
view_zoomstep_apply_ex(
C, vzd, RNA_float_get(op->ptr, "zoomfacx"), RNA_float_get(op->ptr, "zoomfacy"));
}
@ -802,7 +794,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
static void view_zoomstep_exit(wmOperator *op)
{
UI_view2d_zoom_cache_reset();
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
vzd->v2d->flag &= ~V2D_IS_NAVIGATING;
MEM_SAFE_FREE(op->customdata);
}
@ -810,7 +802,7 @@ static void view_zoomstep_exit(wmOperator *op)
/* this operator only needs this single callback, where it calls the view_zoom_*() methods */
static int view_zoomin_exec(bContext *C, wmOperator *op)
{
if (op->customdata == NULL) { /* Might have been setup in _invoke() already. */
if (op->customdata == nullptr) { /* Might have been setup in _invoke() already. */
view_zoomdrag_init(C, op);
}
@ -833,7 +825,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
view_zoomdrag_init(C, op);
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *region = CTX_wm_region(C);
@ -875,7 +867,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op)
{
bool do_zoom_xy[2];
if (op->customdata == NULL) { /* Might have been setup in _invoke() already. */
if (op->customdata == nullptr) { /* Might have been setup in _invoke() already. */
view_zoomdrag_init(C, op);
}
@ -897,7 +889,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event
{
view_zoomdrag_init(C, op);
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
ARegion *region = CTX_wm_region(C);
@ -951,7 +943,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
/* apply transform to view (i.e. adjust 'cur' rect) */
static void view_zoomdrag_apply(bContext *C, wmOperator *op)
{
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
View2D *v2d = vzd->v2d;
const int snap_test = ED_region_snap_size_test(vzd->region);
@ -1020,7 +1012,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
if (ED_region_snap_size_apply(vzd->region, snap_test)) {
ScrArea *area = CTX_wm_area(C);
ED_area_tag_redraw(area);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, nullptr);
}
/* request updates to be done... */
@ -1034,7 +1026,7 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op)
UI_view2d_zoom_cache_reset();
if (op->customdata) {
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
vzd->v2d->flag &= ~V2D_IS_NAVIGATING;
if (vzd->timer) {
@ -1042,7 +1034,7 @@ static void view_zoomdrag_exit(bContext *C, wmOperator *op)
}
MEM_freeN(op->customdata);
op->customdata = NULL;
op->customdata = nullptr;
}
}
@ -1068,7 +1060,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
/* set up customdata */
view_zoomdrag_init(C, op);
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
View2D *v2d = vzd->v2d;
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
@ -1174,7 +1166,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
* not in the apply callback! */
static int view_zoomdrag_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
View2D *v2d = vzd->v2d;
/* execute the events */
@ -1444,7 +1436,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
const wmNDOFMotionData *ndof = event->customdata;
const wmNDOFMotionData *ndof = static_cast<const wmNDOFMotionData *>(event->customdata);
/* tune these until it feels right */
const float zoom_sensitivity = 0.5f;
@ -1462,7 +1454,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
view_pan_init(C, op);
v2dViewPanData *vpd = op->customdata;
v2dViewPanData *vpd = static_cast<v2dViewPanData *>(op->customdata);
view_pan_apply_ex(C, vpd, pan_vec[0], pan_vec[1]);
view_pan_exit(op);
@ -1481,7 +1473,7 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
view_zoomdrag_init(C, op);
v2dViewZoomData *vzd = op->customdata;
v2dViewZoomData *vzd = static_cast<v2dViewZoomData *>(op->customdata);
view_zoomstep_apply_ex(
C, vzd, do_zoom_xy[0] ? zoom_factor : 0.0f, do_zoom_xy[1] ? zoom_factor : 0.0f);
@ -1560,7 +1552,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const
wmWindow *win = CTX_wm_window(C);
View2D *v2d = &region->v2d;
struct SmoothView2DStore sms = {{0}};
SmoothView2DStore sms = {{0}};
bool ok = false;
float fac = 1.0f;
@ -1594,8 +1586,8 @@ void UI_view2d_smooth_view(bContext *C, ARegion *region, const rctf *cur, const
sms.time_allowed *= (double)fac;
/* keep track of running timer! */
if (v2d->sms == NULL) {
v2d->sms = MEM_mallocN(sizeof(struct SmoothView2DStore), "smoothview v2d");
if (v2d->sms == nullptr) {
v2d->sms = MEM_new<SmoothView2DStore>(__func__);
}
*v2d->sms = sms;
if (v2d->smooth_timer) {
@ -1624,10 +1616,10 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
wmWindow *win = CTX_wm_window(C);
ARegion *region = CTX_wm_region(C);
View2D *v2d = &region->v2d;
struct SmoothView2DStore *sms = v2d->sms;
SmoothView2DStore *sms = v2d->sms;
/* escape if not our timer */
if (v2d->smooth_timer == NULL || v2d->smooth_timer != event->customdata) {
if (v2d->smooth_timer == nullptr || v2d->smooth_timer != event->customdata) {
return OPERATOR_PASS_THROUGH;
}
@ -1644,10 +1636,10 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
v2d->cur = sms->new_cur;
MEM_freeN(v2d->sms);
v2d->sms = NULL;
v2d->sms = nullptr;
WM_event_remove_timer(CTX_wm_manager(C), win, v2d->smooth_timer);
v2d->smooth_timer = NULL;
v2d->smooth_timer = nullptr;
/* Event handling won't know if a UI item has been moved under the pointer. */
WM_event_add_mousemove(win);
@ -1663,7 +1655,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
ED_region_tag_redraw_no_rebuild(region);
if (v2d->sms == NULL) {
if (v2d->sms == nullptr) {
UI_view2d_zoom_cache_reset();
}
@ -1704,7 +1696,7 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot)
*/
/* customdata for scroller-invoke data */
typedef struct v2dScrollerMove {
struct v2dScrollerMove {
/** View2D data that this operation affects */
View2D *v2d;
/** region that the scroller is in */
@ -1731,7 +1723,7 @@ typedef struct v2dScrollerMove {
/** previous mouse coordinates (in screen coordinates) for determining movement */
int lastx, lasty;
} v2dScrollerMove;
};
/**
* #View2DScrollers is typedef'd in UI_view2d.h
@ -1840,7 +1832,7 @@ static void scroller_activate_init(bContext *C,
View2D *v2d = &region->v2d;
/* set custom-data for operator */
v2dScrollerMove *vsm = MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
v2dScrollerMove *vsm = MEM_cnew<v2dScrollerMove>(__func__);
op->customdata = vsm;
/* set general data */
@ -1855,7 +1847,7 @@ static void scroller_activate_init(bContext *C,
* - zooming must be allowed on this axis, otherwise, default to pan
*/
View2DScrollers scrollers;
UI_view2d_scrollers_calc(v2d, NULL, &scrollers);
UI_view2d_scrollers_calc(v2d, nullptr, &scrollers);
/* Use a union of 'cur' & 'tot' in case the current view is far outside 'tot'. In this cases
* moving the scroll bars has far too little effect and the view can get stuck T31476. */
@ -1912,13 +1904,13 @@ static void scroller_activate_init(bContext *C,
static void scroller_activate_exit(bContext *C, wmOperator *op)
{
if (op->customdata) {
v2dScrollerMove *vsm = op->customdata;
v2dScrollerMove *vsm = static_cast<v2dScrollerMove *>(op->customdata);
vsm->v2d->scroll_ui &= ~(V2D_SCROLL_H_ACTIVE | V2D_SCROLL_V_ACTIVE);
vsm->v2d->flag &= ~V2D_IS_NAVIGATING;
MEM_freeN(op->customdata);
op->customdata = NULL;
op->customdata = nullptr;
ED_region_tag_redraw_no_rebuild(CTX_wm_region(C));
}
@ -1932,7 +1924,7 @@ static void scroller_activate_cancel(bContext *C, wmOperator *op)
/* apply transform to view (i.e. adjust 'cur' rect) */
static void scroller_activate_apply(bContext *C, wmOperator *op)
{
v2dScrollerMove *vsm = op->customdata;
v2dScrollerMove *vsm = static_cast<v2dScrollerMove *>(op->customdata);
View2D *v2d = vsm->v2d;
/* calculate amount to move view by */
@ -1994,7 +1986,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
*/
static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
v2dScrollerMove *vsm = op->customdata;
v2dScrollerMove *vsm = static_cast<v2dScrollerMove *>(op->customdata);
/* execute the events */
switch (event->type) {
@ -2217,7 +2209,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
if (ED_region_snap_size_apply(region, snap_test)) {
ScrArea *area = CTX_wm_area(C);
ED_area_tag_redraw(area);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, nullptr);
}
/* request updates to be done... */

View File

@ -8,6 +8,7 @@
#pragma once
/* editlattice_select.c */
void LATTICE_OT_select_all(struct wmOperatorType *ot);
void LATTICE_OT_select_more(struct wmOperatorType *ot);
void LATTICE_OT_select_less(struct wmOperatorType *ot);
@ -16,5 +17,6 @@ void LATTICE_OT_select_random(struct wmOperatorType *ot);
void LATTICE_OT_select_mirror(struct wmOperatorType *ot);
/* editlattice_tools.c */
void LATTICE_OT_make_regular(struct wmOperatorType *ot);
void LATTICE_OT_flip(struct wmOperatorType *ot);

View File

@ -136,6 +136,7 @@ struct MaskSplinePoint *ED_mask_point_find_nearest(const struct bContext *C,
float *r_score);
/* mask_shapekey.c */
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
void MASK_OT_shape_key_clear(struct wmOperatorType *ot);
void MASK_OT_shape_key_feather_reset(struct wmOperatorType *ot);

View File

@ -201,6 +201,7 @@ void OBJECT_OT_surfacedeform_bind(struct wmOperatorType *ot);
void OBJECT_OT_geometry_nodes_input_attribute_toggle(struct wmOperatorType *ot);
/* object_gpencil_modifiers.c */
void OBJECT_OT_gpencil_modifier_add(struct wmOperatorType *ot);
void OBJECT_OT_gpencil_modifier_remove(struct wmOperatorType *ot);
void OBJECT_OT_gpencil_modifier_move_up(struct wmOperatorType *ot);
@ -215,6 +216,7 @@ void GPENCIL_OT_segment_remove(struct wmOperatorType *ot);
void GPENCIL_OT_segment_move(struct wmOperatorType *ot);
/* object_shader_fx.c */
void OBJECT_OT_shaderfx_add(struct wmOperatorType *ot);
void OBJECT_OT_shaderfx_copy(struct wmOperatorType *ot);
void OBJECT_OT_shaderfx_remove(struct wmOperatorType *ot);
@ -223,6 +225,7 @@ void OBJECT_OT_shaderfx_move_down(struct wmOperatorType *ot);
void OBJECT_OT_shaderfx_move_to_index(struct wmOperatorType *ot);
/* object_constraint.c */
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
void OBJECT_OT_constraint_add_with_targets(struct wmOperatorType *ot);
void POSE_OT_constraint_add(struct wmOperatorType *ot);

View File

@ -7,6 +7,7 @@
#include <cstdlib>
#include <cstring>
#include <numeric>
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@ -29,6 +30,7 @@
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_curves.hh"
#include "BKE_editmesh.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
@ -68,6 +70,7 @@
using blender::Array;
using blender::float2;
using blender::float3;
using blender::Vector;
/* -------------------------------------------------------------------- */
@ -652,7 +655,7 @@ static int apply_objects_internal(bContext *C,
float obact_invmat[4][4], obact_parent[4][4], obact_parentinv[4][4];
/* Only used when do_multi_user is set. */
Object *obact = NULL;
Object *obact = nullptr;
bool make_single_user = false;
if (do_multi_user) {
@ -672,7 +675,7 @@ static int apply_objects_internal(bContext *C,
ID *obact_data = static_cast<ID *>(obact->data);
BKE_reportf(reports,
RPT_ERROR,
"Cannot apply to a multi user: Object \"%s\", %s \"%s\", aborting",
R"(Cannot apply to a multi user: Object "%s", %s "%s", aborting)",
obact->id.name + 2,
BKE_idtype_idcode_to_name(GS(obact_data->name)),
obact_data->name + 2);
@ -691,7 +694,8 @@ static int apply_objects_internal(bContext *C,
OB_CURVES_LEGACY,
OB_SURF,
OB_FONT,
OB_GPENCIL)) {
OB_GPENCIL,
OB_CURVES)) {
ID *obdata = static_cast<ID *>(ob->data);
if (!do_multi_user && ID_REAL_USERS(obdata) > 1) {
BKE_reportf(reports,
@ -814,7 +818,7 @@ static int apply_objects_internal(bContext *C,
/* Make single user. */
ED_object_single_obdata_user(bmain, scene, obact);
BKE_main_id_newptr_and_tag_clear(bmain);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
DEG_relations_tag_update(bmain);
}
@ -923,6 +927,11 @@ static int apply_objects_internal(bContext *C,
bGPdata *gpd = static_cast<bGPdata *>(ob->data);
BKE_gpencil_transform(gpd, mat);
}
else if (ob->type == OB_CURVES) {
Curves &curves = *static_cast<Curves *>(ob->data);
blender::bke::CurvesGeometry::wrap(curves.geometry).transform(mat);
blender::bke::CurvesGeometry::wrap(curves.geometry).calculate_bezier_auto_handles();
}
else if (ob->type == OB_CAMERA) {
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
@ -1119,7 +1128,7 @@ static int object_transform_apply_invoke(bContext *C, wmOperator *op, const wmEv
bool can_handle_multiuser = apply_objects_internal_can_multiuser(C);
bool need_single_user = can_handle_multiuser && apply_objects_internal_need_single_user(C);
if ((ob->data != NULL) && need_single_user) {
if ((ob->data != nullptr) && need_single_user) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "isolate_users");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_property_boolean_set(op->ptr, prop, true);
@ -1185,7 +1194,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Object *obact = CTX_data_active_object(C);
Object *obedit = CTX_data_edit_object(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
float cent[3], cent_neg[3], centn[3];
float3 cent, cent_neg, centn;
const float *cursor = scene->cursor.location;
int centermode = RNA_enum_get(op->ptr, "type");
@ -1574,6 +1583,42 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
}
else if (ob->type == OB_CURVES) {
using namespace blender;
Curves &curves_id = *static_cast<Curves *>(ob->data);
bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry);
if (ELEM(centermode, ORIGIN_TO_CENTER_OF_MASS_SURFACE, ORIGIN_TO_CENTER_OF_MASS_VOLUME) ||
!ELEM(around, V3D_AROUND_CENTER_BOUNDS, V3D_AROUND_CENTER_MEDIAN)) {
BKE_report(
op->reports, RPT_WARNING, "Curves Object does not support this set origin operation");
continue;
}
if (curves.points_num() == 0) {
continue;
}
if (centermode == ORIGIN_TO_CURSOR) {
/* done */
}
else if (around == V3D_AROUND_CENTER_BOUNDS) {
float3 min;
float3 max;
if (curves.bounds_min_max(min, max)) {
cent = math::midpoint(min, max);
}
}
else if (around == V3D_AROUND_CENTER_MEDIAN) {
Span<float3> positions = curves.positions();
cent = std::accumulate(positions.begin(), positions.end(), float3(0)) /
curves.points_num();
}
tot_change++;
curves.translate(-cent);
curves_id.id.tag |= LIB_TAG_DOIT;
do_inverse_offset = true;
}
/* offset other selected objects */
if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {

View File

@ -85,4 +85,5 @@ void RENDER_OT_view_show(struct wmOperatorType *ot);
void RENDER_OT_view_cancel(struct wmOperatorType *ot);
/* render_opengl.c */
void RENDER_OT_opengl(struct wmOperatorType *ot);

View File

@ -120,6 +120,7 @@ void screen_area_spacelink_add(struct Scene *scene, ScrArea *area, eSpace_Type s
struct AZone *ED_area_actionzone_find_xy(ScrArea *area, const int xy[2]);
/* screen_geometry.c */
int screen_geom_area_height(const ScrArea *area);
int screen_geom_area_width(const ScrArea *area);
ScrVert *screen_geom_vertex_add_ex(ScrAreaMap *area_map, short x, short y);
@ -174,8 +175,10 @@ int ed_screen_context(const struct bContext *C,
extern const char *screen_context_dir[]; /* doc access */
/* screendump.c */
void SCREEN_OT_screenshot(struct wmOperatorType *ot);
void SCREEN_OT_screenshot_area(struct wmOperatorType *ot);
/* workspace_layout_edit.c */
bool workspace_layout_set_poll(const struct WorkSpaceLayout *layout);

View File

@ -710,7 +710,7 @@ static int sculpt_curves_stroke_modal(bContext *C, wmOperator *op, const wmEvent
{
SculptCurvesBrushStrokeData *op_data = static_cast<SculptCurvesBrushStrokeData *>(
op->customdata);
int return_value = paint_stroke_modal(C, op, event, op_data->stroke);
int return_value = paint_stroke_modal(C, op, event, &op_data->stroke);
if (ELEM(return_value, OPERATOR_FINISHED, OPERATOR_CANCELLED)) {
MEM_delete(op_data);
}

View File

@ -497,7 +497,7 @@ static int paint_exec(bContext *C, wmOperator *op)
static int paint_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
return paint_stroke_modal(C, op, event, static_cast<PaintStroke *>(op->customdata));
return paint_stroke_modal(C, op, event, reinterpret_cast<PaintStroke **>(&op->customdata));
}
static void paint_cancel(bContext *C, wmOperator *op)

View File

@ -88,7 +88,7 @@ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
int paint_stroke_modal(struct bContext *C,
struct wmOperator *op,
const struct wmEvent *event,
struct PaintStroke *stroke);
struct PaintStroke **stroke_p);
int paint_stroke_exec(struct bContext *C, struct wmOperator *op, struct PaintStroke *stroke);
void paint_stroke_cancel(struct bContext *C, struct wmOperator *op, struct PaintStroke *stroke);
bool paint_stroke_flipped(struct PaintStroke *stroke);
@ -194,6 +194,7 @@ void PAINT_OT_weight_sample(struct wmOperatorType *ot);
void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
/* paint_vertex_proj.c */
struct VertProjHandle;
struct VertProjHandle *ED_vpaint_proj_handle_create(struct Depsgraph *depsgraph,
struct Scene *scene,
@ -207,6 +208,7 @@ void ED_vpaint_proj_handle_update(struct Depsgraph *depsgraph,
void ED_vpaint_proj_handle_free(struct VertProjHandle *vp_handle);
/* paint_image.c */
typedef struct ImagePaintPartialRedraw {
rcti dirty_region;
} ImagePaintPartialRedraw;
@ -282,6 +284,7 @@ void PAINT_OT_image_paint(struct wmOperatorType *ot);
void PAINT_OT_add_simple_uvs(struct wmOperatorType *ot);
/* paint_image_2d_curve_mask.cc */
/**
* \brief Caching structure for curve mask.
*
@ -482,6 +485,7 @@ void PAINT_OT_mask_box_gesture(struct wmOperatorType *ot);
void PAINT_OT_mask_line_gesture(struct wmOperatorType *ot);
/* paint_curve.c */
void PAINTCURVE_OT_new(struct wmOperatorType *ot);
void PAINTCURVE_OT_add_point(struct wmOperatorType *ot);
void PAINTCURVE_OT_delete_point(struct wmOperatorType *ot);

View File

@ -1389,10 +1389,11 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2])
}
}
int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintStroke *stroke)
int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintStroke **stroke_p)
{
Paint *p = BKE_paint_get_active_from_context(C);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
PaintStroke *stroke = *stroke_p;
Brush *br = stroke->brush = BKE_paint_brush(p);
PaintSample sample_average;
float mouse[2];
@ -1441,6 +1442,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
/* one time initialization */
if (!stroke->stroke_init) {
if (paint_stroke_curve_end(C, op, stroke)) {
*stroke_p = NULL;
return OPERATOR_FINISHED;
}
@ -1497,12 +1499,14 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintS
paint_stroke_line_constrain(stroke, mouse);
paint_stroke_line_end(C, op, stroke, mouse);
stroke_done(C, op, stroke);
*stroke_p = NULL;
return OPERATOR_FINISHED;
}
}
else if (ELEM(event->type, EVT_RETKEY, EVT_SPACEKEY)) {
paint_stroke_line_end(C, op, stroke, sample_average.mouse);
stroke_done(C, op, stroke);
*stroke_p = NULL;
return OPERATOR_FINISHED;
}
else if (br->flag & BRUSH_LINE) {

View File

@ -2596,7 +2596,7 @@ static void wpaint_cancel(bContext *C, wmOperator *op)
static int wpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
return paint_stroke_modal(C, op, event, op->customdata);
return paint_stroke_modal(C, op, event, (struct PaintStroke **)&op->customdata);
}
void PAINT_OT_weight_paint(wmOperatorType *ot)
@ -3551,7 +3551,7 @@ static void vpaint_cancel(bContext *C, wmOperator *op)
static int vpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
return paint_stroke_modal(C, op, event, op->customdata);
return paint_stroke_modal(C, op, event, (struct PaintStroke **)&op->customdata);
}
void PAINT_OT_vertex_paint(wmOperatorType *ot)

View File

@ -5399,7 +5399,7 @@ static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
static int sculpt_brush_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
return paint_stroke_modal(C, op, event, op->customdata);
return paint_stroke_modal(C, op, event, (struct PaintStroke **)&op->customdata);
}
void SCULPT_OT_brush_stroke(wmOperatorType *ot)

View File

@ -1716,6 +1716,7 @@ void SCULPT_bmesh_topology_rake(
/* end sculpt_brush_types.c */
/* sculpt_ops.c */
void SCULPT_OT_brush_stroke(struct wmOperatorType *ot);
/* end sculpt_ops.c */

View File

@ -130,5 +130,6 @@ enum eActKeys_Mirror_Mode {
/* ***************************************** */
/* action_ops.c */
void action_operatortypes(void);
void action_keymap(struct wmKeyConfig *keyconf);

View File

@ -65,6 +65,7 @@ void clip_start_prefetch_job(const struct bContext *C);
void clip_draw_graph(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene);
/* clip_graph_ops.c */
void ED_clip_graph_center_current_frame(struct Scene *scene, struct ARegion *region);
void CLIP_OT_graph_select(struct wmOperatorType *ot);
@ -77,6 +78,7 @@ void CLIP_OT_graph_center_current_frame(struct wmOperatorType *ot);
void CLIP_OT_graph_disable_markers(struct wmOperatorType *ot);
/* clip_ops.c */
void CLIP_OT_open(struct wmOperatorType *ot);
void CLIP_OT_reload(struct wmOperatorType *ot);
void CLIP_OT_view_pan(struct wmOperatorType *ot);
@ -104,6 +106,7 @@ void CLIP_OT_cursor_set(struct wmOperatorType *ot);
void CLIP_OT_lock_selection_toggle(struct wmOperatorType *ot);
/* clip_toolbar.c */
struct ARegion *ED_clip_has_properties_region(struct ScrArea *area);
/* clip_utils.c */
@ -183,6 +186,7 @@ bool clip_view_has_locked_selection(const struct bContext *C);
void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
/* tracking_ops.c */
struct MovieTrackingTrack *tracking_marker_check_slide(
struct bContext *C, const struct wmEvent *event, int *r_area, int *r_action, int *r_corner);
@ -246,6 +250,7 @@ void CLIP_OT_keyframe_insert(struct wmOperatorType *ot);
void CLIP_OT_keyframe_delete(struct wmOperatorType *ot);
/* tracking_select.c */
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
void CLIP_OT_select_box(struct wmOperatorType *ot);

View File

@ -13,6 +13,7 @@ struct bContext;
struct wmOperatorType;
/* console_draw.c */
void console_textview_main(struct SpaceConsole *sc, const struct ARegion *region);
/* needed to calculate the scrollbar */
int console_textview_height(struct SpaceConsole *sc, const struct ARegion *region);
@ -22,6 +23,7 @@ void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_du
void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dummy);
/* console_ops.c */
void console_history_free(SpaceConsole *sc, ConsoleLine *cl);
void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl);
ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, bool own);

View File

@ -18,6 +18,7 @@ struct bContext;
/* ***************************************** */
/* graph_draw.c */
/**
* Left hand part.
*/
@ -223,5 +224,6 @@ bool graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
/* graph_ops.c */
void graphedit_keymap(struct wmKeyConfig *keyconf);
void graphedit_operatortypes(void);

View File

@ -28,6 +28,7 @@ void FILE_OT_find_missing_files(struct wmOperatorType *ot);
void INFO_OT_reports_display_update(struct wmOperatorType *ot);
/* info_draw.c */
void *info_text_pick(const struct SpaceInfo *sinfo,
const struct ARegion *region,
const struct ReportList *reports,
@ -40,6 +41,7 @@ void info_textview_main(const struct SpaceInfo *sinfo,
const struct ReportList *reports);
/* info_report.c */
int info_report_mask(const struct SpaceInfo *sinfo);
void INFO_OT_select_pick(struct wmOperatorType *ot); /* report selection */
void INFO_OT_select_all(struct wmOperatorType *ot);

View File

@ -2580,7 +2580,7 @@ static void reroute_node_draw(
const int y = node.totr.ymax;
uiBut *label_but = uiDefBut(
&block, UI_BTYPE_LABEL, 0, showname, x, y, width, (short)NODE_DY, NULL, 0, 0, 0, 0, NULL);
&block, UI_BTYPE_LABEL, 0, showname, x, y, width, (short)NODE_DY, nullptr, 0, 0, 0, 0, nullptr);
UI_but_drawflag_disable(label_but, UI_BUT_TEXT_LEFT);
}

View File

@ -536,6 +536,7 @@ void OUTLINER_OT_delete(struct wmOperatorType *ot);
/* ---------------------------------------------------------------- */
/* outliner_ops.c */
void outliner_operatortypes(void);
void outliner_keymap(struct wmKeyConfig *keyconf);

View File

@ -1167,7 +1167,6 @@ static void id_override_library_clear_single_fn(bContext *C,
}
WM_event_add_notifier(C, NC_WINDOW, nullptr);
return;
}
static void id_fake_user_set_fn(bContext *UNUSED(C),
@ -1813,11 +1812,11 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot)
using OutlinerDeleteFn = void (*)(bContext *C, ReportList *reports, Scene *scene, Object *ob);
typedef struct ObjectEditData {
using ObjectEditData = struct ObjectEditData {
GSet *objects_set;
bool is_liboverride_allowed;
bool is_liboverride_hierarchy_root_allowed;
} ObjectEditData;
};
static void outliner_do_object_delete(bContext *C,
ReportList *reports,

View File

@ -211,8 +211,8 @@ static int build_hierarchy_foreach_ID_cb(LibraryIDLinkCallbackData *cb_data)
}
void TreeDisplayOverrideLibraryHierarchies::build_hierarchy_for_ID(Main *bmain,
ID &override_root_id,
TreeElementID &te_id) const
ID &override_root_id,
TreeElementID &te_id) const
{
BuildHierarchyForeachIDCbData build_data{*bmain, space_outliner_, override_root_id, &te_id};
build_data.parent_ids.add(&override_root_id);

View File

@ -25,7 +25,8 @@ namespace blender::ed::outliner {
/* Convenience/readability. */
template<typename T> using List = ListBaseWrapper<T>;
TreeDisplayOverrideLibraryProperties::TreeDisplayOverrideLibraryProperties(SpaceOutliner &space_outliner)
TreeDisplayOverrideLibraryProperties::TreeDisplayOverrideLibraryProperties(
SpaceOutliner &space_outliner)
: AbstractTreeDisplay(space_outliner)
{
}

View File

@ -10,9 +10,11 @@
/* internal exports only */
/* script_ops.c */
void script_operatortypes(void);
void script_keymap(struct wmKeyConfig *keyconf);
/* script_edit.c */
void SCRIPT_OT_reload(struct wmOperatorType *ot);
void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);

View File

@ -29,6 +29,7 @@ struct wmOperator;
#define OVERLAP_ALPHA 180
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *region);
void draw_timeline_seq_display(const struct bContext *C, struct ARegion *region);
void sequencer_draw_preview(const struct bContext *C,
@ -68,6 +69,7 @@ struct ImBuf *sequencer_ibuf_get(struct Main *bmain,
const char *viewname);
/* sequencer_thumbnails.c */
void last_displayed_thumbnails_list_free(void *val);
void draw_seq_strip_thumbnail(struct View2D *v2d,
const struct bContext *C,
@ -79,6 +81,7 @@ void draw_seq_strip_thumbnail(struct View2D *v2d,
float pixely);
/* sequencer_edit.c */
struct View2D;
void seq_rectf(struct Sequence *seq, struct rctf *rectf);
struct Sequence *find_nearest_seq(struct Scene *scene,
@ -181,6 +184,7 @@ void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot);
void SEQUENCER_OT_cursor_set(struct wmOperatorType *ot);
/* sequencer_select.c */
void SEQUENCER_OT_select_all(struct wmOperatorType *ot);
void SEQUENCER_OT_select(struct wmOperatorType *ot);
void SEQUENCER_OT_select_side_of_frame(struct wmOperatorType *ot);
@ -195,6 +199,7 @@ void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot);
void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot);
/* sequencer_add.c */
void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot);
@ -204,10 +209,12 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot);
void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
/* sequencer_ops.c */
void sequencer_operatortypes(void);
void sequencer_keymap(struct wmKeyConfig *keyconf);
/* sequencer_scope.c */
struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf *ibuf);
struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf *ibuf);
struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf *ibuf);
@ -215,15 +222,18 @@ struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf *ibuf, float perc);
struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf *ibuf);
/* sequencer_buttons.c */
void sequencer_buttons_register(struct ARegionType *art);
/* sequencer_modifiers.c */
void SEQUENCER_OT_strip_modifier_add(struct wmOperatorType *ot);
void SEQUENCER_OT_strip_modifier_remove(struct wmOperatorType *ot);
void SEQUENCER_OT_strip_modifier_move(struct wmOperatorType *ot);
void SEQUENCER_OT_strip_modifier_copy(struct wmOperatorType *ot);
/* sequencer_view.c */
void SEQUENCER_OT_sample(struct wmOperatorType *ot);
void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
void SEQUENCER_OT_view_frame(struct wmOperatorType *ot);
@ -233,9 +243,11 @@ void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
void SEQUENCER_OT_view_ghost_border(struct wmOperatorType *ot);
/* sequencer_preview.c */
void sequencer_preview_add_sound(const struct bContext *C, struct Sequence *seq);
/* sequencer_add.c */
int sequencer_image_seq_get_minmax_frame(struct wmOperator *op,
int sfra,
int *r_minframe,

View File

@ -18,6 +18,7 @@ struct bContext;
struct wmOperatorType;
/* text_draw.c */
void draw_text_main(struct SpaceText *st, struct ARegion *region);
void text_update_line_edited(struct TextLine *line);
@ -94,6 +95,7 @@ int text_get_span_wrap(const struct SpaceText *st,
int text_get_total_lines(struct SpaceText *st, struct ARegion *region);
/* text_ops.c */
enum {
LINE_BEGIN,
LINE_END,
@ -168,7 +170,9 @@ void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
bool text_space_edit_poll(struct bContext *C);
/* text_autocomplete.c */
void TEXT_OT_autocomplete(struct wmOperatorType *ot);
/* space_text.c */
extern const char *text_context_dir[]; /* doc access */

View File

@ -27,12 +27,15 @@ struct wmOperatorType;
struct wmWindowManager;
/* view3d_header.c */
void VIEW3D_OT_toggle_matcap_flip(struct wmOperatorType *ot);
/* view3d_ops.c */
void view3d_operatortypes(void);
/* view3d_edit.c */
void VIEW3D_OT_zoom_camera_1_to_1(struct wmOperatorType *ot);
void VIEW3D_OT_view_lock_clear(struct wmOperatorType *ot);
void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot);
@ -51,6 +54,7 @@ void VIEW3D_OT_toggle_shading(struct wmOperatorType *ot);
void VIEW3D_OT_toggle_xray(struct wmOperatorType *ot);
/* view3d_draw.c */
void view3d_main_region_draw(const struct bContext *C, struct ARegion *region);
/**
* Information drawn on top of the solid plates and composed data.
@ -80,6 +84,7 @@ void view3d_depths_rect_create(struct ARegion *region, struct rcti *rect, struct
float view3d_depth_near(struct ViewDepths *d);
/* view3d_select.c */
void VIEW3D_OT_select(struct wmOperatorType *ot);
void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
void VIEW3D_OT_select_box(struct wmOperatorType *ot);
@ -88,6 +93,7 @@ void VIEW3D_OT_select_menu(struct wmOperatorType *ot);
void VIEW3D_OT_bone_select_menu(struct wmOperatorType *ot);
/* view3d_utils.c */
/**
* For home, center etc.
*/
@ -103,6 +109,7 @@ bool ED_view3d_boundbox_clip_ex(const RegionView3D *rv3d,
bool ED_view3d_boundbox_clip(RegionView3D *rv3d, const struct BoundBox *bb);
/* view3d_view.c */
void VIEW3D_OT_camera_to_view(struct wmOperatorType *ot);
void VIEW3D_OT_camera_to_view_selected(struct wmOperatorType *ot);
void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
@ -137,6 +144,7 @@ void view3d_viewmatrix_set(struct Depsgraph *depsgraph,
/* Called in transform_ops.c, on each regeneration of key-maps. */
/* view3d_placement.c */
void viewplace_modal_keymap(struct wmKeyConfig *keyconf);
/* view3d_buttons.c */
@ -191,12 +199,15 @@ void VIEW3D_OT_snap_cursor_to_selected(struct wmOperatorType *ot);
void VIEW3D_OT_snap_cursor_to_active(struct wmOperatorType *ot);
/* view3d_placement.c */
void VIEW3D_OT_interactive_add(struct wmOperatorType *ot);
/* space_view3d.c */
extern const char *view3d_context_dir[]; /* doc access */
/* view3d_widgets.c */
void VIEW3D_GGT_light_spot(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_light_area(struct wmGizmoGroupType *gzgt);
void VIEW3D_GGT_light_target(struct wmGizmoGroupType *gzgt);

View File

@ -133,6 +133,7 @@ typedef struct ViewOpsData {
} ViewOpsData;
/* view3d_navigate.c */
bool view3d_location_poll(struct bContext *C);
bool view3d_rotation_poll(struct bContext *C);
bool view3d_zoom_or_dolly_poll(struct bContext *C);
@ -172,19 +173,23 @@ void VIEW3D_OT_view_orbit(struct wmOperatorType *ot);
void VIEW3D_OT_view_pan(struct wmOperatorType *ot);
/* view3d_navigate_dolly.c */
void viewdolly_modal_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_dolly(struct wmOperatorType *ot);
/* view3d_navigate_fly.c */
void fly_modal_keymap(struct wmKeyConfig *keyconf);
void view3d_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_fly(struct wmOperatorType *ot);
/* view3d_navigate_move.c */
void viewmove_modal_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_move(struct wmOperatorType *ot);
/* view3d_navigate_ndof.c */
#ifdef WITH_INPUT_NDOF
struct wmNDOFMotionData;
@ -205,9 +210,11 @@ void VIEW3D_OT_ndof_all(struct wmOperatorType *ot);
#endif /* WITH_INPUT_NDOF */
/* view3d_navigate_roll.c */
void VIEW3D_OT_view_roll(struct wmOperatorType *ot);
/* view3d_navigate_rotate.c */
void viewrotate_modal_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_rotate(struct wmOperatorType *ot);
@ -255,12 +262,15 @@ void ED_view3d_smooth_view_force_finish(struct bContext *C,
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
/* view3d_navigate_walk.c */
void walk_modal_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_walk(struct wmOperatorType *ot);
/* view3d_navigate_zoom.c */
void viewzoom_modal_keymap(struct wmKeyConfig *keyconf);
void VIEW3D_OT_zoom(struct wmOperatorType *ot);
/* view3d_navigate_zoom_border.c */
void VIEW3D_OT_zoom_border(struct wmOperatorType *ot);

View File

@ -50,12 +50,30 @@ void viewdolly_modal_keymap(wmKeyConfig *keyconf)
/* disabled mode switching for now, can re-implement better, later on */
#if 0
WM_modalkeymap_add_item(
keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, KM_ANY, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(
keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, KM_ANY, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(
keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, KM_ANY, VIEWROT_MODAL_SWITCH_MOVE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = LEFTMOUSE,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTCTRLKEY,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTSHIFTKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_MOVE);
#endif
/* assign map to operators */

View File

@ -43,15 +43,50 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
keymap = WM_modalkeymap_ensure(keyconf, "View3D Move Modal", modal_items);
/* items for modal map */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, KM_ANY, VIEW_MODAL_CONFIRM);
WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, KM_ANY, VIEW_MODAL_CONFIRM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = MIDDLEMOUSE,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEW_MODAL_CONFIRM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_ESCKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEW_MODAL_CONFIRM);
/* disabled mode switching for now, can re-implement better, later on */
#if 0
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(
keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = LEFTMOUSE,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTCTRLKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTSHIFTKEY,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ROTATE);
#endif
/* assign map to operators */

View File

@ -46,9 +46,30 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
/* disabled mode switching for now, can re-implement better, later on */
#if 0
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = LEFTMOUSE,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTCTRLKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ZOOM);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTSHIFTKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_MOVE);
#endif
/* assign map to operators */

View File

@ -50,9 +50,30 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
/* disabled mode switching for now, can re-implement better, later on */
#if 0
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = LEFTMOUSE,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTCTRLKEY,
.value = KM_RELEASE,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_ROTATE);
WM_modalkeymap_add_item(keymap,
&(const KeyMapItem_Params){
.type = EVT_LEFTSHIFTKEY,
.value = KM_PRESS,
.modifier = KM_ANY,
.direction = KM_ANY,
},
VIEWROT_MODAL_SWITCH_MOVE);
#endif
/* assign map to operators */

View File

@ -2973,7 +2973,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
changed = ED_lattice_select_pick(C, mval, &params);
}
else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) {
changed = ED_curve_editnurb_select_pick(C, mval, &params);
changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), &params);
}
else if (obedit->type == OB_MBALL) {
changed = ED_mball_select_pick(C, mval, &params);

View File

@ -704,17 +704,78 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
/* Default modal map values:
*
* \code{.c}
* WM_modalkeymap_add_item(keymap, EVT_RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
* WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);
* WM_modalkeymap_add_item(keymap, EVT_PAGEUPKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_INC);
* WM_modalkeymap_add_item(
* keymap, EVT_PAGEDOWNKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_DEC);
* WM_modalkeymap_add_item(keymap, EVT_GKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_TRANSLATE);
* WM_modalkeymap_add_item(keymap, EVT_RKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_ROTATE);
* WM_modalkeymap_add_item(keymap, EVT_SKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_RESIZE);
* WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOCONSTRAINT);
* WM_modalkeymap_add_item(
* keymap, MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOCONSTRAINTPLANE);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_RETKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_CONFIRM);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_ESCKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_CANCEL);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_PAGEUPKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_AUTOIK_LEN_INC);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_PAGEDOWNKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_AUTOIK_LEN_DEC);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_GKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_TRANSLATE);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_RKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_ROTATE);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = EVT_SKEY,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_RESIZE);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = MIDDLEMOUSE,
* .value = KM_PRESS,
* .modifier = KM_ANY,
* .direction = KM_ANY,
* },
* TFM_MODAL_AUTOCONSTRAINT);
* WM_modalkeymap_add_item(keymap,
* &(const KeyMapItem_Params){
* .type = MIDDLEMOUSE,
* .value = KM_PRESS,
* .modifier = KM_SHIFT,
* .direction = KM_ANY,
* },
* TFM_MODAL_AUTOCONSTRAINTPLANE);
* \endcode
*/

View File

@ -721,6 +721,7 @@ struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf);
* \{ */
/* transform_gizmo.c */
#define GIZMO_AXIS_LINE_WIDTH 2.0f
bool gimbal_axis_pose(struct Object *ob, const struct bPoseChannel *pchan, float gmat[3][3]);

View File

@ -134,6 +134,7 @@ void createTransCurveVerts(TransInfo *t);
void recalcData_curve(TransInfo *t);
/* transform_convert_graph.c */
/**
* It is important to note that this doesn't always act on the selection (like it's usually done),
* it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a
@ -149,24 +150,29 @@ void recalcData_graphedit(TransInfo *t);
void special_aftertrans_update__graph(bContext *C, TransInfo *t);
/* transform_convert_gpencil.c */
void createTransGPencil(bContext *C, TransInfo *t);
/* force recalculation of triangles during transformation */
void recalcData_gpencil_strokes(TransInfo *t);
/* transform_convert_lattice.c */
void createTransLatticeVerts(TransInfo *t);
void recalcData_lattice(TransInfo *t);
/* transform_convert_mask.c */
void createTransMaskingData(bContext *C, TransInfo *t);
void recalcData_mask_common(TransInfo *t);
void special_aftertrans_update__mask(bContext *C, TransInfo *t);
/* transform_convert_mball.c */
void createTransMBallVerts(TransInfo *t);
void recalcData_mball(TransInfo *t);
/* transform_convert_mesh.c */
struct TransIslandData {
float (*center)[3];
float (*axismtx)[3][3];
@ -230,65 +236,78 @@ void recalcData_mesh(TransInfo *t);
void special_aftertrans_update__mesh(bContext *C, TransInfo *t);
/* transform_convert_mesh_edge.c */
void createTransEdge(TransInfo *t);
void recalcData_mesh_edge(TransInfo *t);
/* transform_convert_mesh_skin.c */
void createTransMeshSkin(TransInfo *t);
void recalcData_mesh_skin(TransInfo *t);
/* transform_convert_mesh_uv.c */
void createTransUVs(bContext *C, TransInfo *t);
/* helper for recalcData() - for Image Editor transforms */
void recalcData_uv(TransInfo *t);
/* transform_convert_nla.c */
void createTransNlaData(bContext *C, TransInfo *t);
/* helper for recalcData() - for NLA Editor transforms */
void recalcData_nla(TransInfo *t);
void special_aftertrans_update__nla(bContext *C, TransInfo *t);
/* transform_convert_node.c */
void createTransNodeData(TransInfo *t);
void flushTransNodes(TransInfo *t);
void special_aftertrans_update__node(bContext *C, TransInfo *t);
/* transform_convert_object.c */
void createTransObject(bContext *C, TransInfo *t);
/* helper for recalcData() - for object transforms, typically in the 3D view */
void recalcData_objects(TransInfo *t);
void special_aftertrans_update__object(bContext *C, TransInfo *t);
/* transform_convert_object_texspace.c */
void createTransTexspace(TransInfo *t);
/* helper for recalcData() - for object transforms, typically in the 3D view */
void recalcData_texspace(TransInfo *t);
/* transform_convert_paintcurve.c */
void createTransPaintCurveVerts(bContext *C, TransInfo *t);
void flushTransPaintCurve(TransInfo *t);
/* transform_convert_particle.c */
void createTransParticleVerts(TransInfo *t);
void recalcData_particles(TransInfo *t);
/* transform_convert_sculpt.c */
void createTransSculpt(bContext *C, TransInfo *t);
void recalcData_sculpt(TransInfo *t);
void special_aftertrans_update__sculpt(bContext *C, TransInfo *t);
/* transform_convert_sequencer.c */
void createTransSeqData(TransInfo *t);
/* helper for recalcData() - for sequencer transforms */
void recalcData_sequencer(TransInfo *t);
void special_aftertrans_update__sequencer(bContext *C, TransInfo *t);
/* transform_convert_sequencer_image.c */
void createTransSeqImageData(TransInfo *t);
void recalcData_sequencer_image(TransInfo *t);
void special_aftertrans_update__sequencer_image(bContext *C, TransInfo *t);
/* transform_convert_tracking.c */
void createTransTrackingData(bContext *C, TransInfo *t);
/* helper for recalcData() - for Movie Clip transforms */
void recalcData_tracking(TransInfo *t);

Some files were not shown because too many files have changed in this diff Show More