Skip to content

HueVirtualCreature/GDVTubeStudio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GDVTubeStudio

GDVTubeStudio is a project designed for use with Godot 4, serving as an API wrapper for the software VTubeStudio by Denchisoft. By instantiating an instance of GDVtubeStudio and calling its member functions, you can easily interact with VTubeStudio's features.

Getting Started

  1. Installation: To get started, Ensure you have Godot 4 installed and configured. Import the GDVtubeStudio scene into your Godot project and instantiate an instance of the scene as a node.

  2. Initialization: Call the start() function to initialize the GDVTubeStudio client. You can specify whether it should auto-connect to the VTubeStudio API. The function, start(), by itself, just spins up a WebsocketPeer. If you decide to enable auto-connect, then make sure you have supplied an authentication token to GDVTubeStudio, first.

#It is up to your implementation to determine how to save and 
#retrieve existing tokens. Please refer to the demo app for an example.
var some_token = "123412341324134134"
$GDVtubeStudio.authentication_token = some_token;

# Start GDVTubeStudio client
GDVtubeStudio.start(should_auto_connect)
  1. Authentication: You can request an authentication token or session to interact with VTubeStudio. Use the following functions:
  • request_authentication_token(): Request an authentication token.
  • request_authentication(): Request an authentication session. You cannot request a authenticated session without an authentication token.
# Request authentication token
#This function will automatically assign a value to $GDVtubeStudio.authentication_token
GDVtubeStudio.request_authentication_token()

# Request authentication session
GDVtubeStudio.request_authentication()

Available Functions

Here's a list of available functions in GDVTubeStudio and references to the Denchisoft API Documentation. Please refer to their documenation for more information about each request type:

Event Subscription

You can utilize the event system in VTubeStudio by calling

# Example usage of request_event_subscription
var request = RequestTypes.EventSubscriptionRequestArguments;
request.eventName = "ModelMovedEvent"
request.subscribe = true
$GDVtubeStudio.request_event_subscription(request)

Afterwards, GDVtubeStudio will start receiving events via client_response signal. Please refer to the model_move demo scene for an example of how you would use this.

Valid eventName values are:

  • TestEvent
  • ModelLoadedEvent
  • TrackingStatusChangedEvent
  • BackgroundChangedEvent
  • ModelConfigChangedEvent
  • ModelMovedEvent
  • ModelOutlineEvent
  • HotkeyTriggeredEvent
  • ModelAnimationEvent

Please refer to Denchisoft's documentation on how to configure some of these requests: https://github.com/DenchiSoft/VTubeStudio#event-api

Usage

You can call these functions in your Godot project by including the GDVtubeStudio node and invoking the respective functions as needed.

# Example usage of GDVTubeStudio functions
GDVtubeStudio.request_current_model()

None of the functions return a value. If the API returns a response, it will be returned with the signal "client_response"

...
GDVtubeStudio.client_response.connect(_on_gd_vtube_studio_server_response);
...

func _on_gd_vtube_studio_server_response(message):
	#message is the contents of the response object

Contributions

Contributions to GDVTubeStudio are welcome. Feel free to open issues or submit pull requests to improve and expand its functionality.

License

GDVTubeStudio is licensed under the GNU GENERAL PUBLIC LICENSE.