From d3e38d366f87e49598d6ec3fc6e0cb196c6fce0e Mon Sep 17 00:00:00 2001 From: SCell555 Date: Sat, 20 Jun 2026 13:03:18 +0200 Subject: [PATCH 1/2] Add math_expression --- fgd/point/math/math_expression.fgd | 56 ++++++++++++++++++++ fgd/visgroups.cfg | 1 + hammer/materials/editor/math_expression.vmt | 8 +++ hammer/materials/editor/math_expression.vtf | Bin 0 -> 3086 bytes 4 files changed, 65 insertions(+) create mode 100644 fgd/point/math/math_expression.fgd create mode 100644 hammer/materials/editor/math_expression.vmt create mode 100644 hammer/materials/editor/math_expression.vtf diff --git a/fgd/point/math/math_expression.fgd b/fgd/point/math/math_expression.fgd new file mode 100644 index 000000000..1ebf108bf --- /dev/null +++ b/fgd/point/math/math_expression.fgd @@ -0,0 +1,56 @@ +@PointClass base(BaseEntityPoint, EnableDisable) + iconsprite("editor/math_expression.vmt") += math_expression : "Evaluates custom math expression, even more advanced version of math_counter_advanced." + [ + spawnflags(flags) : "spawnflags" = + [ + 1 : "Evaluate manually" : 0 + ] + + // Keys + Expression0(string) : "Expression 0" : "" + Expression1(string) : "Expression 1" : "" + Expression2(string) : "Expression 2" : "" + Expression3(string) : "Expression 3" : "" + Input0(float) : "Input 0" : "" + Input1(float) : "Input 1" : "" + Input2(float) : "Input 2" : "" + Input3(float) : "Input 3" : "" + Input4(float) : "Input 4" : "" + Input5(float) : "Input 5" : "" + Input6(float) : "Input 6" : "" + Input7(float) : "Input 7" : "" + Input8(float) : "Input 8" : "" + Input9(float) : "Input 9" : "" + Input10(float) : "Input 10" : "" + Input11(float) : "Input 11" : "" + Input12(float) : "Input 12" : "" + Input13(float) : "Input 13" : "" + Input14(float) : "Input 14" : "" + Input15(float) : "Input 15" : "" + + // Inputs + input Eval(void) : "Evaluates all expressions." + input SetInput0(float) : "Set the value for parameter 0" + input SetInput1(float) : "Set the value for parameter 1" + input SetInput2(float) : "Set the value for parameter 2" + input SetInput3(float) : "Set the value for parameter 3" + input SetInput4(float) : "Set the value for parameter 4" + input SetInput5(float) : "Set the value for parameter 5" + input SetInput6(float) : "Set the value for parameter 6" + input SetInput7(float) : "Set the value for parameter 7" + input SetInput8(float) : "Set the value for parameter 8" + input SetInput9(float) : "Set the value for parameter 9" + input SetInput10(float) : "Set the value for parameter 10" + input SetInput11(float) : "Set the value for parameter 11" + input SetInput12(float) : "Set the value for parameter 12" + input SetInput13(float) : "Set the value for parameter 13" + input SetInput14(float) : "Set the value for parameter 14" + input SetInput15(float) : "Set the value for parameter 15" + + // Outputs + output Output0(float) : "Fired in response to any of the inputs changing with value calculated from expression 0." + output Output1(float) : "Fired in response to any of the inputs changing with value calculated from expression 1." + output Output2(float) : "Fired in response to any of the inputs changing with value calculated from expression 2." + output Output3(float) : "Fired in response to any of the inputs changing with value calculated from expression 3." + ] diff --git a/fgd/visgroups.cfg b/fgd/visgroups.cfg index 8adec129d..4388da448 100644 --- a/fgd/visgroups.cfg +++ b/fgd/visgroups.cfg @@ -399,6 +399,7 @@ * `math_bits` * `math_clamp` * `math_counter_advanced` + * `math_expression` * `math_generate` * `math_lightpattern` * `math_mod` diff --git a/hammer/materials/editor/math_expression.vmt b/hammer/materials/editor/math_expression.vmt new file mode 100644 index 000000000..d25446a41 --- /dev/null +++ b/hammer/materials/editor/math_expression.vmt @@ -0,0 +1,8 @@ +Sprite +{ + $baseTexture "editor/math_expression" + $spriteorientation "vp_parallel" + $spriteorigin "[ 0.50 0.50 ]" + $spriterendermode 2 + $no_fullbright 1 +} diff --git a/hammer/materials/editor/math_expression.vtf b/hammer/materials/editor/math_expression.vtf new file mode 100644 index 0000000000000000000000000000000000000000..f435bc8389c8fc0586250b5dd7dec351a5f85b36 GIT binary patch literal 3086 zcmYLH2{_bi7yr);gJBk1_ClgT3?fU7rHoznL1e7iDP>8RGL%wTQVa=YFO4LOV(cl& zK9&92Wf{qKapxPi=lj0%K4*E)?>xWvJmCz_xIr`%)v>XMM2qL%>dp?&y$w;pMX&W@4u}Y>b#MYiaNc{+ zC$YTu31HdM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o%}LUlBgk`Kd8J1h0@QJXk*>I;gH2H{UV>-&%wt9i!X&C%M_N zy~|~mqu2>%R@;5CxLM-j@(;P_`aC)zc9e|0$~Pd4Z zAHg=d40j^a(rw8TiJ2Z>PjH|&XKT}}x9{u>EVtmu%$foh#J1E_xFi9bnkuiuVcR*` zsg!=Nh&0pmYh(y9<5O$+A^T+e2^Hl|+A6eqeB0wTB$+D!vIK>uM{0C&hZo>co literal 0 HcmV?d00001 From 54c478f4fa6cc1a79d24f32ddb84ad15d418f47d Mon Sep 17 00:00:00 2001 From: Spencer Brown Date: Mon, 22 Jun 2026 12:05:26 +1000 Subject: [PATCH 2/2] Improve docs for math_expression --- fgd/point/math/math_expression.fgd | 74 +++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/fgd/point/math/math_expression.fgd b/fgd/point/math/math_expression.fgd index 1ebf108bf..d517c655d 100644 --- a/fgd/point/math/math_expression.fgd +++ b/fgd/point/math/math_expression.fgd @@ -1,6 +1,6 @@ @PointClass base(BaseEntityPoint, EnableDisable) iconsprite("editor/math_expression.vmt") -= math_expression : "Evaluates custom math expression, even more advanced version of math_counter_advanced." += math_expression : "Evaluates a custom math expression, even more advanced version of math_counter_advanced." [ spawnflags(flags) : "spawnflags" = [ @@ -8,45 +8,45 @@ ] // Keys - Expression0(string) : "Expression 0" : "" - Expression1(string) : "Expression 1" : "" - Expression2(string) : "Expression 2" : "" - Expression3(string) : "Expression 3" : "" - Input0(float) : "Input 0" : "" - Input1(float) : "Input 1" : "" - Input2(float) : "Input 2" : "" - Input3(float) : "Input 3" : "" - Input4(float) : "Input 4" : "" - Input5(float) : "Input 5" : "" - Input6(float) : "Input 6" : "" - Input7(float) : "Input 7" : "" - Input8(float) : "Input 8" : "" - Input9(float) : "Input 9" : "" - Input10(float) : "Input 10" : "" - Input11(float) : "Input 11" : "" - Input12(float) : "Input 12" : "" - Input13(float) : "Input 13" : "" - Input14(float) : "Input 14" : "" - Input15(float) : "Input 15" : "" + Expression0(string) : "Expression 0" :: "Output0 is fired with the result of this expression." + Expression1(string) : "Expression 1" :: "Output1 is fired with the result of this expression." + Expression2(string) : "Expression 2" :: "Output2 is fired with the result of this expression." + Expression3(string) : "Expression 3" :: "Output3 is fired with the result of this expression." + Input0(float) : "in0 =" : 0 : "Set the intial value for the variable 'in0'." + Input1(float) : "in1 =" : 0 : "Set the intial value for the variable 'in1'." + Input2(float) : "in2 =" : 0 : "Set the intial value for the variable 'in2'." + Input3(float) : "in3 =" : 0 : "Set the intial value for the variable 'in3'." + Input4(float) : "in4 =" : 0 : "Set the intial value for the variable 'in4'." + Input5(float) : "in5 =" : 0 : "Set the intial value for the variable 'in5'." + Input6(float) : "in6 =" : 0 : "Set the intial value for the variable 'in6'." + Input7(float) : "in7 =" : 0 : "Set the intial value for the variable 'in7'." + Input8(float) : "in8 =" : 0 : "Set the intial value for the variable 'in8'." + Input9(float) : "in9 =" : 0 : "Set the intial value for the variable 'in9'." + Input10(float) : "in10 =" : 0 : "Set the intial value for the variable 'in10'." + Input11(float) : "in11 =" : 0 : "Set the intial value for the variable 'in11'." + Input12(float) : "in12 =" : 0 : "Set the intial value for the variable 'in12'." + Input13(float) : "in13 =" : 0 : "Set the intial value for the variable 'in13'." + Input14(float) : "in14 =" : 0 : "Set the intial value for the variable 'in14'." + Input15(float) : "in15 =" : 0 : "Set the intial value for the variable 'in15'." // Inputs input Eval(void) : "Evaluates all expressions." - input SetInput0(float) : "Set the value for parameter 0" - input SetInput1(float) : "Set the value for parameter 1" - input SetInput2(float) : "Set the value for parameter 2" - input SetInput3(float) : "Set the value for parameter 3" - input SetInput4(float) : "Set the value for parameter 4" - input SetInput5(float) : "Set the value for parameter 5" - input SetInput6(float) : "Set the value for parameter 6" - input SetInput7(float) : "Set the value for parameter 7" - input SetInput8(float) : "Set the value for parameter 8" - input SetInput9(float) : "Set the value for parameter 9" - input SetInput10(float) : "Set the value for parameter 10" - input SetInput11(float) : "Set the value for parameter 11" - input SetInput12(float) : "Set the value for parameter 12" - input SetInput13(float) : "Set the value for parameter 13" - input SetInput14(float) : "Set the value for parameter 14" - input SetInput15(float) : "Set the value for parameter 15" + input SetInput0(float) : "Set 'in0' to a new value." + input SetInput1(float) : "Set 'in1' to a new value." + input SetInput2(float) : "Set 'in2' to a new value." + input SetInput3(float) : "Set 'in3' to a new value." + input SetInput4(float) : "Set 'in4' to a new value." + input SetInput5(float) : "Set 'in5' to a new value." + input SetInput6(float) : "Set 'in6' to a new value." + input SetInput7(float) : "Set 'in7' to a new value." + input SetInput8(float) : "Set 'in8' to a new value." + input SetInput9(float) : "Set 'in9' to a new value." + input SetInput10(float) : "Set 'in10' to a new value." + input SetInput11(float) : "Set 'in11' to a new value." + input SetInput12(float) : "Set 'in12' to a new value." + input SetInput13(float) : "Set 'in13' to a new value." + input SetInput14(float) : "Set 'in14' to a new value." + input SetInput15(float) : "Set 'in15' to a new value." // Outputs output Output0(float) : "Fired in response to any of the inputs changing with value calculated from expression 0."