32#include "RNA_prototypes.hh"
88 printf(
"CollisionModifier: collision settings are missing!\n");
96 float current_time = 0;
99 mesh->vert_positions_for_write().copy_from(positions);
100 mesh->tag_positions_changed();
105 printf(
"current_time %f, collmd->time_xnew %f\n", current_time, collmd->
time_xnew);
110 if (current_time < collmd->time_xnew) {
113 else if (current_time == collmd->
time_xnew) {
120 if (collmd->
x && (mvert_num != collmd->
mvert_num)) {
131 for (
uint i = 0;
i < mvert_num;
i++) {
133 mul_m4_v3(ob->object_to_world().ptr(), collmd->
x[
i]);
149 mesh->corner_verts(),
151 {reinterpret_cast<blender::int3 *>(vert_tris), collmd->tri_num});
165 else if (mvert_num == collmd->
mvert_num) {
167 float (*temp)[3] = collmd->
x;
168 collmd->
x = collmd->
xnew;
172 memcpy(collmd->
xnew, mesh->vert_positions().data(), mvert_num *
sizeof(
float[3]));
174 bool is_static =
true;
176 for (
uint i = 0;
i < mvert_num;
i++) {
184 memcpy(collmd->
current_xnew, collmd->
x, mvert_num *
sizeof(
float[3]));
185 memcpy(collmd->
current_x, collmd->
x, mvert_num *
sizeof(
float[3]));
207 else if (!collmd->
is_static || !is_static) {
220 else if (mvert_num != collmd->
mvert_num) {
237 layout->
label(
RPT_(
"Settings are inside the Physics tab"), ICON_NONE);
255 collmd->mfaces =
newdataadr(fd, collmd->mfaces);
263 collmd->
xnew =
nullptr;
278 "CollisionModifierData",
280 &RNA_CollisionModifier,
struct BVHTree * bvhtree_build_from_mvert(const float(*positions)[3], const blender::int3 *vert_tris, int tri_num, float epsilon)
void bvhtree_update_from_mvert(struct BVHTree *bvhtree, const float(*positions)[3], const float(*positions_moving)[3], const blender::int3 *vert_tris, int tri_num, bool moving)
@ eModifierTypeFlag_Single
@ eModifierTypeFlag_AcceptsMesh
void BLI_bvhtree_free(BVHTree *tree)
float BLI_bvhtree_get_epsilon(const BVHTree *tree)
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE bool equals_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
void DEG_add_depends_on_transform_relation(DepsNodeHandle *node_handle, const char *description)
float DEG_get_ctime(const Depsgraph *graph)
#define DNA_struct_default_get(struct_name)
@ eModifierType_Collision
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static void init_data(ModifierData *md)
static void deform_verts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, blender::MutableSpan< blender::float3 > positions)
static void panel_register(ARegionType *region_type)
static void blend_read(BlendDataReader *, ModifierData *md)
static void panel_draw(const bContext *, Panel *panel)
static void free_data(ModifierData *md)
static bool depends_on_time(Scene *, ModifierData *)
static void init_data(ModifierData *md)
static void deform_verts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, blender::MutableSpan< blender::float3 > positions)
static void panel_register(ARegionType *region_type)
static void blend_read(BlendDataReader *, ModifierData *md)
static void free_data(ModifierData *md)
static void update_depsgraph(ModifierData *, const ModifierUpdateDepsgraphContext *ctx)
ModifierTypeInfo modifierType_Collision
static void panel_draw(const bContext *, Panel *panel)
static bool depends_on_time(Scene *, ModifierData *)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void modifier_error_message_draw(uiLayout *layout, PointerRNA *ptr)
constexpr void copy_from(Span< T > values) const
constexpr int64_t size() const
static void update_depsgraph(tGraphSliderOp *gso)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void vert_tris_from_corner_tris(Span< int > corner_verts, Span< int3 > corner_tris, MutableSpan< int3 > vert_tris)
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
static void * newdataadr(FileData *fd, const void *adr)
void label(blender::StringRef name, int icon)