Skip to content

Commit

Permalink
fix: format avatar renderer gdscript
Browse files Browse the repository at this point in the history
  • Loading branch information
kuruk-mm committed Nov 21, 2023
1 parent 315b101 commit b1748a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions godot/src/tool/avatar_renderer/avatar_renderer_helper.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AvatarEntry:
var dest_path := ""
var width := 2048
var height := 2048

var face_dest_path := ""
var face_width := 256
var face_height := 256
Expand All @@ -68,7 +68,7 @@ class AvatarEntry:
ret.dest_path = value.get("destPath", "")
ret.width = value.get("width", 2048)
ret.height = value.get("height", 2048)
ret.face_dest_path = value.get("faceDestPath", "") # optional
ret.face_dest_path = value.get("faceDestPath", "") # optional
ret.face_width = value.get("faceWidth", 256)
ret.face_height = value.get("faceHeight", 256)
ret.face_zoom = value.get("faceZoom", 25)
Expand Down
12 changes: 6 additions & 6 deletions godot/src/tool/avatar_renderer/avatar_renderer_standalone.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,29 @@ func update_avatar(index: int):
func _on_avatar_avatar_loaded():
var payload = payload_to_process.payload[current_payload_index]
RenderingServer.set_default_clear_color(Color(0, 0, 0, 0))

# full body fov 90, y=1
%SubViewport.size = Vector2(payload.width, payload.height)
%Camera3D_Perpective.set_fov(90)
%Camera3D_Perpective.position.y = 1.0

await get_tree().process_frame
await get_tree().process_frame
await get_tree().process_frame

var img := sub_viewport.get_texture().get_image()
img.save_png(payload.dest_path)

if not payload.face_dest_path.is_empty():
# face = fov 20, y=1.7
%SubViewport.size = Vector2(payload.face_width, payload.face_height)
%Camera3D_Perpective.set_fov(payload.face_zoom)
%Camera3D_Perpective.position.y = 1.75
await get_tree().process_frame

var face_img := sub_viewport.get_texture().get_image()
face_img.save_png(payload.face_dest_path)

if current_payload_index >= payload_to_process.payload.size() - 1:
get_tree().quit(0)
else:
Expand Down

0 comments on commit b1748a3

Please sign in to comment.