From 71c1ed2445348a17647e28fd58f26cad292c38cd Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sun, 12 May 2024 17:53:41 +0200 Subject: [PATCH 01/13] Fix #2325 Short plugin website URL dot dot dotting Make theme regex fix more clean and work on Chrome --- js/interface/themes.js | 9 ++------- js/plugin_loader.js | 7 ++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js/interface/themes.js b/js/interface/themes.js index 1560e7c75..3d2319ffe 100644 --- a/js/interface/themes.js +++ b/js/interface/themes.js @@ -435,13 +435,8 @@ const CustomTheme = { CustomTheme.updateColors(); }, loadThumbnailStyles() { - let split_regex; - try { - // Soft fail for iOS 16.3 and older - split_regex = eval('/(? 50) { + return url.substring(0, 50)+'...'; + } else { + return url; + } }, printDate(input_date) { return getDateDisplay(input_date).short; From d7dbc5de7a3f5b4d9df9991ff3b2dc063edc23bf Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sun, 12 May 2024 18:02:23 +0200 Subject: [PATCH 02/13] Update MolangJS to 1.6.4 --- lib/molang.umd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/molang.umd.js b/lib/molang.umd.js index 949704967..2543b3e96 100644 --- a/lib/molang.umd.js +++ b/lib/molang.umd.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Molang=t()}(this,(function(){"use strict";const e=e=>((e+180)%360+180)%360;var t={clamp:(e,t,r)=>(e>r&&(e=r),(ee+Math.random()*(t-e),randomInt:(e,t)=>(e=Math.ceil(e),t=Math.floor(t),e+Math.floor(Math.random()*(t-e+1))),dieRoll(e,t,r){e=this.clamp(e,0,1e9);let n=0;for(var a=0;ae+(t-e)*r,lerpRotate(t,r,n){let a=e(t),s=e(r);a>s&&([a,s]=[s,a]);var u=s-a;return u>180?e(s+n*(360-u)):a+n*u},inRange:(e,t,r)=>e<=r&&e>=t?1:0,all:(e,...t)=>-1===t.findIndex((t=>t!==e))?1:0,any:(e,...t)=>t.findIndex((t=>t==e))>=0?1:0,approxEq:(e,...t)=>-1===t.findIndex((t=>Math.abs(e-t)>1e-7))?1:0};return function(){const e=this;this.global_variables={},this.cache_enabled=!0,this.use_radians=!1,this.variables={},this.variableHandler=null;let r=!1,n=0,a={},s=0;function u(e){this.lines=[];for(let t of e){if(!t)continue;let e=M(t);if(this.lines.push(e),e instanceof f)break}}function i(e,t){this.iterations=M(e),this.body=M(t)}function c(e,t,r,n){this.operator=e,this.a=M(t),void 0!==r&&(this.b=M(r)),void 0!==n&&(this.c=M(n))}function l(e,t){this.query=e,this.args=t.map((e=>M(e)))}function o(e,t){this.value=M(t),this.name=w(e)}function f(e){this.value=M(e)}function h(){}function b(){}let d=()=>this.use_radians?1:Math.PI/180,g=/^-?\d+(\.\d+f?)?$/;function p(e){return g.test(e)}function w(e){if(e[1]!==v)return e;switch(e[0]){case"q":return"query"+e.substring(1);case"v":return"variable"+e.substring(1);case"t":return"temp"+e.substring(1);case"c":return"context"+e.substring(1);default:return e}}const m=/[&|<>=]/,y=/^(temp|variable|t|v)\.\w+=/,v=".";function M(e){if(!e)return 0;for(e.endsWith(";")&&(e=e.substring(0,e.length-1));x(e);)e=e.substr(1,e.length-2);if(p(e))return parseFloat(e);let t=R(e,";");if(t)return new u(t);if(e.startsWith("return"))return new f(e.substr(6));switch(e){case"true":return 1;case"false":return 0;case"break":return new h;case"continue":return new b}let r=-1!==e.indexOf("="),n=r&&e.length>4&&e.match(y);if(n&&"="!==e[n.index+n[0].length]){return new o(n[0].substring(0,n[0].length-1),e.substr(n.index+n[0].length))}let a=-1!==e.indexOf("?"),s=a&&q(e,"??",19);if(s)return s;let d=a&&W(e,"?");if(d){let e=W(d[1],":");return e&&e.length?new c(10,d[0],e[0],e[1]):new c(10,d[0],d[1],0)}if(s=m.test(e)&&(q(e,"&&",11)||q(e,"||",12)||r&&q(e,"==",17)||r&&q(e,"!=",18)||r&&q(e,"<=",14)||q(e,"<",13)||r&&q(e,">=",16)||q(e,">",15))||q(e,"+",1,!0)||function(e,t,r){let n=H(e,t);if(n)return 0===n[0].length?new c(r,0,n[1]):new c(r,n[0],n[1])}(e,"-",2)||q(e,"*",3)||q(e,"/",4,!0)||function(e){if(e.startsWith("!")&&e.length>1)return new c(5,e.substr(1),0)}(e),s instanceof c)return s;if(e.startsWith("math.")){if("math.pi"===e)return Math.PI;let t=e.indexOf("("),r=e.substr(5,t-5),n=e.substr(t+1,e.length-t-2),a=R(n,",");switch(a||(a=[n]),r){case"abs":return new c(100,a[0]);case"sin":return new c(101,a[0]);case"cos":return new c(102,a[0]);case"exp":return new c(103,a[0]);case"ln":return new c(104,a[0]);case"pow":return new c(105,a[0],a[1]);case"sqrt":return new c(106,a[0]);case"random":return new c(107,a[0],a[1]);case"ceil":return new c(108,a[0]);case"round":return new c(109,a[0]);case"trunc":return new c(110,a[0]);case"floor":return new c(111,a[0]);case"mod":return new c(112,a[0],a[1]);case"min":return new c(113,a[0],a[1]);case"max":return new c(114,a[0],a[1]);case"clamp":return new c(115,a[0],a[1],a[2]);case"lerp":return new c(116,a[0],a[1],a[2]);case"lerprotate":return new c(117,a[0],a[1],a[2]);case"asin":return new c(118,a[0]);case"acos":return new c(119,a[0]);case"atan":return new c(120,a[0]);case"atan2":return new c(121,a[0],a[1]);case"die_roll":return new c(122,a[0],a[1],a[2]);case"die_roll_integer":return new c(123,a[0],a[1],a[2]);case"hermite_blend":return new c(124,a[0]);case"random_integer":return new c(125,a[0],a[1])}}if(e.startsWith("loop(")){let t=R(e.substring(5,e.length-1),",");if(t)return new i(...t)}if(d=e.match(/[a-z0-9._]{2,}/g),d&&1===d.length&&d[0].length>=e.length-2)return w(e);if(e.includes("(")&&")"==e[e.length-1]){let t=e.search(/\(/),r=w(e.substr(0,t)),n=e.substr(t+1,e.length-t-2),a=R(n,",");return a||(a=[n]),new l(r,a)}return 0}function x(e){let t=e.startsWith(_)&&e.endsWith(k);if(t||e.startsWith(I)&&e.endsWith(O)){if(e.indexOf(t?k:O)===e.length-1)return!0;let r=0;for(let t=0;t=0;){switch(e[r]){case _:case I:n++;break;case k:case O:n--;break;default:if(!(0!==n||t[0]!==e[r]||1!==t.length&&t!==e.substr(r,t.length)||"-"===t&&!1!=="+*/<>=|&?:".includes(e[r-1])))return[e.substr(0,r),e.substr(r+t.length)]}r--}}function j(e,t,r){return"string"==typeof e&&"'"==e[0]||(e=E(e,r,!0)),"string"==typeof t&&"'"==t[0]||(t=E(t,r,!0)),e===t}function E(a,s,g){if("number"==typeof a)return a;if("string"==typeof a){let t=s[a];if(void 0===t&&"function"==typeof e.variableHandler&&(t=e.variableHandler(a,s)),"number"==typeof t)return t;if("string"==typeof t&&!g)return e.parse(t,s)||0;if(void 0===t)r=!0;else if("function"==typeof t)return t()||0;return t||0}if(void 0===a)return 0;switch(a.constructor){case c:switch(a.operator){case 1:return E(a.a,s)+E(a.b,s);case 2:return E(a.a,s)-E(a.b,s);case 3:return E(a.a,s)*E(a.b,s);case 4:return E(a.a,s)/E(a.b,s);case 5:return 0==E(a.a,s)?1:0;case 10:return E(a.a,s)?E(a.b,s):E(a.c,s);case 11:return E(a.a,s)&&E(a.b,s)?1:0;case 12:return E(a.a,s)||E(a.b,s)?1:0;case 13:return E(a.a,s)E(a.b,s)?1:0;case 16:return E(a.a,s)>=E(a.b,s)?1:0;case 17:return j(a.a,a.b,s)?1:0;case 18:return j(a.a,a.b,s)?0:1;case 19:r=!1;let e=E(a.a,s);return r?E(a.b,s):e;case 100:return Math.abs(E(a.a,s));case 101:return Math.sin(E(a.a,s)*d());case 102:return Math.cos(E(a.a,s)*d());case 103:return Math.exp(E(a.a,s));case 104:return Math.log(E(a.a,s));case 105:return Math.pow(E(a.a,s),E(a.b,s));case 106:return Math.sqrt(E(a.a,s));case 107:return t.random(E(a.a,s),E(a.b,s));case 108:return Math.ceil(E(a.a,s));case 109:return Math.round(E(a.a,s));case 110:return Math.trunc(E(a.a,s));case 111:return Math.floor(E(a.a,s));case 112:return E(a.a,s)%E(a.b,s);case 113:return Math.min(E(a.a,s),E(a.b,s));case 114:return Math.max(E(a.a,s),E(a.b,s));case 115:return t.clamp(E(a.a,s),E(a.b,s),E(a.c,s));case 116:return t.lerp(E(a.a,s),E(a.b,s),E(a.c,s));case 117:return t.lerpRotate(E(a.a,s),E(a.b,s),E(a.c,s));case 118:return Math.asin(E(a.a,s))/d();case 119:return Math.acos(E(a.a,s))/d();case 120:return Math.atan(E(a.a,s))/d();case 121:return Math.atan2(E(a.a,s),E(a.b,s))/d();case 122:return t.dieRoll(E(a.a,s),E(a.b,s),E(a.c,s));case 123:return t.dieRollInt(E(a.a,s),E(a.b,s),E(a.c,s));case 124:let n=E(a.a,s);return 3*Math.pow(n,2)-2*Math.pow(n,3);case 125:return t.randomInt(E(a.a,s),E(a.b,s))}break;case f:return n=1,E(a.value,s);case o:return s[a.name]=e.variables[a.name]=E(a.value,s),0;case l:let g=a.args.map((e=>E(e,s)));switch(a.query){case"query.in_range":return t.inRange(...g);case"query.all":return t.all(...g);case"query.any":return t.any(...g);case"query.approx_eq":return t.approxEq(...g)}return"function"==typeof s[a.query]?s[a.query](...g)||0:"function"==typeof e.variableHandler&&e.variableHandler(a.query,s,g)||0;case u:n=0;let p=0;for(let e of a.lines)if(p=E(e,s),n>0)break;return p;case i:let w=0,m=t.clamp(E(a.iterations,s),0,1024);for(let e=0;e{if("number"==typeof t)return t||0;if("string"!=typeof t||0===t.length)return 0;if(t.length<9&&p(t))return parseFloat(t);let u=this.cache_enabled&&a[t];return u||(u=M(t.toLowerCase().replace(/\s/g,"")),this.cache_enabled&&function(e,t){if(a[e]=t,s++,s>400){let e=Object.keys(a);for(let t=0;t<10;t++)delete a[e[t]];s-=10}}(t,u)),function(t,r){let a={};for(let t in e.global_variables)a[t]=e.global_variables[t];for(let t in e.variables)a[t]=e.variables[t];if(r)for(let e in r)a[e]=r[e];let s=E(t,a);return n=0,s}(u,r)||0},this.resetVariables=()=>{e.variables={}}}})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Molang=t()}(this,(function(){"use strict";const e=e=>((e+180)%360+180)%360;var t={clamp:(e,t,r)=>(e>r&&(e=r),(ee+Math.random()*(t-e),randomInt:(e,t)=>(e=Math.ceil(e),t=Math.floor(t),e+Math.floor(Math.random()*(t-e+1))),dieRoll(e,t,r){e=this.clamp(e,0,1e9);let n=0;for(var a=0;ae+(t-e)*r,lerpRotate(t,r,n){let a=e(t),s=e(r);a>s&&([a,s]=[s,a]);var u=s-a;return u>180?e(s+n*(360-u)):a+n*u},inRange:(e,t,r)=>e<=r&&e>=t?1:0,all:(e,...t)=>-1===t.findIndex((t=>t!==e))?1:0,any:(e,...t)=>t.findIndex((t=>t==e))>=0?1:0,approxEq:(e,...t)=>-1===t.findIndex((t=>Math.abs(e-t)>1e-7))?1:0};return function(){const e=this;this.global_variables={},this.cache_enabled=!0,this.use_radians=!1,this.variables={},this.variableHandler=null;let r=!1,n=0,a={},s=0;function u(e){this.lines=[];for(let t of e){if(!t)continue;let e=M(t);if(this.lines.push(e),e instanceof f)break}}function i(e,t){this.iterations=M(e),this.body=M(t)}function c(e,t,r,n){this.operator=e,this.a=M(t),void 0!==r&&(this.b=M(r)),void 0!==n&&(this.c=M(n))}function l(e,t){this.query=e,this.args=t.map((e=>M(e)))}function o(e,t){this.value=M(t),this.name=w(e)}function f(e){this.value=M(e)}function h(){}function b(){}let d=()=>this.use_radians?1:Math.PI/180,g=/^-?\d+(\.\d+f?)?$/;function p(e){return g.test(e)}function w(e){if(e[1]!==v)return e;switch(e[0]){case"q":return"query"+e.substring(1);case"v":return"variable"+e.substring(1);case"t":return"temp"+e.substring(1);case"c":return"context"+e.substring(1);default:return e}}const m=/[&|<>=]/,y=/^(temp|variable|t|v)\.\w+=/,v=".";function M(e){if(!e)return 0;for(e.endsWith(";")&&(e=e.substring(0,e.length-1));x(e);)e=e.substr(1,e.length-2);if(p(e))return parseFloat(e);let t=R(e,";");if(t)return new u(t);if(e.startsWith("return"))return new f(e.substr(6));switch(e){case"true":return 1;case"false":return 0;case"break":return new h;case"continue":return new b}let r=-1!==e.indexOf("="),n=r&&e.length>4&&e.match(y);if(n&&"="!==e[n.index+n[0].length]){return new o(n[0].substring(0,n[0].length-1),e.substr(n.index+n[0].length))}let a=-1!==e.indexOf("?"),s=a&&q(e,"??",19);if(s)return s;let d=a&&W(e,"?");if(d){let e=W(d[1],":");return e&&e.length?new c(10,d[0],e[0],e[1]):new c(10,d[0],d[1],0)}if(s=m.test(e)&&(q(e,"&&",11)||q(e,"||",12)||r&&q(e,"==",17)||r&&q(e,"!=",18)||r&&q(e,"<=",14)||q(e,"<",13)||r&&q(e,">=",16)||q(e,">",15))||q(e,"+",1,!0)||function(e,t,r){let n=H(e,t);if(n)return 0===n[0].length?new c(r,0,n[1]):new c(r,n[0],n[1])}(e,"-",2)||q(e,"*",3)||q(e,"/",4,!0)||function(e){if(e.startsWith("!")&&e.length>1)return new c(5,e.substr(1),0)}(e),s instanceof c)return s;if(e.startsWith("math.")){if("math.pi"===e)return Math.PI;let t=e.indexOf("("),r=e.substr(5,t-5),n=e.substr(t+1,e.length-t-2),a=R(n,",");switch(a||(a=[n]),r){case"abs":return new c(100,a[0]);case"sin":return new c(101,a[0]);case"cos":return new c(102,a[0]);case"exp":return new c(103,a[0]);case"ln":return new c(104,a[0]);case"pow":return new c(105,a[0],a[1]);case"sqrt":return new c(106,a[0]);case"random":return new c(107,a[0],a[1]);case"ceil":return new c(108,a[0]);case"round":return new c(109,a[0]);case"trunc":return new c(110,a[0]);case"floor":return new c(111,a[0]);case"mod":return new c(112,a[0],a[1]);case"min":return new c(113,a[0],a[1]);case"max":return new c(114,a[0],a[1]);case"clamp":return new c(115,a[0],a[1],a[2]);case"lerp":return new c(116,a[0],a[1],a[2]);case"lerprotate":return new c(117,a[0],a[1],a[2]);case"asin":return new c(118,a[0]);case"acos":return new c(119,a[0]);case"atan":return new c(120,a[0]);case"atan2":return new c(121,a[0],a[1]);case"die_roll":return new c(122,a[0],a[1],a[2]);case"die_roll_integer":return new c(123,a[0],a[1],a[2]);case"hermite_blend":return new c(124,a[0]);case"random_integer":return new c(125,a[0],a[1])}}if(e.startsWith("loop(")){let t=R(e.substring(5,e.length-1),",");if(t)return new i(...t)}if(d=e.match(/[a-z0-9._]{2,}/g),d&&1===d.length&&d[0].length>=e.length-2)return w(e);if(e.includes("(")&&")"==e[e.length-1]){let t=e.search(/\(/),r=w(e.substr(0,t)),n=e.substr(t+1,e.length-t-2),a=R(n,",");return a||(a=[n]),new l(r,a)}return 0}function x(e){let t=e.startsWith(_)&&e.endsWith(k);if(t||e.startsWith(I)&&e.endsWith(O)){if(e.indexOf(t?k:O)===e.length-1)return!0;let r=0;for(let t=0;t=0;){switch(e[r]){case _:case I:n++;break;case k:case O:n--;break;default:if(!(0!==n||t[0]!==e[r]||1!==t.length&&t!==e.substr(r,t.length)||"-"===t&&!1!=="+*/<>=|&?:".includes(e[r-1])))return[e.substr(0,r),e.substr(r+t.length)]}r--}}function j(e,t,r){return"string"==typeof e&&"'"==e[0]||(e=E(e,r,!0)),"string"==typeof t&&"'"==t[0]||(t=E(t,r,!0)),e===t}function E(a,s,g){if("number"==typeof a)return a;if("string"==typeof a){let t=s[a];if(void 0===t&&"function"==typeof e.variableHandler&&(t=e.variableHandler(a,s)),"number"==typeof t)return t;if("string"==typeof t&&!g)return e.parse(t,s)||0;if(void 0===t)r=!0;else if("function"==typeof t)return t()||0;return t||0}if(void 0===a)return 0;switch(a.constructor){case c:switch(a.operator){case 1:return E(a.a,s)+E(a.b,s);case 2:return E(a.a,s)-E(a.b,s);case 3:return E(a.a,s)*E(a.b,s);case 4:return E(a.a,s)/E(a.b,s);case 5:return 0==E(a.a,s)?1:0;case 10:return E(a.a,s)?E(a.b,s):E(a.c,s);case 11:return E(a.a,s)&&E(a.b,s)?1:0;case 12:return E(a.a,s)||E(a.b,s)?1:0;case 13:return E(a.a,s)E(a.b,s)?1:0;case 16:return E(a.a,s)>=E(a.b,s)?1:0;case 17:return j(a.a,a.b,s)?1:0;case 18:return j(a.a,a.b,s)?0:1;case 19:r=!1;let e=E(a.a,s);return r?E(a.b,s):e;case 100:return Math.abs(E(a.a,s));case 101:return Math.sin(E(a.a,s)*d());case 102:return Math.cos(E(a.a,s)*d());case 103:return Math.exp(E(a.a,s));case 104:return Math.log(E(a.a,s));case 105:return E(a.a,s)**E(a.b,s);case 106:return Math.sqrt(E(a.a,s));case 107:return t.random(E(a.a,s),E(a.b,s));case 108:return Math.ceil(E(a.a,s));case 109:return Math.round(E(a.a,s));case 110:return Math.trunc(E(a.a,s));case 111:return Math.floor(E(a.a,s));case 112:return E(a.a,s)%E(a.b,s);case 113:return Math.min(E(a.a,s),E(a.b,s));case 114:return Math.max(E(a.a,s),E(a.b,s));case 115:return t.clamp(E(a.a,s),E(a.b,s),E(a.c,s));case 116:return t.lerp(E(a.a,s),E(a.b,s),E(a.c,s));case 117:return t.lerpRotate(E(a.a,s),E(a.b,s),E(a.c,s));case 118:return Math.asin(E(a.a,s))/d();case 119:return Math.acos(E(a.a,s))/d();case 120:return Math.atan(E(a.a,s))/d();case 121:return Math.atan2(E(a.a,s),E(a.b,s))/d();case 122:return t.dieRoll(E(a.a,s),E(a.b,s),E(a.c,s));case 123:return t.dieRollInt(E(a.a,s),E(a.b,s),E(a.c,s));case 124:let n=E(a.a,s);return 3*n**2-2*n**3;case 125:return t.randomInt(E(a.a,s),E(a.b,s))}break;case f:return n=1,E(a.value,s);case o:return s[a.name]=e.variables[a.name]=E(a.value,s),0;case l:let g=a.args.map((e=>E(e,s)));switch(a.query){case"query.in_range":return t.inRange(...g);case"query.all":return t.all(...g);case"query.any":return t.any(...g);case"query.approx_eq":return t.approxEq(...g)}return"function"==typeof s[a.query]?s[a.query](...g)||0:"function"==typeof e.variableHandler&&e.variableHandler(a.query,s,g)||0;case u:n=0;let p=0;for(let e of a.lines)if(p=E(e,s),n>0)break;return p;case i:let w=0,m=t.clamp(E(a.iterations,s),0,1024);for(let e=0;e{if("number"==typeof t)return t||0;if("string"!=typeof t||0===t.length)return 0;if(t.length<9&&p(t))return parseFloat(t);let u=this.cache_enabled&&a[t];return u||(u=M(t.toLowerCase().replace(/\s/g,"")),this.cache_enabled&&function(e,t){if(a[e]=t,s++,s>400){let e=Object.keys(a);for(let t=0;t<10;t++)delete a[e[t]];s-=10}}(t,u)),function(t,r){let a={};for(let t in e.global_variables)a[t]=e.global_variables[t];for(let t in e.variables)a[t]=e.variables[t];if(r)for(let e in r)a[e]=r[e];let s=E(t,a);return n=0,s}(u,r)||0},this.resetVariables=()=>{e.variables={}}}})); From be5a2082f6ef31678b61d6d5e07d31c3c6cd03b2 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sun, 12 May 2024 18:18:14 +0200 Subject: [PATCH 03/13] Fix animation playback speed not working when recording GIF --- js/preview/screenshot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/preview/screenshot.js b/js/preview/screenshot.js index ecd89f8ac..00a91b286 100644 --- a/js/preview/screenshot.js +++ b/js/preview/screenshot.js @@ -562,7 +562,7 @@ const Screencam = { vars.recording = true; vars.loop = setInterval(() => { if (vars.animation && options.play) { - Timeline.setTime(vars.interval*vars.frames / 1000); + Timeline.setTime((Timeline.playback_speed/100) * vars.interval*vars.frames / 1000); Animator.preview(true); } vars.frames++; From bc9ac15106adc86afb54ff12ac3051467789e48a Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 12:53:44 +0200 Subject: [PATCH 04/13] Fix programmatically setting form value in dialog causing update --- js/interface/dialog.js | 2 +- js/interface/interface.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/interface/dialog.js b/js/interface/dialog.js index 8938f29cb..e7b1a1f51 100644 --- a/js/interface/dialog.js +++ b/js/interface/dialog.js @@ -128,7 +128,7 @@ function buildForm(dialog) { let select_input = new Interface.CustomElements.SelectInput(form_id, { options: data.options, value: data.value || data.default, - onChange() { + onInput() { dialog.updateFormValues(); } }); diff --git a/js/interface/interface.js b/js/interface/interface.js index ccad0a47a..aa344f6d2 100644 --- a/js/interface/interface.js +++ b/js/interface/interface.js @@ -756,7 +756,7 @@ Interface.CustomElements.SelectInput = function(id, data) { let options = typeof data.options == 'function' ? data.options() : data.options; let value = data.value || data.default || Object.keys(options)[0]; let select = Interface.createElement('bb-select', {id, class: 'half', value: value}, getNameFor(options[value])); - function setKey(key, options) { + function setKey(key, options, input_event) { if (!options) { options = typeof data.options == 'function' ? data.options() : data.options; } @@ -766,6 +766,9 @@ Interface.CustomElements.SelectInput = function(id, data) { if (typeof data.onChange == 'function') { data.onChange(value); } + if (input_event && typeof data.onInput == 'function') { + data.onInput(value, input_event); + } } select.addEventListener('click', function(event) { if (Menu.closed_in_this_click == id) return this; @@ -780,7 +783,7 @@ Interface.CustomElements.SelectInput = function(id, data) { color: val.color, condition: val.condition, click: (e) => { - setKey(key, options); + setKey(key, options, e); } }) } From 700cff7e07d7807712edc4206f86510941551535 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 18:30:43 +0200 Subject: [PATCH 05/13] OptiFine JEM texturing improvements --- js/outliner/group.js | 23 +++++++++++------------ js/texturing/textures.js | 2 +- js/undo.js | 3 +++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/js/outliner/group.js b/js/outliner/group.js index 855ccc885..1505e8965 100644 --- a/js/outliner/group.js +++ b/js/outliner/group.js @@ -454,14 +454,18 @@ class Group extends OutlinerNode { }}) }}, {name: 'menu.cube.texture', icon: 'collections', condition: () => Format.per_group_texture, children() { + function applyTexture(texture_value, undo_message) { + let affected_groups = Group.all.filter(g => g.selected); + Undo.initEdit({outliner: true}); + for (let group of affected_groups) { + group.texture = texture_value; + } + Undo.finishEdit(undo_message); + Canvas.updateAllFaces(); + } let arr = [ {icon: 'crop_square', name: Format.single_texture_default ? 'menu.cube.texture.default' : 'menu.cube.texture.blank', click(group) { - Undo.initEdit({group: group}); - group.texture = ''; - Undo.finishEdit('Unassign texture from group'); - group.forEachChild(child => { - if (child.preview_controller?.updateFaces) child.preview_controller.updateFaces(child); - }) + applyTexture('', 'Unassign texture from group'); }} ] Texture.all.forEach(t => { @@ -469,12 +473,7 @@ class Group extends OutlinerNode { name: t.name, icon: (t.mode === 'link' ? t.img : t.source), click(group) { - Undo.initEdit({group: group}); - group.texture = t.uuid; - Undo.finishEdit('Apply texture to group'); - group.forEachChild(child => { - if (child.preview_controller?.updateFaces) child.preview_controller.updateFaces(child); - }) + applyTexture(t.uuid, 'Apply texture to group'); } }) }) diff --git a/js/texturing/textures.js b/js/texturing/textures.js index 2a47bddad..0e806a9fd 100644 --- a/js/texturing/textures.js +++ b/js/texturing/textures.js @@ -1030,7 +1030,7 @@ class Texture { } }); groups = groups.filter(g => g instanceof Group); - let affected_elements = []; + affected_elements = []; Undo.initEdit({outliner: true}); groups.forEach(group => { group.texture = this.uuid; diff --git a/js/undo.js b/js/undo.js index b69d784df..a8d77fb62 100644 --- a/js/undo.js +++ b/js/undo.js @@ -539,6 +539,9 @@ class UndoSystem { if ((save.outliner || save.group) && Format.bone_rig) { Canvas.updateAllBones(); } + if (save.outliner && Format.per_group_texture) { + Canvas.updateAllFaces(); + } if (Modes.animate) { Animator.preview(); } From c90267df7bd426e4ea6c31c9e02b6034ec76ef0f Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 18:42:27 +0200 Subject: [PATCH 06/13] Fix elements remaining when undoing importing skin project --- js/io/formats/bbmodel.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/io/formats/bbmodel.js b/js/io/formats/bbmodel.js index c1b86635d..a3e03e686 100644 --- a/js/io/formats/bbmodel.js +++ b/js/io/formats/bbmodel.js @@ -538,7 +538,11 @@ var codec = new Codec('project', { } if (model.skin_model) { + let elements_before = Outliner.elements.slice(); Codecs.skin_model.rebuild(model.skin_model); + for (let element of Outliner.elements) { + if (!elements_before.includes(element)) new_elements.push(element); + } } let adjust_uv = !Format.per_texture_uv_size || !imported_format?.per_texture_uv_size; if (model.elements) { From a5efa1c578b8f268add966390571e362b22cc31c Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 18:48:26 +0200 Subject: [PATCH 07/13] Revert default rotation space to local Fix theme thumbnail compatibility issue with older browsers --- js/interface/themes.js | 2 +- js/modeling/transform.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/interface/themes.js b/js/interface/themes.js index 3d2319ffe..1c56c7e51 100644 --- a/js/interface/themes.js +++ b/js/interface/themes.js @@ -492,7 +492,7 @@ const CustomTheme = { } } Merge.string(app, theme, 'css'); - theme.thumbnail ??= ''; + if (!theme.thumbnail) theme.thumbnail = ''; Merge.string(app, theme, 'thumbnail'); this.updateColors(); this.updateSettings(); diff --git a/js/modeling/transform.js b/js/modeling/transform.js index c9a48e517..b97e22d2c 100644 --- a/js/modeling/transform.js +++ b/js/modeling/transform.js @@ -909,7 +909,7 @@ BARS.defineActions(function() { new BarSelect('rotation_space', { condition: {modes: ['edit', 'animate', 'pose'], tools: ['rotate_tool']}, category: 'transform', - value: 'parent', + value: 'local', options: { global: 'action.transform_space.global', parent: 'action.transform_space.parent', From a14448bf88bb0986c12195c6a0640b1558e8cf2b Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 19:04:13 +0200 Subject: [PATCH 08/13] Fix overlapping issue with new mobile menu bar --- css/window.css | 5 +++++ js/interface/menu.js | 32 ++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/css/window.css b/css/window.css index aebd97f25..213e911ad 100644 --- a/css/window.css +++ b/css/window.css @@ -660,6 +660,11 @@ color: var(--color-bright_ui_text); opacity: 0.8; } + @media (max-height: 400px) { + #mobile_menu_bar { + top: 0; + } + } /* Tab Bar */ #tab_bar { diff --git a/js/interface/menu.js b/js/interface/menu.js index 9b5d9ab08..d843b0dd8 100644 --- a/js/interface/menu.js +++ b/js/interface/menu.js @@ -16,10 +16,14 @@ function handleMenuOverflow(node) { function offset(amount) { let top = parseInt(node.style.top); let offset = top - $(node).offset().top; + let top_gap = 26; + if (Blockbench.isMobile && Menu.open instanceof BarMenu) { + top_gap = window.innerHeight > 400 ? 106 : 56; + } top = Math.clamp( top + amount, window.innerHeight - node.clientHeight + offset, - offset + 26 + offset + top_gap ); node.style.top = `${top}px`; } @@ -100,17 +104,21 @@ class Menu { } } - let window_height = window.innerHeight - 26; + let top_gap = 26; + if (Blockbench.isMobile && this instanceof BarMenu) { + top_gap = window.innerHeight > 400 ? 106 : 56; + } + let window_height = window.innerHeight - top_gap; if (el_height > window_height) { childlist.css('margin-top', '0').css('top', '0') - childlist.css('top', (-childlist.offset().top + 26) + 'px') + childlist.css('top', (-childlist.offset().top + top_gap) + 'px') handleMenuOverflow(childlist); } else if (offset.top + el_height > window_height) { - childlist.css('margin-top', 26-childlist.height() + 'px') - if (childlist.offset().top < 26) { - childlist.offset({top: 26}) + childlist.css('margin-top', top_gap-childlist.height() + 'px') + if (childlist.offset().top < top_gap) { + childlist.offset({top: top_gap}) } } } @@ -510,9 +518,13 @@ class Menu { let content_list = typeof this.structure == 'function' ? this.structure(context) : this.structure; populateList(content_list, ctxmenu, this.options.searchable); - var el_width = ctxmenu.width() - var el_height = ctxmenu.height() - let window_height = window.innerHeight - 26; + let el_width = ctxmenu.width() + let el_height = ctxmenu.height() + let top_gap = 26; + if (Blockbench.isMobile && this instanceof BarMenu) { + top_gap = window.innerHeight > 400 ? 106 : 56; + } + let window_height = window.innerHeight - top_gap; if (position && position.clientX !== undefined) { var offset_left = position.clientX @@ -553,7 +565,7 @@ class Menu { offset_top = window_height - el_height; } } - offset_top = Math.max(offset_top, 26); + offset_top = Math.max(offset_top, top_gap); ctxmenu.css('left', offset_left+'px') ctxmenu.css('top', offset_top +'px') From 2aea22ed1f4c066490821810d61124d49aab4cb6 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 19:22:42 +0200 Subject: [PATCH 09/13] Fix dialog form updating issue --- js/interface/interface.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/interface/interface.js b/js/interface/interface.js index aa344f6d2..d01cdbea2 100644 --- a/js/interface/interface.js +++ b/js/interface/interface.js @@ -782,8 +782,8 @@ Interface.CustomElements.SelectInput = function(id, data) { icon: val.icon || ((value == key) ? 'far.fa-dot-circle' : 'far.fa-circle'), color: val.color, condition: val.condition, - click: (e) => { - setKey(key, options, e); + click: (context, event) => { + setKey(key, options, event || 1); } }) } From 4916595702b553721fb2215b884fed1b64f80af3 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 19:39:42 +0200 Subject: [PATCH 10/13] Fix grainy face on mesh when UV scale is 0 --- js/outliner/mesh.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/outliner/mesh.js b/js/outliner/mesh.js index fcc7c35a9..3d471b5f5 100644 --- a/js/outliner/mesh.js +++ b/js/outliner/mesh.js @@ -1153,12 +1153,19 @@ new NodePreviewController(Mesh, { ? [tex.getUVWidth(), tex.getUVHeight()] : [Project.texture_width, Project.texture_height]; + let first_values; face.vertices.forEach((key, i) => { let u = (face.uv[key] ? face.uv[key][0] : 0) / uv_size[0]; let v = (face.uv[key] ? face.uv[key][1] : 0) / uv_size[1]; if (stretch > 1) { v = (v + frame) / stretch; } + // Fix grainy visuals when UV all in one point + if (!first_values) { + first_values = [u, v]; + } else if (first_values[0] == u && first_values[1] == v) { + i < 2 ? u += 0.00005 : v += 0.00005; + } uv_array.push(u, 1-v); }) } From 96d63f74aa809aa322e1fc4cc4281358fee7a2df Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 19:45:27 +0200 Subject: [PATCH 11/13] Update lang files --- lang/cz.json | 2 +- lang/de.json | 2 +- lang/es.json | 2 +- lang/fr.json | 2 +- lang/it.json | 2 +- lang/ja.json | 2 +- lang/ko.json | 2 +- lang/nl.json | 2 +- lang/pl.json | 2 +- lang/pt.json | 2 +- lang/ru.json | 2 +- lang/sv.json | 2 +- lang/uk.json | 2 +- lang/vi.json | 2 +- lang/zh.json | 2 +- lang/zh_tw.json | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lang/cz.json b/lang/cz.json index ef242c0ba..8afd241f2 100644 --- a/lang/cz.json +++ b/lang/cz.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/de.json b/lang/de.json index 405775e7a..0eec9134d 100644 --- a/lang/de.json +++ b/lang/de.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Einzelbild hinzufügen", "dialog.animated_texture_editor.resize_frames": "Bildgröße ändern...", "dialog.animated_texture_editor.apply": "Anwenden", - "dialog.add_primitive.shape.rounded_cuboid": "Quader mit Kanten", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Kantenbreite", "dialog.change_animation_speed.speed": "Geschwindigkeit", "dialog.change_animation_speed.adjust_snapping": "Einrastintervall anpassen", diff --git a/lang/es.json b/lang/es.json index 18e534c7e..55aa09b24 100644 --- a/lang/es.json +++ b/lang/es.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/fr.json b/lang/fr.json index 69da880b9..e2dc207a6 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/it.json b/lang/it.json index b1dbc9bd8..a14d38c57 100644 --- a/lang/it.json +++ b/lang/it.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/ja.json b/lang/ja.json index 4928bcce8..f5a338bf2 100644 --- a/lang/ja.json +++ b/lang/ja.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/ko.json b/lang/ko.json index d95e068f4..b25129f4c 100644 --- a/lang/ko.json +++ b/lang/ko.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/nl.json b/lang/nl.json index 271cbe95a..6a750699b 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/pl.json b/lang/pl.json index eb2029a20..86fd91f10 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/pt.json b/lang/pt.json index caa7d5b3b..bbe5f975e 100644 --- a/lang/pt.json +++ b/lang/pt.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/ru.json b/lang/ru.json index f5b926ae5..ee4945eb4 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/sv.json b/lang/sv.json index ab379c2b0..68ae8f984 100644 --- a/lang/sv.json +++ b/lang/sv.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/uk.json b/lang/uk.json index 7b1176581..301ec9805 100644 --- a/lang/uk.json +++ b/lang/uk.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/vi.json b/lang/vi.json index 19f16c5ee..11d95f261 100644 --- a/lang/vi.json +++ b/lang/vi.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/zh.json b/lang/zh.json index 6d70a6b3f..3370fa8e2 100644 --- a/lang/zh.json +++ b/lang/zh.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", diff --git a/lang/zh_tw.json b/lang/zh_tw.json index b9fb6c684..254ea05a8 100644 --- a/lang/zh_tw.json +++ b/lang/zh_tw.json @@ -2081,7 +2081,7 @@ "dialog.animated_texture_editor.add_frame": "Add Frame", "dialog.animated_texture_editor.resize_frames": "Resize Frames...", "dialog.animated_texture_editor.apply": "Apply", - "dialog.add_primitive.shape.rounded_cuboid": "Cuboid with Edges", + "dialog.add_primitive.shape.beveled_cuboid": "Beveled Cuboid", "dialog.add_primitive.edge_size": "Edge Size", "dialog.change_animation_speed.speed": "Speed", "dialog.change_animation_speed.adjust_snapping": "Adjust Snapping", From 0ec8af0a822799f91c94c0f08203e509e7cdafac Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 20:13:33 +0200 Subject: [PATCH 12/13] Let applying texture to mesh from viewport context menu apply to only selected faces --- js/outliner/mesh.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/js/outliner/mesh.js b/js/outliner/mesh.js index 3d471b5f5..11975006a 100644 --- a/js/outliner/mesh.js +++ b/js/outliner/mesh.js @@ -817,7 +817,7 @@ class Mesh extends OutlinerElement { var scope = this; if (faces === true) { var sides = Object.keys(this.faces); - } else if (faces === undefined) { + } else if (!faces) { var sides = this.getSelectedFaces() } else { var sides = faces @@ -872,21 +872,23 @@ class Mesh extends OutlinerElement { } }}) }}, - {name: 'menu.cube.texture', icon: 'collections', condition: () => !Format.single_texture, children: function() { + {name: 'menu.cube.texture', icon: 'collections', condition: () => !Format.single_texture, children() { var arr = [ - {icon: 'crop_square', name: Format.single_texture_default ? 'menu.cube.texture.default' : 'menu.cube.texture.blank', click: function(cube) { - cube.forSelected(function(obj) { - obj.applyTexture(false, true) + {icon: 'crop_square', name: Format.single_texture_default ? 'menu.cube.texture.default' : 'menu.cube.texture.blank', click(mesh) { + let all_faces = BarItems.selection_mode.value != 'face' || Mesh.selected[0]?.getSelectedFaces().length == 0; + mesh.forSelected((obj) => { + obj.applyTexture(false, all_faces) }, 'texture blank') }} ] - Texture.all.forEach(function(t) { + Texture.all.forEach((t) => { arr.push({ name: t.name, icon: (t.mode === 'link' ? t.img : t.source), - click: function(cube) { - cube.forSelected(function(obj) { - obj.applyTexture(t, true) + click(mesh) { + let all_faces = BarItems.selection_mode.value != 'face' || Mesh.selected[0]?.getSelectedFaces().length == 0; + mesh.forSelected((obj) => { + obj.applyTexture(t, all_faces) }, 'apply texture') } }) From eebfed9cdb94b2fbd1dd19e9afdb8025271e293a Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Mon, 13 May 2024 21:28:53 +0200 Subject: [PATCH 13/13] v1.10.1 [ci-build] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb8cbde79..7f01822f5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Blockbench", "description": "Low-poly modeling and animation software", - "version": "4.10.0", + "version": "4.10.1", "license": "GPL-3.0-or-later", "author": { "name": "JannisX11",