Sunday, 15 November 2015

maya tips! inview message help

Python inviewmessage command help:
Since maybe Maya 2014 there's been a groovy viewport feedback tool called inViewMessage.
You'll have seen it when using some default maya commands like hiding objects and changing the viewport mode. Overkill for hiding an object if you've actually used Maya before, but it's nice to look at!
ooo would you look at that!
Here's my messages script, it's a work in progress but has some info and warning commands
https://github.com/tb-animator/tbtools/blob/master/lib/tb_messages.py

turn on inview messages here

Before that all you could use was headsUpMessage;
It's true, nobody ever sees it



A heads up message will vanish as soon as you do anything in maya so it's not great for telling you important things. inview messages can stay until you click somewhere in maya, can be forced to stay for a while, and even fade in and out. They also show up over maya windows so have more chance of actually being seen.
"But wait, that message is super boring!"

 Luckily for use we can format that message using some html style markup, but we can also change font! To find out the names for the fonts you have in maya run this command:




You can colour in parts of the text using span style formatting. Here's a nice colour picker; http://www.w3schools.com/tags/ref_colorpicker.asp

"<span style=\"color:#FF9933;\">some text</span>"

or a more useful format

Now you could make a python class to handle all this span format nonsense, or if you watch this space you can use mine when it's done! Imagine that.

Anyway, hopefully this will make your scripts have prettier feedback for the user after reading this!
For the time being, here's some formatting that inview message accepts, there's probably more but I don't know them:
<sub> and <sup> tags for superscript and subscript
<em>italics</em>
<h1>, <h2> and <h3> for headings, also paragraph formatting
<hl> for highlighting in yellow


1 comment:

  1. Nice write-up Tom !

    Have you gotten this issue of the Inview Message only appearing randomly ?

    I'm using it in a mel script and the messages always show up the first time you call them but then they start to appear randomly and sometimes you see them sometimes you don't.Any clue of what can cause this ? (I'm using both Maya 2015 and 2016)

    Thanks in advance for any reply !

    ReplyDelete