From 4a96906002eadf84e7a4cdd364fcbf6ddc4036e5 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Sat, 18 Jan 2025 19:09:32 +0800 Subject: [PATCH] feat: update BME prototypes - update BMe prototypes. add chris suggested component for future changes. - add new 2 custom function in BME environment. --- bbp_ng/UTIL_bme.py | 23 +++++++++++++++++++++++ bbp_ng/raw_jsons/chris_vanilla.json | Bin 0 -> 13019 bytes bbp_ng/raw_jsons/sides.json | Bin 5155 -> 9248 bytes 3 files changed, 23 insertions(+) create mode 100644 bbp_ng/raw_jsons/chris_vanilla.json diff --git a/bbp_ng/UTIL_bme.py b/bbp_ng/UTIL_bme.py index c0ccf39..a266385 100644 --- a/bbp_ng/UTIL_bme.py +++ b/bbp_ng/UTIL_bme.py @@ -88,6 +88,25 @@ def _get_prototype_by_identifier(ident: str) -> dict[str, typing.Any]: #region Programmable Field Calc +def _env_fct_distance(x1: float, y1: float, x2: float, y2: float) -> float: + diff = mathutils.Vector((x2, y2)) - mathutils.Vector((x1, y1)) + return diff.length + +def _env_fct_angle(x1: float, y1: float, x2: float, y2: float) -> float: + # compute blender angle first + # computed blender angle has some issues: + # first, it is range from -180 to 180 (0 is +X axis). + # second, its direction (clockwise is positive) is opposite with blender rotation direction (counter-clockwise is positive). + diff = mathutils.Vector((x2, y2)) - mathutils.Vector((x1, y1)) + bld_angle = math.degrees(mathutils.Vector((1,0)).angle_signed(diff, 0)) + + # flip it first + bld_angle = -bld_angle + # process positove number and negative number respectively + # to let it range change from -180~180 to 0~360 + if bld_angle > 0: return bld_angle + else: return 360 + bld_angle + _g_ProgFieldGlobals: dict[str, typing.Any] = { # constant 'pi': math.pi, @@ -122,6 +141,10 @@ _g_ProgFieldGlobals: dict[str, typing.Any] = { 'rot': lambda x, y, z: mathutils.Matrix.LocRotScale(None, mathutils.Euler((math.radians(x), math.radians(y), math.radians(z)), 'XYZ'), None), 'scale': lambda x, y, z: mathutils.Matrix.LocRotScale(None, None, (x, y, z)), 'ident': lambda: mathutils.Matrix.Identity(4), + + # my misc custom functions + 'distance': _env_fct_distance, + 'angle': _env_fct_angle, } def _eval_showcase_cfgs_default(strl: str) -> typing.Any: diff --git a/bbp_ng/raw_jsons/chris_vanilla.json b/bbp_ng/raw_jsons/chris_vanilla.json new file mode 100644 index 0000000000000000000000000000000000000000..627c71d6916c8f29ab8556fa6a5d0e2fdb7cd29f GIT binary patch literal 13019 zcmeHNOK;;g5WW}ae;|0WQ75&N7)2LYpy(mTqKCaDhM`!pBdj7C673W%^4~i{iVsng zZ0liXcO&e^aWoXkneUqiM-M;$MBw^Qe&DY(4x^OE>p05jCqh^ICC`Fw^e>CUWe)e~ z#FEXQ+3PCEBalpYNn+pH23hcu!;J?c?@WbX@uDzU65?zLOE=3X+(gSHN;mx3o=nPu zbQtgeh3D5(T7LGMwEz^iwxvhwxnS)Xmy@yeI*)kcWYgXz8-8ccQM`F>-cCo|t%Fqw z2wJ7Vd0QYs0hlYndu`GZbs7y!GCSM?8$Rk7?L2JkeloIgj}Is&awj6TU}=Jf<29UufYOZv}YhF z+CZ{2dZhOWW7!wBy-x!ENIhIJB7bLW9Vd@;T*0=H`BPByk$NE*r=h|%An;~FZYN}B zLti_&-QKfleOEwu?3)5bDBd<^*G{KlK*gs_Y*z|*h5fobK%(D8JTBL}|CD7fkR?Gz zfEl#G1`c>LU+u9pPIDflN5iF@(PzQya*a@^r1Ll>UOGk5j^@tqXmpP6Nwmd-icA#n zSD%v#!6FJDSptY5;OLWR&1DV<17)gbWm+huE-JzTWW|oSQLvJH^E`n<36$n*uoNb4 zLY*Vm!0tGYN}STFjUjH%XNWMCAS`ne z2gz3fh|M5a!T;H1EPHza%No}y`6nW#WoQ%2j<@rPG*qx?L&O)hk4D}-OwpakiDgYs)b5i#!I>^g8vTxYVzb_p7J=335~AIX!$h_<-6~*sh|r(Ph1I zC3A%e2hC#_@>dmdtx)TPSaEt8izool9Qg3EKE>(l$g+oHx4&2#RW$41&eA8c8!vN2 ztC;PK5kl(p&wJ`-na>)lIaP@pZ4S8VG7N2ik8)j}osUFqe&zxl&JJs8@)~RmTN0a6 zR+YQGRl5U~x{#V$)Dgrien14l!xs4Ak{bo=;!%yFAB88Vf||l}UaMPhd8KTq;;NKR z@w3lD=Etlwm20X8yK9h!nAEpPOi^(+|B*{abT-8)C)n$FQ=P~iWmyv-6xUSpr@jkA zm(FQKc_`QE)Pu9zikoyF=gWc0=V-EM;8~Ggo}+BAoE5aA>q5b6975+DstPbntq_m5 zs{K|-wpQ_=S^ElJMu0aFti4jGeR_TA;JxPUn5vgs=x%I32DJKp2Sp`Im5Mt$J^o1C zK_$8*(Z}EKsm}&%L!Z_L3McpUR3z@9i#M{AIVM3GVx#t8xrRr#ViEo>qH$SvhD%$N z4b|m|zZ7fqhBs<;*GwrPn`^ee(j=?�IGnbQ$2`xrmW?&Ru~I-m!J47u{GTI8*py zrovoR!AtlC@eW;*s7535!dVJFh^*uRvzm#VB5@9&f|^)`*xGxlP%VcOPIO4D_` zf&1m|j4#bYBOEr2sHqfmFpiY^Y`xS~Cs@k_m7B%kq+*D-6+jifST7LWkw5sFtONby zY-GsuyW1@z=WcI*TNV;3KNpKsYU^<5J=*MWE<6Oc24hxx_cu7TE_&h;0qy)iG XHG)eq<_ZYnxJCOlIhk$1Ul#uZe$dm6 literal 0 HcmV?d00001 diff --git a/bbp_ng/raw_jsons/sides.json b/bbp_ng/raw_jsons/sides.json index 63c9bf03fc72462a9c81ffe4053050bd082b1214..4f72a6ab17aac0732abb57bc219bd69189d5b84e 100644 GIT binary patch literal 9248 zcmd^FOOM+&5WWYBT z%CzWp3&aSr8*9jq^Z4dLp4 zAIqnQv{oQi?DCvH+NM>yso}v_D}R84|HO|3qWRkC@NqQ+%ckE$;5{8*T@=Ppfm|0?)L_%VK>Lg5+Tn zA3B8a*pZRaVnTpdXkRz(eW1U`V(#{f019*}{(1ql06KJzj7AG1MHgyLq?x#i;YuJ; zEWBMnaUFvXo((eqNr`BS1E$r2Q}8H$tyn**CspiK)npGU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