This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

character / minimal-haru / main.gd
1.6 kB 42 lines
1extends Node2D 2 3const MODEL_PATH = "/home/nandi/.local/share/godot/app_userdata/open-vt/Live2DModels/Haru/Haru.model3.json" 4const SHADERS = [ 5 preload("res://addons/gd_cubism/res/shader/2d_cubism_norm_add.gdshader"), 6 preload("res://addons/gd_cubism/res/shader/2d_cubism_norm_mix.gdshader"), 7 preload("res://addons/gd_cubism/res/shader/2d_cubism_norm_mul.gdshader"), 8 preload("res://addons/gd_cubism/res/shader/2d_cubism_mask.gdshader"), 9] 10 11func _ready() -> void: 12 var loader = ClassDB.instantiate("GDCubismModelLoader") 13 if loader == null: 14 push_error("minimal-haru: GDCubismModelLoader unavailable") 15 get_tree().quit(1) 16 return 17 18 var model = loader.call("load_model", MODEL_PATH, SHADERS, true) 19 if model == null: 20 push_error("minimal-haru: failed to load Haru model") 21 get_tree().quit(1) 22 return 23 24 model.set("mask_viewport_size", 2048) 25 model.set_process(true) 26 model.position = Vector2(640, 360) 27 model.scale = Vector2.ONE * 0.12 28 add_child(model) 29 30 var physics = ClassDB.instantiate("GDCubismEffectPhysics") 31 if physics != null: 32 physics.name = "Physics" 33 model.add_child(physics) 34 35 await get_tree().process_frame 36 37 print("MINIMAL_HARU loaded=true") 38 print("MINIMAL_HARU initialized=%s" % JSON.stringify(model.call("is_initialized"))) 39 print("MINIMAL_HARU mesh_count=%s" % JSON.stringify(model.call("get_meshes").size())) 40 print("MINIMAL_HARU position=%s" % JSON.stringify({"x": model.position.x, "y": model.position.y})) 41 print("MINIMAL_HARU scale=%s" % JSON.stringify({"x": model.scale.x, "y": model.scale.y})) 42 print("MINIMAL_HARU ready_for_interactive_use=true")