Notifications
Clear all

[Closed] Min/Max expressions in a wireparameter?

I was wondering if anyone had used min/max to clamp a rotation inside a Wire Parameter dialogue? I want one bone to control another, but only through a partial arc.

I can assign min and max with a Float Controller, for example:
min(0.1,(max(-0.1,(Left_Thigh_ZR))))

Left_Thigh_ZR is a Scalar Variable that I’ve set up in the Float Expression dialogue. This works, but I’ve had no joy using the Min/Max values within the Wire Parameters dialogue.

10 Replies
 S-S

Hi Rick.

I don’t have direct answer to your question, but i think your code looks hard to read at least for me. I’ve personally used something like this:


  sliderval = Z_Position
  
  case of
  (
   (sliderval >= 1.0): 1.0
   (sliderval <= -10): - 10
   default: sliderval
  )
  

For me it has worked at least with one way wires. This is an example where point helpers z position controls rotation of teapot. It can rotate more into negative direction and so on. Basicly you can do limiting of values with case and i think it’s easier to read.

(rewritten original post to make more sense)

Anyway, I’ve had no joy with using Case either. Gah!

However, my first foray into scripting float expressions seems much nicer than Wire Parameters, and it’s easier to debug. If I can’t figure it out then I might switch everything to Float Controllers – it’ll mean rewriting a few scripts/functions, that may not be a bad thing.

You’re mixing up expressions with maxscript. They are 2 separate things. Parameter Wires use the maxscript format, not the expression controller format.

TC

Yeah, it’s a shame that I can’t mix and match.

In the end I’ve converted most of the scripts to use the Expression controllers – they give me more functionality and are much easier to debug. Seriously, what is up with the Wire Parameters UI?

in that case, you could use a script controller, and use your wire parameter syntax.

 S-S

I would second what Pete said. Learn to use float script controllers. Expression controllers have their own syntax, which is bit different from max script and is not used anywhere else (as far as i know).
There are many good threads here in cgtalk about float script controllers and you can always read more from max script manual. What works in parameter wire box works in float scripts, so you don’t have to write two kind of code.

thanks sami, much better than my answer! I would also just add that a float script gives you the option of using weak referencing too, which is a powerful scripting option.

Cheers folks, I’ll look into that this afternoon.

 PEN

ParamWires are great for connecting A to B with maybe a multiplier or something as simple as a if this to that sort of thing. I try not to let the code start to get complicated, as soon as that happens I move to script controllers. I haven’t used an expression controller in years as I find script controllers every bit as fast now and have more flexibility and of course use Max script instead of the mystery syntax that you need to use with expression controllers. Also note that paramWires only allow one input so you will find your self wanting to add more user control to more complex expressions half the time anyways.

Page 1 / 2