39
39
import bpy
40
40
import mathutils
41
41
42
- from generated .formats .nif import classes as NifClasses
42
+ from nifgen .formats .nif import classes as NifClasses
43
43
44
44
import io_scene_niftools .utils .logging
45
45
from io_scene_niftools .modules .nif_export .block_registry import block_store
@@ -57,7 +57,8 @@ class BhkCollision(Collision):
57
57
EXPORT_OB_SOLID = True
58
58
59
59
def __init__ (self ):
60
- self .HAVOK_SCALE = consts .HAVOK_SCALE
60
+ # to be filled during the export process:
61
+ self .HAVOK_SCALE = None
61
62
62
63
def export_collision_helper (self , b_obj , parent_block ):
63
64
"""Helper function to add collision objects to a node. This function
@@ -77,9 +78,7 @@ def export_collision_helper(self, b_obj, parent_block):
77
78
coll_ispacked = (rigid_body .collision_shape == 'MESH' )
78
79
79
80
# Set Havok Scale ratio
80
- b_scene = bpy .context .scene .niftools_scene
81
- if b_scene .user_version == 12 and b_scene .user_version_2 == 83 :
82
- self .HAVOK_SCALE = consts .HAVOK_SCALE * 10
81
+ self .HAVOK_SCALE = NifData .data .havok_scale
83
82
84
83
# find physics properties/defaults
85
84
# get havok material name from material name
@@ -175,6 +174,7 @@ def export_bhk_collison_object(self, b_obj):
175
174
col_filter = b_obj .nifcollision .col_filter
176
175
177
176
n_col_obj = block_store .create_block ("bhkCollisionObject" , b_obj )
177
+ n_col_obj .flags ._value = 0
178
178
if layer == NifClasses .OblivionLayer .OL_ANIM_STATIC and col_filter != 128 :
179
179
# animated collision requires flags = 41
180
180
# unless it is a constrainted but not keyframed object
@@ -203,7 +203,7 @@ def export_bhk_blend_controller(self, b_obj, parent_block):
203
203
204
204
# TODO [collision] Move to collision
205
205
def update_rigid_bodies (self ):
206
- if bpy .context .scene .niftools_scene .game in ( 'OBLIVION' , 'FALLOUT_3' , 'SKYRIM' ):
206
+ if bpy .context .scene .niftools_scene .is_bs ( ):
207
207
n_rigid_bodies = [n_rigid_body for n_rigid_body in block_store .block_to_obj if isinstance (n_rigid_body , NifClasses .BhkRigidBody )]
208
208
209
209
# update rigid body center of gravity and mass
@@ -244,9 +244,9 @@ def export_bhk_packed_nitristrip_shape(self, b_obj, n_col_mopp):
244
244
n_col_shape = block_store .create_block ("bhkPackedNiTriStripsShape" , b_obj )
245
245
# TODO [collision] radius has default of 0.1, but maybe let depend on margin
246
246
scale = n_col_shape .scale
247
- scale .x = 0
248
- scale .y = 0
249
- scale .z = 0
247
+ scale .x = 1. 0
248
+ scale .y = 1. 0
249
+ scale .z = 1. 0
250
250
scale .w = 0
251
251
n_col_shape .scale_copy = scale
252
252
n_col_mopp .shape = n_col_shape
0 commit comments