From 3d12b54c2c9329e035013d14f9674c42c1bbd7ef Mon Sep 17 00:00:00 2001 From: luboslenco Date: Fri, 30 Aug 2024 21:02:15 +0200 Subject: [PATCH] Cleanup --- .../assets/licenses/{plugins => }/keepme.txt | 0 armorforge/assets/plugins/hello_world.js | 31 ---------- .../assets}/plugins/keepme.txt | 0 armorforge/assets/readme/readme.txt | 20 +++---- armorforge/assets/readme/readme_android.txt | 1 - armorforge/assets/readme/readme_ios.txt | 1 - armorforge/plugins/plugins.c | 8 +++ armorforge/plugins/plugins.cpp | 4 -- armorforge/plugins/project.js | 4 +- armorforge/project.js | 26 ++------- armorforge/sources/tab_objects.ts | 51 ++++++++-------- .../assets/export_presets/base_color.json | 5 -- armorlab/assets/export_presets/generic.json | 9 --- .../assets/export_presets/minecraft_mer.json | 7 --- armorlab/assets/export_presets/unigine.json | 8 --- armorlab/assets/export_presets/unity.json | 8 --- armorlab/assets/export_presets/unreal.json | 7 --- armorlab/assets/export_presets/xplane.json | 6 -- armorlab/assets/licenses/license.md | 9 --- armorlab/assets/plugins/hello_node_brush.js | 58 ------------------- armorlab/assets/plugins/hello_world.js | 31 ---------- armorlab/assets/plugins/import_svg.js | 37 ------------ armorlab/assets/plugins/keepme.txt | 0 armorlab/assets/readme/readme_android.txt | 17 ------ armorlab/assets/readme/readme_dxr.txt | 16 ----- armorlab/assets/readme/readme_ios.txt | 1 - armorlab/assets/readme/readme_vkrt.txt | 17 ------ armorlab/plugins/{plugins.cpp => plugins.c} | 17 +++--- armorlab/plugins/project.js | 17 +++--- armorlab/project.js | 25 ++------ armorpaint/assets/readme/readme_android.txt | 22 ------- armorpaint/assets/readme/readme_ios.txt | 1 - armorpaint/assets/readme/readme_vr.txt | 13 ----- armorpaint/project.js | 20 ------- armorsculpt/assets/licenses/keepme.txt | 0 armorsculpt/assets/licenses/license.md | 9 --- armorsculpt/assets/plugins/hello_world.js | 31 ---------- armorsculpt/assets/plugins/keepme.txt | 0 armorsculpt/assets/readme/readme_android.txt | 1 - armorsculpt/assets/readme/readme_ios.txt | 1 - armorsculpt/plugins/plugins.c | 8 +++ armorsculpt/plugins/plugins.cpp | 4 -- armorsculpt/plugins/project.js | 4 +- armorsculpt/project.js | 14 +---- .../assets/licenses/license.md | 0 .../assets/readme/readme_dxr.txt | 0 .../assets/readme/readme_vkrt.txt | 0 base/project.js | 6 ++ 48 files changed, 92 insertions(+), 483 deletions(-) rename armorforge/assets/licenses/{plugins => }/keepme.txt (100%) delete mode 100644 armorforge/assets/plugins/hello_world.js rename {armorsculpt/assets/licenses => armorforge/assets}/plugins/keepme.txt (100%) delete mode 100644 armorforge/assets/readme/readme_android.txt delete mode 100644 armorforge/assets/readme/readme_ios.txt create mode 100644 armorforge/plugins/plugins.c delete mode 100644 armorforge/plugins/plugins.cpp delete mode 100644 armorlab/assets/export_presets/base_color.json delete mode 100644 armorlab/assets/export_presets/generic.json delete mode 100644 armorlab/assets/export_presets/minecraft_mer.json delete mode 100644 armorlab/assets/export_presets/unigine.json delete mode 100644 armorlab/assets/export_presets/unity.json delete mode 100644 armorlab/assets/export_presets/unreal.json delete mode 100644 armorlab/assets/export_presets/xplane.json delete mode 100644 armorlab/assets/licenses/license.md delete mode 100644 armorlab/assets/plugins/hello_node_brush.js delete mode 100644 armorlab/assets/plugins/hello_world.js delete mode 100644 armorlab/assets/plugins/import_svg.js create mode 100644 armorlab/assets/plugins/keepme.txt delete mode 100644 armorlab/assets/readme/readme_android.txt delete mode 100644 armorlab/assets/readme/readme_dxr.txt delete mode 100644 armorlab/assets/readme/readme_ios.txt delete mode 100644 armorlab/assets/readme/readme_vkrt.txt rename armorlab/plugins/{plugins.cpp => plugins.c} (82%) delete mode 100644 armorpaint/assets/readme/readme_android.txt delete mode 100644 armorpaint/assets/readme/readme_ios.txt delete mode 100644 armorpaint/assets/readme/readme_vr.txt create mode 100644 armorsculpt/assets/licenses/keepme.txt delete mode 100644 armorsculpt/assets/licenses/license.md delete mode 100644 armorsculpt/assets/plugins/hello_world.js create mode 100644 armorsculpt/assets/plugins/keepme.txt delete mode 100644 armorsculpt/assets/readme/readme_android.txt delete mode 100644 armorsculpt/assets/readme/readme_ios.txt create mode 100644 armorsculpt/plugins/plugins.c delete mode 100644 armorsculpt/plugins/plugins.cpp rename {armorforge => base}/assets/licenses/license.md (100%) rename {armorpaint => base}/assets/readme/readme_dxr.txt (100%) rename {armorpaint => base}/assets/readme/readme_vkrt.txt (100%) diff --git a/armorforge/assets/licenses/plugins/keepme.txt b/armorforge/assets/licenses/keepme.txt similarity index 100% rename from armorforge/assets/licenses/plugins/keepme.txt rename to armorforge/assets/licenses/keepme.txt diff --git a/armorforge/assets/plugins/hello_world.js b/armorforge/assets/plugins/hello_world.js deleted file mode 100644 index edf33d31..00000000 --- a/armorforge/assets/plugins/hello_world.js +++ /dev/null @@ -1,31 +0,0 @@ - -let plugin = plugin_create(); - -let h1 = zui_handle_create(); -let h2 = zui_handle_create(); -let h3 = zui_handle_create(); -let h4 = zui_handle_create(); -let h5 = zui_handle_create(); -let h6 = zui_handle_create(); -let h7 = zui_handle_create(); - -plugin.draw_ui = function(ui) { - if (zui_panel(h1, "My Plugin")) { - zui_text("Label"); - zui_text_input(h7, "Text Input"); - if (zui_button("Button")) { - console.error("Hello"); - } - zui_row([1/2, 1/2]); - zui_button("Button A"); - zui_button("Button B"); - zui_combo(h5, ["Item 1", "Item 2"], "Combo"); - zui_row([1/2, 1/2]); - zui_slider(h2, "Slider", 0, 1, true); - zui_slider(h3, "Slider", 0, 1, true); - zui_check(h4, "Check"); - zui_radio(h6, 0, "Radio 1"); - zui_radio(h6, 1, "Radio 2"); - zui_radio(h6, 2, "Radio 3"); - } -} diff --git a/armorsculpt/assets/licenses/plugins/keepme.txt b/armorforge/assets/plugins/keepme.txt similarity index 100% rename from armorsculpt/assets/licenses/plugins/keepme.txt rename to armorforge/assets/plugins/keepme.txt diff --git a/armorforge/assets/readme/readme.txt b/armorforge/assets/readme/readme.txt index a9269ee0..27668bcc 100644 --- a/armorforge/assets/readme/readme.txt +++ b/armorforge/assets/readme/readme.txt @@ -1,14 +1,14 @@ -Thank you for supporting ArmorSculpt! +Thank you for supporting ArmorForge! Quick start: -https://armorsculpt.org/manual +https://armorforge.org/manual ( - ( )\ ) ( ) - )\ ( ) ( (()/( ( )\ ( /( -((((_)( )( ( ( )( /(_)) ( ))\ ((_)` ) )\()) - )\ _ )\(()\ )\ ' )\ (()\ (_)) )\ /((_) _ /(/( (_))/ - (_)_\(_)((_) _((_)) ((_) ((_)/ __| ((_)(_))( | |((_)_\ | |_ - / _ \ | '_|| ' \()/ _ \| '_|\__ \/ _| | || || || '_ \)| _| - /_/ \_\|_| |_|_|_| \___/|_| |___/\__| \_,_||_|| .__/ \__| - |_| + ( )\ ) + )\ ( ) ( (()/( ( ( ( ( +((((_)( )( ( ( )( /(_)) ( )( )\))( ))\ + )\ _ )\(()\ )\ ' )\ (()\ (_))_| )\ (()\ ((_))\ /((_) + (_)_\(_)((_) _((_)) ((_) ((_)| |_ ((_) ((_) (()(_)(_)) + / _ \ | '_|| ' \()/ _ \| '_|| __|/ _ \| '_|/ _` | / -_) + /_/ \_\|_| |_|_|_| \___/|_| |_| \___/|_| \__, | \___| + |___/ diff --git a/armorforge/assets/readme/readme_android.txt b/armorforge/assets/readme/readme_android.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorforge/assets/readme/readme_android.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorforge/assets/readme/readme_ios.txt b/armorforge/assets/readme/readme_ios.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorforge/assets/readme/readme_ios.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorforge/plugins/plugins.c b/armorforge/plugins/plugins.c new file mode 100644 index 00000000..f4ed47c9 --- /dev/null +++ b/armorforge/plugins/plugins.c @@ -0,0 +1,8 @@ + +#include "../../../base/sources/plugin_api.h" + +void plugin_embed() { + JSValue global_obj = JS_GetGlobalObject(js_ctx); + + JS_FreeValue(js_ctx, global_obj); +} diff --git a/armorforge/plugins/plugins.cpp b/armorforge/plugins/plugins.cpp deleted file mode 100644 index f65c5faf..00000000 --- a/armorforge/plugins/plugins.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -void plugin_embed() { - -} diff --git a/armorforge/plugins/project.js b/armorforge/plugins/project.js index ee4349d3..9fbd9cd6 100644 --- a/armorforge/plugins/project.js +++ b/armorforge/plugins/project.js @@ -1,5 +1,5 @@ -let project = new Project('plugins'); +let project = new Project("plugins"); -project.addFile('sources/**'); +project.addFile("plugins.c"); return project; diff --git a/armorforge/project.js b/armorforge/project.js index 4e7fd01c..37314d2f 100644 --- a/armorforge/project.js +++ b/armorforge/project.js @@ -9,8 +9,9 @@ project.addDefine("is_forge"); project.addDefine("is_paint"); project.addProject("../base"); -project.addSources("../armorpaint/sources"); //// -project.addShaders("../armorpaint/shaders/*.glsl", { embed: flags.embed }); //// +project.addSources("../armorpaint/sources"); +project.addSources("../armorpaint/sources/nodes"); +project.addShaders("../armorpaint/shaders/*.glsl", { embed: flags.embed }); project.addSources("sources"); project.addSources("sources/nodes"); project.addShaders("shaders/*.glsl", { embed: flags.embed }); @@ -18,27 +19,8 @@ project.addAssets("assets/*", { destination: "data/{name}", embed: flags.embed } project.addAssets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); project.addAssets("assets/licenses/**", { destination: "data/licenses/{name}" }); project.addAssets("assets/plugins/*", { destination: "data/plugins/{name}" }); +project.addAssets("../armorpaint/assets/plugins/hello_world.js", { destination: "data/plugins/{name}" }); project.addAssets("assets/meshes/*", { destination: "data/meshes/{name}" }); project.addAssets("assets/readme/readme.txt", { destination: "{name}" }); -if (flags.android) { - project.addAssets("assets/readme/readme_android.txt", { destination: "{name}" }); -} -else if (flags.ios) { - project.addAssets("assets/readme/readme_ios.txt", { destination: "{name}" }); -} - -if (flags.physics) { - project.addDefine("arm_physics"); -} - -if (flags.raytrace) { - if (flags.d3d12) { - project.addAssets("assets/readme/readme_dxr.txt", { destination: "{name}" }); - } - else if (flags.vulkan) { - project.addAssets("assets/readme/readme_vkrt.txt", { destination: "{name}" }); - } -} - return project; diff --git a/armorforge/sources/tab_objects.ts b/armorforge/sources/tab_objects.ts index 9a08a2a4..ea47fa1e 100644 --- a/armorforge/sources/tab_objects.ts +++ b/armorforge/sources/tab_objects.ts @@ -3,13 +3,14 @@ let tab_objects_material_id: i32 = 0; let tab_objects_line_counter: i32 = 0; let tab_objects_current_object: object_t; -function tab_objects_roundfp(f: f32, precision: i32 = 2): f32 { - f *= math_pow(10, precision); - return math_round(f) / math_pow(10, precision); +function f32_to_string_prec(f: f32): string { + f = math_round(f); + return f + ""; } function tab_objects_import_mesh_done() { - object_set_parent(array_pop(project_paint_objects).base, null); + let mo: mesh_object_t = array_pop(project_paint_objects); + object_set_parent(mo.base, null); } function tab_objects_draw_menu(ui: zui_t) { @@ -100,7 +101,7 @@ function tab_objects_draw_list(ui: zui_t, list_handle: zui_handle_t, current_obj } if (b) { - let current_y = ui._y; + let current_y: i32 = ui._y; for (let i: i32 = 0; i < current_object.children.length; ++i) { let child: object_t = current_object.children[i]; // ui.indent(); @@ -131,7 +132,7 @@ function tab_objects_draw(htab: zui_handle_t) { outliner_handle.selected = true; } - if (zui_panel(outliner_handle, "Outliner")) { + if (zui_panel(outliner_handle, "Outliner", true, false)) { ui._y -= zui_ELEMENT_OFFSET(ui); tab_objects_line_counter = 0; @@ -147,7 +148,7 @@ function tab_objects_draw(htab: zui_handle_t) { properties_handle.selected = true; } - if (zui_panel(properties_handle, "Properties")) { + if (zui_panel(properties_handle, "Properties", true, false)) { if (context_raw.selected_object != null) { let h: zui_handle_t = zui_handle(__ID__); h.selected = context_raw.selected_object.visible; @@ -166,21 +167,21 @@ function tab_objects_draw(htab: zui_handle_t) { zui_text("Loc"); h = zui_handle(__ID__); - h.text = math_round(local_pos.x) + ""; + h.text = f32_to_string_prec(local_pos.x); f = parse_float(zui_text_input(h, "X")); if (h.changed) { local_pos.x = f; } h = zui_handle(__ID__); - h.text = math_round(local_pos.y) + ""; + h.text = f32_to_string_prec(local_pos.y); f = parse_float(zui_text_input(h, "Y")); if (h.changed) { local_pos.y = f; } h = zui_handle(__ID__); - h.text = math_round(local_pos.z) + ""; + h.text = f32_to_string_prec(local_pos.z); f = parse_float(zui_text_input(h, "Z")); if (h.changed) { local_pos.z = f; @@ -190,16 +191,16 @@ function tab_objects_draw(htab: zui_handle_t) { zui_text("Rotation"); h = zui_handle(__ID__); - h.text = math_round(rot.x) + ""; + h.text = f32_to_string_prec(rot.x); f = parse_float(zui_text_input(h, "X")); - let changed = false; + let changed: bool = false; if (h.changed) { changed = true; rot.x = f; } h = zui_handle(__ID__); - h.text = math_round(rot.y) + ""; + h.text = f32_to_string_prec(rot.y); f = parse_float(zui_text_input(h, "Y")); if (h.changed) { changed = true; @@ -207,7 +208,7 @@ function tab_objects_draw(htab: zui_handle_t) { } h = zui_handle(__ID__); - h.text = math_round(rot.z) + ""; + h.text = f32_to_string_prec(rot.z); f = parse_float(zui_text_input(h, "Z")); if (h.changed) { changed = true; @@ -227,21 +228,21 @@ function tab_objects_draw(htab: zui_handle_t) { zui_text("Scale"); h = zui_handle(__ID__); - h.text = math_round(scale.x) + ""; + h.text = f32_to_string_prec(scale.x); f = parse_float(zui_text_input(h, "X")); if (h.changed) { scale.x = f; } h = zui_handle(__ID__); - h.text = math_round(scale.y) + ""; + h.text = f32_to_string_prec(scale.y); f = parse_float(zui_text_input(h, "Y")); if (h.changed) { scale.y = f; } h = zui_handle(__ID__); - h.text = math_round(scale.z) + ""; + h.text = f32_to_string_prec(scale.z); f = parse_float(zui_text_input(h, "Z")); if (h.changed) { scale.z = f; @@ -251,21 +252,21 @@ function tab_objects_draw(htab: zui_handle_t) { zui_text("Dimensions"); h = zui_handle(__ID__); - h.text = math_round(dim.x) + ""; + h.text = f32_to_string_prec(dim.x); f = parse_float(zui_text_input(h, "X")); if (h.changed) { dim.x = f; } h = zui_handle(__ID__); - h.text = math_round(dim.y) + ""; + h.text = f32_to_string_prec(dim.y); f = parse_float(zui_text_input(h, "Y")); if (h.changed) { dim.y = f; } h = zui_handle(__ID__); - h.text = math_round(dim.z) + ""; + h.text = f32_to_string_prec(dim.z); f = parse_float(zui_text_input(h, "Z")); if (h.changed) { dim.z = f; @@ -274,7 +275,7 @@ function tab_objects_draw(htab: zui_handle_t) { context_raw.selected_object.transform.dirty = true; if (context_raw.selected_object.name == "Scene") { - let p = scene_world; + let p: world_data_t = scene_world; let p_handle: zui_handle_t = zui_handle(__ID__); if (p_handle.init) { @@ -284,14 +285,14 @@ function tab_objects_draw(htab: zui_handle_t) { p.strength = zui_slider(p_handle, "Environment", 0.0, 5.0, true); } else if (context_raw.selected_object.ext_type == "light_object_t") { - let light = context_raw.selected_object.ext; - let light_handle = zui_handle(__ID__); + let light: light_object_t = context_raw.selected_object.ext; + let light_handle: zui_handle_t = zui_handle(__ID__); light_handle.value = light.data.strength / 10; light.data.strength = zui_slider(light_handle, "Strength", 0.0, 5.0, true) * 10; } else if (context_raw.selected_object.ext_type == "camera_object_t") { - let cam = context_raw.selected_object.ext; - let fov_handle = zui_handle(__ID__); + let cam: camera_object_t = context_raw.selected_object.ext; + let fov_handle: zui_handle_t = zui_handle(__ID__); fov_handle.value = math_floor(cam.data.fov * 100) / 100; cam.data.fov = zui_slider(fov_handle, "FoV", 0.3, 2.0, true); if (fov_handle.changed) { diff --git a/armorlab/assets/export_presets/base_color.json b/armorlab/assets/export_presets/base_color.json deleted file mode 100644 index 540d7dd4..00000000 --- a/armorlab/assets/export_presets/base_color.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/generic.json b/armorlab/assets/export_presets/generic.json deleted file mode 100644 index 5f27f462..00000000 --- a/armorlab/assets/export_presets/generic.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" }, - { "name": "nor", "channels": ["nor_r", "nor_g", "nor_b", "1.0"], "color_space": "linear" }, - { "name": "occ", "channels": ["occ", "occ", "occ", "1.0"], "color_space": "linear" }, - { "name": "rough", "channels": ["rough", "rough", "rough", "1.0"], "color_space": "linear" }, - { "name": "height", "channels": ["height", "height", "height", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/minecraft_mer.json b/armorlab/assets/export_presets/minecraft_mer.json deleted file mode 100644 index 33a8e729..00000000 --- a/armorlab/assets/export_presets/minecraft_mer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "textures": [ - { "name": "", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" }, - { "name": "normal", "channels": ["nor_r", "nor_g", "nor_b", "1.0"], "color_space": "linear" }, - { "name": "mer", "channels": ["0.0", "emis", "rough", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/unigine.json b/armorlab/assets/export_presets/unigine.json deleted file mode 100644 index 02df221a..00000000 --- a/armorlab/assets/export_presets/unigine.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" }, - { "name": "nor", "channels": ["nor_r", "nor_g", "0.0", "1.0"], "color_space": "linear" }, - { "name": "sh", "channels": ["0.0", "rough", "0.0", "1.0"], "color_space": "linear" }, - { "name": "occ", "channels": ["occ", "0.0", "0.0", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/unity.json b/armorlab/assets/export_presets/unity.json deleted file mode 100644 index fa21a10a..00000000 --- a/armorlab/assets/export_presets/unity.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" }, - { "name": "nor", "channels": ["nor_r", "nor_g", "nor_b", "1.0"], "color_space": "linear" }, - { "name": "mos", "channels": ["0.0", "occ", "1.0", "smooth"], "color_space": "linear" }, - { "name": "height", "channels": ["0.0", "height", "0.0", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/unreal.json b/armorlab/assets/export_presets/unreal.json deleted file mode 100644 index 5423b382..00000000 --- a/armorlab/assets/export_presets/unreal.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "1.0"], "color_space": "linear" }, - { "name": "nor", "channels": ["nor_r", "nor_g_directx", "nor_b", "1.0"], "color_space": "linear" }, - { "name": "orm", "channels": ["occ", "rough", "0.0", "1.0"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/export_presets/xplane.json b/armorlab/assets/export_presets/xplane.json deleted file mode 100644 index cde16191..00000000 --- a/armorlab/assets/export_presets/xplane.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "textures": [ - { "name": "base", "channels": ["base_r", "base_g", "base_b", "opac"], "color_space": "linear" }, - { "name": "nor", "channels": ["nor_r", "nor_g", "metal", "smooth"], "color_space": "linear" } - ] -} diff --git a/armorlab/assets/licenses/license.md b/armorlab/assets/licenses/license.md deleted file mode 100644 index 27b5c072..00000000 --- a/armorlab/assets/licenses/license.md +++ /dev/null @@ -1,9 +0,0 @@ -# The zlib/libpng License - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -This notice may not be removed or altered from any source distribution. - -https://github.com/armory3d/armortools diff --git a/armorlab/assets/plugins/hello_node_brush.js b/armorlab/assets/plugins/hello_node_brush.js deleted file mode 100644 index 1e60cdf6..00000000 --- a/armorlab/assets/plugins/hello_node_brush.js +++ /dev/null @@ -1,58 +0,0 @@ - -let plugin = new arm.Plugin(); - -let categoryName = "My Nodes"; -let nodeName = "Hello World"; -let nodeType = "HELLO_WORLD"; - -// Create new node category -let categories = arm.NodesBrush.categories; -categories.push(categoryName); - -// Create new node -let nodes = [ - { - id: 0, - name: nodeName, - type: nodeType, - x: 0, - y: 0, - color: 0xffb34f5a, - inputs: [ - { - id: 0, - node_id: 0, - name: "Scale", - type: "VALUE", - color: 0xffa1a1a1, - default_value: 1.0, - min: 0.0, - max: 5.0 - } - ], - outputs: [ - { - id: 0, - node_id: 0, - name: "Value", - type: "VALUE", - color: 0xffc7c729, - default_value: 1.0 - } - ], - buttons: [] - } -]; -arm.NodesBrush.list.push(nodes); - -// Brush node -arm.Brush.customNodes.set(nodeType, function(node, from) { - return Math.sin(iron.Time.time() * node.inputs[0].get(0)); -}); - -// Cleanup -plugin.delete = function() { - arm.Brush.customNodes.delete(nodeType); - arm.NodesBrush.list.splice(arm.NodesBrush.list.indexOf(nodes), 1); - categories.splice(categories.indexOf(categoryName), 1); -}; diff --git a/armorlab/assets/plugins/hello_world.js b/armorlab/assets/plugins/hello_world.js deleted file mode 100644 index 10c69512..00000000 --- a/armorlab/assets/plugins/hello_world.js +++ /dev/null @@ -1,31 +0,0 @@ - -let plugin = new arm.Plugin(); - -let h1 = new zui.Handle(); -let h2 = new zui.Handle(); -let h3 = new zui.Handle(); -let h4 = new zui.Handle(); -let h5 = new zui.Handle(); -let h6 = new zui.Handle(); -let h7 = new zui.Handle(); - -plugin.drawUI = function(ui) { - if (Zui.panel(h1, "My Plugin")) { - Zui.text("Label"); - Zui.textInput(h7, "Text Input"); - if (Zui.button("Button")) { - console.error("Hello"); - } - Zui.row([1/2, 1/2]); - Zui.button("Button A"); - Zui.button("Button B"); - Zui.combo(h5, ["Item 1", "Item 2"], "Combo"); - Zui.row([1/2, 1/2]); - Zui.slider(h2, "Slider", 0, 1, true); - Zui.slider(h3, "Slider", 0, 1, true); - Zui.check(h4, "Check"); - Zui.radio(h6, 0, "Radio 1"); - Zui.radio(h6, 1, "Radio 2"); - Zui.radio(h6, 2, "Radio 3"); - } -} diff --git a/armorlab/assets/plugins/import_svg.js b/armorlab/assets/plugins/import_svg.js deleted file mode 100644 index 28d6f6be..00000000 --- a/armorlab/assets/plugins/import_svg.js +++ /dev/null @@ -1,37 +0,0 @@ - -let a = Krom_import_svg; -class R { - get buffer() { return Krom_import_svg._buffer(); } -} -let r = new R(); - -// import_svg.js -let import_svg = function(path, done) { - iron.Data.getBlob(path, function(b) { - let buf = new Uint8Array(r.buffer, a._init(b.byteLength + 1), b.byteLength + 1); - let bbuf = new Uint8Array(b); - for (let i = 0; i < b.byteLength; ++i) buf[i] = bbuf[i]; - buf[b.byteLength] = 0; - - a._parse(); - let w = a._get_pixels_w(); - let h = a._get_pixels_h(); - let pixels = r.buffer.slice(a._get_pixels(), a._get_pixels() + w * h * 4); - let image = core.Image.fromBytes(pixels, w, h); - done(image); - - a._destroy(); - iron.Data.deleteBlob(path); - }); -} - -let plugin = new arm.Plugin(); -let formats = arm.Path.textureFormats; -let importers = arm.Path.textureImporters; -formats.push("svg"); -importers.h["svg"] = import_svg; - -plugin.delete = function() { - formats.splice(formats.indexOf("svg"), 1); - importers.h["svg"] = null; -}; diff --git a/armorlab/assets/plugins/keepme.txt b/armorlab/assets/plugins/keepme.txt new file mode 100644 index 00000000..e69de29b diff --git a/armorlab/assets/readme/readme_android.txt b/armorlab/assets/readme/readme_android.txt deleted file mode 100644 index a105cccc..00000000 --- a/armorlab/assets/readme/readme_android.txt +++ /dev/null @@ -1,17 +0,0 @@ -! This is an experimental build for Android ! - -Recommended: -- Android: 10.0 or newer -- GPU: Adreno 530 / Mali T880MP12 or faster -- CPU: 64bit (arm64-v8a) - -Installation: -- Copy .apk file to Android device -- Open the .apk with file browser to install it -- Allow installing from unknown sources - -This build is only intended for testing and -may be sub-par in other areas compared to regular builds. - -Please report bugs at: -https://github.com/armory3d/armortools/issues diff --git a/armorlab/assets/readme/readme_dxr.txt b/armorlab/assets/readme/readme_dxr.txt deleted file mode 100644 index 6678626b..00000000 --- a/armorlab/assets/readme/readme_dxr.txt +++ /dev/null @@ -1,16 +0,0 @@ -! This is an experimental build with hardware accelerated ray-tracing using DXR and Direct3D12 ! - -Supported GPUs: -- NVIDIA RTX 20 Series or better -- AMD RX 6800 XT or better - -Up to date Windows 10/11 and graphics drivers required. - -Learn more: -https://en.wikipedia.org/wiki/DirectX_Raytracing - -This build is only intended for testing ray-tracing features and -may be sub-par in other areas compared to regular builds. - -Currently exposed ray-tracing features: -- Viewport Mode - Path-Trace diff --git a/armorlab/assets/readme/readme_ios.txt b/armorlab/assets/readme/readme_ios.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorlab/assets/readme/readme_ios.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorlab/assets/readme/readme_vkrt.txt b/armorlab/assets/readme/readme_vkrt.txt deleted file mode 100644 index 2bb85fee..00000000 --- a/armorlab/assets/readme/readme_vkrt.txt +++ /dev/null @@ -1,17 +0,0 @@ -! This is an experimental build with hardware accelerated ray-tracing powered by Vulkan Ray Tracing ! - -Supported GPUs: -- NVIDIA RTX 20 Series or better -- AMD RX 6800 XT or better - -Requires Vulkan driver 455.46.04 or newer on NVIDIA cards: -https://developer.nvidia.com/vulkan-driver - -Learn more: -https://www.khronos.org/blog/ray-tracing-in-vulkan - -This build is only intended for testing ray-tracing features and -may be sub-par in other areas compared to regular builds. - -Currently exposed ray-tracing features: -- Viewport Mode - Path-Trace diff --git a/armorlab/plugins/plugins.cpp b/armorlab/plugins/plugins.c similarity index 82% rename from armorlab/plugins/plugins.cpp rename to armorlab/plugins/plugins.c index 75561ea2..a2f64e70 100644 --- a/armorlab/plugins/plugins.cpp +++ b/armorlab/plugins/plugins.c @@ -1,6 +1,5 @@ -#include - +/* extern "C" { void texsynth_inpaint(int w, int h, void *output_ptr, void *image_ptr, void *mask_ptr, bool tiling); } @@ -21,11 +20,6 @@ namespace { } } -#define SET_FUNCTION(object, name, fn)\ - object->Set(String::NewFromUtf8(isolate, name).ToLocalChecked(),\ - FunctionTemplate::New(isolate, fn, Local(), Local(), 0,\ - v8::ConstructorBehavior::kThrow, v8::SideEffectType::kHasNoSideEffect, nullptr)) - void plugin_embed(Isolate *_isolate, Local global) { isolate = _isolate; Isolate::Scope isolate_scope(isolate); @@ -35,3 +29,12 @@ void plugin_embed(Isolate *_isolate, Local global) { SET_FUNCTION(krom_texsynth, "inpaint", krom_texsynth_inpaint); global->Set(String::NewFromUtf8(isolate, "Krom_texsynth").ToLocalChecked(), krom_texsynth); } +*/ + +#include "../../../base/sources/plugin_api.h" + +void plugin_embed() { + JSValue global_obj = JS_GetGlobalObject(js_ctx); + + JS_FreeValue(js_ctx, global_obj); +} diff --git a/armorlab/plugins/project.js b/armorlab/plugins/project.js index c1c8f3fd..8c532bfd 100644 --- a/armorlab/plugins/project.js +++ b/armorlab/plugins/project.js @@ -1,16 +1,15 @@ -let project = new Project('plugins'); +let project = new Project("plugins"); -project.addFile('sources/**'); +project.addFile("plugins.c"); -if (platform === Platform.Windows) { - project.addLib('sources/proc_texsynth/win32/texsynth'); +if (platform === "windows") { + project.addLib('proc_texsynth/win32/texsynth'); } -else if (platform === Platform.Linux) { - process.env.LIBRARY_PATH = project.basedir + "/sources/proc_texsynth/linux"; - project.addLib('texsynth'); +else if (platform === "linux") { + project.addLib("texsynth -L" + project.basedir + "/proc_texsynth/linux"); } -else if (platform === Platform.OSX) { - project.addLib('sources/proc_texsynth/macos/libtexsynth.a'); +else if (platform === "macos") { + project.addLib(project.basedir + '/proc_texsynth/macos/libtexsynth.a'); } return project; diff --git a/armorlab/project.js b/armorlab/project.js index ad8311be..60488ff7 100644 --- a/armorlab/project.js +++ b/armorlab/project.js @@ -12,36 +12,23 @@ project.addSources("sources"); project.addSources("sources/nodes"); project.addShaders("shaders/*.glsl", { embed: flags.embed }); project.addAssets("assets/*", { destination: "data/{name}", embed: flags.embed }); -project.addAssets("assets/export_presets/*", { destination: "data/export_presets/{name}" }); +project.addAssets("../armorpaint/assets/export_presets/*", { destination: "data/export_presets/{name}" }); project.addAssets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); project.addAssets("assets/licenses/**", { destination: "data/licenses/{name}" }); project.addAssets("assets/plugins/*", { destination: "data/plugins/{name}" }); +project.addAssets("../armorpaint/assets/plugins/hello_world.js", { destination: "data/plugins/{name}" }); +project.addAssets("../armorpaint/assets/plugins/hello_node_brush.js", { destination: "data/plugins/{name}" }); +project.addAssets("../armorpaint/assets/plugins/import_svg.js", { destination: "data/plugins/{name}" }); project.addAssets("assets/meshes/*", { destination: "data/meshes/{name}" }); project.addAssets("assets/models/*.onnx", { destination: "data/models/{name}" }); project.addAssets("assets/models/LICENSE.txt", { destination: "data/models/LICENSE.txt" }); project.addAssets("assets/readme/readme.txt", { destination: "{name}" }); -if (flags.android) { - project.addAssets("assets/readme/readme_android.txt", { destination: "{name}" }); -} -else if (flags.ios) { - project.addAssets("assets/readme/readme_ios.txt", { destination: "{name}" }); -} - -if (process.platform === "win32") { +if (platform === "win32") { project.addAssets("onnx/win32/*.dll", { destination: "{name}" }); } -else if (process.platform === "linux") { +else if (platform === "linux") { project.addAssets("onnx/linux/*.so.*", { destination: "{name}" }); // Versioned lib } -if (flags.raytrace) { - if (flags.d3d12) { - project.addAssets("assets/readme/readme_dxr.txt", { destination: "{name}" }); - } - else if (flags.vulkan) { - project.addAssets("assets/readme/readme_vkrt.txt", { destination: "{name}" }); - } -} - return project; diff --git a/armorpaint/assets/readme/readme_android.txt b/armorpaint/assets/readme/readme_android.txt deleted file mode 100644 index 6049a50e..00000000 --- a/armorpaint/assets/readme/readme_android.txt +++ /dev/null @@ -1,22 +0,0 @@ -! This is an experimental build for Android ! - -Recommended: -- Android: 10.0 or newer -- GPU: Adreno 530 / Mali T880MP12 or faster -- CPU: 64bit (arm64-v8a) - -Installation: -- Copy .apk file to Android device -- Open the .apk with file browser to install it -- Allow installing from unknown sources - -Controls: -- Paint with one finger, rotate and scroll with two fingers -- Support for pen with pressure sensitivity is included -- Support for mouse and keyboard is included - -This build is only intended for testing and -may be sub-par in other areas compared to regular builds. - -Please report bugs at: -https://github.com/armory3d/armortools/issues diff --git a/armorpaint/assets/readme/readme_ios.txt b/armorpaint/assets/readme/readme_ios.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorpaint/assets/readme/readme_ios.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorpaint/assets/readme/readme_vr.txt b/armorpaint/assets/readme/readme_vr.txt deleted file mode 100644 index c59a204e..00000000 --- a/armorpaint/assets/readme/readme_vr.txt +++ /dev/null @@ -1,13 +0,0 @@ -! This is an experimental build with with support for virtual reality headsets ! - -Supported headsets: -- Oculus Rift -- Oculus Quest via Oculus Link -- SteamVR support will be added in the future - -This build is only intended for testing VR features and -may be sub-par in other areas compared to regular builds. - -Currently exposed VR features: -- Preview the model in VR -- Painting the model in VR is planned but not yet present diff --git a/armorpaint/project.js b/armorpaint/project.js index b98f101e..19c575f9 100644 --- a/armorpaint/project.js +++ b/armorpaint/project.js @@ -18,25 +18,5 @@ project.addAssets("assets/plugins/*", { destination: "data/plugins/{name}" }); project.addAssets("assets/meshes/*", { destination: "data/meshes/{name}" }); project.addAssets("assets/readme/readme.txt", { destination: "{name}" }); -if (flags.android) { - project.addAssets("assets/readme/readme_android.txt", { destination: "{name}" }); -} -else if (flags.ios) { - project.addAssets("assets/readme/readme_ios.txt", { destination: "{name}" }); -} - -if (flags.physics) { - project.addDefine("arm_physics"); -} - -if (flags.raytrace) { - if (flags.d3d12) { - project.addAssets("assets/readme/readme_dxr.txt", { destination: "{name}" }); - } - else if (flags.vulkan) { - project.addAssets("assets/readme/readme_vkrt.txt", { destination: "{name}" }); - } -} - project.flatten(); return project; diff --git a/armorsculpt/assets/licenses/keepme.txt b/armorsculpt/assets/licenses/keepme.txt new file mode 100644 index 00000000..e69de29b diff --git a/armorsculpt/assets/licenses/license.md b/armorsculpt/assets/licenses/license.md deleted file mode 100644 index 27b5c072..00000000 --- a/armorsculpt/assets/licenses/license.md +++ /dev/null @@ -1,9 +0,0 @@ -# The zlib/libpng License - -This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: -The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -This notice may not be removed or altered from any source distribution. - -https://github.com/armory3d/armortools diff --git a/armorsculpt/assets/plugins/hello_world.js b/armorsculpt/assets/plugins/hello_world.js deleted file mode 100644 index a91f1fcf..00000000 --- a/armorsculpt/assets/plugins/hello_world.js +++ /dev/null @@ -1,31 +0,0 @@ - -let plugin = plugin_create(); - -let h1 = zui_handle_create(); -let h2 = zui_handle_create(); -let h3 = zui_handle_create(); -let h4 = zui_handle_create(); -let h5 = zui_handle_create(); -let h6 = zui_handle_create(); -let h7 = zui_handle_create(); - -plugin.draw_ui = function(ui) { - if (zui_panel(h1, "My Plugin")) { - zui_text("Label"); - zui_textInput(h7, "Text Input"); - if (zui_button("Button")) { - console.error("Hello"); - } - zui_row([1/2, 1/2]); - zui_button("Button A"); - zui_button("Button B"); - zui_combo(h5, ["Item 1", "Item 2"], "Combo"); - zui_row([1/2, 1/2]); - zui_slider(h2, "Slider", 0, 1, true); - zui_slider(h3, "Slider", 0, 1, true); - zui_check(h4, "Check"); - zui_radio(h6, 0, "Radio 1"); - zui_radio(h6, 1, "Radio 2"); - zui_radio(h6, 2, "Radio 3"); - } -} diff --git a/armorsculpt/assets/plugins/keepme.txt b/armorsculpt/assets/plugins/keepme.txt new file mode 100644 index 00000000..e69de29b diff --git a/armorsculpt/assets/readme/readme_android.txt b/armorsculpt/assets/readme/readme_android.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorsculpt/assets/readme/readme_android.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorsculpt/assets/readme/readme_ios.txt b/armorsculpt/assets/readme/readme_ios.txt deleted file mode 100644 index b0e2aa07..00000000 --- a/armorsculpt/assets/readme/readme_ios.txt +++ /dev/null @@ -1 +0,0 @@ -keepme diff --git a/armorsculpt/plugins/plugins.c b/armorsculpt/plugins/plugins.c new file mode 100644 index 00000000..f4ed47c9 --- /dev/null +++ b/armorsculpt/plugins/plugins.c @@ -0,0 +1,8 @@ + +#include "../../../base/sources/plugin_api.h" + +void plugin_embed() { + JSValue global_obj = JS_GetGlobalObject(js_ctx); + + JS_FreeValue(js_ctx, global_obj); +} diff --git a/armorsculpt/plugins/plugins.cpp b/armorsculpt/plugins/plugins.cpp deleted file mode 100644 index f65c5faf..00000000 --- a/armorsculpt/plugins/plugins.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -void plugin_embed() { - -} diff --git a/armorsculpt/plugins/project.js b/armorsculpt/plugins/project.js index ee4349d3..9fbd9cd6 100644 --- a/armorsculpt/plugins/project.js +++ b/armorsculpt/plugins/project.js @@ -1,5 +1,5 @@ -let project = new Project('plugins'); +let project = new Project("plugins"); -project.addFile('sources/**'); +project.addFile("plugins.c"); return project; diff --git a/armorsculpt/project.js b/armorsculpt/project.js index 0f584a71..ab31a585 100644 --- a/armorsculpt/project.js +++ b/armorsculpt/project.js @@ -7,7 +7,7 @@ let project = new Project(flags.name); project.addDefine("is_sculpt"); project.addProject("../base"); -project.addSources("../armorpaint/Sources"); //// +project.addSources("../armorpaint/sources"); project.addSources("sources"); project.addSources("sources/nodes"); project.addShaders("shaders/*.glsl", { embed: flags.embed }); @@ -15,18 +15,8 @@ project.addAssets("assets/*", { destination: "data/{name}", embed: flags.embed } project.addAssets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); project.addAssets("assets/licenses/**", { destination: "data/licenses/{name}" }); project.addAssets("assets/plugins/*", { destination: "data/plugins/{name}" }); +project.addAssets("../armorpaint/assets/plugins/hello_world.js", { destination: "data/plugins/{name}" }); project.addAssets("assets/meshes/*", { destination: "data/meshes/{name}" }); project.addAssets("assets/readme/readme.txt", { destination: "{name}" }); -if (flags.android) { - project.addAssets("assets/readme/readme_android.txt", { destination: "{name}" }); -} -else if (flags.ios) { - project.addAssets("assets/readme/readme_ios.txt", { destination: "{name}" }); -} - -if (flags.physics) { - project.addDefine("arm_physics"); -} - return project; diff --git a/armorforge/assets/licenses/license.md b/base/assets/licenses/license.md similarity index 100% rename from armorforge/assets/licenses/license.md rename to base/assets/licenses/license.md diff --git a/armorpaint/assets/readme/readme_dxr.txt b/base/assets/readme/readme_dxr.txt similarity index 100% rename from armorpaint/assets/readme/readme_dxr.txt rename to base/assets/readme/readme_dxr.txt diff --git a/armorpaint/assets/readme/readme_vkrt.txt b/base/assets/readme/readme_vkrt.txt similarity index 100% rename from armorpaint/assets/readme/readme_vkrt.txt rename to base/assets/readme/readme_vkrt.txt diff --git a/base/project.js b/base/project.js index 839d1edc..6b4105e8 100644 --- a/base/project.js +++ b/base/project.js @@ -80,6 +80,10 @@ else { project.addAssets("assets/extra/*", { destination: "data/{name}" }); } +if (flags.physics) { + project.addDefine("arm_physics"); +} + project.addDefine("arm_particles"); // project.addDefine("arm_skin"); // project.addDefine("arm_audio"); @@ -93,9 +97,11 @@ if (flags.raytrace) { if (flags.d3d12) { project.addAssets("shaders/raytrace/*.cso", { destination: "data/{name}", embed: flags.embed }); + project.addAssets("assets/readme/readme_dxr.txt", { destination: "{name}" }); } else if (flags.vulkan) { project.addAssets("shaders/raytrace/*.spirv", { destination: "data/{name}", embed: flags.embed }); + project.addAssets("assets/readme/readme_vkrt.txt", { destination: "{name}" }); } else if (flags.metal) { project.addAssets("shaders/raytrace/*.metal", { destination: "data/{name}", embed: flags.embed });