|
|
@ -27,9 +27,6 @@ var accumulative_offset := Vector3( 0.35, 0.0, 0.0) |
|
|
|
# I don't believe this should be a source of issues. |
|
|
|
# I don't believe this should be a source of issues. |
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void: |
|
|
|
func _ready() -> void: |
|
|
|
# FIXME: Hardcoded way to get the main model controller. |
|
|
|
|
|
|
|
main_controller = $"/root/SnekStudio_Main/ModelController" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: This is just thrown together. Dunno if this is an accurate list. |
|
|
|
# FIXME: This is just thrown together. Dunno if this is an accurate list. |
|
|
|
# TODO: Allow specifying additional bones, with the help of a hierachical list of existing bones in the model. |
|
|
|
# TODO: Allow specifying additional bones, with the help of a hierachical list of existing bones in the model. |
|
|
|
tracked_bones = [ "Hips", "Spine", "Chest", "UpperChest", "Neck", "Head" ] |
|
|
|
tracked_bones = [ "Hips", "Spine", "Chest", "UpperChest", "Neck", "Head" ] |
|
|
@ -49,6 +46,11 @@ func _ready() -> void: |
|
|
|
for phalange in [ "Proximal", "Intermediate", "Distal" ]: |
|
|
|
for phalange in [ "Proximal", "Intermediate", "Distal" ]: |
|
|
|
tracked_bones.append("%s%s%s" % [ side, finger, phalange ]) |
|
|
|
tracked_bones.append("%s%s%s" % [ side, finger, phalange ]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# FIXME: Hardcoded way to get the main model controller. |
|
|
|
|
|
|
|
main_controller = $"/root/SnekStudio_Main/ModelController" |
|
|
|
|
|
|
|
main_controller.child_entered_tree.connect(on_model_changed) |
|
|
|
|
|
|
|
on_model_changed(main_controller.get_node_or_null("Model")) |
|
|
|
|
|
|
|
|
|
|
|
setup_setting_widget("cache" , "Cache/LineEdit", true ) |
|
|
|
setup_setting_widget("cache" , "Cache/LineEdit", true ) |
|
|
|
setup_setting_widget("nickname", "Name/LineEdit" , false) |
|
|
|
setup_setting_widget("nickname", "Name/LineEdit" , false) |
|
|
|
setup_setting_widget("address" , "Host/Address" , true ) |
|
|
|
setup_setting_widget("address" , "Host/Address" , true ) |
|
|
@ -220,12 +222,13 @@ func clear_player_models() -> void: |
|
|
|
func _process(_delta: float) -> void: |
|
|
|
func _process(_delta: float) -> void: |
|
|
|
SyncController.send_model_animation(self) |
|
|
|
SyncController.send_model_animation(self) |
|
|
|
|
|
|
|
|
|
|
|
# Called when module is initialized or load_vrm is called. |
|
|
|
# Will be called once when the module is initialized, and also when a child is |
|
|
|
func scene_init() -> void: |
|
|
|
# added to the main ModelController, which happens when the model is changed. |
|
|
|
var model := get_model() |
|
|
|
func on_model_changed(model: Node) -> void: |
|
|
|
var skeleton := get_skeleton() |
|
|
|
if (model == null) or (model.name != "Model"): return |
|
|
|
# Do nothing, I guess? Unsure if source of potential bugs. |
|
|
|
|
|
|
|
if (not model) or (not skeleton): return |
|
|
|
var skeleton: Skeleton3D = main_controller._get_model_skeleton() |
|
|
|
|
|
|
|
if not skeleton: return # Do nothing, I guess? Unsure if potential bug. |
|
|
|
|
|
|
|
|
|
|
|
# This "version" is used to ensure that sync updates |
|
|
|
# This "version" is used to ensure that sync updates |
|
|
|
# are not applied to the incorrect lookup tables. |
|
|
|
# are not applied to the incorrect lookup tables. |
|
|
@ -247,8 +250,10 @@ func scene_init() -> void: |
|
|
|
blendshape_lookup.append(anim.track_get_path(track_index)) |
|
|
|
blendshape_lookup.append(anim.track_get_path(track_index)) |
|
|
|
continue |
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
if multiplayer.get_peers().size() > 1: |
|
|
|
# Wait for one frame, then "_last_loaded_vrm" is updated. |
|
|
|
|
|
|
|
await get_tree().process_frame |
|
|
|
var filename = main_controller._last_loaded_vrm.get_file() |
|
|
|
var filename = main_controller._last_loaded_vrm.get_file() |
|
|
|
|
|
|
|
|
|
|
|
change_model.rpc(version, bone_lookup, blendshape_lookup, filename) |
|
|
|
change_model.rpc(version, bone_lookup, blendshape_lookup, filename) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|