-
Notifications
You must be signed in to change notification settings - Fork 0
/
SAMMIVtubeStudioExtension.sef
1243 lines (1125 loc) · 59.4 KB
/
SAMMIVtubeStudioExtension.sef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[extension_name]
SAMMIVTubeStudioExtension
[extension_info]
Written by Hue_vCreature, the Centipede Youkai
[insert_external]
<style type="">
* {
box-sizing: border-box;
}
</style>
<div class="row">
<p>SAMMIVtubeStudioExtension: Interfaces SAMMI with Denchisoft's VTubeStudio by invoking endpoints on the VTubeStudio API via Commands</p>
</div>
<div class="row">
<div class="column">
<img class="hue-img" src="https://i.imgur.com/PXr3Lez.png"></img>
</div>
<div class="column">
<p>Created by Hue, the Centipede Youkai</p>
<a href="https://hue-centipedeyokai.carrd.co/">My Carrd!</a>
<a href="https://github.com/HueVirtualCreature/SAMMIVtubeStudioExtension">Instructions and Readme</a>
<p>You may access the commands under Extension Commands > SAMMI Bridge > VTubeStudio*</p>
<p>Please keep in mind that the Bridge MUST BE OPEN in order for any of its commands to work.</p>
<p>Version: $!BUILDNUMBER!$</p>
<button class="btn btn-primary btn-sm" onclick="requestRefresh();">Refresh Model and Hotkey Lists</button>
</div>
</div>
[insert_command]
SAMMIVTS_initialize();
[insert_hook]
[insert_script]
const VTUBESTUDIO_SERVER = 'ws://127.0.0.1:8001';
const VTUBESTUDIO_PLUGINNAME = "SAMMIVtubeStudioExtension";
const VTUBESTUDIO_AUTHORNAME = "Hue_vCreature";
const VTUBESTUDIO_PLUGIN_ICON64 = `iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAG3RFWHRTb2Z0d2FyZQBDZWxzeXMgU3R1ZGlvIFRvb2zBp+F8AAAUSklEQVR42u2dfXwU9Z3HP7ObbDbJbsJuniCRGiyoqNAzaLkiD+1LzpzlaO+gV1RAUCpaUCyVghQQjECAA1E5DluQZ7BRUfDgNIIaFGitPLykeJGDihpMQEIeN8lmk525P2CWyWR+v/nN0+5ms9+/YHZmZzOf9+/7+35/D9/h9m4tExC3bmtcHIA4AHEA4gDELQ5A3OIAGLWTxTM7/H/g3N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EMgJqR4gPSbimt+ygiIXyXBcCM8W8zjAaAUn3FaDXDAFQcr+9Qk6Y7iB8HQAYAAMshiCbx5SmgPAagFdmMaQAAWAZBNAJAGryxssZi1AIgmhWeINrEp+X20lFHLXUWuywAVkMQjeKzDPCopYExBYASBLEuvtIAjxaLOQDMhCHahWcFIFKrfCIOgF4QuorwrCCYORjVJQHojsY6OdQtPEAcAnWPEWkQ4gBEyAvEu4C4xQGIWxyAuEXY/h9ZrqY7VVmfuAAAAABJRU5ErkJggg==`;
VTUBESTUDIO_WebSocket_ReadyStates = { CONNECTING: 0, OPEN: 1, CLOSING: 2, CLOSED: 3 };
//#region Insert Commands
//Inserts base extension commands into SAMMI
//TODO Move to private space
function SAMMIVTS_insertBaseCommands() {
const saveAsVariableBox = ["Save Variable As", 14, ""]
const vtsStatsProps = ["*leave blank to save entire response*","uptime","framerate","vTubeStudioVersion","allowedPlugins",
"connectedPlugins","startedWithSteam","windowWidth","windowHeight","windowIsFullscreen",];
const commonModelDataProps = ["*leave blank to save entire response*","modelID", "modelName", "modelPosition", "positionX",
"positionY", "size", "rotation", "modelLoaded", "modelLoadTime", "hasPhysicsFile", "timeSinceModelLoaded"];
SAMMI.extCommand("VtubeStudio - Send Hotkey",3355443, 52, {
Hotkey: ['Hotkey', 20, "Please make a selection", null, ["No Hotkeys! (Did you authenticate?)"]]
});
SAMMI.extCommand("VtubeStudio - Send Hotkey (By Name)",3355443, 52, {
HotkeyName: ['Hotkey Name', 14, ""]
});
SAMMI.extCommand("VtubeStudio - Send Hotkey (Item)",3355443, 52, {
InstanceID: ['Item InstanceID', 14, "", null],
Hotkey: ['Hotkey', 14, "", null]
});
SAMMI.extCommand("VtubeStudio - Load Model",3355443, 52, {
Model: ['Model to Load', 20, "Please make a selection", null, ["No Models! (Did you authenticate?)"]]
})
//This is used to trigger the initial authentication
SAMMI.extCommand("VtubeStudio - Request Token",3355443, 52, {
//Token: ["Save Token to Variable", 14, ""] //When the server responds with the auth token, save to global OR user-defined variable
dev_note: ["Dev Note", 0, "This is used to request a token from vTubestudio. The server will return with a token and save that to a global variable"]
});
//This is used to trigger the initial authentication
SAMMI.extCommand("VtubeStudio - Authenticate",3355443, 52, {
//Token: ["Save Token to Variable", 14, ""] //When the server responds with the auth token, save to global OR user-defined variable
dev_note: ["Dev Note", 0, "This is used to authenticate with vTubestudio. The auth state will be saved to global"]
});
SAMMI.extCommand("VtubeStudio - Move Model",3355443, 52, {
//Need better default values
positionX: ["PositionX", 14, "0"],
positionY: ["PositionY", 14, "0"],
size: ["Size", 14, "-50.0"],
rotation: ["Rotation", 14, "360"],
time: ["Time (0-2)", 14, "0.5"],
relative: ["Relative Values", 2, false],
dev_note: ["Dev Note", 0, "This one doesn't work super \nwell mainly because you have to \ndo a lot of trial and error to get \nthe numbers just right....\ngood luck! Changing the \ncontents of this textbox \ndoes nothing, by the way."]
});
SAMMI.extCommand("VtubeStudio - Pull Value",3355443, 52, {
PullValue: ["Pull Value", 20, "", null, commonModelDataProps],
Global: ["Global", 2, false],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Get Items List",3355443, 80, {
includeAvailableSpots: ["includeAvailableSpots", 2, false],
includeItemInstancesInScene: ["includeItemInstancesInScene", 2, false],
includeAvailableItemFiles: ["includeAvailableItemFiles", 2, false],
onlyItemsWithFileName: ["onlyItemsWithFileName", 14, ""],
onlyItemsWithInstanceID: ["onlyItemsWithInstanceID", 14, ""],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Load Item",3355443, 80, {
fileName: ["fileName", 14, ""],
positionX: ["positionX", 14, "0"],
positionY: ["positionY", 14, "0.5"],
size: ["size", 14, "0.33"],
rotation: ["rotation", 14, "90"],
fadeTime: ["fadeTime", 14, "0.5"],
order: ["order", 14, "4"],
failIfOrderTaken: ["failIfOrderTaken", 2, false],
smoothing: ["smoothing", 14, "0.5"],
censored: ["censored", 2, false],
flipped: ["flipped", 2, false],
locked: ["locked", 2, false],
unloadWhenPluginDisconnects: ["unloadWhenPluginDisconnects", 2, true],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Remove Item",3355443, 80, {
unloadAllInScene: ["Remove All in Scene", 2, false],
unloadAllLoadedByThisPlugin: ["Remove All (by SAMMI)", 2, false],
allowUnloadingItemsLoadedByUserOrOtherPlugins: ["Allow Removal of Items (by other than SAMMI)", 2, true],
instanceIDs: ["instanceIDs ArrayName", 14, ""],
fileNames: ["fileNames ArrayName", 14, ""],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Control Animation",3355443, 80, {
itemInstanceID: ["itemInstanceID", 14, ""],
framerate: ["framerate", 14, "12"],
frame: ["frame", 14, "0"],
brightness: ["brightness", 14, "1"],
opacity: ["opacity", 14, "1"],
setAutoStopFrames: ["setAutoStopFrames", 2, false],
autoStopFrames: ["autoStopFrames", 14, ""],
setAnimationPlayState: ["setAnimationPlayState", 2, true],
animationPlayState: ["animationPlayState", 2, true],
variable: saveAsVariableBox //Not used
});
//TODO Move Items UI needs to be improved to be more user friendly
SAMMI.extCommand("VtubeStudio - Move Item",3355443, 80, {
itemsToMove: ["itemsToMove Variable Name", 14, ""],
//TODO This sucks ass
dev_note: ["Request model", 0, `{\n"itemInstanceID": "ItemInstanceId",\n"timeInSeconds": 1,\n"fadeMode": "easeOut",\n"positionX": 0.2,\n"positionY": -0.8,\n"size": 0.6,\n"rotation": 180,\n"order": -1000,\n"setFlip": true,\n"flip": false,\n"userCanStop": true\n}`],
variable: saveAsVariableBox //Not used
});
SAMMI.extCommand("VtubeStudio - PostProcessing List Get (BETA)",3355443, 80, {
fillPostProcessingPresetsArray: ["Include Presets?", 2, false, 0.5],
fillPostProcessingEffectsArray: ["Include VFX?", 2, false, 0.5],
effectIDFilter: ["effectIDFilter (array name or blank)", 14, "", 1.5],
variable: ["Save Variable As", 14, "", 1.5]
});
SAMMI.extCommand("VtubeStudio - PostProcessing Simple On/Off (BETA)",3355443, 30, {
postProcessingOn: ["On/Off", 14, "", 0.5],
variable: ["Save Variable As", 14, "", 1.5]
});
const postProcessingEffects = [
"ColorGrading","WeatherEffects","Bloom","Backlight","CustomParticles","BackgroundShift","SimpleOverlay",
"Vignette","ChromaticAberration","OldFilm","Lowfps","Datamosh","LineScanner","ParticleShower","AnalogGlitch",
"DigitalGlitch","Letterbox","FoggyWindow","Speedlines","Pixelation","LensDistortion","WaveDistortion","BlurEffects",
"Grain","Vhs","Outline","Posterize","Ascii","ModelGlitch"
]
//https://github.com/DenchiSoft/VTubeStudio/blob/master/Files/EffectConfigs.cs
SAMMI.extCommand("VtubeStudio - PostProcessing - Helper - Add Effect to Array (BETA)",3355443, 30, {
effectName: ["Effect to add to array", 20, "", 0.8, postProcessingEffects],
variable: ["Array Name", 14, "",0.8],
dev_note: ["Note", 0, "The array is not updated right away. \nYou may need to wait. \nAlso useful as a reference.", 1.4]
});
const postProcessingConfigTypes = ["ColorGrading_Strength","ColorGrading_HueShift","ColorGrading_Saturation","ColorGrading_Brightness","ColorGrading_Contrast","ColorGrading_ColorFilter","ColorGrading_WhitebalanceTemperature","ColorGrading_WhitebalanceTint","ColorGrading_Invert","WeatherEffects_RainStrength","WeatherEffects_SnowStrength","WeatherEffects_RainInFront","WeatherEffects_SnowInFront","Bloom_Strength",
"Bloom_ModelColorDarken","Bloom_BackgroundColorDarken","Bloom_MainThreshold","Bloom_MainIntensity","Bloom_MainColorTint","Bloom_StreakThreshold","Bloom_StreakIntensity","Bloom_StreakColorTint","Bloom_StreakVertical","Bloom_MicIncreasesBloom","Bloom_Quality","Backlight_Strength","Backlight_BgBlurOverModel","Backlight_BgBlurOverBg","Backlight_DarkenModel",
"Backlight_DarkenBg","Backlight_StrengthNormal","Backlight_StrengthDirectional","Backlight_BrightnessLimit","Backlight_BacklightDirection","Backlight_BacklightBothDirections","Backlight_BacklightSoftness","Backlight_BacklightColorTint","Backlight_BacklightColorFromBg","Backlight_OutlineSize","Backlight_OutlineColorMain","Backlight_OutlineColorStripes","Backlight_OutlineStripeCount",
"Backlight_OutlineStripeSpeed","Backlight_OutlineStripeCurve","Backlight_ShadowMainColor","Backlight_ShadowOffsetX","Backlight_ShadowOffsetY","CustomParticles_Strength","CustomParticles_BaseMoveWithHead","CustomParticles_SparkleStrength","CustomParticles_SparkleSize","CustomParticles_SparkleColorA","CustomParticles_SparkleColorB","CustomParticles_FloatyStrength",
"CustomParticles_FloatySize","CustomParticles_FloatyColorA","CustomParticles_FloatyColorB","CustomParticles_CloudStrength","CustomParticles_CloudSize","CustomParticles_CloudColorA","CustomParticles_CloudColorB","CustomParticles_SphereStrength","CustomParticles_SphereSize","CustomParticles_SphereColorA","CustomParticles_SphereColorB","CustomParticles_HeartsStrength","CustomParticles_HeartsSize","CustomParticles_HeartsColorA",
"CustomParticles_HeartsColorB","CustomParticles_Custom1TextureFile","CustomParticles_Custom1ColorA","CustomParticles_Custom1ColorB","CustomParticles_Custom1MaterialTypeId","CustomParticles_Custom1InBack","CustomParticles_Custom1MoveWithHead","CustomParticles_Custom1Size","CustomParticles_Custom1Amount","CustomParticles_Custom1FillToCenter","CustomParticles_Custom1BaseRotation","CustomParticles_Custom1RotationSpeed","CustomParticles_Custom1MoveFasterMicVol",
"CustomParticles_Custom2TextureFile","CustomParticles_Custom2ColorA","CustomParticles_Custom2ColorB","CustomParticles_Custom2MaterialTypeId","CustomParticles_Custom2InBack","CustomParticles_Custom2MoveWithHead","CustomParticles_Custom2Size","CustomParticles_Custom2Amount","CustomParticles_Custom2FillToCenter","CustomParticles_Custom2BaseRotation","CustomParticles_Custom2RotationSpeed","CustomParticles_Custom2MoveFasterMicVol","BackgroundShift_Strength",
"BackgroundShift_ZoomIn","BackgroundShift_MicZoomIn","BackgroundShift_TrackingX","BackgroundShift_TrackingY","BackgroundShift_TrackingSmoothing","BackgroundShift_RandomMovementX","BackgroundShift_RandomMovementY","BackgroundShift_RandomMovementRotation","BackgroundShift_RandomMovementSpeed","BackgroundShift_BlurMixBack","BackgroundShift_BlurMainBack","BackgroundShift_BlurBrightnessBack",
"BackgroundShift_BlurMixFront","BackgroundShift_BlurMainFront","BackgroundShift_BlurBrightnessFront","SimpleOverlay_Strength","SimpleOverlay_TextureFile","SimpleOverlay_ZoomIn","SimpleOverlay_TrackingX","SimpleOverlay_TrackingY","SimpleOverlay_TrackingSmoothing","SimpleOverlay_RandomMovementX","SimpleOverlay_RandomMovementY",
"SimpleOverlay_RandomMovementRotation","SimpleOverlay_RandomMovementSpeed","SimpleOverlay_TintColor","Vignette_Strength","Vignette_Smoothness","Vignette_Color","Vignette_CenterX","Vignette_CenterY","Vignette_Roundness","Vignette_Circular",
"ChromaticAberration_Strength","ChromaticAberration_BlurEdges","OldFilm_Strength","OldFilm_FilmFps","OldFilm_FilmContrast","OldFilm_FilmBurn","OldFilm_FilmSceneCut","Lowfps_Strength","Lowfps_FpsLimit","Lowfps_FpsRandom","Lowfps_ScreenTearing",
"Datamosh_Strength","Datamosh_Size","Datamosh_ResetAfterSecs","Datamosh_Entropy","Datamosh_NoiseContrast","Datamosh_VelocityScale","Datamosh_Diffusion","LineScanner_Strength","LineScanner_Direction","LineScanner_ScanStepTotal","LineScanner_ScanStepSize","LineScanner_ScanLineColor","LineScanner_ScanLineSize","LineScanner_ScanLineWaitBetweenScansSecs","ParticleShower_Strength","ParticleShower_TextureFile1",
"ParticleShower_TextureFile2","ParticleShower_TextureFile3","ParticleShower_Speed1","ParticleShower_Speed2","ParticleShower_Speed3","ParticleShower_InBack1","ParticleShower_InBack2","ParticleShower_InBack3","AnalogGlitch_Strength","AnalogGlitch_ScanlineJitter","AnalogGlitch_VerticalJump","AnalogGlitch_HorizontalShake","AnalogGlitch_ColorDrift","AnalogGlitch_MicEffect",
"DigitalGlitch_Strength","DigitalGlitch_Colorshift","DigitalGlitch_MicEffect","Letterbox_Strength","Letterbox_ProgressY","Letterbox_ProgressX","Letterbox_Zoom","Letterbox_Color","FoggyWindow_Strength","FoggyWindow_FogStrength","FoggyWindow_FogTint","FoggyWindow_FogBoost","FoggyWindow_RaindropVisibility","FoggyWindow_RaindropSpeed","FoggyWindow_RaindropSize","FoggyWindow_FogWipeSize","FoggyWindow_FogWipeLifetimeSeconds",
"FoggyWindow_FogLifetimeInfinite","Speedlines_Strength","Speedlines_XCenter","Speedlines_YCenter","Speedlines_ColorA","Speedlines_ColorB","Speedlines_MicEffect","Pixelation_Strength","Pixelation_Resolution","Pixelation_Colorize","Pixelation_C1","Pixelation_C2","Pixelation_C3","Pixelation_C4",
"Pixelation_C5","Pixelation_C6","Pixelation_C7","Pixelation_C8","Pixelation_Fry","LensDistortion_Strength","LensDistortion_LensStrength","LensDistortion_ZoomIn","LensDistortion_Squish","WaveDistortion_Strength","WaveDistortion_HeatStrength","WaveDistortion_RaindropStrength","WaveDistortion_RaindropFrequency","WaveDistortion_ZoomIn",
"WaveDistortion_RotationBase","WaveDistortion_WaveXStrength","WaveDistortion_WaveXScroll","WaveDistortion_WaveXFrequency","WaveDistortion_WaveYStrength","WaveDistortion_WaveYScroll","WaveDistortion_WaveYFrequency","BlurEffects_Strength","BlurEffects_BasicBlurVisibility","BlurEffects_BasicBlurStrength","BlurEffects_PixelationBlur","BlurEffects_MotionBlur","Grain_Strength","Grain_Size",
"Grain_Luminosity","Grain_Colored","Vhs_Strength","Vhs_Fisheye","Vhs_Vignette","Vhs_ScreenBleed","Vhs_NoiseGrain","Vhs_NoiseLines","Vhs_TwitchVertical","Vhs_TwitchHorizontal","Vhs_Interlacing","Vhs_GammaCorrection","Vhs_PaleColor",
"Vhs_AfterImageAmount","Vhs_AfterImageColor","Outline_Strength","Outline_Sharpen","Outline_Visibility","Outline_Color","Outline_Threshold","Outline_Contrast","Posterize_Strength","Ascii_Strength","Ascii_Size","Ascii_CharacterVisibility","Ascii_CharacterColorStrength","Ascii_CharacterColor",
"ModelGlitch_StrengthExplode","ModelGlitch_StrengthWiggle","ModelGlitch_StrengthPulse","ModelGlitch_StrengthLiquify"];
SAMMI.extCommand("VtubeStudio - PostProcessing - Helper - Create Config Object (BETA)",3355443, 30, {
"configID": ["Config Name", 20, "", null, postProcessingConfigTypes],//"Backlight_Strength",
"configValue": ["Config Value", 14, ""],//"0.8"
variable: saveAsVariableBox
});
//https://github.com/DenchiSoft/VTubeStudio/blob/master/Files/EffectConfigs.cs
SAMMI.extCommand("VtubeStudio - PostProcessing Set (BETA)",3355443, 30, {
postProcessingOn: ["On/Off", 14, ""], //NOTE /$variable$/ works!
postProcessingFadeTime: ["Fade (sec)", 14, ""],
setAllOtherValuesToDefault: ["Set Missing to Default", 2, false],
usingRestrictedEffects: ["Allow Restricted VFX", 2, false],
randomizeAll: ["Randomize", 2, false],
randomizeAllChaosLevel: ["Chaos Level", 11, false],
postProcessingValues: ["Config Array", 14, ""],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - PostProcessing Set by Preset(BETA)",3355443, 30, {
postProcessingOn: ["On/Off", 14, ""], //NOTE /$variable$/ works!
postProcessingFadeTime: ["Fade (sec)", 14, ""],
presetToSet: ["Preset Name", 14, ""],
setAllOtherValuesToDefault: ["Set Missing to Default", 2, false],
usingRestrictedEffects: ["Allow Restricted VFX", 2, false],
randomizeAll: ["Randomize", 2, false],
randomizeAllChaosLevel: ["Chaos Level", 11, false],
postProcessingValues: ["Config Array", 14, ""],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Get VTS Info",3355443, 30, {
variable: saveAsVariableBox,
pullValue: ["Pull Value", 20, "", null, vtsStatsProps],
});
const events = [ "TestEvent","ModelLoadedEvent","TrackingStatusChangedEvent","BackgroundChangedEvent","ModelConfigChangedEvent",
"ModelMovedEvent","ModelOutlineEvent"];
SAMMI.extCommand("VtubeStudio - Listen to Event",3355443, 80, {
Event: ["Event", 20, "", null, events],
variable: saveAsVariableBox
});
SAMMI.extCommand("VtubeStudio - Unsubscribe from Event",3355443, 80, {
Event: ["Event", 20, "", null, events],
variable: saveAsVariableBox
});
//ExpressionStateRequest
//https://github.com/DenchiSoft/VTubeStudio#requesting-current-expression-state-list
SAMMI.extCommand("VtubeStudio - Get Expression State",3355443, 80, {
ExpressionFile: ["Expression File Name (Leave blank to get all)", 14, "example.exp3.json"],
Details: ["Include Details", 2, false],
variable: saveAsVariableBox
});
//ExpressionActivationRequest
//https://github.com/DenchiSoft/VTubeStudio#requesting-activation-or-deactivation-of-expressions
SAMMI.extCommand("VtubeStudio - Toggle Expression",3355443, 80, {
ExpressionFile: ["Expression File Name", 14, ""],
Active: ["Turn On? (true/false)", 15, "false"]
});
}
//#endregion
//#region Insert Hooks
//(We don't call them that anymore)
//TODO Move to private space
function SAMMIVTS_insertCommandHooks() {
sammiclient.on('VtubeStudio - Request Token', async (json) => {
const data = json.Data;
//Request a token from the VTS server and save the token it replies with to a Global variable
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
SAMMI.setVariable("SAMMIVtubeStudioExtension_AuthToken", data.authenticationToken || undefined); //Hardcoded to save to Global
};
createVTSWebSocketClient(() => {requestVtubeStudioAuthenticationToken({requestID: requestID});});
});
sammiclient.on('VtubeStudio - Authenticate', async (json) => {
const data = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (data.authenticated == false) SAMMIVTS_postConsoleMessage("The VTS server failed to authenticate the extension");
SAMMI.setVariable("SAMMIVtubeStudioExtension_IsAuthenticated", data.authenticated || false); //Hardcoded to save to Global
};
createVTSWebSocketClient(() => { requestAuthentication({requestID: requestID}); });
});
sammiclient.on('VtubeStudio - Send Hotkey', async (json) => {
const SAMMIJSON = json.Data;
const hotkey = window[`${VTUBESTUDIO_PLUGINNAME}_HotKeys`].find(h => SAMMIJSON.Hotkey.toLowerCase() === getVTSHotKeyIdentifier(h.hotkeyName.toLowerCase(), h.modelName.toLowerCase()));
if (!!hotkey) {
requestHotkeyTrigger(hotkey.hotkeyID);
return;
}
else {
SAMMIVTS_postSAMMIMessage(`Warning - Attempted to trigger hotkey [${SAMMIJSON.Hotkey.toLowerCase()}]. Could not identifiy hotkey.`)
return;
}
});
sammiclient.on('VtubeStudio - Send Hotkey (By Name)', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
var hotkey = (data.availableHotkeys || []).find(h => h.name.toLowerCase() == SAMMIJSON.HotkeyName.toLowerCase());
if (hotkey) {
requestHotkeyTrigger(hotkey.hotkeyID);
}
else {
SAMMIVTS_postSAMMIMessage(`Warning - Attempted to trigger hotkey [${SAMMIJSON.HotkeyName.toLowerCase()}]. Could not identifiy hotkey on current model`)
}
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = undefined;
};
requestModelHotKeys(null, requestID);
});
sammiclient.on('VtubeStudio - Send Hotkey (Item)', async (json) => {
requestHotkeyTrigger(SAMMIJSON.Hotkey, SAMMIJSON.InstanceID);
});
sammiclient.on('VtubeStudio - Load Model', async (json) => {
const SAMMIJSON = json.Data;
let model = window[`${VTUBESTUDIO_PLUGINNAME}_Models`].find(m => m.modelName === SAMMIJSON.Model);
if (!!model) {
requestLoadModel(model.modelID);
}
});
sammiclient.on('VtubeStudio - Move Model', async (json) => {
const SAMMIJSON = json.Data;
requestMoveModel(SAMMIJSON.positionX, SAMMIJSON.positionY, SAMMIJSON.rotation, SAMMIJSON.size, SAMMIJSON.time, SAMMIJSON.relative);
});
sammiclient.on('VtubeStudio - Pull Value', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (modelData) => {
if (!!SAMMIJSON.variable) {
//I think the model position data is inside "modelPosition" proptery, so let's extract it....
modelData = { ...modelData, ...modelData.modelPosition };
let buttonID = 'global';
if (SAMMIJSON.Global !== true) {buttonID = SAMMIJSON.FromButton;}
if (!SAMMIJSON.PullValue || SAMMIJSON.PullValue == "") {SAMMI.setVariable(SAMMIJSON.variable, modelData, buttonID); return;}
SAMMI.setVariable(SAMMIJSON.variable, modelData[SAMMIJSON.PullValue] || undefined, buttonID);
}
};
requestCurrentModelData({requestID: requestID});
});
sammiclient.on('VtubeStudio - Get Items List', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
return;
}
};
requestItemList({requestID: requestID}, SAMMIJSON.includeAvailableSpots,
SAMMIJSON.includeItemInstancesInScene, SAMMIJSON.includeAvailableItemFiles,
SAMMIJSON.onlyItemsWithFileName, SAMMIJSON.onlyItemsWithInstanceID);
});
sammiclient.on('VtubeStudio - Load Item', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
return;
}
};
const {fileName, positionX,positionY,size,rotation,fadeTime,order,failIfOrderTaken,
smoothing,censored,flipped,locked,unloadWhenPluginDisconnects} = SAMMIJSON;
requestLoadItem({requestID,fileName,positionX,positionY,size,rotation,fadeTime,
order,failIfOrderTaken,smoothing,censored,flipped,locked,unloadWhenPluginDisconnects
});
});
sammiclient.on('VtubeStudio - Remove Item', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
return;
}
};
const {unloadAllInScene,unloadAllLoadedByThisPlugin,allowUnloadingItemsLoadedByUserOrOtherPlugins,
instanceIDs: instanceIDsArrayName,fileNames: fileNamesArrayName} = SAMMIJSON;
SAMMI.getVariable(instanceIDsArrayName, SAMMIJSON.FromButton).then(instanceIDs => {
SAMMI.getVariable(fileNamesArrayName, SAMMIJSON.FromButton).then(fileNames => {
requestRemoveItem({
requestID,
unloadAllInScene,
unloadAllLoadedByThisPlugin,
allowUnloadingItemsLoadedByUserOrOtherPlugins,
instanceIDs: instanceIDs.value,
fileNames: fileNames.value
});
});
});
});
sammiclient.on('VtubeStudio - Control Animation', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
const {itemInstanceID,framerate,frame,brightness,opacity,setAutoStopFrames,autoStopFrames,setAnimationPlayState,animationPlayState} = SAMMIJSON;
if (autoStopFrames && autoStopFrames !== "") {
SAMMI.getVariable(autoStopFrames, SAMMIJSON.FromButton).then(autoStopFramesVariable => {
requestItemAnimationControl({requestID,itemInstanceID,framerate,frame,brightness,opacity,
setAutoStopFrames,autoStopFrames: autoStopFramesVariable.value,setAnimationPlayState,animationPlayState});
});
return;
}
requestItemAnimationControl({requestID,itemInstanceID,framerate,frame,brightness,opacity,setAutoStopFrames,
autoStopFrames: null,setAnimationPlayState,animationPlayState});
});
sammiclient.on('VtubeStudio - Move Item', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
const {
itemsToMove: itemsToMoveVariableName
} = SAMMIJSON;
if (itemsToMoveVariableName && itemsToMoveVariableName !== "") {
SAMMI.getVariable(itemsToMoveVariableName, SAMMIJSON.FromButton).then(itemsToMoveVariable => {
requestItemMove({requestID, itemsToMove: itemsToMoveVariable.value});
});
return;
}
});
sammiclient.on('VtubeStudio - Get VTS Info', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
if (!SAMMIJSON.pullValue || SAMMIJSON.pullValue == "") {SAMMI.setVariable(SAMMIJSON.variable, data, buttonID); return;}
SAMMI.setVariable(SAMMIJSON.variable, data[SAMMIJSON.pullValue] || undefined, buttonID);
}
};
requestVTSStats({requestID: requestID});
});
sammiclient.on('VtubeStudio - Get Expression State', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
}
};
requestExpressionStateRequest({requestID: requestID, expressionFile: SAMMIJSON.ExpressionFile, details: SAMMIJSON.Details});
});
sammiclient.on('VtubeStudio - Toggle Expression', async (json) => {
const SAMMIJSON = json.Data;
requestExpressionActivationRequest({requestID: uuidv4(), expressionFile: SAMMIJSON.ExpressionFile, active: SAMMIJSON.Active});
});
sammiclient.on('VtubeStudio - Listen to Event', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
if (!SAMMIJSON.pullValue || SAMMIJSON.pullValue == "") {SAMMI.setVariable(SAMMIJSON.variable, data, buttonID); return;}
SAMMI.setVariable(SAMMIJSON.variable, data[SAMMIJSON.pullValue] || undefined, buttonID);
}
};
requestVTSEventSubscription({requestID: requestID, event: SAMMIJSON.Event});
});
sammiclient.on('VtubeStudio - Unsubscribe from Event', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
if (!SAMMIJSON.pullValue || SAMMIJSON.pullValue == "") {SAMMI.setVariable(SAMMIJSON.variable, data, buttonID); return;}
SAMMI.setVariable(SAMMIJSON.variable, data[SAMMIJSON.pullValue] || undefined, buttonID);
}
};
requestVTSEventUnSubscribe({requestID: requestID, event: SAMMIJSON.Event});
});
//#region Hooks: PostProcessing VFX
sammiclient.on('VtubeStudio - PostProcessing List Get (BETA)', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, SAMMIJSON.FromButton);
}
};
const {fillPostProcessingPresetsArray,fillPostProcessingEffectsArray, effectIDFilter: effectIDFilterArrayName} = SAMMIJSON;
var data = {
fillPostProcessingPresetsArray,
fillPostProcessingEffectsArray
}
if (effectIDFilterArrayName && effectIDFilterArrayName !== "") {
SAMMI.getVariable(effectIDFilterArrayName, SAMMIJSON.FromButton).then(response => {
data.effectIDFilter = response.value;
requestPostProcessingListRequest({requestID: requestID, data: data});
});
return;
}
requestPostProcessingListRequest({requestID: requestID, data: data});
});
sammiclient.on('VtubeStudio - PostProcessing - Helper - Add Effect to Array (BETA)', async (json) => {
const SAMMIJSON = json.Data;
const {effectName, variable: arrayName} = SAMMIJSON;
await SAMMI.getVariable(arrayName, SAMMIJSON.FromButton).then(async (response) => {
let array_value = [];
if (!!response.value) { array_value = response.value; }
array_value.push(effectName);
await SAMMI.setVariable(arrayName, array_value, SAMMIJSON.FromButton);
});
});
sammiclient.on('VtubeStudio - PostProcessing Simple On/Off (BETA)', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
}
};
const { postProcessingOn } = SAMMIJSON;
var data = {
postProcessingOn
}
requestPostProcessingUpdateRequest({requestID: requestID, data: data});
});
sammiclient.on('VtubeStudio - PostProcessing - Helper - Create Config Object (BETA)', async (json) => {
const SAMMIJSON = json.Data;
const { configID, configValue, variable } = SAMMIJSON;
var data = {
configID,
configValue
}
await SAMMI.setVariable(variable, data, SAMMIJSON.FromButton);
});
sammiclient.on('VtubeStudio - PostProcessing Set (BETA)', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
}
};
const {postProcessingOn,postProcessingFadeTime,setAllOtherValuesToDefault,
usingRestrictedEffects,randomizeAll,randomizeAllChaosLevel,postProcessingValues: postProcessingValuesArrayName} = SAMMIJSON;
var data = {
postProcessingOn,
setPostProcessingPreset: false,
setPostProcessingValues: true,
postProcessingFadeTime,
setAllOtherValuesToDefault,
usingRestrictedEffects,
randomizeAll,
randomizeAllChaosLevel
}
if (postProcessingValuesArrayName && postProcessingValuesArrayName !== "") {
SAMMI.getVariable(postProcessingValuesArrayName, SAMMIJSON.FromButton).then(response => {
requestPostProcessingUpdateRequest({
requestID,
data: {
...data,
postProcessingValues: response.value
}
});
});
return;
}
requestPostProcessingUpdateRequest({requestID: requestID, data: data});
});
sammiclient.on('VtubeStudio - PostProcessing Set by Preset(BETA)', async (json) => {
const SAMMIJSON = json.Data;
const requestID = uuidv4();
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][requestID] = (data) => {
if (!!SAMMIJSON.variable) {
let buttonID = SAMMIJSON.FromButton;
SAMMI.setVariable(SAMMIJSON.variable, data, buttonID);
}
};
const {postProcessingOn,presetToSet,postProcessingFadeTime,setAllOtherValuesToDefault,
usingRestrictedEffects,randomizeAll,randomizeAllChaosLevel,postProcessingValues: postProcessingValuesArrayName} = SAMMIJSON;
var data = {
postProcessingOn,
setPostProcessingPreset: true,
setPostProcessingValues: false,
presetToSet,
postProcessingFadeTime,
setAllOtherValuesToDefault,
usingRestrictedEffects,
randomizeAll,
randomizeAllChaosLevel
}
if (postProcessingValuesArrayName && postProcessingValuesArrayName !== "") {
SAMMI.getVariable(postProcessingValuesArrayName, SAMMIJSON.FromButton).then(response => {
requestPostProcessingUpdateRequest({
requestID,
data: {
...data,
postProcessingValues: response.value
}
});
});
return;
}
requestPostProcessingUpdateRequest({requestID: requestID, data: data});
});
//#endregion Hooks: PostProcessing VFX
}
//#endregion
//#region Interpret API Response
//This is the master logic for recieving responses from the VTS server
//TODO Move to private space
function interpretResponse(responseData) {
if (!responseData) { throw 'interpretResponse: responseData cannot be null!'; }
console.debug("Received Message of Type: " + responseData.messageType)
switch(responseData.messageType) {
case "AuthenticationTokenResponse":
window.VTUBESTUDIO_AUTHTOKEN = responseData.data.authenticationToken;
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
break;
case "AuthenticationResponse":
SAMMIVTS_postSAMMIMessage(`Response from server: ${responseData.data.reason}`);
window.VTUBESTUDIO_AUTHTOKEN = responseData.data.authenticationToken;
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
if (responseData.data.authenticated === true) {
requestListOfModels();
}
break;
case "AvailableModelsResponse":
SAMMIVTS_postConsoleMessage(`Found ${responseData.data.numberOfModels} models.`);
window[`${VTUBESTUDIO_PLUGINNAME}_Models`] = responseData.data.availableModels;
window[`${VTUBESTUDIO_PLUGINNAME}_HotKeys`] = [];
SAMMI.extCommand("VtubeStudio - Load Model",3355443, 52, {
Model: ['Model to Load', 20, "Please make a selection", null, window[`${VTUBESTUDIO_PLUGINNAME}_Models`].map(m => `${m.modelName}`)]
})
//TODO Eesh, race condition maybe. Find a better way
for(let index = 0; index < window[`${VTUBESTUDIO_PLUGINNAME}_Models`].length; index++) {
setTimeout(() => {requestModelHotKeys(responseData.data.availableModels[index].modelID);}, 50);
}
break;
case "HotkeysInCurrentModelResponse":
SAMMIVTS_postConsoleMessage(`Found ${responseData.data.availableHotkeys.length} hotkeys for ${responseData.data.modelName}`);
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
else {
window[`${VTUBESTUDIO_PLUGINNAME}_HotKeys`] = window[`${VTUBESTUDIO_PLUGINNAME}_HotKeys`].concat(responseData.data.availableHotkeys.filter(hotkey => !!hotkey.name && hotkey.name !== "").map(hotkey => {
return {
hotkeyName: hotkey.name.toLowerCase(),
hotkeyID: hotkey.hotkeyID,
modelName: responseData.data.modelName.toLowerCase()
};
}));
SAMMI.extCommand("VtubeStudio - Send Hotkey",3355443, 52, {
Hotkey: ['Hotkey', 20, "Please make a selection", null, window[`${VTUBESTUDIO_PLUGINNAME}_HotKeys`].map(hotkey => getVTSHotKeyIdentifier(hotkey.hotkeyName.toLowerCase(), hotkey.modelName.toLowerCase()))]
});
}
break;
case "HotkeyTriggerResponse":
SAMMIVTS_postSAMMIMessage(`Triggered hotkey`);
break;
case "ModelLoadResponse":
SAMMIVTS_postSAMMIMessage(`Model loaded`);
break;
case "MoveModelResponse":
break;
case "ItemLoadResponse":
if (responseData.data && responseData.data.instanceID) {
//SAMMIVTS_postConsoleMessage("ItemListResponse SUCCESS: " + responseData.data.instanceID)
if (!responseData.requestID) { console.error("The supplied API response did not include a requestID", responseData); }
if (!window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
console.error("The supplied API repsonse included a request ID that did not match any callbacks in the _OnMessageRecievedFunctions collection.\n This response will not produce any effects in SAMMI.");
}
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data.instanceID);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
}
break;
case "ItemUnloadResponse":
if (responseData.data && responseData.data.unloadedItems) {
//SAMMIVTS_postConsoleMessage("ItemUnloadResponse SUCCESS: " + responseData.data.unloadedItems)
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data.instanceID);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
}
break;
case "ItemAnimationControlResponse":
if (responseData.data && responseData.data.animationPlaying !== undefined) {
//SAMMIVTS_postSAMMIMessage("ItemAnimationControlResponse SUCCESS");
}
break;
case "ItemMoveResponse":
if (responseData.data && responseData.data.movedItems) {
//SAMMIVTS_postSAMMIMessage("ItemMoveResponse SUCCESS");
}
break;
case "ItemListResponse":
case "CurrentModelResponse":
case "StatisticsResponse":
case "ExpressionStateResponse":
case "PostProcessingListResponse":
case "PostProcessingUpdateResponse":
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
break;
case "ExpressionActivationResponse":
//Nothing happens with this
//https://github.com/DenchiSoft/VTubeStudio#requesting-activation-or-deactivation-of-expressions
SAMMIVTS_postSAMMIMessage(`Triggered Expression`);
break;
//#region Event Subscriptions
case "EventSubscriptionResponse":
if (window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID]) {
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID](responseData.data);
window[`${VTUBESTUDIO_PLUGINNAME}_OnMessageRecievedFunctions`][responseData.requestID] = undefined;
}
break;
case "TestEvent":
case "ModelLoadedEvent":
case "TrackingStatusChangedEvent":
case "BackgroundChangedEvent":
case "ModelConfigChangedEvent":
case "ModelMovedEvent":
case "ModelOutlineEvent":
if (responseData.data) {
SAMMI.triggerExt(`VTSEvent - ${responseData.messageType}`, { ...responseData.data });
}
break;
//#endregion Event Subscriptions
case 'APIError':
SAMMIVTS_postSAMMIMessage("Received an error from the API: " + responseData.data.errorID + ": " + responseData.data.message);
break;
default:
SAMMIVTS_postSAMMIMessage("Received an unknown message type: " + responseData.messageType + ". The handler for this event has not been implemented.");
break;
}
}
//#endregion
//Create the socket by which to faciliate comms with VTS with
//TODO Move to private space
function createVTSWebSocketClient(callback = null) {
SAMMIVTS_postSAMMIMessage('Checking client');
if (!window.VTUBESTUDIO_WebSocket || window.VTUBESTUDIO_WebSocket.readyState === VTUBESTUDIO_WebSocket_ReadyStates.CLOSED) {
window.VTUBESTUDIO_WebSocket = new WebSocket(VTUBESTUDIO_SERVER);
//Add Event Handlers
window.VTUBESTUDIO_WebSocket.onmessage = function(event) {
if (event.data) {
const responseData = JSON.parse(event.data);
interpretResponse(responseData);
} else {
SAMMIVTS_postSAMMIMessage("Response data was empty", 1);
}
}
window.VTUBESTUDIO_WebSocket.onclose = function(event) {
SAMMIVTS_postConsoleMessage(`Disconnected(${event.code || "No code provided"}, ${event.reason || "No reason provided"}), reconnecting in 5 seconds`);
SAMMIVTS_postSAMMIMessage('Socket disconnected, reconnecting in 5 seconds');
setTimeout(createVTSWebSocketClient, 5000);
}
window.VTUBESTUDIO_WebSocket.onopen = function(event) {
if (callback) callback();
}
return;
}
else if (window.VTUBESTUDIO_WebSocket.readyState === VTUBESTUDIO_WebSocket_ReadyStates.CLOSING) {
SAMMIVTS_postConsoleMessage(`Closure pending, waiting 5 seconds to reopen`);
setTimeout(() => { createVTSWebSocketClient(callback); }, 5000);
return;
}
if (callback) callback();
}
//#region Request Functions
//TODO Move to private space
function sendMessageToVtubeStudio(request) {
//TODO Need better retry logic, maybe implement a queuing system? Also, how do you spell that word?
if (window.VTUBESTUDIO_WebSocket) {
if ( window.VTUBESTUDIO_WebSocket.readyState == VTUBESTUDIO_WebSocket_ReadyStates.OPEN) {
const str = JSON.stringify(request);
const bytes = new TextEncoder().encode(str);
const blob = new Blob([bytes], {
type: "application/json;charset=utf-8"
});
window.VTUBESTUDIO_WebSocket.send(blob);
} else { //Socket was not open???!!!?!?! Uh......;;;;
SAMMIVTS_postSAMMIMessage('Connection pending(' + window.VTUBESTUDIO_WebSocket.readyState + ')');
if (window.VTUBESTUDIO_WebSocket.readyState == VTUBESTUDIO_WebSocket_ReadyStates.CLOSING) {
setTimeout(createVTSWebSocketClient, 5000);
} else if (window.VTUBESTUDIO_WebSocket.readyState == VTUBESTUDIO_WebSocket_ReadyStates.CLOSED) {
createVTSWebSocketClient();
} else if (window.VTUBESTUDIO_WebSocket.readyState == VTUBESTUDIO_WebSocket_ReadyStates.OPENING) {
setTimeout(() => { sendMessageToVtubeStudio(request); }, 3000);
}
}
} else {
SAMMIVTS_postSAMMIMessage(`Websocket not instantiated`);
createVTSWebSocketClient();
}
};
//TODO Move to private space
async function requestVtubeStudioAuthenticationToken({requestID}) {
SAMMIVTS_postSAMMIMessage('Plugin is asking for authentication in VTube Studio', 0);
const request = await SAMMIVTS_generateBaseRequest("AuthenticationTokenRequest");
request.requestID = requestID;
request.data.pluginIcon = VTUBESTUDIO_PLUGIN_ICON64;
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestAuthentication({requestID}) {
let request = await SAMMIVTS_generateBaseRequest("AuthenticationRequest");
request.requestID = requestID;
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestListOfModels() {
let request = await SAMMIVTS_generateBaseRequest("AvailableModelsRequest");
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestModelHotKeys(modelID = null, requestID = null) {
let request = await SAMMIVTS_generateBaseRequest("HotkeysInCurrentModelRequest");
request.data.modelID = modelID;
if (requestID) request.requestID = requestID;
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestHotkeyTrigger(hotkeyID, instanceID = null) {
let request = await SAMMIVTS_generateBaseRequest("HotkeyTriggerRequest");
request.data.hotkeyID = hotkeyID;
if (instanceID) {
request.data.itemInstanceID = instanceID;
}
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestItemList(obj, includeAvailableSpots = false, includeItemInstancesInScene = false, includeAvailableItemFiles = false, onlyItemsWithFileName = "", onlyItemsWithInstanceID = "") {
let request = await SAMMIVTS_generateBaseRequest("ItemListRequest");
request = {...request, ...obj};
request.data = {
...request.data,
"includeAvailableSpots": includeAvailableSpots,
"includeItemInstancesInScene": includeItemInstancesInScene,
"includeAvailableItemFiles": includeAvailableItemFiles,
"onlyItemsWithFileName": onlyItemsWithFileName,
"onlyItemsWithInstanceID": onlyItemsWithInstanceID
};
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestLoadItem(
{
requestID,
fileName,
positionX,
positionY,
size,
rotation,
fadeTime,
order,
failIfOrderTaken,
smoothing,
censored,
flipped,
locked,
unloadWhenPluginDisconnects
} = {
positionX: 0,
positionY: 0.5,
size: 0.33,
rotation: 90,
fadeTime: 0.5,
order: 4,
failIfOrderTaken: false,
smoothing: 0,
censored: false,
flipped: false,
locked: false,
unloadWhenPluginDisconnects: true
}) {
if (!fileName) return;
let request = await SAMMIVTS_generateBaseRequest("ItemLoadRequest");
request.requestID = requestID;
request.data = {
...request.data,
fileName,
positionX,
positionY,
size,
rotation,
fadeTime,
order,
failIfOrderTaken,
smoothing,
censored,
flipped,
locked,
unloadWhenPluginDisconnects
};
sendMessageToVtubeStudio(request);
}
//TODO Move to private space
async function requestRemoveItem({
requestID,
unloadAllInScene,
unloadAllLoadedByThisPlugin,
allowUnloadingItemsLoadedByUserOrOtherPlugins,
instanceIDs,
fileNames
} = {
unloadAllInScene: false,
unloadAllLoadedByThisPlugin: false,
allowUnloadingItemsLoadedByUserOrOtherPlugins: true,
instanceIDs: [],
fileNames: []
}) {
let request = await SAMMIVTS_generateBaseRequest("ItemUnloadRequest");
request.requestID = requestID;
request.data = {
...request.data,
unloadAllInScene,
unloadAllLoadedByThisPlugin,
allowUnloadingItemsLoadedByUserOrOtherPlugins,
instanceIDs,
fileNames
};
sendMessageToVtubeStudio(request);
}
//TODO Move to private space