|
Blender V4.3
|
#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "MEM_guardedalloc.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_mempool.h"#include "BKE_context.hh"#include "BKE_curve.hh"#include "BKE_fcurve.hh"#include "BKE_object_types.hh"#include "BKE_report.hh"#include "DEG_depsgraph.hh"#include "WM_api.hh"#include "WM_types.hh"#include "ED_curve.hh"#include "ED_screen.hh"#include "ED_space_api.hh"#include "ED_view3d.hh"#include "GPU_batch.hh"#include "GPU_batch_presets.hh"#include "GPU_immediate.hh"#include "GPU_immediate_util.hh"#include "GPU_matrix.hh"#include "GPU_state.hh"#include "curve_intern.hh"#include "UI_resources.hh"#include "RNA_access.hh"#include "RNA_define.hh"#include "RNA_prototypes.hh"#include "RNA_enum_types.hh"#include "curve_fit_nd.h"Go to the source code of this file.
Classes | |
| struct | StrokeElem |
| struct | CurveDrawData |
Macros | |
| #define | USE_SPLINE_FIT |
| #define | STROKE_SAMPLE_DIST_MIN_PX 1 |
| #define | STROKE_SAMPLE_DIST_MAX_PX 3 |
| #define | STROKE_CYCLIC_DIST_PX 8 |
StrokeElem / #RNA_OperatorStrokeElement Conversion Functions | |
| enum | CurveDrawState { CURVE_DRAW_IDLE = 0 , CURVE_DRAW_PAINTING = 1 } |
| static float | stroke_elem_radius_from_pressure (const CurveDrawData *cdd, const float pressure) |
| static float | stroke_elem_radius (const CurveDrawData *cdd, const StrokeElem *selem) |
| static void | stroke_elem_pressure_set (const CurveDrawData *cdd, StrokeElem *selem, float pressure) |
| static void | stroke_elem_interp (StrokeElem *selem_out, const StrokeElem *selem_a, const StrokeElem *selem_b, float t) |
| static bool | stroke_elem_project (const CurveDrawData *cdd, const int mval_i[2], const float mval_fl[2], float surface_offset, const float radius, float r_location_world[3], float r_normal_world[3]) |
| static bool | stroke_elem_project_fallback (const CurveDrawData *cdd, const int mval_i[2], const float mval_fl[2], const float surface_offset, const float radius, const float location_fallback_depth[3], float r_location_world[3], float r_location_local[3], float r_normal_world[3], float r_normal_local[3]) |
| static bool | stroke_elem_project_fallback_elem (const CurveDrawData *cdd, const float location_fallback_depth[3], StrokeElem *selem) |
| #define STROKE_CYCLIC_DIST_PX 8 |
Definition at line 64 of file editcurve_paint.cc.
Referenced by blender::ed::curves::curve_draw_exec_precalc(), and curve_draw_exec_precalc().
| #define STROKE_SAMPLE_DIST_MAX_PX 3 |
Definition at line 61 of file editcurve_paint.cc.
Referenced by blender::ed::curves::curve_draw_event_add(), and curve_draw_event_add().
| #define STROKE_SAMPLE_DIST_MIN_PX 1 |
Definition at line 60 of file editcurve_paint.cc.
Referenced by curve_draw_modal(), and blender::ed::curves::curves_draw_modal().
| #define USE_SPLINE_FIT |
Definition at line 51 of file editcurve_paint.cc.
| enum CurveDrawState |
| Enumerator | |
|---|---|
| CURVE_DRAW_IDLE | |
| CURVE_DRAW_PAINTING | |
Definition at line 82 of file editcurve_paint.cc.
|
static |
Definition at line 1155 of file editcurve_paint.cc.
References curve_draw_exit().
Referenced by curve_draw_modal(), and CURVE_OT_draw().
|
static |
Definition at line 454 of file editcurve_paint.cc.
References ARRAY_SET_ITEMS, BLI_mempool_calloc(), ceil(), copy_v2_v2(), copy_v3_v3(), wmOperator::customdata, ED_region_tag_redraw(), int, invert_m4_m4(), len_squared_v2v2(), CurveDrawData::location_world, StrokeElem::location_world, CurveDrawData::location_world_valid, CurveDrawData::mval, StrokeElem::mval, wmEvent::mval, ViewContext::obedit, StrokeElem::pressure, CurveDrawData::prev, ViewContext::region, Object::runtime, CurveDrawData::sample, CurveDrawData::selem, sqrt(), square_f(), stroke_elem_interp(), CurveDrawData::stroke_elem_pool, stroke_elem_project_fallback_elem(), STROKE_SAMPLE_DIST_MAX_PX, CurveDrawData::use_substeps, and CurveDrawData::vc.
Referenced by curve_draw_event_add_first(), and curve_draw_modal().
|
static |
Definition at line 510 of file editcurve_paint.cc.
References copy_v3_v3(), cross_v3_v3v3(), curve_draw_event_add(), CURVE_DRAW_PAINTING, CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS, CURVE_PAINT_PROJECT_SURFACE, ToolSettings::curve_paint_settings, CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, wmOperator::customdata, CurvePaintSettings::depth_mode, CurveDrawData::depths, dot_v3v3(), ED_view3d_depth_read_cached_normal(), ELEM, CurvePaintSettings::flag, float, CurveDrawData::init_event_type, is_zero_v3(), CurveDrawData::location_world_valid, wmEvent::mval, normalize_v3_v3(), CurveDrawData::offset, CurveDrawData::plane, CurveDrawData::prev, CurveDrawData::project, ViewContext::region, ViewContext::rv3d, ViewContext::scene, CurveDrawData::state, stroke_elem_project(), sub_v3_v3v3(), CurveDrawData::surface_offset, CurvePaintSettings::surface_plane, Scene::toolsettings, CurveDrawData::use_depth, CurveDrawData::use_offset, CurveDrawData::use_plane, CurveDrawData::vc, and RegionView3D::viewinv.
Referenced by curve_draw_invoke(), and curve_draw_modal().
|
static |
Definition at line 764 of file editcurve_paint.cc.
References Curve::actvert, Nurb::bezt, BKE_curve_nurb_active_set(), BKE_nurb_handles_calc(), BKE_nurb_knot_calc_u(), BLI_addtail(), BLI_mempool_iternew(), BLI_mempool_iterstep(), BLI_mempool_len(), Nurb::bp, copy_v3_v3(), CU_3D, CU_BEZIER, CU_NURB_CYCLIC, CU_POLY, CU_SMOOTH, curve_draw_exit(), curve_draw_init(), curve_draw_stroke_from_operator(), CURVE_PAINT_FIT_METHOD_REFIT, CURVE_PAINT_FIT_METHOD_SPLIT, CURVE_PAINT_FLAG_PRESSURE_RADIUS, ToolSettings::curve_paint_settings, CurveDrawData::curve_type, wmOperator::customdata, Object::data, DEG_id_tag_update(), ED_curve_deselect_all_multi(), BezTriple::f1, BPoint::f1, BezTriple::f2, BezTriple::f3, Curve::flag, CurvePaintSettings::flag, Nurb::flag, Nurb::flagu, free(), BezTriple::h1, BezTriple::h2, HD_ALIGN, HD_AUTO, HD_FREE, invert_m4_m4(), StrokeElem::location_local, M_PI, MEM_callocN, MEM_freeN(), MEM_mallocN, CurveDrawData::min, NC_GEOM, ND_DATA, ViewContext::obedit, object_editcurve_get(), OPERATOR_CANCELLED, OPERATOR_FINISHED, Nurb::orderu, Nurb::orderv, Nurb::pntsu, Nurb::pntsv, StrokeElem::pressure, wmOperator::ptr, BezTriple::radius, BPoint::radius, CurveDrawData::radius, CurvePaintSettings::radius_max, CurvePaintSettings::radius_min, CurvePaintSettings::radius_taper_end, CurvePaintSettings::radius_taper_start, CurveDrawData::range, Curve::resolu, Nurb::resolu, Curve::resolv, Nurb::resolv, result, RNA_boolean_get(), RNA_enum_get(), RNA_float_get(), Object::runtime, ViewContext::scene, SELECT, CurveDrawData::stroke_elem_pool, Scene::toolsettings, Nurb::type, UNLIKELY, CurveDrawData::vc, BezTriple::vec, BPoint::vec, and WM_event_add_notifier().
Referenced by curve_draw_invoke(), curve_draw_modal(), and CURVE_OT_draw().
|
static |
Initialize values before calling 'exec' (when running interactively).
Definition at line 644 of file editcurve_paint.cc.
References BLI_mempool_iternew(), BLI_mempool_iterstep(), BLI_mempool_len(), CurvePaintSettings::corner_angle, CURVE_PAINT_FLAG_CORNERS_DETECT, ToolSettings::curve_paint_settings, wmOperator::customdata, CurvePaintSettings::error_threshold, CurvePaintSettings::fit_method, CurvePaintSettings::flag, float, len_squared_v2v2(), len_v2v2(), len_v3v3(), StrokeElem::location_local, M_PI, MEM_freeN(), MEM_mallocN, StrokeElem::mval, StrokeElem::pressure, wmOperator::ptr, CurvePaintSettings::radius_taper_end, CurvePaintSettings::radius_taper_start, RNA_property_boolean_set(), RNA_property_enum_set(), RNA_property_float_set(), RNA_property_is_set(), RNA_struct_find_property(), ViewContext::scene, square_f(), STROKE_CYCLIC_DIST_PX, CurveDrawData::stroke_elem_pool, stroke_elem_pressure_set(), Scene::toolsettings, UI_SCALE_FAC, and CurveDrawData::vc.
Referenced by curve_draw_modal().
|
static |
Definition at line 620 of file editcurve_paint.cc.
References BLI_mempool_destroy(), wmOperator::customdata, CurveDrawData::depths, CurveDrawData::draw_handle_view, ED_region_draw_cb_exit(), ED_view3d_depths_free(), MEM_freeN(), ViewContext::region, CurveDrawData::stroke_elem_pool, ARegion::type, CurveDrawData::vc, ViewContext::win, and WM_cursor_modal_restore().
Referenced by curve_draw_cancel(), and curve_draw_exec().
|
static |
Definition at line 571 of file editcurve_paint.cc.
References BKE_report(), BLI_assert, BLI_MEMPOOL_ALLOW_ITER, BLI_mempool_create(), ViewContext::bmain, CTX_data_edit_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS, ToolSettings::curve_paint_settings, CurveDrawData::curve_type, CurvePaintSettings::curve_type, wmOperator::customdata, depsgraph, ViewContext::depsgraph, ED_view3d_viewcontext_init(), ELEM, CurvePaintSettings::flag, CurveDrawData::max, MEM_callocN, MEM_freeN(), CurveDrawData::min, ViewContext::obedit, CurveDrawData::project, wmOperator::ptr, CurveDrawData::radius, CurvePaintSettings::radius_max, CurvePaintSettings::radius_min, CurveDrawData::range, ViewContext::region, wmOperator::reports, RNA_collection_is_empty(), RPT_ERROR, ViewContext::rv3d, ViewContext::scene, CurveDrawData::stroke_elem_pool, CurveDrawData::surface_offset, CurvePaintSettings::surface_offset, Scene::toolsettings, CurveDrawData::use_surface_offset_absolute, ViewContext::v3d, CurveDrawData::vc, ViewContext::view_layer, and ViewContext::win.
Referenced by curve_draw_exec(), and curve_draw_invoke().
|
static |
Definition at line 1061 of file editcurve_paint.cc.
References BKE_report(), copy_v3_v3(), CU_IS_2D, CU_POLY, Scene::cursor, curve_draw_event_add_first(), curve_draw_exec(), curve_draw_init(), curve_draw_stroke_3d(), CURVE_PAINT_FLAG_DEPTH_ONLY_SELECTED, CURVE_PAINT_PROJECT_SURFACE, ToolSettings::curve_paint_settings, CurveDrawData::curve_type, wmOperator::customdata, Object::data, ViewContext::depsgraph, CurvePaintSettings::depth_mode, CurveDrawData::depths, dot_v3v3(), CurveDrawData::draw_handle_view, ED_region_draw_cb_activate(), ED_view3d_depth_override(), ED_view3d_win_to_3d(), CurvePaintSettings::flag, float, View3DCursor::location, CurveDrawData::location_world, CurveDrawData::location_world_valid, wmEvent::mval, negate_v3_v3(), normalize_v3_v3(), OB_WIRE, ViewContext::obedit, RegionView3D::ofs, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, CurveDrawData::plane, CurveDrawData::prev, CurveDrawData::project, wmOperator::ptr, ViewContext::region, REGION_DRAW_POST_VIEW, wmOperator::reports, RNA_boolean_get(), RNA_struct_property_is_set(), RPT_WARNING, ViewContext::rv3d, CurveDrawData::sample, ViewContext::scene, View3D::shading, Scene::toolsettings, ARegion::type, View3DShading::type, CurveDrawData::use_depth, CurveDrawData::use_plane, CurveDrawData::use_substeps, ViewContext::v3d, V3D_DEPTH_NO_OVERLAYS, V3D_DEPTH_SELECTED_ONLY, CurveDrawData::vc, view3d_operator_needs_opengl(), RegionView3D::viewinv, ViewContext::win, WM_cursor_modal_set(), WM_CURSOR_PAINT_BRUSH, and WM_event_add_modal_handler().
Referenced by CURVE_OT_draw().
|
static |
Definition at line 1161 of file editcurve_paint.cc.
References curve_draw_cancel(), curve_draw_event_add(), curve_draw_event_add_first(), curve_draw_exec(), curve_draw_exec_precalc(), CURVE_DRAW_PAINTING, curve_draw_stroke_to_operator(), wmOperator::customdata, ED_region_tag_redraw(), ELEM, EVT_ESCKEY, float, CurveDrawData::init_event_type, ISMOUSE_MOTION, KM_PRESS, KM_RELEASE, LEFTMOUSE, len_squared_v2v2(), CurveDrawData::mval, wmEvent::mval, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, CurveDrawData::prev, ViewContext::region, ret, RIGHTMOUSE, square_f(), CurveDrawData::state, STROKE_SAMPLE_DIST_MIN_PX, wmEvent::type, UNUSED_VARS, wmEvent::val, and CurveDrawData::vc.
Referenced by CURVE_OT_draw().
Definition at line 347 of file editcurve_paint.cc.
References Curve::bevel_radius, BLI_mempool_iternew(), BLI_mempool_iterstep(), BLI_mempool_len(), copy_v3_v3(), wmOperator::customdata, Object::data, float, GPU_batch_draw(), GPU_batch_preset_sphere(), GPU_batch_program_set_builtin(), GPU_batch_uniform_3fv, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_DEPTH_LESS_EQUAL, GPU_DEPTH_NONE, GPU_depth_test(), GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), GPU_matrix_scale_1f(), GPU_matrix_translate_3f(), GPU_PRIM_LINE_STRIP, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), imm_cpack(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immVertex3fv(), immVertexFormat(), StrokeElem::location_local, StrokeElem::location_world, MEM_freeN(), MEM_mallocN, ViewContext::obedit, pos, CurveDrawData::stroke_elem_pool, stroke_elem_radius(), TH_WIRE, UI_GetThemeColor3fv(), and CurveDrawData::vc.
Referenced by curve_draw_invoke().
|
static |
Definition at line 333 of file editcurve_paint.cc.
References curve_draw_stroke_from_operator_elem(), wmOperator::ptr, RNA_BEGIN, and RNA_END.
Referenced by curve_draw_exec().
|
static |
Definition at line 305 of file editcurve_paint.cc.
References BLI_mempool_calloc(), wmOperator::customdata, StrokeElem::location_local, StrokeElem::location_world, mul_v3_m4v3(), StrokeElem::mval, ViewContext::obedit, StrokeElem::pressure, RNA_float_get(), RNA_float_get_array(), CurveDrawData::stroke_elem_pool, and CurveDrawData::vc.
Referenced by curve_draw_stroke_from_operator().
|
static |
Definition at line 318 of file editcurve_paint.cc.
References BLI_mempool_iternew(), BLI_mempool_iterstep(), curve_draw_stroke_to_operator_elem(), wmOperator::customdata, and CurveDrawData::stroke_elem_pool.
Referenced by curve_draw_modal().
|
static |
Definition at line 295 of file editcurve_paint.cc.
References StrokeElem::location_world, StrokeElem::mval, StrokeElem::pressure, wmOperator::ptr, RNA_collection_add(), RNA_float_set(), and RNA_float_set_array().
Referenced by curve_draw_stroke_to_operator().
| void CURVE_OT_draw | ( | wmOperatorType * | ot | ) |
Definition at line 1203 of file editcurve_paint.cc.
References wmOperatorType::cancel, curve_draw_cancel(), curve_draw_exec(), curve_draw_invoke(), curve_draw_modal(), CURVE_PAINT_FIT_METHOD_REFIT, DEG2RADF, wmOperatorType::description, ED_operator_editcurve(), wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, M_PI, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, PROP_ANGLE, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_boolean(), RNA_def_collection_runtime(), RNA_def_enum(), RNA_def_float_distance(), RNA_def_property_flag(), RNA_def_property_subtype(), RNA_def_property_ui_range(), rna_enum_curve_fit_method_items, and wmOperatorType::srna.
Referenced by ED_operatortypes_curve().
|
static |
Definition at line 162 of file editcurve_paint.cc.
References interp_v2_v2v2(), interp_v3_v3v3(), interpf(), StrokeElem::location_local, StrokeElem::location_world, StrokeElem::mval, and StrokeElem::pressure.
Referenced by curve_draw_event_add().
|
static |
Definition at line 148 of file editcurve_paint.cc.
References is_zero_v3(), StrokeElem::location_local, StrokeElem::location_world, madd_v3_v3fl(), mul_v3_m4v3(), StrokeElem::normal_local, ViewContext::obedit, StrokeElem::pressure, CurveDrawData::project, stroke_elem_radius_from_pressure(), CurveDrawData::surface_offset, CurveDrawData::use_surface_offset_absolute, and CurveDrawData::vc.
Referenced by curve_draw_exec_precalc().
|
static |
Sets the depth from StrokeElem.mval
Definition at line 176 of file editcurve_paint.cc.
References add_v3_v3(), copy_v3_v3(), ViewDepths::depth_range, CurveDrawData::depths, double(), ED_view3d_depth_read_cached(), ED_view3d_depth_read_cached_normal(), ED_view3d_depth_unproject_v3(), ED_view3d_win_to_3d_on_plane(), ViewDepths::h, madd_v3_v3fl(), CurveDrawData::offset, CurveDrawData::plane, CurveDrawData::project, ViewContext::region, CurveDrawData::use_offset, CurveDrawData::use_plane, CurveDrawData::use_surface_offset_absolute, CurveDrawData::vc, ViewDepths::w, and zero_v3().
Referenced by curve_draw_event_add_first(), and stroke_elem_project_fallback().
|
static |
Definition at line 236 of file editcurve_paint.cc.
References copy_v3_v3(), ED_view3d_win_to_3d(), is_zero_v3(), mul_transposed_mat3_m4_v3(), mul_v3_m4v3(), normalize_v3(), ViewContext::obedit, ViewContext::region, stroke_elem_project(), ViewContext::v3d, CurveDrawData::vc, and zero_v3().
Referenced by stroke_elem_project_fallback_elem().
|
static |
Definition at line 271 of file editcurve_paint.cc.
References int, StrokeElem::location_local, StrokeElem::location_world, StrokeElem::mval, StrokeElem::normal_local, StrokeElem::normal_world, CurveDrawData::project, stroke_elem_project_fallback(), stroke_elem_radius(), and CurveDrawData::surface_offset.
Referenced by curve_draw_event_add().
|
static |
Definition at line 143 of file editcurve_paint.cc.
References StrokeElem::pressure, and stroke_elem_radius_from_pressure().
Referenced by curve_draw_stroke_3d(), and stroke_elem_project_fallback_elem().
|
static |
Definition at line 137 of file editcurve_paint.cc.
References Curve::bevel_radius, Object::data, CurveDrawData::min, ViewContext::obedit, CurveDrawData::radius, CurveDrawData::range, and CurveDrawData::vc.
Referenced by stroke_elem_pressure_set(), and stroke_elem_radius().