Blender  V2.93
Classes
particle_edit.c File Reference
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "BLI_kdtree.h"
#include "BLI_lasso_2d.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_rect.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BKE_bvhutils.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_particle.h"
#include "ED_physics.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_view3d.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_state.h"
#include "UI_resources.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "DEG_depsgraph_query.h"
#include "PIL_time_utildefines.h"
#include "physics_intern.h"
#include "particle_edit_utildefines.h"

Go to the source code of this file.

Classes

struct  PEData
 
struct  KeyIterData
 
struct  DeflectEmitterIter
 
struct  ApplyLengthsIterData
 
struct  IterateLengthsIterData
 
struct  BrushAddCountIterData
 
struct  BrushAddCountIterTLSData
 
struct  BrushEdit
 
struct  PointInsideBVH
 

Functions

Public Utilities
bool PE_poll (bContext *C)
 
bool PE_hair_poll (bContext *C)
 
bool PE_poll_view3d (bContext *C)
 
void PE_free_ptcache_edit (PTCacheEdit *edit)
 
int PE_minmax (Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, float min[3], float max[3])
 
Edit Mode Helpers
int PE_start_edit (PTCacheEdit *edit)
 
ParticleEditSettingsPE_settings (Scene *scene)
 
static float pe_brush_size_get (const Scene *UNUSED(scene), ParticleBrushData *brush)
 
PTCacheEditPE_get_current_from_psys (ParticleSystem *psys)
 
static void pe_update_hair_particle_edit_pointers (PTCacheEdit *edit)
 
static PTCacheEditpe_get_current (Depsgraph *depsgraph, Scene *scene, Object *ob, bool create)
 
PTCacheEditPE_get_current (Depsgraph *depsgraph, Scene *scene, Object *ob)
 
PTCacheEditPE_create_current (Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void PE_current_changed (Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void PE_hide_keys_time (Scene *scene, PTCacheEdit *edit, float cfra)
 
static int pe_x_mirror (Object *ob)
 
Selection Utilities
static bool key_test_depth (const PEData *data, const float co[3], const int screen_co[2])
 
static bool key_inside_circle (const PEData *data, float rad, const float co[3], float *distance)
 
static bool key_inside_rect (PEData *data, const float co[3])
 
static bool key_inside_test (PEData *data, const float co[3])
 
static bool point_is_selected (PTCacheEditPoint *point)
 
Particle Edit Mirroring
static void PE_update_mirror_cache (Object *ob, ParticleSystem *psys)
 
static void PE_mirror_particle (Object *ob, Mesh *mesh, ParticleSystem *psys, ParticleData *pa, ParticleData *mpa)
 
static void PE_apply_mirror (Object *ob, ParticleSystem *psys)
 
Edit Selections
static void select_key (PEData *data, int point_index, int key_index, bool UNUSED(is_inside))
 
static void select_key_op (PEData *data, int point_index, int key_index, bool is_inside)
 
static void select_keys (PEData *data, int point_index, int UNUSED(key_index), bool UNUSED(is_inside))
 
static void extend_key_select (PEData *data, int point_index, int key_index, bool UNUSED(is_inside))
 
static void deselect_key_select (PEData *data, int point_index, int key_index, bool UNUSED(is_inside))
 
static void toggle_key_select (PEData *data, int point_index, int key_index, bool UNUSED(is_inside))
 
De-Select All Operator
static bool select_action_apply (PTCacheEditPoint *point, PTCacheEditKey *key, int action)
 
static int pe_select_all_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_select_all (wmOperatorType *ot)
 
Pick Select Operator
bool PE_mouse_particles (bContext *C, const int mval[2], bool extend, bool deselect, bool toggle)
 
Select Root Operator
static void select_root (PEData *data, int point_index)
 
static int select_roots_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_select_roots (wmOperatorType *ot)
 
Select Tip Operator
static void select_tip (PEData *data, int point_index)
 
static int select_tips_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_select_tips (wmOperatorType *ot)
 
Select Linked operator
static int select_linked_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_select_linked (wmOperatorType *ot)
 
static int select_linked_pick_exec (bContext *C, wmOperator *op)
 
static int select_linked_pick_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void PARTICLE_OT_select_linked_pick (wmOperatorType *ot)
 
Box Select Operator
bool PE_deselect_all_visible_ex (PTCacheEdit *edit)
 
bool PE_deselect_all_visible (bContext *C)
 
bool PE_box_select (bContext *C, const rcti *rect, const int sel_op)
 
Circle Select Operator
bool PE_circle_select (bContext *C, const int sel_op, const int mval[2], float rad)
 
Lasso Select Operator
int PE_lasso_select (bContext *C, const int mcoords[][2], const int mcoords_len, const int sel_op)
 
Hide Operator
static int hide_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_hide (wmOperatorType *ot)
 
Reveal Operator
static int reveal_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_reveal (wmOperatorType *ot)
 
Select Less Operator
static void select_less_keys (PEData *data, int point_index)
 
static int select_less_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_select_less (wmOperatorType *ot)
 
Select More Operator
static void select_more_keys (PEData *data, int point_index)
 
static int select_more_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_select_more (wmOperatorType *ot)
 
Re-Key Operator
static void rekey_particle (PEData *data, int pa_index)
 
static int rekey_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_rekey (wmOperatorType *ot)
 
static void rekey_particle_to_time (const bContext *C, Scene *scene, Object *ob, int pa_index, float path_time)
 
Internal Utilities
static int remove_tagged_particles (Object *ob, ParticleSystem *psys, int mirror)
 
static void remove_tagged_keys (Depsgraph *depsgraph, Object *ob, ParticleSystem *psys)
 
Subdivide Operator
static void subdivide_particle (PEData *data, int pa_index)
 
static int subdivide_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_subdivide (wmOperatorType *ot)
 
Remove Doubles Operator
static int remove_doubles_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_remove_doubles (wmOperatorType *ot)
 
static int weight_set_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_weight_set (wmOperatorType *ot)
 
Cursor Drawing
static void brush_drawcursor (bContext *C, int x, int y, void *UNUSED(customdata))
 
static void toggle_particle_cursor (Scene *scene, bool enable)
 
Mirror Operator
static void PE_mirror_x (Depsgraph *depsgraph, Scene *scene, Object *ob, int tagged)
 
static int mirror_exec (bContext *C, wmOperator *UNUSED(op))
 
static bool mirror_poll (bContext *C)
 
void PARTICLE_OT_mirror (wmOperatorType *ot)
 
Particle Edit Toggle Operator
void PE_create_particle_edit (Depsgraph *depsgraph, Scene *scene, Object *ob, PointCache *cache, ParticleSystem *psys)
 
static bool particle_edit_toggle_poll (bContext *C)
 
static void free_all_psys_edit (Object *object)
 
bool ED_object_particle_edit_mode_supported (const Object *ob)
 
void ED_object_particle_edit_mode_enter_ex (Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_particle_edit_mode_enter (bContext *C)
 
void ED_object_particle_edit_mode_exit_ex (Scene *scene, Object *ob)
 
void ED_object_particle_edit_mode_exit (bContext *C)
 
static int particle_edit_toggle_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_particle_edit_toggle (wmOperatorType *ot)
 
Set Editable Operator
static int clear_edited_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_edited_clear (wmOperatorType *ot)
 
Unify length operator
static float calculate_point_length (PTCacheEditPoint *point)
 
static float calculate_average_length (PTCacheEdit *edit)
 
static void scale_point_factor (PTCacheEditPoint *point, float factor)
 
static void scale_point_to_length (PTCacheEditPoint *point, float length)
 
static void scale_points_to_length (PTCacheEdit *edit, float length)
 
static int unify_length_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_unify_length (struct wmOperatorType *ot)
 

Iterators

enum  eParticleSelectFlag { PSEL_NEAREST = (1 << 0) , PSEL_ALL_KEYS = (1 << 1) }
 
typedef void(* ForPointFunc) (PEData *data, int point_index)
 
typedef void(* ForHitPointFunc) (PEData *data, int point_index, float mouse_distance)
 
typedef void(* ForKeyFunc) (PEData *data, int point_index, int key_index, bool is_inside)
 
typedef void(* ForKeyMatFunc) (PEData *data, const float mat[4][4], const float imat[4][4], int point_index, int key_index, PTCacheEditKey *key)
 
typedef void(* ForHitKeyMatFunc) (PEData *data, float mat[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float mouse_distance)
 
typedef struct KeyIterData KeyIterData
 
static void for_mouse_hit_keys (PEData *data, ForKeyFunc func, const enum eParticleSelectFlag flag)
 
static void foreach_mouse_hit_point (PEData *data, ForHitPointFunc func, int selected)
 
static void foreach_mouse_hit_key_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void foreach_mouse_hit_key (PEData *data, ForHitKeyMatFunc func, int selected)
 
static void foreach_selected_point (PEData *data, ForPointFunc func)
 
static void foreach_selected_key (PEData *data, ForKeyFunc func)
 
static void foreach_point (PEData *data, ForPointFunc func)
 
static int count_selected_keys (Scene *scene, PTCacheEdit *edit)
 

Select Random Operator

enum  { RAN_HAIR , RAN_POINTS }
 
static const EnumPropertyItem select_random_type_items []
 
static int select_random_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_select_random (wmOperatorType *ot)
 

Delete Operator

enum  { DEL_PARTICLE , DEL_KEY }
 
static const EnumPropertyItem delete_type_items []
 
static void set_delete_particle (PEData *data, int pa_index)
 
static void set_delete_particle_key (PEData *data, int pa_index, int key_index, bool UNUSED(is_inside))
 
static int delete_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_delete (wmOperatorType *ot)
 

Common Struct Passed to Callbacks

typedef struct PEData PEData
 
static void PE_set_data (bContext *C, PEData *data)
 
static void PE_set_view3d_data (bContext *C, PEData *data)
 
static bool PE_create_shape_tree (PEData *data, Object *shapeob)
 
static void PE_free_shape_tree (PEData *data)
 
static void PE_create_random_generator (PEData *data)
 
static void PE_free_random_generator (PEData *data)
 

Edit Calculation

typedef struct DeflectEmitterIter DeflectEmitterIter
 
typedef struct ApplyLengthsIterData ApplyLengthsIterData
 
typedef struct IterateLengthsIterData IterateLengthsIterData
 
static void deflect_emitter_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void pe_deflect_emitter (Scene *scene, Object *ob, PTCacheEdit *edit)
 
static void apply_lengths_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void PE_apply_lengths (Scene *scene, PTCacheEdit *edit)
 
static void iterate_lengths_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void pe_iterate_lengths (Scene *scene, PTCacheEdit *edit)
 
void recalc_lengths (PTCacheEdit *edit)
 
void recalc_emitter_field (Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), ParticleSystem *psys)
 
static void PE_update_selection (Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
 
void update_world_cos (Object *ob, PTCacheEdit *edit)
 
static void update_velocities (PTCacheEdit *edit)
 
void PE_update_object (Depsgraph *depsgraph, Scene *scene, Object *ob, int useflag)
 

Brush Edit Callbacks

typedef struct BrushAddCountIterData BrushAddCountIterData
 
typedef struct BrushAddCountIterTLSData BrushAddCountIterTLSData
 
static void brush_comb (PEData *data, float UNUSED(mat[4][4]), float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float mouse_distance)
 
static void brush_cut (PEData *data, int pa_index)
 
static void brush_length (PEData *data, int point_index, float UNUSED(mouse_distance))
 
static void brush_puff (PEData *data, int point_index, float mouse_distance)
 
static void BKE_brush_weight_get (PEData *data, float UNUSED(mat[4][4]), float UNUSED(imat[4][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key), float UNUSED(mouse_distance))
 
static void brush_smooth_get (PEData *data, float mat[4][4], float UNUSED(imat[4][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key, float UNUSED(mouse_distance))
 
static void brush_smooth_do (PEData *data, float UNUSED(mat[4][4]), float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float UNUSED(mouse_distance))
 
static void intersect_dm_quad_weights (const float v1[3], const float v2[3], const float v3[3], const float v4[3], float w[4])
 
static int particle_intersect_mesh (Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, Mesh *mesh, float *vert_cos, const float co1[3], const float co2[3], float *min_d, int *min_face, float *min_w, float *face_minmax, float *pa_minmax, float radius, float *ipoint)
 
static void brush_add_count_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict tls_v)
 
static void brush_add_count_iter_reduce (const void *__restrict UNUSED(userdata), void *__restrict join_v, void *__restrict chunk_v)
 
static void brush_add_count_iter_free (const void *__restrict UNUSED(userdata_v), void *__restrict chunk_v)
 
static int brush_add (const bContext *C, PEData *data, short number)
 

Brush Edit Operator

typedef struct BrushEdit BrushEdit
 
static int brush_edit_init (bContext *C, wmOperator *op)
 
static void brush_edit_apply (bContext *C, wmOperator *op, PointerRNA *itemptr)
 
static void brush_edit_exit (wmOperator *op)
 
static int brush_edit_exec (bContext *C, wmOperator *op)
 
static void brush_edit_apply_event (bContext *C, wmOperator *op, const wmEvent *event)
 
static int brush_edit_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int brush_edit_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void brush_edit_cancel (bContext *UNUSED(C), wmOperator *op)
 
void PARTICLE_OT_brush_edit (wmOperatorType *ot)
 

Cut Shape

typedef struct PointInsideBVH PointInsideBVH
 
static bool shape_cut_poll (bContext *C)
 
static void point_inside_bvh_cb (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
 
static bool shape_cut_test_point (PEData *data, ParticleEditSettings *pset, ParticleCacheKey *key)
 
static void shape_cut (PEData *data, int pa_index)
 
static int shape_cut_exec (bContext *C, wmOperator *UNUSED(op))
 
void PARTICLE_OT_shape_cut (wmOperatorType *ot)
 

Typedef Documentation

◆ ApplyLengthsIterData

◆ BrushAddCountIterData

◆ BrushAddCountIterTLSData

◆ BrushEdit

typedef struct BrushEdit BrushEdit

◆ DeflectEmitterIter

◆ ForHitKeyMatFunc

typedef void(* ForHitKeyMatFunc) (PEData *data, float mat[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float mouse_distance)

Definition at line 707 of file particle_edit.c.

◆ ForHitPointFunc

typedef void(* ForHitPointFunc) (PEData *data, int point_index, float mouse_distance)

Definition at line 697 of file particle_edit.c.

◆ ForKeyFunc

typedef void(* ForKeyFunc) (PEData *data, int point_index, int key_index, bool is_inside)

Definition at line 699 of file particle_edit.c.

◆ ForKeyMatFunc

typedef void(* ForKeyMatFunc) (PEData *data, const float mat[4][4], const float imat[4][4], int point_index, int key_index, PTCacheEditKey *key)

Definition at line 701 of file particle_edit.c.

◆ ForPointFunc

typedef void(* ForPointFunc) (PEData *data, int point_index)

Definition at line 696 of file particle_edit.c.

◆ IterateLengthsIterData

◆ KeyIterData

typedef struct KeyIterData KeyIterData

◆ PEData

typedef struct PEData PEData

◆ PointInsideBVH

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RAN_HAIR 
RAN_POINTS 

Definition at line 2067 of file particle_edit.c.

◆ anonymous enum

anonymous enum
Enumerator
DEL_PARTICLE 
DEL_KEY 

Definition at line 3385 of file particle_edit.c.

◆ eParticleSelectFlag

Enumerator
PSEL_NEAREST 
PSEL_ALL_KEYS 

Definition at line 715 of file particle_edit.c.

Function Documentation

◆ apply_lengths_iter()

static void apply_lengths_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ BKE_brush_weight_get()

static void BKE_brush_weight_get ( PEData data,
float   UNUSEDmat[4][4],
float   UNUSEDimat[4][4],
int  point_index,
int  key_index,
PTCacheEditKey UNUSEDkey,
float   UNUSEDmouse_distance 
)
static

◆ brush_add()

static int brush_add ( const bContext C,
PEData data,
short  number 
)
static

Definition at line 4351 of file particle_edit.c.

References BrushAddCountIterData::add_pars, add_v3_v3(), add_v3_v3v3(), BLI_assert, BLI_parallel_range_settings_defaults(), BLI_rng_free(), BLI_rng_new_srandom(), BLI_task_parallel_range(), ParticleEditSettings::brush, brush_add_count_iter(), brush_add_count_iter_free(), brush_add_count_iter_reduce(), C, PTCacheEditKey::co, HairKey::co, ParticleKey::co, copy_m4_m4(), CTX_data_depsgraph_pointer(), data, BrushAddCountIterData::data, Mesh_Runtime::deformed_only, ParticleSimulationData::depsgraph, depsgraph, BrushAddCountIterData::depsgraph, DMCACHE_NOTFOUND, PTCacheEditKey::flag, PTCacheEditPoint::flag, ParticleSystem::flag, ParticleEditSettings::flag, float(), ParticleData::foffset, ParticleSettings::from, TaskParallelSettings::func_free, TaskParallelSettings::func_reduce, ParticleData::fuv, ParticleData::hair, BrushAddCountIterData::imat, init_particle(), invert_m4_m4(), PTCacheEditPoint::keys, ParticleData::lifetime, madd_v3_v3v3fl(), MEM_callocN, MEM_freeN, mesh, BrushAddCountIterData::mesh, ParticleSystemModifierData::mesh_final, ParticleSystemModifierData::mesh_original, MIN2, PTCacheEdit::mirror_cache, mul_m4_v3(), mul_v3_fl(), NULL, ParticleData::num, BrushAddCountIterTLSData::num_added, ParticleData::num_dmcache, BrushAddCountIterData::number, ParticleSimulationData::ob, BrushAddCountIterData::object, Object::obmat, ParticleSystem::part, ParticleSystem::particles, PE_BRUSH_ADD, PE_INTERPOLATE_ADDED, PE_settings(), pe_x_mirror(), PEK_USE_WCO, PEP_EDIT_RECALC, PEP_TAG, PTCacheEdit::points, KDL::pow(), ParticleSimulationData::psmd, PTCacheEdit::psmd_eval, ParticleSimulationData::psys, PTCacheEdit::psys, psys_get_particle_on_path(), psys_get_timestep(), PSYS_GLOBAL_HAIR, psys_mat_hair_to_global(), psys_particle_on_dm(), reset_particle(), Mesh::runtime, ParticleSimulationData::scene, scene, BrushAddCountIterData::scene, ParticleSystem::seed, size(), BrushAddCountIterData::size, ParticleData::size, ParticleBrushData::size, ParticleData::state, sub_v3_v3v3(), PTCacheEditKey::time, HairKey::time, ParticleKey::time, ParticleData::time, ParticleEditSettings::totaddkey, PTCacheEditPoint::totkey, ParticleData::totkey, ParticleSystem::totpart, PTCacheEdit::totpoint, tree, ParticleSettings::use_modifier_stack, TaskParallelSettings::userdata_chunk, TaskParallelSettings::userdata_chunk_size, ParticleKey::vel, w(), and HairKey::weight.

Referenced by brush_edit_apply().

◆ brush_add_count_iter()

static void brush_add_count_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict  tls_v 
)
static

◆ brush_add_count_iter_free()

static void brush_add_count_iter_free ( const void *__restrict   UNUSEDuserdata_v,
void *__restrict  chunk_v 
)
static

Definition at line 4342 of file particle_edit.c.

References BLI_rng_free(), NULL, and BrushAddCountIterTLSData::rng.

Referenced by brush_add().

◆ brush_add_count_iter_reduce()

static void brush_add_count_iter_reduce ( const void *__restrict   UNUSEDuserdata,
void *__restrict  join_v,
void *__restrict  chunk_v 
)
static

Definition at line 4333 of file particle_edit.c.

References BrushAddCountIterTLSData::num_added.

Referenced by brush_add().

◆ brush_comb()

static void brush_comb ( PEData data,
float   UNUSEDmat[4][4],
float  imat[4][4],
int  point_index,
int  key_index,
PTCacheEditKey key,
float  mouse_distance 
)
static

◆ brush_cut()

static void brush_cut ( PEData data,
int  pa_index 
)
static

◆ brush_drawcursor()

static void brush_drawcursor ( bContext C,
int  x,
int  y,
void *  UNUSEDcustomdata 
)
static

◆ brush_edit_apply()

static void brush_edit_apply ( bContext C,
wmOperator op,
PointerRNA itemptr 
)
static

Definition at line 4685 of file particle_edit.c.

References BKE_brush_weight_get(), BKE_particle_batch_cache_dirty_tag(), BKE_PARTICLE_BATCH_DIRTY_ALL, ParticleEditSettings::brush, brush_add(), brush_comb(), brush_cut(), brush_length(), brush_puff(), brush_smooth_do(), brush_smooth_get(), ParticleEditSettings::brushtype, C, ParticleBrushData::count, count_selected_keys(), CTX_data_depsgraph_pointer(), CTX_wm_region(), wmOperator::customdata, data, BrushEdit::data, DEG_id_tag_update(), depsgraph, ED_view3d_win_to_delta(), BrushEdit::edit, ELEM, fabsf, BrushEdit::first, ParticleSystem::flag, ParticleEditSettings::flag, float(), foreach_mouse_hit_key(), foreach_mouse_hit_point(), foreach_point(), foreach_selected_point(), ParticleSettings::from, Object::id, ID_RECALC_GEOMETRY, ID_RECALC_PSYS_REDO, Object::imat, ParticleBrushData::invert, invert_m4_m4(), BrushEdit::lastmouse, max_ff(), ParticleSystemModifierData::mesh_final, mul_v3_fl(), NA_EDITED, NC_OBJECT, ND_MODIFIER, ND_PARTICLE, NULL, BrushEdit::ob, Object::obmat, ParticleSystem::part, PART_FROM_FACE, PTCacheEdit::pathcache, PE_BRUSH_ADD, PE_BRUSH_COMB, PE_BRUSH_CUT, PE_BRUSH_LENGTH, PE_BRUSH_PUFF, pe_brush_size_get(), PE_BRUSH_SMOOTH, PE_BRUSH_WEIGHT, PE_KEEP_LENGTHS, PE_LOCK_FIRST, PE_mirror_x(), PE_settings(), PE_start_edit(), PE_update_object(), pe_x_mirror(), PTCacheEdit::psmd_eval, PTCacheEdit::psys, psys_free_path_cache(), PSYS_GLOBAL_HAIR, recalc_lengths(), remove_tagged_particles(), RNA_boolean_get(), RNA_float_get_array(), scene, BrushEdit::scene, sqrtf, ParticleBrushData::step, ParticleBrushData::strength, update_world_cos(), view3d_operator_needs_opengl(), WM_event_add_notifier(), and BrushEdit::zfac.

Referenced by brush_edit_apply_event(), and brush_edit_exec().

◆ brush_edit_apply_event()

static void brush_edit_apply_event ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ brush_edit_cancel()

static void brush_edit_cancel ( bContext UNUSEDC,
wmOperator op 
)
static

Definition at line 4993 of file particle_edit.c.

References brush_edit_exit().

Referenced by PARTICLE_OT_brush_edit().

◆ brush_edit_exec()

static int brush_edit_exec ( bContext C,
wmOperator op 
)
static

◆ brush_edit_exit()

static void brush_edit_exit ( wmOperator op)
static

◆ brush_edit_init()

static int brush_edit_init ( bContext C,
wmOperator op 
)
static

◆ brush_edit_invoke()

static int brush_edit_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ brush_edit_modal()

static int brush_edit_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ brush_length()

static void brush_length ( PEData data,
int  point_index,
float   UNUSEDmouse_distance 
)
static

◆ brush_puff()

static void brush_puff ( PEData data,
int  point_index,
float  mouse_distance 
)
static

◆ brush_smooth_do()

static void brush_smooth_do ( PEData data,
float   UNUSEDmat[4][4],
float  imat[4][4],
int  point_index,
int  key_index,
PTCacheEditKey key,
float   UNUSEDmouse_distance 
)
static

◆ brush_smooth_get()

static void brush_smooth_get ( PEData data,
float  mat[4][4],
float   UNUSEDimat[4][4],
int   UNUSEDpoint_index,
int  key_index,
PTCacheEditKey key,
float   UNUSEDmouse_distance 
)
static

Definition at line 4021 of file particle_edit.c.

References add_v3_v3(), PTCacheEditKey::co, data, mul_mat3_m4_v3(), and sub_v3_v3v3().

Referenced by brush_edit_apply().

◆ calculate_average_length()

static float calculate_average_length ( PTCacheEdit edit)
static

Definition at line 5569 of file particle_edit.c.

References calculate_point_length(), LOOP_SELECTED_POINTS, and POINT_P.

Referenced by unify_length_exec().

◆ calculate_point_length()

static float calculate_point_length ( PTCacheEditPoint point)
static

◆ clear_edited_exec()

static int clear_edited_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ count_selected_keys()

static int count_selected_keys ( Scene scene,
PTCacheEdit edit 
)
static

◆ deflect_emitter_iter()

static void deflect_emitter_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ delete_exec()

static int delete_exec ( bContext C,
wmOperator op 
)
static

◆ deselect_key_select()

static void deselect_key_select ( PEData data,
int  point_index,
int  key_index,
bool   UNUSEDis_inside 
)
static

◆ ED_object_particle_edit_mode_enter()

void ED_object_particle_edit_mode_enter ( bContext C)

◆ ED_object_particle_edit_mode_enter_ex()

void ED_object_particle_edit_mode_enter_ex ( Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ ED_object_particle_edit_mode_exit()

void ED_object_particle_edit_mode_exit ( bContext C)

◆ ED_object_particle_edit_mode_exit_ex()

void ED_object_particle_edit_mode_exit_ex ( Scene scene,
Object ob 
)

◆ ED_object_particle_edit_mode_supported()

bool ED_object_particle_edit_mode_supported ( const Object ob)

◆ extend_key_select()

static void extend_key_select ( PEData data,
int  point_index,
int  key_index,
bool   UNUSEDis_inside 
)
static

◆ for_mouse_hit_keys()

static void for_mouse_hit_keys ( PEData data,
ForKeyFunc  func,
const enum eParticleSelectFlag  flag 
)
static

◆ foreach_mouse_hit_key()

static void foreach_mouse_hit_key ( PEData data,
ForHitKeyMatFunc  func,
int  selected 
)
static

◆ foreach_mouse_hit_key_iter()

static void foreach_mouse_hit_key_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ foreach_mouse_hit_point()

static void foreach_mouse_hit_point ( PEData data,
ForHitPointFunc  func,
int  selected 
)
static

◆ foreach_point()

static void foreach_point ( PEData data,
ForPointFunc  func 
)
static

◆ foreach_selected_key()

static void foreach_selected_key ( PEData data,
ForKeyFunc  func 
)
static

Definition at line 918 of file particle_edit.c.

References data, KEY_K, LOOP_SELECTED_KEYS, LOOP_VISIBLE_POINTS, and POINT_P.

Referenced by delete_exec(), and select_linked_exec().

◆ foreach_selected_point()

static void foreach_selected_point ( PEData data,
ForPointFunc  func 
)
static

Definition at line 908 of file particle_edit.c.

References data, LOOP_SELECTED_POINTS, and POINT_P.

Referenced by brush_edit_apply(), delete_exec(), rekey_exec(), and shape_cut_exec().

◆ free_all_psys_edit()

static void free_all_psys_edit ( Object object)
static

◆ hide_exec()

static int hide_exec ( bContext C,
wmOperator op 
)
static

◆ intersect_dm_quad_weights()

static void intersect_dm_quad_weights ( const float  v1[3],
const float  v2[3],
const float  v3[3],
const float  v4[3],
float  w[4] 
)
static

Definition at line 4065 of file particle_edit.c.

References copy_v3_v3(), interp_weights_poly_v3(), v1, v2, and w().

Referenced by particle_intersect_mesh().

◆ iterate_lengths_iter()

static void iterate_lengths_iter ( void *__restrict  iter_data_v,
const int  iter,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ key_inside_circle()

static bool key_inside_circle ( const PEData data,
float  rad,
const float  co[3],
float distance 
)
static

◆ key_inside_rect()

static bool key_inside_rect ( PEData data,
const float  co[3] 
)
static

◆ key_inside_test()

static bool key_inside_test ( PEData data,
const float  co[3] 
)
static

Definition at line 667 of file particle_edit.c.

References data, key_inside_circle(), key_inside_rect(), and NULL.

Referenced by for_mouse_hit_keys().

◆ key_test_depth()

static bool key_test_depth ( const PEData data,
const float  co[3],
const int  screen_co[2] 
)
static

◆ mirror_exec()

static int mirror_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ mirror_poll()

static bool mirror_poll ( bContext C)
static

◆ particle_edit_toggle_exec()

static int particle_edit_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ particle_edit_toggle_poll()

static bool particle_edit_toggle_poll ( bContext C)
static

◆ particle_intersect_mesh()

static int particle_intersect_mesh ( Depsgraph depsgraph,
Scene UNUSEDscene,
Object ob,
Mesh mesh,
float vert_cos,
const float  co1[3],
const float  co2[3],
float min_d,
int *  min_face,
float min_w,
float face_minmax,
float pa_minmax,
float  radius,
float ipoint 
)
static

◆ PARTICLE_OT_brush_edit()

void PARTICLE_OT_brush_edit ( wmOperatorType ot)

◆ PARTICLE_OT_delete()

void PARTICLE_OT_delete ( wmOperatorType ot)

◆ PARTICLE_OT_edited_clear()

void PARTICLE_OT_edited_clear ( wmOperatorType ot)

◆ PARTICLE_OT_hide()

void PARTICLE_OT_hide ( wmOperatorType ot)

◆ PARTICLE_OT_mirror()

void PARTICLE_OT_mirror ( wmOperatorType ot)

◆ PARTICLE_OT_particle_edit_toggle()

void PARTICLE_OT_particle_edit_toggle ( wmOperatorType ot)

◆ PARTICLE_OT_rekey()

void PARTICLE_OT_rekey ( wmOperatorType ot)

◆ PARTICLE_OT_remove_doubles()

void PARTICLE_OT_remove_doubles ( wmOperatorType ot)

◆ PARTICLE_OT_reveal()

void PARTICLE_OT_reveal ( wmOperatorType ot)

◆ PARTICLE_OT_select_all()

void PARTICLE_OT_select_all ( wmOperatorType ot)

◆ PARTICLE_OT_select_less()

void PARTICLE_OT_select_less ( wmOperatorType ot)

◆ PARTICLE_OT_select_linked()

void PARTICLE_OT_select_linked ( wmOperatorType ot)

◆ PARTICLE_OT_select_linked_pick()

void PARTICLE_OT_select_linked_pick ( wmOperatorType ot)

◆ PARTICLE_OT_select_more()

void PARTICLE_OT_select_more ( wmOperatorType ot)

◆ PARTICLE_OT_select_random()

void PARTICLE_OT_select_random ( wmOperatorType ot)

◆ PARTICLE_OT_select_roots()

void PARTICLE_OT_select_roots ( wmOperatorType ot)

◆ PARTICLE_OT_select_tips()

void PARTICLE_OT_select_tips ( wmOperatorType ot)

◆ PARTICLE_OT_shape_cut()

void PARTICLE_OT_shape_cut ( wmOperatorType ot)

◆ PARTICLE_OT_subdivide()

void PARTICLE_OT_subdivide ( wmOperatorType ot)

◆ PARTICLE_OT_unify_length()

void PARTICLE_OT_unify_length ( struct wmOperatorType ot)

◆ PARTICLE_OT_weight_set()

void PARTICLE_OT_weight_set ( wmOperatorType ot)

◆ PE_apply_lengths()

static void PE_apply_lengths ( Scene scene,
PTCacheEdit edit 
)
static

◆ PE_apply_mirror()

static void PE_apply_mirror ( Object ob,
ParticleSystem psys 
)
static

◆ PE_box_select()

bool PE_box_select ( bContext C,
const rcti rect,
const int  sel_op 
)

◆ pe_brush_size_get()

static float pe_brush_size_get ( const Scene UNUSEDscene,
ParticleBrushData brush 
)
static

◆ PE_circle_select()

bool PE_circle_select ( bContext C,
const int  sel_op,
const int  mval[2],
float  rad 
)

◆ PE_create_current()

PTCacheEdit* PE_create_current ( Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ PE_create_particle_edit()

void PE_create_particle_edit ( Depsgraph depsgraph,
Scene scene,
Object ob,
PointCache cache,
ParticleSystem psys 
)

◆ PE_create_random_generator()

static void PE_create_random_generator ( PEData data)
static

Definition at line 557 of file particle_edit.c.

References BLI_rng_new(), data, PIL_check_seconds_timer_i(), POINTER_AS_UINT, and UINT_MAX.

Referenced by brush_edit_init().

◆ PE_create_shape_tree()

static bool PE_create_shape_tree ( PEData data,
Object shapeob 
)
static

◆ PE_current_changed()

void PE_current_changed ( Depsgraph depsgraph,
Scene scene,
Object ob 
)

Definition at line 417 of file particle_edit.c.

References depsgraph, Object::mode, OB_MODE_PARTICLE_EDIT, PE_create_current(), and scene.

◆ pe_deflect_emitter()

static void pe_deflect_emitter ( Scene scene,
Object ob,
PTCacheEdit edit 
)
static

◆ PE_deselect_all_visible()

bool PE_deselect_all_visible ( bContext C)

◆ PE_deselect_all_visible_ex()

bool PE_deselect_all_visible_ex ( PTCacheEdit edit)

◆ PE_free_ptcache_edit()

void PE_free_ptcache_edit ( PTCacheEdit edit)

◆ PE_free_random_generator()

static void PE_free_random_generator ( PEData data)
static

Definition at line 565 of file particle_edit.c.

References BLI_rng_free(), data, and NULL.

Referenced by brush_edit_exit().

◆ PE_free_shape_tree()

static void PE_free_shape_tree ( PEData data)
static

Definition at line 552 of file particle_edit.c.

References data, and free_bvhtree_from_mesh().

Referenced by shape_cut_exec().

◆ PE_get_current()

PTCacheEdit* PE_get_current ( Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ pe_get_current()

static PTCacheEdit* pe_get_current ( Depsgraph depsgraph,
Scene scene,
Object ob,
bool  create 
)
static

◆ PE_get_current_from_psys()

PTCacheEdit* PE_get_current_from_psys ( ParticleSystem psys)

◆ PE_hair_poll()

bool PE_hair_poll ( bContext C)

◆ PE_hide_keys_time()

void PE_hide_keys_time ( Scene scene,
PTCacheEdit edit,
float  cfra 
)

◆ pe_iterate_lengths()

static void pe_iterate_lengths ( Scene scene,
PTCacheEdit edit 
)
static

◆ PE_lasso_select()

int PE_lasso_select ( bContext C,
const int  mcoords[][2],
const int  mcoords_len,
const int  sel_op 
)

◆ PE_minmax()

int PE_minmax ( Depsgraph depsgraph,
Scene scene,
ViewLayer view_layer,
float  min[3],
float  max[3] 
)

◆ PE_mirror_particle()

static void PE_mirror_particle ( Object ob,
Mesh mesh,
ParticleSystem psys,
ParticleData pa,
ParticleData mpa 
)
static

◆ PE_mirror_x()

static void PE_mirror_x ( Depsgraph depsgraph,
Scene scene,
Object ob,
int  tagged 
)
static

◆ PE_mouse_particles()

bool PE_mouse_particles ( bContext C,
const int  mval[2],
bool  extend,
bool  deselect,
bool  toggle 
)

◆ PE_poll()

bool PE_poll ( bContext C)

◆ PE_poll_view3d()

bool PE_poll_view3d ( bContext C)

◆ pe_select_all_exec()

static int pe_select_all_exec ( bContext C,
wmOperator op 
)
static

◆ PE_set_data()

static void PE_set_data ( bContext C,
PEData data 
)
static

◆ PE_set_view3d_data()

static void PE_set_view3d_data ( bContext C,
PEData data 
)
static

◆ PE_settings()

ParticleEditSettings* PE_settings ( Scene scene)

◆ PE_start_edit()

int PE_start_edit ( PTCacheEdit edit)

◆ pe_update_hair_particle_edit_pointers()

static void pe_update_hair_particle_edit_pointers ( PTCacheEdit edit)
static

◆ PE_update_mirror_cache()

static void PE_update_mirror_cache ( Object ob,
ParticleSystem psys 
)
static

◆ PE_update_object()

void PE_update_object ( Depsgraph depsgraph,
Scene scene,
Object ob,
int  useflag 
)

◆ PE_update_selection()

static void PE_update_selection ( Depsgraph depsgraph,
Scene scene,
Object ob,
int  useflag 
)
static

◆ pe_x_mirror()

static int pe_x_mirror ( Object ob)
static

◆ point_inside_bvh_cb()

static void point_inside_bvh_cb ( void *  userdata,
int  index,
const BVHTreeRay ray,
BVHTreeRayHit hit 
)
static

Definition at line 5046 of file particle_edit.c.

References data, and BVHTreeRayHit::index.

Referenced by shape_cut_test_point().

◆ point_is_selected()

static bool point_is_selected ( PTCacheEditPoint point)
static

Definition at line 675 of file particle_edit.c.

References PTCacheEditPoint::flag, KEY_K, LOOP_SELECTED_KEYS, and PEP_HIDE.

Referenced by PE_mirror_x().

◆ recalc_emitter_field()

void recalc_emitter_field ( Depsgraph UNUSEDdepsgraph,
Object UNUSEDob,
ParticleSystem psys 
)

◆ recalc_lengths()

void recalc_lengths ( PTCacheEdit edit)

◆ rekey_exec()

static int rekey_exec ( bContext C,
wmOperator op 
)
static

◆ rekey_particle()

static void rekey_particle ( PEData data,
int  pa_index 
)
static

◆ rekey_particle_to_time()

static void rekey_particle_to_time ( const bContext C,
Scene scene,
Object ob,
int  pa_index,
float  path_time 
)
static

◆ remove_doubles_exec()

static int remove_doubles_exec ( bContext C,
wmOperator op 
)
static

◆ remove_tagged_keys()

static void remove_tagged_keys ( Depsgraph depsgraph,
Object ob,
ParticleSystem psys 
)
static

◆ remove_tagged_particles()

static int remove_tagged_particles ( Object ob,
ParticleSystem psys,
int  mirror 
)
static

◆ reveal_exec()

static int reveal_exec ( bContext C,
wmOperator op 
)
static

◆ scale_point_factor()

static void scale_point_factor ( PTCacheEditPoint point,
float  factor 
)
static

◆ scale_point_to_length()

static void scale_point_to_length ( PTCacheEditPoint point,
float  length 
)
static

Definition at line 5609 of file particle_edit.c.

References calculate_point_length(), length(), and scale_point_factor().

Referenced by scale_points_to_length().

◆ scale_points_to_length()

static void scale_points_to_length ( PTCacheEdit edit,
float  length 
)
static

◆ select_action_apply()

static bool select_action_apply ( PTCacheEditPoint point,
PTCacheEditKey key,
int  action 
)
static

◆ select_key()

static void select_key ( PEData data,
int  point_index,
int  key_index,
bool   UNUSEDis_inside 
)
static

◆ select_key_op()

static void select_key_op ( PEData data,
int  point_index,
int  key_index,
bool  is_inside 
)
static

◆ select_keys()

static void select_keys ( PEData data,
int  point_index,
int   UNUSEDkey_index,
bool   UNUSEDis_inside 
)
static

◆ select_less_exec()

static int select_less_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ select_less_keys()

static void select_less_keys ( PEData data,
int  point_index 
)
static

◆ select_linked_exec()

static int select_linked_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ select_linked_pick_exec()

static int select_linked_pick_exec ( bContext C,
wmOperator op 
)
static

◆ select_linked_pick_invoke()

static int select_linked_pick_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ select_more_exec()

static int select_more_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ select_more_keys()

static void select_more_keys ( PEData data,
int  point_index 
)
static

◆ select_random_exec()

static int select_random_exec ( bContext C,
wmOperator op 
)
static

◆ select_root()

static void select_root ( PEData data,
int  point_index 
)
static

◆ select_roots_exec()

static int select_roots_exec ( bContext C,
wmOperator op 
)
static

◆ select_tip()

static void select_tip ( PEData data,
int  point_index 
)
static

◆ select_tips_exec()

static int select_tips_exec ( bContext C,
wmOperator op 
)
static

◆ set_delete_particle()

static void set_delete_particle ( PEData data,
int  pa_index 
)
static

Definition at line 3393 of file particle_edit.c.

References data, PTCacheEditPoint::flag, PEP_TAG, and PTCacheEdit::points.

Referenced by delete_exec().

◆ set_delete_particle_key()

static void set_delete_particle_key ( PEData data,
int  pa_index,
int  key_index,
bool   UNUSEDis_inside 
)
static

Definition at line 3400 of file particle_edit.c.

References data, PTCacheEditKey::flag, PTCacheEditPoint::keys, PEK_TAG, and PTCacheEdit::points.

Referenced by delete_exec().

◆ shape_cut()

static void shape_cut ( PEData data,
int  pa_index 
)
static

◆ shape_cut_exec()

static int shape_cut_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ shape_cut_poll()

static bool shape_cut_poll ( bContext C)
static

◆ shape_cut_test_point()

static bool shape_cut_test_point ( PEData data,
ParticleEditSettings pset,
ParticleCacheKey key 
)
static

◆ subdivide_exec()

static int subdivide_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ subdivide_particle()

static void subdivide_particle ( PEData data,
int  pa_index 
)
static

◆ toggle_key_select()

static void toggle_key_select ( PEData data,
int  point_index,
int  key_index,
bool   UNUSEDis_inside 
)
static

◆ toggle_particle_cursor()

static void toggle_particle_cursor ( Scene scene,
bool  enable 
)
static

◆ unify_length_exec()

static int unify_length_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ update_velocities()

static void update_velocities ( PTCacheEdit edit)
static

◆ update_world_cos()

void update_world_cos ( Object ob,
PTCacheEdit edit 
)

◆ weight_set_exec()

static int weight_set_exec ( bContext C,
wmOperator op 
)
static

Variable Documentation

◆ delete_type_items

const EnumPropertyItem delete_type_items[]
static
Initial value:
= {
{DEL_PARTICLE, "PARTICLE", 0, "Particle", ""},
{DEL_KEY, "KEY", 0, "Key", ""},
{0, NULL, 0, NULL, NULL},
}
@ DEL_KEY
@ DEL_PARTICLE

Definition at line 3387 of file particle_edit.c.

Referenced by PARTICLE_OT_delete().

◆ select_random_type_items

const EnumPropertyItem select_random_type_items[]
static
Initial value:
= {
{RAN_HAIR, "HAIR", 0, "Hair", ""},
{RAN_POINTS, "POINTS", 0, "Points", ""},
{0, NULL, 0, NULL, NULL},
}
@ RAN_HAIR
@ RAN_POINTS

Definition at line 2069 of file particle_edit.c.

Referenced by PARTICLE_OT_select_random().