| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2011-10-23 17:52:20 +00:00
										 |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							| 
									
										
										
										
											2020-05-09 17:14:35 +10:00
										 |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2011-10-23 17:52:20 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2005 by the Blender Foundation. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup modifiers | 
					
						
							| 
									
										
										
										
											2011-02-25 13:57:17 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-25 11:56:24 +01:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BLI_math.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | #include "BLT_translation.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-01 09:38:00 -05:00
										 |  |  | #include "DNA_defaults.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-17 15:26:59 +02:00
										 |  |  | #include "DNA_mesh_types.h"
 | 
					
						
							| 
									
										
										
										
											2010-08-10 05:41:51 +00:00
										 |  |  | #include "DNA_meshdata_types.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #include "DNA_object_types.h"
 | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | #include "DNA_screen_types.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-16 05:46:10 +00:00
										 |  |  | #include "MEM_guardedalloc.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-12 00:36:50 +00:00
										 |  |  | #include "BKE_collision.h"
 | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | #include "BKE_context.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | #include "BKE_global.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 12:58:59 +01:00
										 |  |  | #include "BKE_lib_id.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-17 15:26:59 +02:00
										 |  |  | #include "BKE_mesh.h"
 | 
					
						
							| 
									
										
										
										
											2018-06-05 15:59:53 +02:00
										 |  |  | #include "BKE_mesh_runtime.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | #include "BKE_modifier.h"
 | 
					
						
							| 
									
										
										
										
											2016-12-28 17:30:58 +01:00
										 |  |  | #include "BKE_pointcache.h"
 | 
					
						
							| 
									
										
										
										
											2010-06-27 05:39:55 +00:00
										 |  |  | #include "BKE_scene.h"
 | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | #include "BKE_screen.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "UI_interface.h"
 | 
					
						
							|  |  |  | #include "UI_resources.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "RNA_access.h"
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-01 09:06:34 +10:00
										 |  |  | #include "MOD_modifiertypes.h"
 | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | #include "MOD_ui_common.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-17 15:26:59 +02:00
										 |  |  | #include "MOD_util.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-23 17:25:44 +02:00
										 |  |  | #include "BLO_read_write.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-17 15:26:59 +02:00
										 |  |  | #include "DEG_depsgraph_query.h"
 | 
					
						
							| 
									
										
										
										
											2017-08-01 09:06:34 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-17 17:04:27 +02:00
										 |  |  | static void initData(ModifierData *md) | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   CollisionModifierData *collmd = (CollisionModifierData *)md; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-01 09:38:00 -05:00
										 |  |  |   BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(collmd, modifier)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   MEMCPY_STRUCT_AFTER(collmd, DNA_struct_default_get(CollisionModifierData), modifier); | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void freeData(ModifierData *md) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   CollisionModifierData *collmd = (CollisionModifierData *)md; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (collmd) { /* Seriously? */ | 
					
						
							|  |  |  |     if (collmd->bvhtree) { | 
					
						
							|  |  |  |       BLI_bvhtree_free(collmd->bvhtree); | 
					
						
							|  |  |  |       collmd->bvhtree = NULL; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->x); | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->xnew); | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->current_x); | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->current_xnew); | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->current_v); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     MEM_SAFE_FREE(collmd->tri); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     collmd->time_x = collmd->time_xnew = -1000; | 
					
						
							|  |  |  |     collmd->mvert_num = 0; | 
					
						
							|  |  |  |     collmd->tri_num = 0; | 
					
						
							|  |  |  |     collmd->is_static = false; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 03:59:19 +00:00
										 |  |  | static bool dependsOnTime(ModifierData *UNUSED(md)) | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   return true; | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | static void deformVerts(ModifierData *md, | 
					
						
							|  |  |  |                         const ModifierEvalContext *ctx, | 
					
						
							|  |  |  |                         Mesh *mesh, | 
					
						
							|  |  |  |                         float (*vertexCos)[3], | 
					
						
							|  |  |  |                         int numVerts) | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   CollisionModifierData *collmd = (CollisionModifierData *)md; | 
					
						
							|  |  |  |   Mesh *mesh_src; | 
					
						
							|  |  |  |   MVert *tempVert = NULL; | 
					
						
							|  |  |  |   Object *ob = ctx->object; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (mesh == NULL) { | 
					
						
							|  |  |  |     mesh_src = MOD_deform_mesh_eval_get(ob, NULL, NULL, NULL, numVerts, false, false); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     /* Not possible to use get_mesh() in this case as we'll modify its vertices
 | 
					
						
							|  |  |  |      * and get_mesh() would return 'mesh' directly. */ | 
					
						
							|  |  |  |     BKE_id_copy_ex(NULL, (ID *)mesh, (ID **)&mesh_src, LIB_ID_COPY_LOCALIZE); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (!ob->pd) { | 
					
						
							|  |  |  |     printf("CollisionModifier deformVerts: Should not happen!\n"); | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (mesh_src) { | 
					
						
							|  |  |  |     float current_time = 0; | 
					
						
							| 
									
										
										
										
											2019-09-19 13:32:36 +10:00
										 |  |  |     uint mvert_num = 0; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-22 06:28:35 +10:00
										 |  |  |     BKE_mesh_vert_coords_apply(mesh_src, vertexCos); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     BKE_mesh_calc_normals(mesh_src); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     current_time = DEG_get_ctime(ctx->depsgraph); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (G.debug & G_DEBUG_SIMDATA) { | 
					
						
							|  |  |  |       printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     mvert_num = mesh_src->totvert; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (current_time < collmd->time_xnew) { | 
					
						
							|  |  |  |       freeData((ModifierData *)collmd); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (current_time == collmd->time_xnew) { | 
					
						
							|  |  |  |       if (mvert_num != collmd->mvert_num) { | 
					
						
							|  |  |  |         freeData((ModifierData *)collmd); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* check if mesh has changed */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:15:10 +10:00
										 |  |  |     if (collmd->x && (mvert_num != collmd->mvert_num)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       freeData((ModifierData *)collmd); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:15:10 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (collmd->time_xnew == -1000) { /* first time */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->x = MEM_dupallocN(mesh_src->mvert); /* frame start position */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       for (uint i = 0; i < mvert_num; i++) { | 
					
						
							|  |  |  |         /* we save global positions */ | 
					
						
							|  |  |  |         mul_m4_v3(ob->obmat, collmd->x[i].co); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->xnew = MEM_dupallocN(collmd->x);          // frame end position
 | 
					
						
							|  |  |  |       collmd->current_x = MEM_dupallocN(collmd->x);     // inter-frame
 | 
					
						
							|  |  |  |       collmd->current_xnew = MEM_dupallocN(collmd->x);  // inter-frame
 | 
					
						
							|  |  |  |       collmd->current_v = MEM_dupallocN(collmd->x);     // inter-frame
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->mvert_num = mvert_num; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         const MLoop *mloop = mesh_src->mloop; | 
					
						
							|  |  |  |         const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(mesh_src); | 
					
						
							|  |  |  |         collmd->tri_num = BKE_mesh_runtime_looptri_len(mesh_src); | 
					
						
							|  |  |  |         MVertTri *tri = MEM_mallocN(sizeof(*tri) * collmd->tri_num, __func__); | 
					
						
							|  |  |  |         BKE_mesh_runtime_verttri_from_looptri(tri, mloop, looptri, collmd->tri_num); | 
					
						
							|  |  |  |         collmd->tri = tri; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* create bounding box hierarchy */ | 
					
						
							|  |  |  |       collmd->bvhtree = bvhtree_build_from_mvert( | 
					
						
							|  |  |  |           collmd->x, collmd->tri, collmd->tri_num, ob->pd->pdef_sboft); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->time_x = collmd->time_xnew = current_time; | 
					
						
							|  |  |  |       collmd->is_static = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (mvert_num == collmd->mvert_num) { | 
					
						
							|  |  |  |       /* put positions to old positions */ | 
					
						
							|  |  |  |       tempVert = collmd->x; | 
					
						
							|  |  |  |       collmd->x = collmd->xnew; | 
					
						
							|  |  |  |       collmd->xnew = tempVert; | 
					
						
							|  |  |  |       collmd->time_x = collmd->time_xnew; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       memcpy(collmd->xnew, mesh_src->mvert, mvert_num * sizeof(MVert)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       bool is_static = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       for (uint i = 0; i < mvert_num; i++) { | 
					
						
							|  |  |  |         /* we save global positions */ | 
					
						
							|  |  |  |         mul_m4_v3(ob->obmat, collmd->xnew[i].co); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* detect motion */ | 
					
						
							|  |  |  |         is_static = is_static && equals_v3v3(collmd->x[i].co, collmd->xnew[i].co); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       memcpy(collmd->current_xnew, collmd->x, mvert_num * sizeof(MVert)); | 
					
						
							|  |  |  |       memcpy(collmd->current_x, collmd->x, mvert_num * sizeof(MVert)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* check if GUI setting has changed for bvh */ | 
					
						
							|  |  |  |       if (collmd->bvhtree) { | 
					
						
							|  |  |  |         if (ob->pd->pdef_sboft != BLI_bvhtree_get_epsilon(collmd->bvhtree)) { | 
					
						
							|  |  |  |           BLI_bvhtree_free(collmd->bvhtree); | 
					
						
							|  |  |  |           collmd->bvhtree = bvhtree_build_from_mvert( | 
					
						
							|  |  |  |               collmd->current_x, collmd->tri, collmd->tri_num, ob->pd->pdef_sboft); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* happens on file load (ONLY when i decomment changes in readfile.c) */ | 
					
						
							|  |  |  |       if (!collmd->bvhtree) { | 
					
						
							|  |  |  |         collmd->bvhtree = bvhtree_build_from_mvert( | 
					
						
							|  |  |  |             collmd->current_x, collmd->tri, collmd->tri_num, ob->pd->pdef_sboft); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (!collmd->is_static || !is_static) { | 
					
						
							|  |  |  |         /* recalc static bounding boxes */ | 
					
						
							|  |  |  |         bvhtree_update_from_mvert(collmd->bvhtree, | 
					
						
							|  |  |  |                                   collmd->current_x, | 
					
						
							|  |  |  |                                   collmd->current_xnew, | 
					
						
							|  |  |  |                                   collmd->tri, | 
					
						
							|  |  |  |                                   collmd->tri_num, | 
					
						
							|  |  |  |                                   true); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->is_static = is_static; | 
					
						
							|  |  |  |       collmd->time_xnew = current_time; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (mvert_num != collmd->mvert_num) { | 
					
						
							|  |  |  |       freeData((ModifierData *)collmd); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-29 16:08:22 +11:00
										 |  |  |   if (!ELEM(mesh_src, NULL, mesh)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     BKE_id_free(NULL, mesh_src); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-04 10:39:12 +02:00
										 |  |  | static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgraphContext *ctx) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   DEG_add_modifier_to_transform_relation(ctx->node, "Collision Modifier"); | 
					
						
							| 
									
										
										
										
											2019-04-04 10:39:12 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-02 14:13:26 -05:00
										 |  |  | static void panel_draw(const bContext *UNUSED(C), Panel *panel) | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | { | 
					
						
							|  |  |  |   uiLayout *layout = panel->layout; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-02 14:13:26 -05:00
										 |  |  |   PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-02 14:13:26 -05:00
										 |  |  |   modifier_panel_end(layout, ptr); | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void panelRegister(ARegionType *region_type) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   modifier_panel_register(region_type, eModifierType_Collision, panel_draw); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-23 17:25:44 +02:00
										 |  |  | static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   CollisionModifierData *collmd = (CollisionModifierData *)md; | 
					
						
							|  |  |  | #if 0
 | 
					
						
							|  |  |  |       // TODO: CollisionModifier should use pointcache
 | 
					
						
							|  |  |  |       // + have proper reset events before enabling this
 | 
					
						
							|  |  |  |       collmd->x = newdataadr(fd, collmd->x); | 
					
						
							|  |  |  |       collmd->xnew = newdataadr(fd, collmd->xnew); | 
					
						
							|  |  |  |       collmd->mfaces = newdataadr(fd, collmd->mfaces); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       collmd->current_x = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_x"); | 
					
						
							|  |  |  |       collmd->current_xnew = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_xnew"); | 
					
						
							|  |  |  |       collmd->current_v = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_v"); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   collmd->x = NULL; | 
					
						
							|  |  |  |   collmd->xnew = NULL; | 
					
						
							|  |  |  |   collmd->current_x = NULL; | 
					
						
							|  |  |  |   collmd->current_xnew = NULL; | 
					
						
							|  |  |  |   collmd->current_v = NULL; | 
					
						
							|  |  |  |   collmd->time_x = collmd->time_xnew = -1000; | 
					
						
							|  |  |  |   collmd->mvert_num = 0; | 
					
						
							|  |  |  |   collmd->tri_num = 0; | 
					
						
							|  |  |  |   collmd->is_static = false; | 
					
						
							|  |  |  |   collmd->bvhtree = NULL; | 
					
						
							|  |  |  |   collmd->tri = NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | ModifierTypeInfo modifierType_Collision = { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     /* name */ "Collision", | 
					
						
							|  |  |  |     /* structName */ "CollisionModifierData", | 
					
						
							|  |  |  |     /* structSize */ sizeof(CollisionModifierData), | 
					
						
							| 
									
										
										
										
											2020-09-25 12:49:18 +02:00
										 |  |  |     /* srna */ &RNA_CollisionModifier, | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     /* type */ eModifierTypeType_OnlyDeform, | 
					
						
							|  |  |  |     /* flags */ eModifierTypeFlag_AcceptsMesh | eModifierTypeFlag_Single, | 
					
						
							| 
									
										
										
										
											2020-09-25 12:45:30 +02:00
										 |  |  |     /* icon */ ICON_MOD_PHYSICS, | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* copyData */ NULL, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* deformVerts */ deformVerts, | 
					
						
							|  |  |  |     /* deformMatrices */ NULL, | 
					
						
							|  |  |  |     /* deformVertsEM */ NULL, | 
					
						
							|  |  |  |     /* deformMatricesEM */ NULL, | 
					
						
							| 
									
										
										
										
											2020-04-21 13:09:41 +02:00
										 |  |  |     /* modifyMesh */ NULL, | 
					
						
							|  |  |  |     /* modifyHair */ NULL, | 
					
						
							|  |  |  |     /* modifyPointCloud */ NULL, | 
					
						
							|  |  |  |     /* modifyVolume */ NULL, | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* initData */ initData, | 
					
						
							|  |  |  |     /* requiredDataMask */ NULL, | 
					
						
							|  |  |  |     /* freeData */ freeData, | 
					
						
							|  |  |  |     /* isDisabled */ NULL, | 
					
						
							|  |  |  |     /* updateDepsgraph */ updateDepsgraph, | 
					
						
							|  |  |  |     /* dependsOnTime */ dependsOnTime, | 
					
						
							|  |  |  |     /* dependsOnNormals */ NULL, | 
					
						
							|  |  |  |     /* foreachIDLink */ NULL, | 
					
						
							|  |  |  |     /* foreachTexLink */ NULL, | 
					
						
							|  |  |  |     /* freeRuntimeData */ NULL, | 
					
						
							| 
									
										
										
										
											2020-06-05 10:41:03 -04:00
										 |  |  |     /* panelRegister */ panelRegister, | 
					
						
							| 
									
										
										
										
											2020-06-15 17:37:07 +02:00
										 |  |  |     /* blendWrite */ NULL, | 
					
						
							| 
									
										
										
										
											2020-06-23 17:25:44 +02:00
										 |  |  |     /* blendRead */ blendRead, | 
					
						
							| 
									
										
										
										
											2010-04-11 22:12:30 +00:00
										 |  |  | }; |