|
|
@@ -107,13 +107,13 @@ progress::-webkit-progress-value |
|
|
|
|
|
|
|
var g_autosave_timer = 4.0; |
|
|
|
var g_autosave_time = 4.0; |
|
|
|
var g_code_addin = ['custom setmesh "#CODE#"', '#CODE#']; |
|
|
|
var g_code_addin = [' custom setmesh "#CODE#" ', '#CODE#']; |
|
|
|
var g_code_base = []; |
|
|
|
var CodeDictionnary = []; |
|
|
|
|
|
|
|
g_code_id = 0; |
|
|
|
g_code_base = ["//This is a comment\nsc#f8f afcb 1 1 1 0", |
|
|
|
"//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1)\naddlight 0.0 position (8 2 6) color #ffff\nshowgizmo true\nshowlight true"]; |
|
|
|
var g_code_id = 0; |
|
|
|
g_code_base[0] = "//This is a comment\nsc#f8f afcb 1 1 1 0"; |
|
|
|
g_code_base[1] = "//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1)\naddlight 0.0 position (8 2 6) color #ffff\nshowgizmo true\nshowlight true"; |
|
|
|
|
|
|
|
function machinchose() { return 'test machin '; } |
|
|
|
function GetTextAreaCodeSrc() { return g_txtarea_code_src; } |
|
|
@@ -184,11 +184,16 @@ function machinchose() { return 'test machin '; } |
|
|
|
//Put here any cookie update |
|
|
|
if (DoesLolCookieExist("LolMeshViewerAutosave")) |
|
|
|
{ |
|
|
|
var lol_cookie = GetLolCookie("LolMeshViewerAutosave");
|
|
|
|
var value_list = lol_cookie.m_value.split(";");
|
|
|
|
|
|
|
|
var lol_cookie = GetLolCookie("LolMeshViewerAutosave", false); |
|
|
|
var value_list = lol_cookie.m_value.split(";"); |
|
|
|
for (var i = 0; i < g_code_base.length && i < value_list.length; i++) |
|
|
|
{ |
|
|
|
g_code_base[i] = value_list[i]; |
|
|
|
var addins = g_code_addin[i].split('#CODE#'); |
|
|
|
for (var j = 0; j < addins.length; j++) |
|
|
|
if (addins[j] && addins[j] != '') |
|
|
|
g_code_base[i] = g_code_base[i].replace(addins[j], ""); |
|
|
|
} |
|
|
|
g_txtarea_code_src.value = g_code_base[g_code_id]; |
|
|
|
} |
|
|
|
else if (!g_txtarea_code_src.value) |
|
|
@@ -249,20 +254,16 @@ function machinchose() { return 'test machin '; } |
|
|
|
if (g_autosave_timer < 0.0) |
|
|
|
{ |
|
|
|
g_autosave_timer = g_autosave_time; |
|
|
|
StoreLolCookie("LolMeshViewerAutosave", GetTextValue(true), 10); |
|
|
|
StoreCodeCookie(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function GetTextValue(getall) |
|
|
|
function StoreCodeCookie() |
|
|
|
{ |
|
|
|
var result = ''; |
|
|
|
for (var i = (getall)?(0):(g_code_id); i < g_code_base.length; i++) |
|
|
|
{ |
|
|
|
result += g_code_addin[i].replace('#CODE#', g_code_base[i]) + (getall)?(';'):(''); |
|
|
|
if (getall && i == g_code_id) |
|
|
|
break; |
|
|
|
} |
|
|
|
return result; |
|
|
|
for (var i = 0; i < g_code_base.length; i++) |
|
|
|
{ result += g_code_addin[i].replace('#CODE#', g_code_base[i]) + ";"; } |
|
|
|
StoreLolCookie(new LolCookieDays("LolMeshViewerAutosave", result, 10)); |
|
|
|
} |
|
|
|
|
|
|
|
function StoreTextAreaValue() |
|
|
@@ -289,14 +290,24 @@ function machinchose() { return 'test machin '; } |
|
|
|
alert('Module sent message: ' + message.data); |
|
|
|
} |
|
|
|
|
|
|
|
//When module is live, it calls this. |
|
|
|
function ModuleIsLive() |
|
|
|
{ |
|
|
|
for (var i = 0; i < g_code_base.length; i++) |
|
|
|
{ |
|
|
|
SendMessageToModule(); |
|
|
|
ExchangeSetup(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//Called by the "Send Mesh Command !" button |
|
|
|
function SendMessageToModule() |
|
|
|
{ |
|
|
|
StoreTextAreaValue(); |
|
|
|
if (g_embed_module) |
|
|
|
{ |
|
|
|
StoreLolCookie("LolMeshViewerAutosave", GetTextValue(true), 10); |
|
|
|
g_embed_module.SendMessage(GetTextValue(false)); |
|
|
|
StoreCodeCookie(); |
|
|
|
g_embed_module.SendMessage(g_code_addin[g_code_id].replace('#CODE#', g_code_base[g_code_id])); |
|
|
|
} |
|
|
|
else |
|
|
|
alert("Module not loaded !"); |
|
|
|