Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / text value by expression?
  RSS 2.0 ATOM  

text value by expression?
Rate this thread
 
30119
 
Permlink of this thread   Subscribe to this thread
avatar
  • Total Posts: 16
  • Joined: 19 February 2008 04:07 AM

Hello there!
Hopefully simple question. I’d like to control text value in the object (created using Create>Text>Curves) by an expression. Now… how do I do that? When I make the text parameter keyable, it still can’t be animated. How to go around this obstacle?

Kind regards,
F.



Replies: 0
avatar
  • saajjj
  • Posted: 13 October 2008 04:52 AM

Hi,
A simple hack for this is to use the script editor to read the commands XSI churns out when you change values in the interface. In your case, the text>curves is created with the following command:

CreatePrim("Text", “NurbsCurve”, “myText”, null);

myText is the name of the Text prmitive, by default the first instance in XSI would be called ‘text’, 2nd ‘text1’ and so on.
When you change the default ‘text’ in the Text primitive, say set it to ‘hello world!, the script editor shows the following command:

SetValue("myText.text.text", “_RTF_{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil\\fprq5\\fcharset0 Arial;}}\r\n\\viewkind4\\uc1\\pard\\lang2057\\f0\\fs20 hello world!\\par\r\n}\r\n”, null);

All the stuff which goes in the second argument is how XSI describes the rich text formatting. The very last bit is where the display text actually goes (hello world!) in the above case.

As you noted, the value in the textbox isn’t animatable using the interace. Off the top of my head there are two approaches I can think of:
1. Fire off a timer in your script and at specific intervals use the SetProperty command to set new values.
2. Set off a loop which checks the current frame number and based on that value use the SetProperty command to set new text values.

I would go with the 2nd method as that offers more control and should be easier to set up. Also, I really don’t know how the first option would resolve at render time.

Hope this helps.



Replies: 0




   
  Settings Choose Theme color: