Blender V4.3
particle_edit.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#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.hh"
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_rand.h"
#include "BLI_rect.h"
#include "BLI_task.h"
#include "BLI_time_utildefines.h"
#include "BLI_utildefines.h"
#include "BKE_bvhutils.hh"
#include "BKE_context.hh"
#include "BKE_customdata.hh"
#include "BKE_global.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "DEG_depsgraph.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_particle.hh"
#include "ED_physics.hh"
#include "ED_screen.hh"
#include "ED_select_utils.hh"
#include "ED_view3d.hh"
#include "GPU_immediate.hh"
#include "GPU_immediate_util.hh"
#include "GPU_state.hh"
#include "UI_resources.hh"
#include "WM_api.hh"
#include "WM_message.hh"
#include "WM_toolsystem.hh"
#include "WM_types.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "DEG_depsgraph_query.hh"
#include "physics_intern.hh"
#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  NearestParticleData
 
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, blender::float3 &min, blender::float3 &max)
 
Edit Mode Helpers
int PE_start_edit (PTCacheEdit *edit)
 
ParticleEditSettingsPE_settings (Scene *scene)
 
static float pe_brush_size_get (const 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)
 
Common Struct Passed to Callbacks
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)
 
static void PE_data_free (PEData *data)
 
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 Calculation
static void deflect_emitter_iter (void *__restrict iter_data_v, const int iter, const TaskParallelTLS *__restrict)
 
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)
 
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)
 
static void pe_iterate_lengths (Scene *scene, PTCacheEdit *edit)
 
void recalc_lengths (PTCacheEdit *edit)
 
void recalc_emitter_field (Depsgraph *, Object *, 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)
 
Edit Selections
static void select_key (PEData *data, int point_index, int key_index, bool)
 
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, bool)
 
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
static void nearest_key_fn (PEData *data, int point_index, int key_index, bool)
 
static bool pe_nearest_point_and_key (bContext *C, const int mval[2], PTCacheEditPoint **r_point, PTCacheEditKey **r_key)
 
bool PE_mouse_particles (bContext *C, const int mval[2], const SelectPick_Params *params)
 
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 *)
 
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
static void pe_select_cache_free_generic_userdata (void *data)
 
static void pe_select_cache_init_with_generic_userdata (bContext *C, wmGenericUserData *wm_userdata)
 
bool PE_circle_select (bContext *C, wmGenericUserData *wm_userdata, 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 *)
 
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 *)
 
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 *)
 
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 *)
 
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 *)
 
static bool mirror_poll (bContext *C)
 
void PARTICLE_OT_mirror (wmOperatorType *ot)
 
Brush Edit Callbacks
static void brush_comb (PEData *data, float[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)
 
static void brush_puff (PEData *data, int point_index, float mouse_distance)
 
static void BKE_brush_weight_get (PEData *data, float[4][4], float[4][4], int point_index, int key_index, PTCacheEditKey *, float)
 
static void brush_smooth_get (PEData *data, float mat[4][4], float[4][4], int, int key_index, PTCacheEditKey *key, float)
 
static void brush_smooth_do (PEData *data, float[4][4], float imat[4][4], int point_index, int key_index, PTCacheEditKey *key, float)
 
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 *, 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, void *__restrict join_v, void *__restrict chunk_v)
 
static void brush_add_count_iter_free (const void *__restrict, void *__restrict chunk_v)
 
static int brush_add (const bContext *C, PEData *data, short number)
 
Brush Edit Operator
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 *, wmOperator *op)
 
static bool brush_edit_poll (bContext *C)
 
void PARTICLE_OT_brush_edit (wmOperatorType *ot)
 
Cut Shape
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 *)
 
void PARTICLE_OT_shape_cut (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 *)
 
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 *)
 
void PARTICLE_OT_unify_length (wmOperatorType *ot)
 

Iterators

enum  eParticleSelectFlag { PSEL_NEAREST = (1 << 0) , PSEL_ALL_KEYS = (1 << 1) }
 
using ForPointFunc = void (*)(PEData *data, int point_index)
 
using ForHitPointFunc = void (*)(PEData *data, int point_index, float mouse_distance)
 
using ForKeyFunc = void (*)(PEData *data, int point_index, int key_index, bool is_inside)
 
using ForKeyMatFunc
 
using ForHitKeyMatFunc
 
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)
 
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)
 
static int delete_exec (bContext *C, wmOperator *op)
 
void PARTICLE_OT_delete (wmOperatorType *ot)
 

Typedef Documentation

◆ ForHitKeyMatFunc

Initial value:
void (*)(PEData *data,
float mat[4][4],
float imat[4][4],
int point_index,
int key_index,
float mouse_distance)

Definition at line 715 of file particle_edit.cc.

◆ ForHitPointFunc

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

Definition at line 705 of file particle_edit.cc.

◆ ForKeyFunc

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

Definition at line 707 of file particle_edit.cc.

◆ ForKeyMatFunc

Initial value:
void (*)(PEData *data,
const float mat[4][4],
const float imat[4][4],
int point_index,
int key_index,

Definition at line 709 of file particle_edit.cc.

◆ ForPointFunc

using ForPointFunc = void (*)(PEData *data, int point_index)

Definition at line 704 of file particle_edit.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RAN_HAIR 
RAN_POINTS 

Definition at line 2099 of file particle_edit.cc.

◆ anonymous enum

anonymous enum
Enumerator
DEL_PARTICLE 
DEL_KEY 

Definition at line 3454 of file particle_edit.cc.

◆ eParticleSelectFlag

Enumerator
PSEL_NEAREST 
PSEL_ALL_KEYS 

Definition at line 723 of file particle_edit.cc.

Function Documentation

◆ apply_lengths_iter()

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

◆ BKE_brush_weight_get()

static void BKE_brush_weight_get ( PEData * data,
float [4][4],
float [4][4],
int point_index,
int key_index,
PTCacheEditKey * ,
float  )
static

◆ brush_add()

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

Definition at line 4423 of file particle_edit.cc.

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(), HairKey::co, ParticleKey::co, PTCacheEditKey::co, copy_m4_m4(), CTX_data_depsgraph_pointer(), BrushAddCountIterData::data, data, BrushAddCountIterData::depsgraph, depsgraph, ParticleSimulationData::depsgraph, DMCACHE_NOTFOUND, ParticleEditSettings::flag, ParticleSystem::flag, PTCacheEditKey::flag, float, ParticleData::foffset, ParticleSettings::from, ParticleData::fuv, ParticleData::hair, BrushAddCountIterData::imat, init_particle(), invert_m4_m4(), ParticleData::lifetime, madd_v3_v3v3fl(), MEM_callocN, MEM_freeN(), MEM_SAFE_FREE, BrushAddCountIterData::mesh, mesh, ParticleSystemModifierData::mesh_final, ParticleSystemModifierData::mesh_original, PTCacheEdit::mirror_cache, mul_m4_v3(), mul_v3_fl(), ParticleData::num, BrushAddCountIterTLSData::num_added, ParticleData::num_dmcache, BrushAddCountIterData::number, ParticleSimulationData::ob, BrushAddCountIterData::object, ParticleSystem::part, ParticleSystem::particles, PE_BRUSH_ADD, PE_INTERPOLATE_ADDED, PE_settings(), pe_x_mirror(), PEK_USE_WCO, PEP_EDIT_RECALC, PEP_TAG, point, PTCacheEdit::points, 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, BrushAddCountIterData::scene, ParticleSimulationData::scene, scene, ParticleSystem::seed, BrushAddCountIterData::size, ParticleBrushData::size, ParticleData::size, size(), ParticleData::state, sub_v3_v3v3(), HairKey::time, ParticleData::time, ParticleKey::time, PTCacheEditKey::time, ParticleEditSettings::totaddkey, ParticleData::totkey, ParticleSystem::totpart, PTCacheEdit::totpoint, tree, ParticleSettings::use_modifier_stack, ParticleKey::vel, w(), and HairKey::weight.

Referenced by brush_edit_apply().

◆ brush_add_count_iter()

◆ brush_add_count_iter_free()

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

Definition at line 4414 of file particle_edit.cc.

References BLI_rng_free(), and BrushAddCountIterTLSData::rng.

Referenced by brush_add().

◆ brush_add_count_iter_reduce()

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

Definition at line 4405 of file particle_edit.cc.

References BrushAddCountIterTLSData::num_added.

Referenced by brush_add().

◆ brush_comb()

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

◆ brush_cut()

◆ brush_drawcursor()

◆ brush_edit_apply()

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

Definition at line 4753 of file particle_edit.cc.

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, PEData::context, ParticleBrushData::count, count_selected_keys(), CTX_data_depsgraph_pointer(), CTX_wm_region(), wmOperator::customdata, BrushEdit::data, DEG_id_tag_update(), depsgraph, ED_view3d_win_to_delta(), BrushEdit::edit, ELEM, fabsf, BrushEdit::first, ParticleEditSettings::flag, ParticleSystem::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, ParticleBrushData::invert, invert_m4_m4(), BrushEdit::lastmouse, max_ff(), ParticleSystemModifierData::mesh_final, mul_v3_fl(), NA_EDITED, NC_OBJECT, ND_MODIFIER, ND_PARTICLE, BrushEdit::ob, 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(), Object::runtime, 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 * ,
wmOperator * op )
static

Definition at line 5062 of file particle_edit.cc.

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

◆ brush_edit_invoke()

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

◆ brush_edit_modal()

◆ brush_edit_poll()

static bool brush_edit_poll ( bContext * C)
static

Definition at line 5067 of file particle_edit.cc.

References PE_poll_view3d(), and WM_toolsystem_active_tool_is_brush().

Referenced by PARTICLE_OT_brush_edit().

◆ brush_length()

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

◆ brush_puff()

◆ brush_smooth_do()

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

◆ brush_smooth_get()

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

Definition at line 4093 of file particle_edit.cc.

References add_v3_v3(), PTCacheEditKey::co, 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 5647 of file particle_edit.cc.

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

Definition at line 5635 of file particle_edit.cc.

References KEY_K, len_v3v3(), length(), and LOOP_KEYS.

Referenced by calculate_average_length(), and scale_point_to_length().

◆ clear_edited_exec()

◆ count_selected_keys()

static int count_selected_keys ( Scene * scene,
PTCacheEdit * edit )
static

◆ deflect_emitter_iter()

◆ delete_exec()

◆ ED_object_particle_edit_mode_enter()

void ED_object_particle_edit_mode_enter ( bContext * C)

◆ ED_object_particle_edit_mode_enter_ex()

◆ ED_object_particle_edit_mode_exit()

void ED_object_particle_edit_mode_exit ( bContext * C)

◆ ED_object_particle_edit_mode_exit_ex()

◆ ED_object_particle_edit_mode_supported()

bool ED_object_particle_edit_mode_supported ( const Object * ob)

◆ for_mouse_hit_keys()

◆ foreach_mouse_hit_key()

◆ foreach_mouse_hit_key_iter()

◆ 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 926 of file particle_edit.cc.

References 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 916 of file particle_edit.cc.

References 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

Definition at line 5456 of file particle_edit.cc.

References BLI_assert.

Referenced by ED_object_particle_edit_mode_exit_ex().

◆ hide_exec()

◆ 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 4137 of file particle_edit.cc.

References copy_v3_v3(), interp_weights_poly_v3(), 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 )
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 675 of file particle_edit.cc.

References key_inside_circle(), and key_inside_rect().

Referenced by for_mouse_hit_keys().

◆ key_test_depth()

◆ mirror_exec()

◆ mirror_poll()

◆ nearest_key_fn()

static void nearest_key_fn ( PEData * data,
int point_index,
int key_index,
bool  )
static

◆ particle_edit_toggle_exec()

◆ particle_edit_toggle_poll()

◆ particle_intersect_mesh()

static int particle_intersect_mesh ( Depsgraph * depsgraph,
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

◆ PARTICLE_OT_brush_edit()

◆ PARTICLE_OT_delete()

◆ PARTICLE_OT_edited_clear()

◆ PARTICLE_OT_hide()

◆ PARTICLE_OT_mirror()

◆ PARTICLE_OT_particle_edit_toggle()

◆ PARTICLE_OT_rekey()

◆ PARTICLE_OT_remove_doubles()

◆ PARTICLE_OT_reveal()

◆ PARTICLE_OT_select_all()

◆ PARTICLE_OT_select_less()

◆ PARTICLE_OT_select_linked()

◆ PARTICLE_OT_select_linked_pick()

◆ PARTICLE_OT_select_more()

◆ PARTICLE_OT_select_random()

◆ PARTICLE_OT_select_roots()

◆ PARTICLE_OT_select_tips()

◆ PARTICLE_OT_shape_cut()

◆ PARTICLE_OT_subdivide()

◆ PARTICLE_OT_unify_length()

◆ PARTICLE_OT_weight_set()

◆ PE_apply_lengths()

◆ PE_apply_mirror()

◆ PE_box_select()

◆ pe_brush_size_get()

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

◆ PE_circle_select()

◆ PE_create_current()

◆ PE_create_particle_edit()

◆ PE_create_random_generator()

static void PE_create_random_generator ( PEData * data)
static

Definition at line 551 of file particle_edit.cc.

References BLI_rng_new(), BLI_time_now_seconds_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 409 of file particle_edit.cc.

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

◆ PE_data_free()

◆ pe_deflect_emitter()

◆ PE_deselect_all_visible()

◆ PE_deselect_all_visible_ex()

◆ PE_free_ptcache_edit()

◆ PE_free_random_generator()

static void PE_free_random_generator ( PEData * data)
static

Definition at line 559 of file particle_edit.cc.

References BLI_rng_free().

Referenced by PE_data_free().

◆ PE_free_shape_tree()

static void PE_free_shape_tree ( PEData * data)
static

Definition at line 546 of file particle_edit.cc.

References free_bvhtree_from_mesh().

Referenced by PE_data_free(), and shape_cut_exec().

◆ PE_get_current()

◆ pe_get_current()

◆ PE_get_current_from_psys()

◆ PE_hair_poll()

◆ PE_hide_keys_time()

◆ pe_iterate_lengths()

◆ PE_lasso_select()

◆ PE_minmax()

◆ PE_mirror_particle()

◆ PE_mirror_x()

◆ PE_mouse_particles()

◆ pe_nearest_point_and_key()

static bool pe_nearest_point_and_key ( bContext * C,
const int mval[2],
PTCacheEditPoint ** r_point,
PTCacheEditKey ** r_key )
static

◆ PE_poll()

◆ PE_poll_view3d()

◆ pe_select_all_exec()

◆ pe_select_cache_free_generic_userdata()

static void pe_select_cache_free_generic_userdata ( void * data)
static

Definition at line 2350 of file particle_edit.cc.

References MEM_freeN(), and PE_data_free().

Referenced by pe_select_cache_init_with_generic_userdata().

◆ pe_select_cache_init_with_generic_userdata()

static void pe_select_cache_init_with_generic_userdata ( bContext * C,
wmGenericUserData * wm_userdata )
static

◆ PE_set_data()

◆ PE_set_view3d_data()

◆ PE_settings()

◆ PE_start_edit()

◆ pe_update_hair_particle_edit_pointers()

◆ PE_update_mirror_cache()

◆ PE_update_object()

◆ PE_update_selection()

◆ 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 5120 of file particle_edit.cc.

References PointInsideBVH::bvhdata, and BVHTreeFromMesh::raycast_callback.

Referenced by shape_cut_test_point().

◆ point_is_selected()

static bool point_is_selected ( PTCacheEditPoint * point)
static

Definition at line 683 of file particle_edit.cc.

References KEY_K, LOOP_SELECTED_KEYS, and PEP_HIDE.

Referenced by find_fcurve_segment(), and PE_mirror_x().

◆ recalc_emitter_field()

◆ recalc_lengths()

void recalc_lengths ( PTCacheEdit * edit)

Set current distances to be kept between neighboring keys.

Definition at line 1422 of file particle_edit.cc.

References KEY_K, len_v3v3(), LOOP_EDITED_POINTS, and POINT_P.

Referenced by brush_edit_apply(), copy_particle_edit(), delete_exec(), PE_create_particle_edit(), rekey_exec(), scale_points_to_length(), shape_cut_exec(), and subdivide_exec().

◆ rekey_exec()

◆ rekey_particle()

◆ rekey_particle_to_time()

◆ remove_doubles_exec()

◆ remove_tagged_keys()

◆ remove_tagged_particles()

◆ reveal_exec()

◆ 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 5687 of file particle_edit.cc.

References calculate_point_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

Definition at line 5696 of file particle_edit.cc.

References LOOP_SELECTED_POINTS, POINT_P, recalc_lengths(), and scale_point_to_length().

Referenced by unify_length_exec().

◆ 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  )
static

Definition at line 1687 of file particle_edit.cc.

References PTCacheEditKey::flag, PEK_SELECT, PEP_EDIT_RECALC, and PTCacheEdit::points.

Referenced by PE_circle_select().

◆ 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 ,
bool  )
static

◆ select_less_exec()

◆ select_less_keys()

static void select_less_keys ( PEData * data,
int point_index )
static

◆ select_linked_exec()

◆ select_linked_pick_exec()

◆ select_linked_pick_invoke()

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

◆ select_more_exec()

◆ select_more_keys()

static void select_more_keys ( PEData * data,
int point_index )
static

◆ select_random_exec()

◆ select_root()

static void select_root ( PEData * data,
int point_index )
static

◆ select_roots_exec()

◆ select_tip()

static void select_tip ( PEData * data,
int point_index )
static

◆ select_tips_exec()

◆ set_delete_particle()

static void set_delete_particle ( PEData * data,
int pa_index )
static

Definition at line 3462 of file particle_edit.cc.

References 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  )
static

Definition at line 3469 of file particle_edit.cc.

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

Referenced by delete_exec().

◆ shape_cut()

◆ shape_cut_exec()

◆ shape_cut_poll()

static bool shape_cut_poll ( bContext * C)
static

◆ shape_cut_test_point()

◆ subdivide_exec()

◆ subdivide_particle()

◆ toggle_particle_cursor()

◆ unify_length_exec()

◆ update_velocities()

◆ update_world_cos()

◆ weight_set_exec()

Variable Documentation

◆ delete_type_items

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

Definition at line 3456 of file particle_edit.cc.

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, nullptr, 0, nullptr, nullptr},
}
@ RAN_HAIR
@ RAN_POINTS

Definition at line 2101 of file particle_edit.cc.

Referenced by PARTICLE_OT_select_random().