mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
relative path
This commit is contained in:
parent
19693492cf
commit
3c4019c6ea
6 changed files with 69 additions and 17 deletions
|
@ -39,7 +39,7 @@
|
|||
LATEST_VERSION = 1_16_00;
|
||||
VERSION = 1_17_11_0;
|
||||
SAVE_VERSION = 1_17_10_0;
|
||||
VERSION_STRING = "1.17.11.005";
|
||||
VERSION_STRING = "1.17.11.006";
|
||||
BUILD_NUMBER = 1_17_11_0;
|
||||
|
||||
HOTKEYS = ds_map_create();
|
||||
|
|
|
@ -45,7 +45,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
array_push(attributeEditors, [ "File Watcher", function() { return attributes.file_checker; },
|
||||
new checkBox(function() { attributes.file_checker = !attributes.file_checker; }) ]);
|
||||
|
||||
on_drop_file = function(path) { #region
|
||||
on_drop_file = function(path) {
|
||||
inputs[0].setValue(path);
|
||||
|
||||
if(updatePaths(path)) {
|
||||
|
@ -54,9 +54,9 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
|
||||
return false;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function createSprite(path) { #region
|
||||
function createSprite(path) {
|
||||
if(!file_exists(path))
|
||||
return noone;
|
||||
|
||||
|
@ -82,25 +82,25 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
}
|
||||
|
||||
return noone;
|
||||
} #endregion
|
||||
}
|
||||
|
||||
function updatePaths(path) { #region
|
||||
function updatePaths(path) {
|
||||
|
||||
if(sprite_exists(spr))
|
||||
sprite_delete(spr);
|
||||
|
||||
spr = createSprite(path);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
insp1UpdateTooltip = __txt("Refresh");
|
||||
insp1UpdateIcon = [ THEME.refresh_icon, 1, COLORS._main_value_positive ];
|
||||
|
||||
static onInspector1Update = function() { #region
|
||||
static onInspector1Update = function() {
|
||||
updatePaths(path_get(getInputData(0)));
|
||||
triggerRender();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
var path = path_get(getInputData(0));
|
||||
|
||||
if(!file_exists_empty(path)) return;
|
||||
|
@ -109,9 +109,9 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
updatePaths(path);
|
||||
triggerRender();
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static update = function(frame = CURRENT_FRAME) { #region
|
||||
static update = function(frame = CURRENT_FRAME) {
|
||||
|
||||
var path = path_get(getInputData(0));
|
||||
var pad = getInputData(1);
|
||||
|
@ -157,7 +157,7 @@ function Node_Image(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
|
|||
_splice.inputs[3].setValue([ amo, 1 ]);
|
||||
|
||||
#endregion
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static dropPath = function(path) {
|
||||
if(is_array(path)) path = array_safe_get(path, 0);
|
||||
|
|
|
@ -441,7 +441,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
|
|||
case VALUE_TYPE.float : return _val;
|
||||
case VALUE_TYPE.text : return is_string(_val)? _val : string_real(_val);
|
||||
case VALUE_TYPE.color : return is_real(_val)? cola(_val) : _val;
|
||||
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
|
||||
case VALUE_TYPE.surface : return is_string(_val)? get_asset(_val) : _val;
|
||||
}
|
||||
|
||||
return _val;
|
||||
|
|
|
@ -853,6 +853,25 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return setValueInspector(path);
|
||||
}, THEME.button_path_icon).setTooltip(__txt("Open Explorer..."));
|
||||
|
||||
editWidget.front_button = button(function() {
|
||||
var project = PROJECT;
|
||||
if(project.path == "") {
|
||||
noti_warning("Save the current project first.")
|
||||
return;
|
||||
}
|
||||
|
||||
var _pth = getValue();
|
||||
if(!file_exists(_pth)) return;
|
||||
|
||||
var _nam = filename_name(_pth);
|
||||
var _dir = filename_dir(project.path);
|
||||
|
||||
var _newpath = _dir + "/" + _nam;
|
||||
file_copy(_pth, _newpath);
|
||||
setValue("./" + _nam);
|
||||
|
||||
}).setIcon(THEME.copy_20, 0, COLORS._main_icon).setTooltip(__txt("Copy to Project"));
|
||||
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
|
@ -867,6 +886,20 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return setValueInspector(path);
|
||||
}, THEME.button_path_icon).setTooltip(__txt("Open Explorer..."));
|
||||
|
||||
editWidget.front_button = button(function() {
|
||||
var project = PROJECT;
|
||||
if(project.path == "") {
|
||||
noti_warning("Save the current project first.")
|
||||
return;
|
||||
}
|
||||
|
||||
var _pth = getValue();
|
||||
var _nam = filename_name(_pth);
|
||||
var _dir = filename_dir(project.path);
|
||||
setValue("./" + _nam);
|
||||
|
||||
}).setIcon(THEME.copy_20, 0, COLORS._main_icon).setTooltip(__txt("Make Relative"));
|
||||
|
||||
extract_node = "Node_String";
|
||||
break;
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ function Panel_Image_Array_Editor(_junction) : PanelContent() constructor {
|
|||
dragging = index;
|
||||
}
|
||||
|
||||
var spr = struct_try_get(SPRITE_PATH_MAP, path, noone);
|
||||
var rpath = path_get(path);
|
||||
var spr = struct_try_get(SPRITE_PATH_MAP, rpath, noone);
|
||||
if(spr == noone || !sprite_exists(spr))
|
||||
spr = s_texture_default;
|
||||
|
||||
|
@ -171,7 +172,26 @@ function Panel_Image_Array_Editor(_junction) : PanelContent() constructor {
|
|||
]);
|
||||
} else {
|
||||
menuCall("image_array_edit_menu", [
|
||||
menuItem(__txt("Remove"), function() /*=>*/ { array_delete(data, menuOn, 1); apply(); }, THEME.cross)
|
||||
menuItem(__txt("Copy to Project"), function() /*=>*/ {
|
||||
var project = PROJECT;
|
||||
if(project.path == "") {
|
||||
noti_warning("Save the current project first.")
|
||||
return;
|
||||
}
|
||||
|
||||
var _pth = data[menuOn];
|
||||
if(!file_exists(_pth)) return;
|
||||
|
||||
var _nam = filename_name(_pth);
|
||||
var _dir = filename_dir(project.path);
|
||||
|
||||
var _newpath = _dir + "/" + _nam;
|
||||
file_copy(_pth, _newpath);
|
||||
data[menuOn] = "./" + _nam;
|
||||
apply();
|
||||
|
||||
}, THEME.copy_20),
|
||||
menuItem(__txt("Remove"), function() /*=>*/ { array_delete(data, menuOn, 1); apply(); }, THEME.cross),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
|||
|
||||
static clone = function() {
|
||||
var cln = new pathArrayBox(target, data, onClick);
|
||||
|
||||
return cln;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue