Fix error when pasting raw data to gradient object.

This commit is contained in:
Tanasart 2024-12-17 10:24:48 +07:00
parent 0bb2417839
commit 6457706823
6 changed files with 54 additions and 32 deletions

View file

@ -44,7 +44,7 @@
LATEST_VERSION = 1_18_00_0;
VERSION = 1_18_05_1;
SAVE_VERSION = 1_18_05_0;
VERSION_STRING = MAC? "1.18.003m" : "1.18.6.004";
VERSION_STRING = MAC? "1.18.003m" : "1.18.6.005";
BUILD_NUMBER = 1_18_05_1;
var _vsp = string_split(VERSION_STRING, ".");

View file

@ -243,7 +243,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
con_tag = 0;
#endregion
/////META
////- META
static setDummy = function(get_node, _dummy_undo = -1, _dummy_redo = -1) {
is_dummy = true;
@ -284,7 +284,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return self;
}
/////NAME
////- NAME
static getName = function() {
if(name_custom) return name;
@ -297,7 +297,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return self;
}
/////VALUE
////- VALUE
static setType = function(_type) {
if(type == _type) return false;
@ -448,7 +448,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
}
/////ANIMATION
////- ANIMATION
static setAnimable = function(_anim) {
animable = _anim;
@ -504,7 +504,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
if(NOT_LOAD && node.group) node.group.checkPureFunction();
}
/////DISPLAY
////- DISPLAY
static setVisibleManual = function(v) {
visible_manual = v;
@ -1012,7 +1012,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
resetDisplay();
/////RENDER
////- RENDER
static isRendered = function() {
if(type == VALUE_TYPE.node) return true;
@ -1068,7 +1068,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return is_anim;
}
/////CACHE
////- CACHE
static uncache = function() {
use_cache = false;
@ -1077,7 +1077,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static resetCache = function() { cache_value[0] = false; }
/////GET
////- GET
static valueProcess = function(value, nodeFrom = undefined, applyUnit = true, arrIndex = 0) {
var typeFrom = nodeFrom == undefined? VALUE_TYPE.any : nodeFrom.type;
@ -1429,7 +1429,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
arrayLength = __arrayLength;
/////SET
////- SET
static onValidate = function() {
if(!validateValue) return;
@ -1607,21 +1607,22 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
var val = showValue();
if(type == VALUE_TYPE.text) return val;
return json_beautify(val);
return json_stringify(val);
}
static setString = function(str) {
if(connect_type == CONNECT_TYPE.output) return;
if(!editable || connect_type == CONNECT_TYPE.output) return;
if(type == VALUE_TYPE.text) { setValue(str); return; }
var _dat = json_try_parse(str);
var _dat = json_try_parse(str, -1);
if(_dat == -1) return;
if(type_array && !is_array(_dat)) _dat = [ _dat ];
setValue(_dat);
setValueRaw(_dat);
}
/////CONNECT
static setValueRaw = function(_dat) { setValue(_dat); }
////- CONNECT
static rejectConnect = function() {
auto_connect = false;
@ -1800,7 +1801,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
static getJunctionTo = function() { return array_filter(value_to, function(v) /*=>*/ {return v.value_from == self && v.node.active}); }
/////DRAW
////- DRAW
static setColor = function(_color) {
color = color_real(_color);
@ -2099,7 +2100,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
__draw_sprite_ext(custom_icon, draw_junction_index, _mx, _my, ss / 2, ss / 2, 0, c_white, 1);
}
/////EXPRESSION
////- EXPRESSION
static setUseExpression = function(useExp) {
INLINE
@ -2120,7 +2121,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
node.triggerRender();
}
/////SERIALIZE
////- SERIALIZE
static serialize = function(scale = false, preset = false) {
var _map = {};
@ -2311,7 +2312,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
return false;
}
/////MISC
////- MISC
static extractNode = function(_type = extract_node) {
if(_type == "") return noone;

View file

@ -33,4 +33,18 @@ function __NodeValue_Gradient(_name, _node, _value, _tooltip = "") : NodeValue(_
}
static arrayLength = arrayLengthSimple;
static setValueRaw = function(_dat) {
if(is(_dat, gradientObject)) {
setValue(_dat);
return;
}
if(is_struct(_dat)) {
static_set(_dat, static_get(gradientObject));
setValue(_dat);
return;
}
}
}

View file

@ -47,7 +47,7 @@
function noti_status(str, icon = noone, flash = false, ref = noone) {
str = string(str);
show_debug_message("STATUS: " + str);
show_debug_message($"STATUS: {str}🠂");
if(TEST_ERROR) return {};
if(PANEL_MAIN == 0) return;
@ -91,7 +91,7 @@
return noti;
}
show_debug_message("WARNING: " + str);
show_debug_message($"WARNING: {str}🠂");
var noti = new notification(NOTI_TYPE.warning, str, icon, c_ui_orange, PREFERENCES.notification_time);
noti.txtclr = c_ui_orange;
@ -113,7 +113,7 @@
function noti_error(str, icon = noone, ref = noone) {
if(TEST_ERROR) return {};
show_debug_message("ERROR: " + str);
show_debug_message($"ERROR: {str}🠂");
if(PANEL_MAIN == 0) print(str);
var noti = new notification(NOTI_TYPE.error, str, icon, c_ui_red);

View file

@ -351,8 +351,15 @@ function Panel_Inspector() : PanelContent() constructor {
prop_highlight_time = 60;
}
function propSelectCopy() { if(!prop_selecting) return; clipboard_set_text(prop_selecting.getString()); }
function propSelectPaste() { if(!prop_selecting) return; prop_selecting.setString(clipboard_get_text()); }
function propSelectCopy() {
if(!prop_selecting) return;
clipboard_set_text(prop_selecting.getString());
}
function propSelectPaste() {
if(!prop_selecting) return;
prop_selecting.setString(clipboard_get_text());
}
////- DRAW

View file

@ -15,13 +15,13 @@ function shellOpenExplorer(path) {
function shell_execute(path, command, ref = noone, _log = true) {
INLINE
if(OS == os_macosx) {
// if(OS == os_macosx) {
path = string_replace_all(path, "\\", "/");
command = string_replace_all(command, "\\", "/");
}
// }
var txt = $"{path} {command}";
var res = ProcessExecute(txt);
var cmd = $"{path} {command}";
var res = ProcessExecute(cmd);
if(_log) print($"Execute {path} {command} | {res}");
return res;
@ -37,8 +37,8 @@ function shell_execute_async(path, command, ref = noone, _log = true) {
command = string_replace_all(command, "\\", "/");
}
var txt = $"{path} {command}";
var res = ProcessExecuteAsync(txt);
var cmd = $"{path} {command}";
var res = ProcessExecuteAsync(cmd);
if(_log) print($"Execute async {path} {command} | {res}");
return res;