- [Inspector] Fix d3dMaterial surface not show up in the inspector.

This commit is contained in:
Tanasart 2023-11-17 18:33:25 +07:00
parent e187bc7184
commit 6e73ae5855
16 changed files with 180 additions and 93 deletions

View file

@ -766,7 +766,6 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"mfcore.dll","CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"mfplat.dll","CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"README.txt","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"arrowRight.png","CopyToMask":-1,"filePath":"datafiles/Sample Projects",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Bevel.png","CopyToMask":-1,"filePath":"datafiles/Sample Projects",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Broken heart.png","CopyToMask":-1,"filePath":"datafiles/Sample Projects",},
@ -801,6 +800,7 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Steamworks_Extension_Documentation.html","CopyToMask":0,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ucrtbased.dll","ConfigValues":{},"CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"webpmux.exe","CopyToMask":-1,"filePath":"datafiles/webp",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"Welcome files.zip","CopyToMask":-1,"filePath":"datafiles",},
],
"isEcma": false,
"LibraryEmitters": [],

Binary file not shown.

View file

@ -389,5 +389,17 @@
"reload_theme": "Reload theme",
"reset_layout": "Reset layout",
"close_current_project": "Close current project",
"panel_menu_connect_patreon": "Connect to Patreon",
"pref_directory_ImageMagick": "ImageMagick path*",
"pref_directory_webp": "Webp path*",
"pref_directory_gifski": "Gifski path*",
"pref_directory_FFmpeg": "FFmpeg path*",
"pref_supporter_icon": "Show supporter icon",
"pref_graph_group_in_tab": "Open group in new tab",
"pref_widget_autocomplete_delay": "Code Autocomplete delay",
"panel_collection_workshop_update": "Update Steam Workshop content",
"meta_new_version": "Created on a newer version",
"" : ""
}

View file

@ -330,5 +330,12 @@
"pattern": "Pattern",
"related": "Related",
"uncategorized": "uncategorized",
"libraries": "Libraries",
"extra": "Extra",
"modify": "Modify",
"points": "Points",
"text_area": "Text Area",
"" : ""
}

View file

@ -2,6 +2,7 @@
active = textbox != noone;
if(textbox == noone) exit;
if(textbox != WIDGET_CURRENT) exit;
if(array_empty(data)) exit;
#region
dialog_x = clamp(dialog_x, 0, WIN_W - dialog_w - 1);

View file

@ -268,7 +268,6 @@ function __part(_node) constructor {
break;
case ANIM_END_ACTION.destroy:
if(ind >= len) {
//print($"Drawing part destroy when animation end");
kill();
return;
} else

View file

@ -2,6 +2,8 @@ function __Node_Base(x, y) constructor {
self.x = x;
self.y = y;
node_id = 0;
display_name = "";
inputs = ds_list_create();
outputs = ds_list_create();
@ -11,6 +13,41 @@ function __Node_Base(x, y) constructor {
preview_index = 0;
anim_priority = -999;
#region --- attributes ----
attributes = {
update_graph: true,
show_update_trigger: false,
color: -1,
};
#endregion
#region ---- timeline ----
timeline_item = new timelineItemNode(self);
anim_priority = 0;
is_anim_timeline = false;
static refreshTimeline = function() { #region
var _pre_anim = is_anim_timeline;
var _cur_anim = false;
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(_inp.is_anim && _inp.isLeaf()) {
_cur_anim = true;
break;
}
}
if(_pre_anim && !_cur_anim)
timeline_item.removeSelf();
else if(!_pre_anim && _cur_anim)
PROJECT.timelines.addItem(timeline_item);
is_anim_timeline = _cur_anim;
} #endregion
#endregion
static step = function() {}
static update = function(frame = CURRENT_FRAME) {}

View file

@ -11,21 +11,25 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.")
.rejectArray();
inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Alpha", "Additive" ])
.rejectArray();
input_display_list = [ 0, 1 ];
setIsDynamicInput(1);
setIsDynamicInput(2);
attribute_surface_depth();
attribute_interpolation();
static createNewInput = function() {
static createNewInput = function() { #region
var index = ds_list_size(inputs);
inputs[| index] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone )
inputs[| index + 0] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Alpha", "Additive" ])
.rejectArray();
inputs[| index + 1] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone )
.setVisible(true, true);
}
if(!LOADING && !APPENDING) createNewInput();
array_push(input_display_list, ["Particle", false], index + 0, index + 1);
} if(!LOADING && !APPENDING) createNewInput(); #endregion
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -35,12 +39,21 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static onInspector2Update = function() { clearCache(); }
static refreshDynamicInput = function() { #region
var _l = ds_list_create();
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(i < input_fix_len || inputs[| i].value_from)
ds_list_add(_l, inputs[| i]);
else
delete inputs[| i];
var _l = ds_list_create();
var _disp = [];
for( var i = 0; i < input_fix_len ; i ++ ) {
ds_list_add(_l, inputs[| i]);
array_push(_disp, i);
}
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
if(!inputs[| i + 1].value_from) continue;
ds_list_add(_l, inputs[| i + 0]);
ds_list_add(_l, inputs[| i + 1]);
array_push(_disp, ["Particle", false], i + 0, i + 1);
}
for( var i = 0; i < ds_list_size(_l); i++ )
@ -48,6 +61,7 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
ds_list_destroy(inputs);
inputs = _l;
input_display_list = _disp;
createNewInput();
} #endregion
@ -78,7 +92,6 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var _dim = inputs[| 0].getValue(_time);
var _exact = inputs[| 1].getValue(_time);
var _blend = inputs[| 2].getValue(_time);
var _outSurf = outputs[| 0].getValue();
@ -87,17 +100,18 @@ function Node_VFX_Renderer(_x, _y, _group = noone) : Node(_x, _y, _group) constr
surface_set_shader(_outSurf);
shader_set_interpolation(_outSurf);
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
var surf_w = surface_get_width_safe(_outSurf);
var surf_h = surface_get_height_safe(_outSurf);
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
var parts = inputs[| i].getValue(_time);
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var blend = inputs[| i + 0].getValue(_time);
var parts = inputs[| i + 1].getValue(_time);
switch(blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
if(!is_array(parts) || array_length(parts) == 0) continue;
if(!is_array(parts[0])) parts = [ parts ];

View file

@ -15,11 +15,9 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
inputs[| 1] = nodeValue("Round position", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true, "Round position to the closest integer value to avoid jittering.")
.rejectArray();
inputs[| 2] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Alpha", "Additive" ])
.rejectArray();
input_display_list = [ 0, 1 ];
setIsDynamicInput(1);
setIsDynamicInput(2);
attribute_surface_depth();
attribute_interpolation();
@ -31,8 +29,15 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
static createNewInput = function() { #region
var index = ds_list_size(inputs);
inputs[| index] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone )
inputs[| index + 0] = nodeValue("Blend mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Normal", "Alpha", "Additive" ])
.rejectArray();
inputs[| index + 1] = nodeValue("Particles", self, JUNCTION_CONNECT.input, VALUE_TYPE.particle, noone )
.setVisible(true, true);
array_push(input_display_list, ["Particle", false], index + 0, index + 1);
} if(!LOADING && !APPENDING) createNewInput(); #endregion
static createOutput = function() { #region
@ -53,12 +58,21 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
} if(!LOADING && !APPENDING) createOutput(); #endregion
static refreshDynamicInput = function() { #region
var _l = ds_list_create();
for( var i = 0; i < ds_list_size(inputs); i++ ) {
if(i < input_fix_len || inputs[| i].value_from)
ds_list_add(_l, inputs[| i]);
else
delete inputs[| i];
var _l = ds_list_create();
var _disp = [];
for( var i = 0; i < input_fix_len ; i ++ ) {
ds_list_add(_l, inputs[| i]);
array_push(_disp, i);
}
for( var i = input_fix_len; i < ds_list_size(inputs); i += data_length ) {
if(!inputs[| i + 1].value_from) continue;
ds_list_add(_l, inputs[| i + 0]);
ds_list_add(_l, inputs[| i + 1]);
array_push(_disp, ["Particle", false], i + 0, i + 1);
}
for( var i = 0; i < ds_list_size(_l); i++ )
@ -66,6 +80,7 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
ds_list_destroy(inputs);
inputs = _l;
input_display_list = _disp;
createNewInput();
} #endregion
@ -97,7 +112,6 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
var _dim = inputs[| 0].getValue(_time);
var _exact = inputs[| 1].getValue(_time);
var _blend = inputs[| 2].getValue(_time);
var _outSurf = outParent.getValue();
@ -106,18 +120,19 @@ function Node_VFX_Renderer_Output(_x, _y, _group = noone) : Node_Group_Output(_x
surface_set_shader(_outSurf);
shader_set_interpolation(_outSurf);
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
var surf_w = surface_get_width_safe(_outSurf);
var surf_h = surface_get_height_safe(_outSurf);
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i++ ) {
var parts = inputs[| i].getValue(_time);
for( var i = input_fix_len; i < ds_list_size(inputs) - 1; i += data_length ) {
var blend = inputs[| i + 0].getValue(_time);
var parts = inputs[| i + 1].getValue(_time);
switch(blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
if(!is_array(parts) || array_length(parts) == 0) continue;
if(!is_array(parts[0])) parts = [ parts ];

View file

@ -204,9 +204,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
timeline_item = new timelineItemNode(self);
anim_priority = ds_map_size(PROJECT.nodeMap);
is_anim_timeline = false;
dopesheet_color = COLORS.panel_animation_dope_blend_default;
dopesheet_y = 0;
#endregion
#region ---- notification ----
@ -1516,26 +1513,6 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
return _tool.selecting == subtool;
} #endregion
static refreshTimeline = function() { #region
var _pre_anim = is_anim_timeline;
var _cur_anim = false;
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
var _inp = inputs[| i];
if(_inp.is_anim && _inp.isLeaf()) {
_cur_anim = true;
break;
}
}
if(_pre_anim && !_cur_anim)
timeline_item.removeSelf();
else if(!_pre_anim && _cur_anim)
PROJECT.timelines.addItem(timeline_item);
is_anim_timeline = _cur_anim;
} #endregion
static clone = function(target = PANEL_GRAPH.getCurrentContext()) { #region
CLONING = true;
var _type = instanceof(self);

View file

@ -1,4 +1,4 @@
function variable_editor(nodeVal) constructor {
function variable_editor(nodeVal) constructor { #region
value = nodeVal;
val_type = [ VALUE_TYPE.integer, VALUE_TYPE.float, VALUE_TYPE.boolean, VALUE_TYPE.color, VALUE_TYPE.gradient, VALUE_TYPE.path, VALUE_TYPE.curve, VALUE_TYPE.text ];
@ -177,15 +177,18 @@ function variable_editor(nodeVal) constructor {
return _h;
}
}
} #endregion
function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
name = "GLOBAL";
display_name = "";
group = noone;
node_id = 0;
group = noone;
use_cache = CACHE_USE.none;
value = ds_map_create();
value = ds_map_create();
input_display_list = -1;
anim_priority = -999;
@ -193,19 +196,19 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
RENDER_ALL
}
static createValue = function() {
static createValue = function() { #region
var _in = nodeValue("NewValue", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0);
_in.editor = new variable_editor(_in);
ds_list_add(inputs, _in);
return _in;
}
} #endregion
static inputExist = function(key) {
static inputExist = function(key) { #region
return ds_map_exists(value, key);
}
} #endregion
static inputGetable = function(from, key) {
static inputGetable = function(from, key) { #region
if(!inputExist(key)) return false;
var to = value[? key];
@ -215,14 +218,14 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
return false;
return true;
}
} #endregion
static getInput = function(key, def = noone) {
static getInput = function(key, def = noone) { #region
if(!ds_map_exists(value, key)) return def;
return value[? key];
}
} #endregion
static step = function() {
static step = function() { #region
for( var i = 0; i < ds_list_size(inputs); i++ ) {
var _inp = inputs[| i];
value[? _inp.name] = _inp;
@ -231,9 +234,9 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
if(string_pos(" ", _inp.name)) val = false;
_inp.editor.tb_name.boxColor = val? c_white : COLORS._main_value_negative;
}
}
} #endregion
static serialize = function() {
static serialize = function() { #region
var _map = {};
var _inputs = [];
@ -250,10 +253,12 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
}
_map.inputs = _inputs;
_map.attri = attributes;
return _map;
}
} #endregion
static deserialize = function(_map) {
static deserialize = function(_map) { #region
var _inputs = _map.inputs;
for(var i = 0; i < array_length(_inputs); i++) {
@ -273,6 +278,8 @@ function Node_Global(_x = 0, _y = 0) : __Node_Base(_x, _y) constructor {
_in.applyDeserialize(_des);
}
if(struct_has(_map, "attr")) struct_override(attributes, _map.attr);
step();
}
} #endregion
}

View file

@ -95,14 +95,15 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
var _blend = inputs[| input_len + 2].getValue(_time);
var _outSurf = outputs[| 0].getValue();
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
if(render_amount == 0) {
surface_set_shader(_outSurf);
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
shader_set_interpolation(_outSurf);
for(var i = 0; i < attributes.part_amount; i++)
if(parts[i].active) parts[i].draw(_exact, _dim[0], _dim[1]);
@ -110,6 +111,13 @@ function Node_Particle(_x, _y, _group = noone) : Node_VFX_Spawner_Base(_x, _y, _
} else if(is_array(_outSurf)) {
for( var o = 0, n = array_length(_outSurf); o < n; o++ ) {
surface_set_shader(_outSurf[o]);
switch(_blend) {
case PARTICLE_BLEND_MODE.normal: BLEND_NORMAL; break;
case PARTICLE_BLEND_MODE.alpha: BLEND_ALPHA; break;
case PARTICLE_BLEND_MODE.additive: BLEND_ADD; break;
}
shader_set_interpolation(_outSurf[o]);
for(var i = 0; i < attributes.part_amount; i++)
if(parts[i].active) parts[i].draw(_exact, _dim[0], _dim[1], o);

View file

@ -22,6 +22,8 @@ function pxl_document_parser(prompt) {
}
function pxl_autocomplete_server(prompt, params = [], context = {}) {
if(isNumber(prompt)) return [];
var res = [];
var pr_list = ds_priority_create();

View file

@ -51,6 +51,8 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
_type = VALUE_TYPE.dynaSurface;
} else if(is_instanceof(_surf_single, SurfaceAtlas)) {
_type = VALUE_TYPE.atlas;
} else if(is_instanceof(_surf_single, __d3dMaterial)) {
_type = VALUE_TYPE.d3Material;
}
if(!open) {
@ -82,6 +84,8 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
if(is_array(_surface) && array_length(_surface))
_surface = _surface[safe_mod(round(current_time / 250), array_length(_surface))];
if(is_instanceof(_surface, __d3dMaterial))
_surface = _surface.surface;
if(is_surface(_surface)) {
var sfw = surface_get_width_safe(_surface);

View file

@ -112,6 +112,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
localParams = parser_server(crop, autocomplete_object);
var data = autocomplete_server(pmt, localParams, autocomplete_context);
o_dialog_textbox_autocomplete.data = data;
if(array_length(data)) {
o_dialog_textbox_autocomplete.data = data;
o_dialog_textbox_autocomplete.prompt = pmt;

View file

@ -118,7 +118,10 @@ function timelineItemNode(node) : timelineItem() constructor {
show = struct_try_get(_map, "show", true);
var _node_id = _map.node_id;
if(ds_map_exists(PROJECT.nodeMap, _node_id)) {
if(_node_id == 0) {
node = PROJECT.globalNode;
node.timeline_item = self;
} else if(ds_map_exists(PROJECT.nodeMap, _node_id)) {
node = PROJECT.nodeMap[? _node_id];
node.timeline_item = self;
}