Blender V4.3
editcurve_paint.cc File Reference
#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
 

Functions

Operator/Stroke Conversion
static void curve_draw_stroke_to_operator_elem (wmOperator *op, const StrokeElem *selem)
 
static void curve_draw_stroke_from_operator_elem (wmOperator *op, PointerRNA *itemptr)
 
static void curve_draw_stroke_to_operator (wmOperator *op)
 
static void curve_draw_stroke_from_operator (wmOperator *op)
 
Operator Callbacks & Helpers
static void curve_draw_stroke_3d (const bContext *, ARegion *, void *arg)
 
static void curve_draw_event_add (wmOperator *op, const wmEvent *event)
 
static void curve_draw_event_add_first (wmOperator *op, const wmEvent *event)
 
static bool curve_draw_init (bContext *C, wmOperator *op, bool is_invoke)
 
static void curve_draw_exit (wmOperator *op)
 
static void curve_draw_exec_precalc (wmOperator *op)
 
static int curve_draw_exec (bContext *C, wmOperator *op)
 
static int curve_draw_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void curve_draw_cancel (bContext *, wmOperator *op)
 
static int curve_draw_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
void CURVE_OT_draw (wmOperatorType *ot)
 

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)
 

Macro Definition Documentation

◆ STROKE_CYCLIC_DIST_PX

#define STROKE_CYCLIC_DIST_PX   8

◆ STROKE_SAMPLE_DIST_MAX_PX

#define STROKE_SAMPLE_DIST_MAX_PX   3

◆ STROKE_SAMPLE_DIST_MIN_PX

#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().

◆ USE_SPLINE_FIT

#define USE_SPLINE_FIT

Definition at line 51 of file editcurve_paint.cc.

Enumeration Type Documentation

◆ CurveDrawState

Enumerator
CURVE_DRAW_IDLE 
CURVE_DRAW_PAINTING 

Definition at line 82 of file editcurve_paint.cc.

Function Documentation

◆ curve_draw_cancel()

static void curve_draw_cancel ( bContext * ,
wmOperator * op )
static

Definition at line 1155 of file editcurve_paint.cc.

References curve_draw_exit().

Referenced by curve_draw_modal(), and CURVE_OT_draw().

◆ curve_draw_event_add()

◆ curve_draw_event_add_first()

◆ curve_draw_exec()

static int curve_draw_exec ( bContext * C,
wmOperator * op )
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().

◆ curve_draw_exec_precalc()

◆ curve_draw_exit()

◆ curve_draw_init()

◆ curve_draw_invoke()

static int curve_draw_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
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().

◆ curve_draw_modal()

◆ curve_draw_stroke_3d()

◆ curve_draw_stroke_from_operator()

static void curve_draw_stroke_from_operator ( wmOperator * op)
static

◆ curve_draw_stroke_from_operator_elem()

◆ curve_draw_stroke_to_operator()

static void curve_draw_stroke_to_operator ( wmOperator * op)
static

◆ curve_draw_stroke_to_operator_elem()

static void curve_draw_stroke_to_operator_elem ( wmOperator * op,
const StrokeElem * selem )
static

◆ CURVE_OT_draw()

◆ stroke_elem_interp()

static void stroke_elem_interp ( StrokeElem * selem_out,
const StrokeElem * selem_a,
const StrokeElem * selem_b,
float t )
static

◆ stroke_elem_pressure_set()

◆ stroke_elem_project()

◆ stroke_elem_project_fallback()

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

◆ stroke_elem_project_fallback_elem()

static bool stroke_elem_project_fallback_elem ( const CurveDrawData * cdd,
const float location_fallback_depth[3],
StrokeElem * selem )
static

◆ stroke_elem_radius()

static float stroke_elem_radius ( const CurveDrawData * cdd,
const StrokeElem * selem )
static

◆ stroke_elem_radius_from_pressure()

static float stroke_elem_radius_from_pressure ( const CurveDrawData * cdd,
const float pressure )
static