mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-10 09:00:36 +01:00
#911 Fix expressions
This commit is contained in:
parent
78c599a413
commit
2622999284
@ -515,7 +515,7 @@ async function moduleWorker() {
|
|||||||
|
|
||||||
//set checkbox to global var
|
//set checkbox to global var
|
||||||
$('#image_type_toggle').prop('checked', extension_settings.expressions.live2d);
|
$('#image_type_toggle').prop('checked', extension_settings.expressions.live2d);
|
||||||
if(extension_settings.expressions.live2d == true){
|
if (extension_settings.expressions.live2d) {
|
||||||
setLive2dState(extension_settings.expressions.live2d);
|
setLive2dState(extension_settings.expressions.live2d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -641,11 +641,11 @@ async function live2dcheck() {
|
|||||||
let live2dObj = spriteCache[spriteFolderName].find(obj => obj.label === 'live2d');
|
let live2dObj = spriteCache[spriteFolderName].find(obj => obj.label === 'live2d');
|
||||||
let live2dPath_f = live2dObj ? live2dObj.path : null;
|
let live2dPath_f = live2dObj ? live2dObj.path : null;
|
||||||
|
|
||||||
if(live2dPath_f != null){
|
if (live2dPath_f != null) {
|
||||||
//console.log("live2dPath_f " + live2dPath_f);
|
//console.log("live2dPath_f " + live2dPath_f);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//console.log("live2dPath_f is null");
|
//console.log("live2dPath_f is null");
|
||||||
unloadLiveChar();
|
unloadLiveChar();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -654,7 +654,7 @@ async function live2dcheck() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLive2dState(switch_var){
|
function setLive2dState(switch_var) {
|
||||||
extension_settings.expressions.live2d = switch_var; // Store setting
|
extension_settings.expressions.live2d = switch_var; // Store setting
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
|
||||||
@ -662,22 +662,18 @@ function setLive2dState(switch_var){
|
|||||||
if (result) {
|
if (result) {
|
||||||
//console.log("Live2d exists!");
|
//console.log("Live2d exists!");
|
||||||
|
|
||||||
if (extension_settings.expressions.live2d) {
|
if (extension_settings.expressions.live2d) {
|
||||||
loadLiveChar();
|
loadLiveChar();
|
||||||
} else {
|
} else {
|
||||||
unloadLiveChar();
|
unloadLiveChar();
|
||||||
}
|
}
|
||||||
handleImageChange(switch_var); // Change image as needed
|
handleImageChange(switch_var); // Change image as needed
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//console.log("Live2d does not exist.");
|
//console.log("Live2d does not exist.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSpriteFolderName(message) {
|
function getSpriteFolderName(message) {
|
||||||
@ -867,8 +863,7 @@ async function getExpressionsList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setExpression(character, expression, force) {
|
async function setExpression(character, expression, force) {
|
||||||
if (extension_settings.expressions.live2d == false) {
|
if (!extension_settings.expressions.live2d) {
|
||||||
|
|
||||||
console.debug('entered setExpressions');
|
console.debug('entered setExpressions');
|
||||||
await validateImages(character);
|
await validateImages(character);
|
||||||
const img = $('img.expression');
|
const img = $('img.expression');
|
||||||
@ -982,14 +977,14 @@ async function setExpression(character, expression, force) {
|
|||||||
|
|
||||||
live2dcheck().then(result => {
|
live2dcheck().then(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
// Find the <img> element with id="expression-image" and class="expression"
|
// Find the <img> element with id="expression-image" and class="expression"
|
||||||
const imgElement = document.querySelector('img#expression-image.expression');
|
const imgElement = document.querySelector('img#expression-image.expression');
|
||||||
//console.log("searching");
|
//console.log("searching");
|
||||||
if (imgElement) {
|
if (imgElement) {
|
||||||
//console.log("setting value");
|
//console.log("setting value");
|
||||||
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
|
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//console.log("The fetch failed!");
|
//console.log("The fetch failed!");
|
||||||
}
|
}
|
||||||
@ -1254,14 +1249,15 @@ function setExpressionOverrideHtml(forceClear = false) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inline-drawer-content">
|
<div class="inline-drawer-content">
|
||||||
<!-- Toggle button for aituber/static images -->
|
<!-- Toggle button for aituber/static images -->
|
||||||
<div class="toggle_button">
|
<div class="toggle_button">
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
<input id="image_type_toggle" type="checkbox">
|
<input id="image_type_toggle" type="checkbox">
|
||||||
<span class="slider round"></span>
|
<span class="slider round"></span>
|
||||||
<label for="image_type_toggle">Image Type - Live2d (extras)</label>
|
<label for="image_type_toggle">Image Type - Live2d (extras)</label>
|
||||||
</div>
|
</label>
|
||||||
<div class="offline_mode">
|
</div>
|
||||||
|
<div class="offline_mode">
|
||||||
<small>You are in offline mode. Click on the image below to set the expression.</small>
|
<small>You are in offline mode. Click on the image below to set the expression.</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-container flexnowrap">
|
<div class="flex-container flexnowrap">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user