Blender V4.3
effect.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstdarg>
#include <cstddef>
#include <cstdlib>
#include "MEM_guardedalloc.h"
#include "DNA_curve_types.h"
#include "DNA_listBase.h"
#include "DNA_mesh_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
#include "BLI_math_base_safe.h"
#include "BLI_math_matrix.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BLI_noise.h"
#include "BLI_rand.h"
#include "BLI_time.h"
#include "BLI_utildefines.h"
#include "BKE_anim_path.h"
#include "BKE_bvhutils.hh"
#include "BKE_collection.hh"
#include "BKE_collision.h"
#include "BKE_curve.hh"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_fluid.h"
#include "BKE_global.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_object_types.hh"
#include "BKE_particle.h"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_physics.hh"
#include "DEG_depsgraph_query.hh"
#include "RE_texture.h"

Go to the source code of this file.

Macros

#define rot(x, k)   (((x) << (k)) | ((x) >> (32 - (k))))
 

Functions

EffectorWeightsBKE_effector_add_weights (Collection *collection)
 
PartDeflectBKE_partdeflect_new (int type)
 
PartDeflectBKE_partdeflect_copy (const PartDeflect *pd_src)
 
void BKE_partdeflect_free (PartDeflect *pd)
 
static void precalculate_effector (Depsgraph *depsgraph, EffectorCache *eff)
 
static void add_effector_relation (ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd)
 
static void add_effector_evaluation (ListBase **effectors, Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
 
ListBaseBKE_effector_relations_create (Depsgraph *depsgraph, const Scene *scene, ViewLayer *view_layer, Collection *collection)
 
void BKE_effector_relations_free (ListBase *lb)
 
static bool is_effector_enabled (PartDeflect *pd, bool use_rotation)
 
static bool is_effector_nonzero_strength (PartDeflect *pd)
 
static bool is_effector_relevant (PartDeflect *pd, EffectorWeights *weights, bool use_rotation)
 
ListBaseBKE_effectors_create (Depsgraph *depsgraph, Object *ob_src, ParticleSystem *psys_src, EffectorWeights *weights, bool use_rotation)
 
void BKE_effectors_free (ListBase *lb)
 
void pd_point_from_particle (ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, EffectedPoint *point)
 
void pd_point_from_loc (Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
 
void pd_point_from_soft (Scene *scene, float *loc, float *vel, int index, EffectedPoint *point)
 
static void eff_tri_ray_hit (void *, int, const BVHTreeRay *, BVHTreeRayHit *hit)
 
static float eff_calc_visibility (ListBase *colliders, EffectorCache *eff, EffectorData *efd, EffectedPoint *point)
 
static float wind_func (RNG *rng, float strength)
 
static float falloff_func (float fac, int usemin, float mindist, int usemax, float maxdist, float power)
 
static float falloff_func_dist (PartDeflect *pd, float fac)
 
static float falloff_func_rad (PartDeflect *pd, float fac)
 
float effector_falloff (EffectorCache *eff, EffectorData *efd, EffectedPoint *, EffectorWeights *weights)
 
bool closest_point_on_surface (SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3])
 
bool get_effector_data (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int real_velocity)
 
static void get_effector_tot (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
 
static void do_texture_effector (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
 
static void do_physical_effector (EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force)
 
void BKE_effectors_apply (ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *wind_force, float *impulse)
 
uint BKE_sim_debug_data_hash (int i)
 
uint BKE_sim_debug_data_hash_combine (uint kx, uint ky)
 
static uint debug_element_hash (const void *key)
 
static bool debug_element_compare (const void *a, const void *b)
 
static void debug_element_free (void *val)
 
void BKE_sim_debug_data_set_enabled (bool enable)
 
bool BKE_sim_debug_data_get_enabled ()
 
void BKE_sim_debug_data_free ()
 
static void debug_data_insert (SimDebugData *debug_data, SimDebugElement *elem)
 
void BKE_sim_debug_data_add_element (int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, uint hash)
 
void BKE_sim_debug_data_remove_element (uint hash)
 
void BKE_sim_debug_data_clear ()
 
void BKE_sim_debug_data_clear_category (const char *category)
 

Variables

SimDebugData_sim_debug_data = nullptr
 

Macro Definition Documentation

◆ rot

#define rot ( x,
k )   (((x) << (k)) | ((x) >> (32 - (k))))

Referenced by TransformWriter::add_joint_transform(), TransformWriter::add_node_transform_identity(), TransformWriter::add_node_transform_ob(), add_primitive_circle_exec(), add_primitive_cone_exec(), add_primitive_cube_exec(), add_primitive_cylinder_exec(), add_primitive_grid_exec(), add_primitive_icosphere_exec(), add_primitive_monkey_exec(), add_primitive_plane_exec(), add_primitive_uvsphere_exec(), blender::ed::object::add_type(), blender::ed::object::add_type_with_obdata(), btSoftBody::appendDeformableAnchor(), AnimationImporter::apply_matrix_curves(), AnimationImporter::Assign_transform_animations(), bc_create_restpose_mat(), BKE_object_apply_mat4_ex(), BKE_object_tfm_copy(), BKE_object_tfm_protected_backup(), BKE_pchan_apply_mat4(), BKE_pose_rest(), BKE_sim_debug_data_hash_combine(), BKE_vfont_build_char(), blender::math::DualQuaternionBase< T >::BLI_STRUCT_EQUALITY_OPERATORS_5(), build_underline(), cloth_parallel_transport_hair_frame(), IK_QOrientationTask::ComputeJacobian(), convert_pose(), convert_tree(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::io::grease_pencil::GreasePencilImporter::create_object(), blender::io::usd::create_transform2d_shader(), curvesurf_prim_add(), diagonalize(), do_kink_spiral(), do_kink_spiral_deform(), btSoftColliders::CollideSDF_RD::DoNode(), btSoftColliders::CollideSDF_RDF::DoNode(), blender::ed::object::effector_add_exec(), explodeMesh(), blender::geometry::extend_curves_curved(), get_auto_filter(), blender::bke::greasepencil::get_stroke_to_texture_matrix(), GetJointRotation(), KDL::TwistAcc::GetTwist(), KDL::TwistVel::GetTwist(), KDL::TwistAcc::GetTwistDot(), KDL::TwistVel::GetTwistDot(), blender::ed::greasepencil::grease_pencil_primitive_rotate_all_update(), IK_CreateSegment(), IK_SolverAddGoalOrientation(), init_meta(), blender::ed::object::init_transform_on_add(), btDeformableMultiBodyDynamicsWorld::integrateTransforms(), blender::ed::object::lightprobe_add_exec(), loc_rot_size_to_mat4(), make_prim_init(), mat3_to_rot_size(), mat4_decompose(), mat4_to_loc_rot_size(), mat4_to_rot(), Matrix_decompose(), Matrix_to_scale(), modify_mesh(), blender::ed::object::new_primitive_matrix(), blender::ed::object::object_add_exec(), blender::ed::object::object_add_text_exec(), blender::ed::object::object_armature_add_exec(), blender::ed::object::object_camera_add_exec(), blender::ed::object::object_curves_random_add_exec(), blender::ed::object::object_data_instance_add_exec(), blender::ed::object::object_empty_add_exec(), blender::ed::object::object_grease_pencil_add_exec(), blender::ed::object::object_image_add_exec(), blender::ed::object::object_light_add_exec(), blender::ed::object::object_metaball_add_exec(), blender::ed::object::object_pointcloud_add_exec(), blender::ed::object::object_speaker_add_exec(), blender::ed::object::object_transform_apply_exec(), blender::ed::object::object_volume_add(), ObjectToTransData(), KDL::Twist::operator()(), KDL::Twist::operator()(), KDL::Twist::operator+=(), KDL::TwistAcc::operator+=(), KDL::TwistVel::operator+=(), KDL::Twist::operator-=(), KDL::TwistAcc::operator-=(), KDL::TwistVel::operator-=(), blender::draw::pack_rotation_aspect_hardness(), pivotcon_evaluate(), psys_cache_edit_paths_iter(), psys_cache_paths(), psys_get_birth_coords(), psys_get_from_key(), psys_thread_create_path(), ptcache_particle_interpolate(), radial_control_paint_tex(), RB_body_new(), RB_body_set_loc_rot(), RB_compound_add_child_shape(), KDL::Twist::RefPoint(), KDL::TwistAcc::RefPoint(), KDL::TwistVel::RefPoint(), KDL::Twist::ReverseSign(), KDL::TwistAcc::ReverseSign(), KDL::TwistVel::ReverseSign(), btSoftBody::rotate(), blender::bke::subdiv::rotate_indices(), BCMatrix::rotation(), blender::ed::object::rotation_from_quat(), blender::ed::object::rotation_from_view(), set_plane_exec(), blender::io::usd::USDTransformWriter::set_xform_ops(), setUpVector(), setWorldToBaseRot(), blender::ed::sculpt_paint::pose::solve_ik_chain(), blender::ed::sculpt_paint::pose::solve_roll_chain(), testAngLimits(), transform_evaluate(), txt_add_object(), wm_gizmo_set_matrix_rotation_from_z_axis__internal(), and wm_xr_navigation_reset_exec().

Function Documentation

◆ add_effector_evaluation()

static void add_effector_evaluation ( ListBase ** effectors,
Depsgraph * depsgraph,
Scene * scene,
Object * ob,
ParticleSystem * psys,
PartDeflect * pd )
static

◆ add_effector_relation()

static void add_effector_relation ( ListBase * relations,
Object * ob,
ParticleSystem * psys,
PartDeflect * pd )
static

◆ BKE_effector_add_weights()

◆ BKE_effector_relations_create()

◆ BKE_effector_relations_free()

void BKE_effector_relations_free ( ListBase * lb)

Definition at line 242 of file effect.cc.

References BLI_freelistN(), and MEM_freeN().

Referenced by blender::deg::clear_physics_relations().

◆ BKE_effectors_apply()

◆ BKE_effectors_create()

◆ BKE_effectors_free()

◆ BKE_partdeflect_copy()

PartDeflect * BKE_partdeflect_copy ( const PartDeflect * pd_src)

Definition at line 110 of file effect.cc.

References MEM_dupallocN.

◆ BKE_partdeflect_free()

void BKE_partdeflect_free ( PartDeflect * pd)

Definition at line 119 of file effect.cc.

References MEM_freeN().

Referenced by object_free_data(), and particle_settings_free_data().

◆ BKE_partdeflect_new()

◆ BKE_sim_debug_data_add_element()

◆ BKE_sim_debug_data_clear()

void BKE_sim_debug_data_clear ( void )

Definition at line 1366 of file effect.cc.

References _sim_debug_data, BLI_ghash_clear(), debug_element_free(), and SimDebugData::gh.

◆ BKE_sim_debug_data_clear_category()

◆ BKE_sim_debug_data_free()

void BKE_sim_debug_data_free ( void )

◆ BKE_sim_debug_data_get_enabled()

bool BKE_sim_debug_data_get_enabled ( void )

Definition at line 1276 of file effect.cc.

References _sim_debug_data.

◆ BKE_sim_debug_data_hash()

uint BKE_sim_debug_data_hash ( int i)

Definition at line 1203 of file effect.cc.

References BLI_ghashutil_uinthash().

◆ BKE_sim_debug_data_hash_combine()

uint BKE_sim_debug_data_hash_combine ( uint kx,
uint ky )

Definition at line 1208 of file effect.cc.

References b, and rot.

◆ BKE_sim_debug_data_remove_element()

void BKE_sim_debug_data_remove_element ( uint hash)

◆ BKE_sim_debug_data_set_enabled()

void BKE_sim_debug_data_set_enabled ( bool enable)

◆ closest_point_on_surface()

◆ debug_data_insert()

static void debug_data_insert ( SimDebugData * debug_data,
SimDebugElement * elem )
static

◆ debug_element_compare()

static bool debug_element_compare ( const void * a,
const void * b )
static

Definition at line 1244 of file effect.cc.

References b, and SimDebugElement::hash.

Referenced by BKE_sim_debug_data_set_enabled().

◆ debug_element_free()

static void debug_element_free ( void * val)
static

◆ debug_element_hash()

static uint debug_element_hash ( const void * key)
static

Definition at line 1238 of file effect.cc.

References SimDebugElement::hash.

Referenced by BKE_sim_debug_data_set_enabled().

◆ do_physical_effector()

◆ do_texture_effector()

◆ eff_calc_visibility()

◆ eff_tri_ray_hit()

static void eff_tri_ray_hit ( void * ,
int ,
const BVHTreeRay * ,
BVHTreeRayHit * hit )
static

Definition at line 453 of file effect.cc.

Referenced by eff_calc_visibility().

◆ effector_falloff()

◆ falloff_func()

static float falloff_func ( float fac,
int usemin,
float mindist,
int usemax,
float maxdist,
float power )
static

Definition at line 550 of file effect.cc.

References pow(), and power().

Referenced by falloff_func_dist(), and falloff_func_rad().

◆ falloff_func_dist()

static float falloff_func_dist ( PartDeflect * pd,
float fac )
static

◆ falloff_func_rad()

static float falloff_func_rad ( PartDeflect * pd,
float fac )
static

◆ get_effector_data()

◆ get_effector_tot()

◆ is_effector_enabled()

static bool is_effector_enabled ( PartDeflect * pd,
bool use_rotation )
static

◆ is_effector_nonzero_strength()

◆ is_effector_relevant()

static bool is_effector_relevant ( PartDeflect * pd,
EffectorWeights * weights,
bool use_rotation )
static

◆ pd_point_from_loc()

void pd_point_from_loc ( Scene * scene,
float * loc,
float * vel,
int index,
EffectedPoint * point )

Definition at line 417 of file effect.cc.

References float.

Referenced by cloth_calc_force(), and dynamic_paint_prepare_effect_cb().

◆ pd_point_from_particle()

◆ pd_point_from_soft()

void pd_point_from_soft ( Scene * scene,
float * loc,
float * vel,
int index,
EffectedPoint * point )

Definition at line 432 of file effect.cc.

References float, and PE_WIND_AS_SPEED.

Referenced by _scan_for_ext_spring_forces(), and _softbody_calc_forces_slice_in_a_thread().

◆ precalculate_effector()

◆ wind_func()

static float wind_func ( RNG * rng,
float strength )
static

Definition at line 532 of file effect.cc.

References BLI_rng_get_float(), BLI_rng_get_int(), float, and ret.

Referenced by do_physical_effector().

Variable Documentation

◆ _sim_debug_data