Browsing"Characters"

TrackBot – A Max Custom UI Control for Characters

Oct 27, 2008 by     No Comments    Posted under: 3dsMax, Characters, DotNet, Technical Research, User Controls

This control was made to try and build some UI shortcuts when using morph controls on a character. I wanted to be able to add a control that gave me the ability to reset, nudge and scrub the morph values. In the past I would have to build each button control in MXS and make sure they all worked.

With this control, I am hoping it will work well enough to use in a facial rig setup.

There are a few extras with this control of use. Firstly, the slider, once focused can be moved by rolling the mouse wheel. This makes it good for fine tuning expressions. And secondly, the label color can be changed so that you can visually group expressions together by type. The nudge buttons can be used with shift and control to nudge values of 10 and 5 respectively. I will add a property to set these soon, as you may wish to specify max and min values smaller than this.

The buttons are drawn with GDI+, with the exception of the key icon, which is embedded as a resource in the control. I would like the button images to fill with the control color eventually too.

Apart from the Valuechanged event, there is a setkey event that is fired every time – yup, you guessed it – the setkey button is pressed.

Here is the class diagram so that you can see all the properties and events-

  • BarColor – The color of the right hand side of the slider
  • ElapsedColor – The color of the left hand side of the slider
  • ResetValue – Specify a value for reset, in case your slider goes negative for example.
  • Title – The text on the control
  • LabelColor – the text background

the slider is a C# control from CodeProject. I have used it because it implemented the great mouse wheel functionality. I have mirrored some of the properties in the control to allow the user to change the slider ui colors. I am currently trying to convert the source to VB so that i can embed it within the control. You can see the article here

One thing i have noticed with running dotnet controls in the max command panel is panel seems to refresh after the controls, and subsequently makes them dissapear. The only way to get them back is to drag the command panel out and in again. While i am not exactly sure why this is happening, it can be fixed in a slightly hacky way by placing a timer with an interval of 1 in the rollout which ticks once, invalidating the controls via the refresh() method, like so –

rollout Trackbot "" width:170 height:249
(
dotNetControl TBslider1 "LoneRobot.Trackbot" pos:[1,3] width:156 height:54
dotNetControl TBslider2 "LoneRobot.Trackbot" pos:[1,61] width:156 height:54
dotNetControl TBslider3 "LoneRobot.Trackbot" pos:[1,119] width:156 height:54
dotNetControl TBslider4 "LoneRobot.Trackbot" pos:[1,174] width:156 height:54
timer refresh "" interval:1

on Trackbot open do refresh.active = true

on refresh tick do
(
TBslider1.refresh()
TBslider2.refresh()
TBslider3.refresh()
TBslider4.refresh()
refresh.active = false
)

)

Update!

Hello again, In my recent article about ColorMatrix, I included an update to my TrackBot slider assembly. Previously, it had included a C# slider component that I handled via a custom event. Using this method can be really useful, as you can make a composite control of many other existing elements. The UI is still the same although I changed the appearance of the slider slightly. (In the picture below, I’ve hidden the lower controls by making the UI height of the dotnetcontrol smaller)

Click the image if you want to read the ColorMatrix article, and get the code for Image adjustments in Max.

I’ve updated the assembly with a VB conversion of the slider component, which means that it is now integrated into one assembly. I’ve changed the way the event is triggered also, so let me know if it doesn’t function as you expect. As usual, it is a download below.

download script