Expression inside Type ?


#1

Hi there people;

I wonder if is there a way to insert any kind of code inside a type node?.

Let’s assume that I want a text type node with the current frame or time. It would be cool if I just could put a (frame) code and that’s all.

Any ideas?.

Thanks in advance, though I guess this is impossible to do LOL


#2

Hey,

This is possible, but it isn’t easy yet.

You need to talk to Type in unicode, so a MEL expression might look something like this (it sets the text on type1 to be the scene time in seconds - it assumes the frame rate is 24fps):

string $numbers[] = {"30", "31", "32", "33", "34", "35", "36", "37", "38", "39"}; //unicode for 0 to 9
int $seconds = (`currentTime -query`)/24 % size($numbers);
int $tensOfSeconds = (`currentTime -query`)/24 / 10;

string $time;
$time += $numbers[$tensOfSeconds];
$time += " "; // the space is really important so Type knows the unicode character has ended
$time += $numbers[$seconds];
setAttr "type1.textInput" -type "string" $time;

If you can use Python everything gets much easier as you can convert to unicode on the fly.
Best,
Ian


#3

Oh My God, that is so cumbersome for a such simple task!. I hope adesk add that functionality to the type tool since, in my opinion, it’s a must have.

Thank you Ian for your help, is much appreciated and I follow you on youtube since the introduction of the MASH tool. Keep the good job up! :slight_smile:


#4

Thankfully this has been addresed with the update 3 new “generators” attribute on the type tool? :smiley:


#5

Yeah, you were right, so we added this :slight_smile:


#6

Is there anyway to simply create a type node with the MEL “createNode type” and not get 20 other nodes and 15 script jobs?

All I need is a simple flat type and I will happily feed it unicode.

If there is source code or AETemplate code that makes all of these nodes and scriptJobs , I can edit it if you point me in the right direction.

Thank you,
Chris