-CharacterSkeleton now uses _enter_tree() instead of _init() to set itself up, also it will duplicate the character material here, instead of durgin generation. This fixed a threading related crash.

-TVVoxelChunk will now just use the library's prop material instead of creating one.
Also update HEADS for a threading fix in Voxelman, and the deferred spawning requests.
This commit is contained in:
Relintai 2020-02-16 16:23:45 +01:00
parent f3f9de391a
commit e826266b7a
8 changed files with 25 additions and 38 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "245ecb6684d089940273564fb7a314e5e11ea72e", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "0bdf71c431b62b24d56c1fc178dbcb792e5dca3d"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "919080a1b5b6a6d7b0013c777b1ee7e41e206683"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "655be02357fb4fd9d8d1b537758c1599fb37bb15"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}}
{"engine": {"3.2": "245ecb6684d089940273564fb7a314e5e11ea72e", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "a73f61628b21e57b6fe8c74d6a8c84bfbfceb7be"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "509d45a66281c87e3136ea7252e062208fc64555"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "00f6c128bd0e9799b7f7f86e118ed68277fbe27d"}, "fast_quadratic_mesh_simplifier": {"master": "655be02357fb4fd9d8d1b537758c1599fb37bb15"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "prop_tool": {"master": "df438053ebc900966f8f842fc65f0264f1271d49"}}

View File

@ -207,7 +207,7 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name
return createinfo.created_entity
func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
func spawn_mob(class_id : int, level : int, position : Vector3) -> void:
var createinfo : EntityCreateInfo = EntityCreateInfo.new()
var cls : EntityData = EntityDataManager.get_entity_data(class_id)
@ -220,11 +220,11 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
createinfo.entity_player_type = EntityEnums.ENTITY_PLAYER_TYPE_AI
createinfo.transform.origin = position
EntityDataManager.request_entity_spawn(createinfo)
EntityDataManager.request_entity_spawn_deferred(createinfo)
Logger.info("Mob spawned " + str(createinfo))
return createinfo.created_entity
#return createinfo.created_entity
func on_entity_spawn_requested(createinfo : EntityCreateInfo):

File diff suppressed because one or more lines are too long

View File

@ -97,7 +97,7 @@ var _thread : Thread = null
var _editor_built : bool = false
func _ready():
func _enter_tree():
st = SurfaceTool.new()
_texture_packer = TexturePacker.new()
_texture_packer.texture_flags = 0
@ -112,6 +112,9 @@ func _ready():
torso_attach_point = get_node(torso_attach_point_path) as CharacterSkeketonAttachPoint
root_attach_point = get_node(root_attach_point_path) as CharacterSkeketonAttachPoint
if _material == null:
_material = material.duplicate()
if not OS.can_use_threads():
use_threads = false
@ -268,9 +271,6 @@ func prepare_textures() -> void:
_texture_packer.merge()
if _material == null:
_material = material.duplicate()
var tex : Texture = _texture_packer.get_generated_texture(0)
# var mat : SpatialMaterial = _material as SpatialMaterial

View File

@ -36,4 +36,3 @@ transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )]
refresh_in_editor = false

View File

@ -127,7 +127,11 @@ func set_max_distance(var value : float) -> void:
max_distance = value
func c_health_changed(stat : Stat) -> void:
if stat.cmax != 0:
health_bar.max_value = stat.cmax
else:
health_bar.max_value = 1
health_bar.value = stat.ccurrent

View File

@ -58,8 +58,7 @@ adjustment_enabled = true
]]
data_margin_start = 1
data_margin_end = 2
use_threads = false
max_concurrent_generations = 1
max_concurrent_generations = 4
library = ExtResource( 2 )
level_generator = SubResource( 1 )
voxel_scale = 1.6

View File

@ -88,14 +88,14 @@ func build_phase_prop_mesh() -> void:
if get_prop_mesh_rid() == RID():
allocate_prop_mesh()
if _prop_material == null:
_prop_material = SpatialMaterial.new()
_prop_material.flags_vertex_lighting = true
_prop_material.vertex_color_use_as_albedo = true
_prop_material.params_specular_mode = SpatialMaterial.SPECULAR_DISABLED
_prop_material.metallic = 0
# if _prop_material == null:
# _prop_material = SpatialMaterial.new()
# _prop_material.flags_vertex_lighting = true
# _prop_material.vertex_color_use_as_albedo = true
# _prop_material.params_specular_mode = SpatialMaterial.SPECULAR_DISABLED
# _prop_material.metallic = 0
VisualServer.instance_geometry_set_material_override(get_prop_mesh_instance_rid(), _prop_material.get_rid())
VisualServer.instance_geometry_set_material_override(get_prop_mesh_instance_rid(), library.get_prop_material().get_rid())
for i in range(get_mesher_count()):
get_mesher(i).material = _prop_material
@ -211,7 +211,8 @@ func _build_phase(phase):
set_physics_process_internal(true)
return false
elif phase == VoxelChunk.BUILD_PHASE_FINALIZE:
notification(NOTIFICATION_TRANSFORM_CHANGED)
_notification(NOTIFICATION_TRANSFORM_CHANGED)
return ._build_phase(phase)
else:
return ._build_phase(phase)