X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=blender_export.py;h=b60b2e02fc8cf14550c3f2ace276c11545c48bec;hb=e61356f70eddb79f05d7b9e329e91963ec74f817;hp=d6da9c2864f358c8be0ee5f51dc7473ac9d4c114;hpb=56f320d8ce6e8997370ec8e02fe50ca2d07b67f0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/blender_export.py b/blender_export.py index d6da9c2..b60b2e0 100644 --- a/blender_export.py +++ b/blender_export.py @@ -255,6 +255,40 @@ class classtype_gate(Structure): #} #} +class classtype_nonlocal_gate(classtype_gate): +#{ + def encode_obj(_,node,node_def): + #{ + node.classtype = 300 + + obj = node_def['obj'] + _.target = encoder_process_pstr( node_def['obj'].cv_data.strp ) + + if obj.type == 'MESH': + #{ + _.dims[0] = obj.data.cv_data.v0[0] + _.dims[1] = obj.data.cv_data.v0[1] + _.dims[2] = obj.data.cv_data.v0[2] + #} + else: + #{ + _.dims[0] = obj.cv_data.v0[0] + _.dims[1] = obj.cv_data.v0[1] + _.dims[2] = obj.cv_data.v0[2] + #} + #} + + @staticmethod + def editor_interface( layout, obj ): + #{ + layout.prop( obj.cv_data, "strp", text="Nonlocal ID" ) + + mesh = obj.data + layout.label( text=F"(i) Data is stored in {mesh.name}" ) + layout.prop( mesh.cv_data, "v0", text="Gate dimensions" ) + #} +#} + # Classtype 3 # # Purpose: player can reset here, its a safe place @@ -773,22 +807,36 @@ class classtype_audio(Structure): # Classtype 200 # -# Purpose: point light +# Purpose: world light # -class classtype_point_light(Structure): +class classtype_world_light( Structure ): #{ _pack_ = 1 - _fields_ = [("colour",c_float*4)] + _fields_ = [("type",c_uint32), + ("colour",c_float*4), + ("angle",c_float)] def encode_obj(_, node, node_def): #{ node.classtype = 200 - data = node_def['obj'].data + obj = node_def['obj'] + data = obj.data _.colour[0] = data.color[0] _.colour[1] = data.color[1] _.colour[2] = data.color[2] _.colour[3] = data.energy + + if obj.data.type == 'POINT': + #{ + _.type = 0 + _.angle = 0.0 + #} + elif obj.data.type == 'SPOT': + #{ + _.type = 1 + _.angle = math.cos(data.spot_size*0.5) + #} #} @staticmethod @@ -1873,8 +1921,7 @@ def encoder_process_definition( node_def ): obj_classtype = 'classtype_skeleton' elif obj_type == 'LIGHT': #{ - if obj.data.type == 'POINT': - obj_classtype = 'classtype_point_light' + obj_classtype = 'classtype_world_light' #} else: #{ @@ -2633,6 +2680,7 @@ class CV_OBJ_SETTINGS(bpy.types.PropertyGroup): ('classtype_logic_achievement',"classtype_logic_achievement","",101), ('classtype_logic_relay',"classtype_logic_relay","",102), ('classtype_spawn_link',"classtype_spawn_link","",150), + ('classtype_nonlocal_gate', "classtype_nonlocal_gate", "", 300) ]) #}