@@ -149,6 +149,9 @@ def monitor_eventHandler(scene):
149
149
if props .progrWeakStartFact != 1 :
150
150
monitor_progressiveWeakening (scene , props .progrWeakStartFact )
151
151
152
+ ### Motor constraint warm up period
153
+ monitor_motorWarmUp (scene )
154
+
152
155
### Displacement correction initialization
153
156
monitor_displCorrectDiffExport (scene )
154
157
@@ -207,6 +210,10 @@ def monitor_eventHandler(scene):
207
210
###### Function
208
211
monitor_fixSprings (scene )
209
212
213
+ ### Motor constraint warm up period
214
+ if scene .frame_current < scene .frame_start + props .warmUpPeriod :
215
+ monitor_motorWarmUp (scene )
216
+
210
217
### Displacement correction vertex location differences export
211
218
if scene .frame_current == scene .frame_start + props .warmUpPeriod :
212
219
monitor_displCorrectDiffExport (scene )
@@ -241,6 +248,9 @@ def monitor_eventHandler(scene):
241
248
if props .progrWeakStartFact != 1 :
242
249
monitor_progressiveWeakening_fm (scene , props .progrWeakStartFact )
243
250
251
+ ### Motor constraint warm up period
252
+ monitor_motorWarmUp_fm (scene )
253
+
244
254
### Displacement correction initialization
245
255
monitor_displCorrectDiffExport (scene )
246
256
@@ -294,6 +304,10 @@ def monitor_eventHandler(scene):
294
304
###### Function
295
305
monitor_fixSprings_fm (scene )
296
306
307
+ ### Motor constraint warm up period
308
+ if scene .frame_current < scene .frame_start + props .warmUpPeriod :
309
+ monitor_motorWarmUp_fm (scene )
310
+
297
311
### Displacement correction vertex location differences export
298
312
if scene .frame_current == scene .frame_start + props .warmUpPeriod :
299
313
monitor_displCorrectDiffExport (scene )
@@ -1288,6 +1302,61 @@ def monitor_progressiveWeakening_fm(scene, progrWeakVar):
1288
1302
1289
1303
################################################################################
1290
1304
1305
+ def monitor_motorWarmUp (scene ):
1306
+
1307
+ if debug : print ("Calling motorWarmUp" )
1308
+
1309
+ props = bpy .context .window_manager .bcb
1310
+
1311
+ # Find motor constraints (not BCB generated)
1312
+ try : emptyObjs = bpy .data .groups ["RigidBodyConstraints" ].objects
1313
+ except : emptyObjs = []
1314
+ emptyObjs = [obj for obj in emptyObjs if obj .type == 'EMPTY' and not obj .hide and obj .is_visible (bpy .context .scene ) and obj .rigid_body_constraint != None ]
1315
+
1316
+ if scene .frame_current == scene .frame_start :
1317
+ factor = 1 / props .warmUpPeriod
1318
+ else :
1319
+ factor = 1 / (scene .frame_current - scene .frame_start ) + 1
1320
+
1321
+ for objConst in emptyObjs :
1322
+ const = objConst .rigid_body_constraint
1323
+ if const .type == 'MOTOR' and const .enabled :
1324
+ if const .use_motor_lin :
1325
+ const .motor_lin_target_velocity *= factor
1326
+ const .motor_lin_max_impulse *= factor
1327
+ if const .use_motor_ang :
1328
+ const .motor_ang_target_velocity *= factor
1329
+ const .motor_ang_max_impulse *= factor
1330
+
1331
+ ########################################
1332
+
1333
+ def monitor_motorWarmUp_fm (scene ):
1334
+
1335
+ if debug : print ("Calling motorWarmUp_fm" )
1336
+
1337
+ props = bpy .context .window_manager .bcb
1338
+
1339
+ # Get Fracture Modifier
1340
+ try : ob = scene .objects [asciiExportName ]
1341
+ except : print ("Error: Fracture Modifier object expected but not found." ); return
1342
+ md = ob .modifiers ["Fracture" ]
1343
+
1344
+ if scene .frame_current == scene .frame_start :
1345
+ factor = 1 / props .warmUpPeriod
1346
+ else :
1347
+ factor = 1 / (scene .frame_current - scene .frame_start ) + 1
1348
+
1349
+ for const in md .mesh_constraints :
1350
+ if const .type == 'MOTOR' and const .enabled :
1351
+ if const .use_motor_lin :
1352
+ const .motor_lin_target_velocity *= factor
1353
+ const .motor_lin_max_impulse *= factor
1354
+ if const .use_motor_ang :
1355
+ const .motor_ang_target_velocity *= factor
1356
+ const .motor_ang_max_impulse *= factor
1357
+
1358
+ ################################################################################
1359
+
1291
1360
def monitor_dampingRegion (scene ):
1292
1361
1293
1362
if debug : print ("Calling dampingRegion" )
0 commit comments