_fields_ = [("pstr_name",c_uint32),
("shader",c_uint32),
("flags",c_uint32),
+ ("surface_prop",c_uint32),
("colour",c_float*4),
("colour1",c_float*4),
("tex_diffuse",c_uint32),
cv_view_verts += [(v1[0],v1[1],v1[2])]
cv_view_colours += [(0,1,1,1),(0,1,1,1)]
#}
+
+ cv_draw_sphere( obj.location, 20.0, [0.1,0,0.9,0.4] )
#}
@staticmethod
#}
#}
+class classtype_spawn_link(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("connections",c_uint32*4)]
+
+ def encode_obj(_, node,node_def ):
+ #{
+ node.classtype = 0
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ pass
+ #}
+
+ @staticmethod
+ def draw_scene_helpers( obj ):
+ #{
+ global cv_view_verts, cv_view_colours
+
+ count = 0
+
+ for obj1 in bpy.context.collection.objects:
+ #{
+ if (obj1.cv_data.classtype != 'classtype_spawn_link') and \
+ (obj1.cv_data.classtype != 'classtype_spawn') :
+ continue
+
+ if (obj1.location - obj.location).length < 40.0:
+ #{
+ cv_draw_line( obj.location, obj1.location, [1,1,1,1] )
+ count +=1
+ #}
+
+ if count == 4:
+ break
+ #}
+
+ cv_draw_sphere( obj.location, 20.0, [0.5,0,0.2,0.4] )
+ #}
+#}
+
# ---------------------------------------------------------------------------- #
# #
# Compiler section #
},
"Mix":
{
- "Color1": material_tex_image("tex_diffuse"),
- "Color2": material_tex_image("tex_decal")
+ "A": material_tex_image("tex_diffuse"),
+ "B": material_tex_image("tex_decal")
},
},
"Normal":
if isinstance( link_def, dict ):
#{
- node_link = node.inputs[link]
+ node_link = None
+ for x in node.inputs:
+ #{
+ if isinstance( x, bpy.types.NodeSocketColor ):
+ #{
+ if link == x.name:
+ #{
+ node_link = x
+ break
+ #}
+ #}
+ #}
- if node_link.is_linked:
+ if node_link and node_link.is_linked:
#{
# look for definitions for the connected node type
#
dest.pstr_name = encoder_process_pstr( mat.name )
flags = 0x00
- if mat.cv_data.skate_surface: flags |= 0x1
- if mat.cv_data.collision: flags |= 0x2
+ if mat.cv_data.collision:
+ flags |= 0x2
+ if mat.cv_data.skate_surface: flags |= 0x1
+ if mat.cv_data.grind_surface: flags |= (0x8|0x1)
+
+ if mat.cv_data.grow_grass: flags |= 0x4
dest.flags = flags
+ if mat.cv_data.surface_prop == 'concrete': dest.surface_prop = 0
+ if mat.cv_data.surface_prop == 'wood': dest.surface_prop = 1
+ if mat.cv_data.surface_prop == 'grass': dest.surface_prop = 2
+
if mat.cv_data.shader == 'standard': dest.shader = 0
if mat.cv_data.shader == 'standard_cutout': dest.shader = 1
if mat.cv_data.shader == 'terrain_blend':
#{
dest.shader = 3
- dest.colour1[0] = mat.cv_data.uv_offset[0]
- dest.colour1[1] = mat.cv_data.uv_offset[1]
+ dest.colour1[0] = mat.cv_data.blend_offset[0]
+ dest.colour1[1] = mat.cv_data.blend_offset[1]
#}
if mat.cv_data.shader == 'water':
int(norm[2]*m+0.5),
int(uv[0]*m+0.5),
int(uv[1]*m+0.5),
- colour[0]*m+0.5, # these guys are already quantized
- colour[1]*m+0.5, # .
- colour[2]*m+0.5, # .
- colour[3]*m+0.5, # .
- weights[0]*m+0.5, # v
- weights[1]*m+0.5,
- weights[2]*m+0.5,
- weights[3]*m+0.5,
- groups[0]*m+0.5,
- groups[1]*m+0.5,
- groups[2]*m+0.5,
- groups[3]*m+0.5)
+ colour[0], # these guys are already quantized
+ colour[1], # .
+ colour[2], # .
+ colour[3], # .
+ weights[0], # v
+ weights[1],
+ weights[2],
+ weights[3],
+ groups[0],
+ groups[1],
+ groups[2],
+ groups[3])
if key in vertex_reference:
return vertex_reference[key]
weights[ml] = max( weights[ml], 0 )
#}
#}
+ #}
+ else:
+ #{
+ li1 = tri.loops[(j+1)%3]
+ vi1 = data.loops[li1].vertex_index
+ e0 = data.edges[ data.loops[li].edge_index ]
+
+ if e0.use_freestyle_mark and \
+ ((e0.vertices[0] == vi and e0.vertices[1] == vi1) or \
+ (e0.vertices[0] == vi1 and e0.vertices[1] == vi)):
+ #{
+ weights[0] = 1
+ #}
+ #}
# Add vertex and expand bound box
#
#{
global g_encoder
print( F"Model graph | Create mode '{collection_name}'" )
+ folder = bpy.path.abspath(bpy.context.scene.cv_data.export_dir)
+ path = F"{folder}{collection_name}.mdl"
+ print( path )
collection = bpy.data.collections[collection_name]
# Write
#
- # TODO HOLY
- path = F"/home/harry/Documents/carve/models_src/{collection_name}.mdl"
encoder_write_to_file( path )
print( F"Completed {collection_name}.mdl" )
('classtype_trigger',"classtype_trigger","",100),
('classtype_logic_achievement',"classtype_logic_achievement","",101),
('classtype_logic_relay',"classtype_logic_relay","",102),
+ ('classtype_spawn_link',"classtype_spawn_link","",150),
])
#}
('vertex_blend', "vertex_blend", "", 3),
('water',"water","",4),
])
+
+ surface_prop: bpy.props.EnumProperty(
+ name="Surface Property",
+ items = [
+ ('concrete','concrete','',0),
+ ('wood','wood','',1),
+ ('grass','grass','',2)
+ ])
collision: bpy.props.BoolProperty( \
name="Collisions Enabled",\
default=True,\
description = "Should the game try to target this surface?" \
)
+ grind_surface: bpy.props.BoolProperty( \
+ name="Grind Surface", \
+ default=False,\
+ description = "Grind face?" \
+ )
+ grow_grass: bpy.props.BoolProperty( \
+ name="Grow Grass", \
+ default=False,\
+ description = "Spawn grass sprites on this surface?" \
+ )
blend_offset: bpy.props.FloatVectorProperty( \
name="Blend Offset", \
size=2, \
info = material_info( active_mat )
+ if 'tex_diffuse' in info:
+ #{
+ _.layout.label( icon='INFO', \
+ text=F"{info['tex_diffuse'].name} will be compiled" )
+ #}
+
_.layout.prop( active_mat.cv_data, "shader" )
+ _.layout.prop( active_mat.cv_data, "surface_prop" )
_.layout.prop( active_mat.cv_data, "collision" )
if active_mat.cv_data.collision:
_.layout.prop( active_mat.cv_data, "skate_surface" )
+ _.layout.prop( active_mat.cv_data, "grind_surface" )
+ _.layout.prop( active_mat.cv_data, "grow_grass" )
if active_mat.cv_data.shader == "terrain_blend":
#{