TextPlus : GeometryClass

TextPlus – superclass: GeometryClass; super-superclass:node – classID: #(1815478437, 291720888)

Constructor

TextPlus()

Properties

Interpolation Properties

<TextPlus>.interpolationsteps : integer default:5

The number of interpolation steps for font smoothing.

 <TextPlus>.optimize : integer

The interpolation optimization setting. 1=on, 0=off.

 <TextPlus>.adaptive : integer
		  

The interpolation adaptive setting. 1=on, 0=off.

Layout Properties

<TextPlus>  .layouttype : integer

The layout type. 0=Point, 1=Region

<TextPlus>  .plane : integer

The layout plane, when layouttype is Point. 0=Auto, 1=XY, 2=XZ, 3=YZ

<TextPlus>  .length : float

The layout region length.

<TextPlus>  .width : float

The layout region width.

Font Properties

  .alignment : integer

The font alignment:

 .size : float
		  

The font size.

 .tracking : float
		  

The font tracking value.

 .leading : float
		  

The font leading value.

 .vscale : float
		  

The font Vertical Scale value, as a percent.

 .hscale : float
		  

The font Horizontal Scale value, as a percent.

Character Settings

  .elementtype : integer

The type of elements that the text will be split into for animation presets.

  • 0 = characters
  • 1 = words
  • 2 = lines
  • 3 = paragraphs

  .charKerningOffset : float array

An array of kerning offset values for each character in the text string.

  .charBaselineOffset : float array

An array of baseline offset values for each character in the text string.

  .charXScale : float array

An array of X scale values for each character in the text string.

  .charYScale : float array

An array of Y scale values for each character in the text string.

Geometry Settings

  .generateGeometry : integer

The Generate Geometry setting, 0=off, 1=on.

  .extrudeamount : float

The extrude amount, which can be positive or negative. The default is 0.

  .extrudesegments : integer

The number of segments making up the extrusion. From front to back, the extruded characters will be divided by this number of segments.

  .applybevel : Boolean

Indicates whether a bevel is applied to the text.

  .beveldepth : float

The depth of the bevel.

  .usebevelwidth (UseBevelDepth) : Boolean

Indicates whether the .bevelwidth setting is applied.

  .bevelwidth : float

The bevel width – only applied if .usebevelwidth is true.

  .bevelsteps : integer

The number of steps in the bevel. This determines the number of subdivisions per Bezier segment of the bevel profile curve.

  .bevelpush : float

The Bevel Push value. This is a scaling factor applied to the bevel profile curve, perpendicular to the bevel. A value of 1.0 gives the original bevel curve. A value of -1.0 gives an inverted bevel curve. A value of 0 always results in a straight bevel.

  .beveloptimize : Boolean

Indicates whether the bevel is optimized. When optimized, linear segments in the bevel profile curve will be reduced to a single edge, disregarding the .bevelsteps parameter.

  .beveloffset : float

The Outline Offset setting. May be a positive or negative value.

Bevel Cap Settings

 .capstart : integer  
  .capend : integer

The capping setting for the start (top) and end (bottom) of the beveled text:

  • 0 = Cap
  • 1 = No Cap
  • 2 = Bevel Cap
  • 3 = Bevel No Cap
.capstartconstrain : boolean
.capendconstrain : Boolean

The cap constrain setting for the start (top) and end (bottom) of the beveled text.

  .captype : integer

The Cap Type setting:

  • 0 = Morph
  • 1 = Grid
  .startcapmaterial : integer
  .startbevelmaterial : integer
  .sidematerial : integer
  .endbevelmaterial : integer
  .endcapmaterial : integer

The ID of the material associated with the Start Cap, Start Bevel, Sides, End Bevel, and End Cap, respectively.

  .macroname : string array
  .macroflags : int array
  .macrovalue : float array
  .upaxis : integer

The “Up” axis setting:

  • 0 = X
  • 1 = Y
  • 2 = Z
  .axisflip : Boolean

Indicates whether the axis is flipped.

  .nodeElements : node array
  .nodeElementsCenters : point3 array
  .BevelProfileCurve

The bevel profile curve, an object of type ReferenceTarget:BevelProfileCurve. Note that this type is not currently exposed in MaxScript.

Methods

Methods are exposed via Interface: textObject2

    <void>GetRTFString <&TSTR>rtfstring

rtfstring is Out parameter

Returns the object string in RTF format.

    <boolean>SetRTFString <string>string

Sets the object string as an RTF formatted string. This method clears all formatting settings, equivalent to calling ResetStyle().

    <void>GetPlaintextString <&TSTR>textstring

textstring is Out parameter

Gets the object string as a plain text string without formatting.

    <boolean>SetPlaintextString <string>string

Sets the object string as a plain text string without formatting. This method clears all formatting settings, equivalent to calling ResetStyle().

    <void>ResetString()

Resets the object string to an empty string.

Formatting methods

These methods affect the current text formatting settings. Calling them does not affect the formatting of text already in the TextPlus object’s text string, they affect text added subsequently using AppendString(). Calling SetPlaintextString() or SetRTFString() resets all formatting settings.

See the Code Sample section below for an illustration of these methods being used to create and format a string.

 <boolean>SetFont <string>fontName <integer>charset
		  

Sets the current font selection and character set index.

 <void>SetBold <boolean>sw		  
 <void>SetItalic <boolean>sw
 <void>SetUnderline <boolean>sw
 <void>SetStrikethrough <boolean>sw
<void>SetSubscript <boolean>sw
<void>SetSuperscript <boolean>sw
<void>SetAllCaps <boolean>sw
 <void>SetSmallCaps <boolean>sw		  		  		  

These methods all set text formatting options, where true=on and false=off.

 <void>ResetStyle() 
		  

Resets all text formatting settings to their defaults.

 <void>AppendString <string>string
		  

Appends the specified string to the TextPlus object’s string. The appended string takes the current text formatting.

 <void>AppendChar <integer>character
		  

Appends the character, specified by ASCII code, to the TextPlus object’s string. Note that this method will add a newline when the string source is RTF.

Animation Methods

    <boolean>SetCharBaseline <index>index <time>time <worldUnits>value
    <boolean>SetCharKerning <index>index <time>time <worldUnits>value
<boolean>SetCharXScale <index>index <time>time <float>value
<boolean>SetCharYScale <index>index <time>time <float>value

These methods set animatable values for the character specified by index to the specified value, at the specified time. Note that you must set Animate to On before using these methods.

    <integer>GetNumChars()

Returns the number of characters in the TextPlus string.

    <boolean>GetCharacter <index>index <&integer>character <&TSTR>fontName <&integer>charSet <&DWORD>style

character is Out parameter

fontName is Out parameter

charSet is Out parameter

style is Out parameter

Gets formatting information for the character at the specified index.

    <boolean>SetCharacter <index>index <integer>character <TSTR>fontName <integer>charSet <DWORD>style

Sets the character (specified by ASCII code), font, character set, and style for the character at the specified index.

Style is a bitflag and can be:

  • 0=plain
  • 1=italic
  • 2=underlined
  • 4=bold
  • 8=strikeout
  • 16=all caps
  • 32=small caps
  • 64=superscript
  • 128=subscript
    <index>GetSeparationType()
    <boolean>SetSeparationType <index>type

Gets or sets the Animation Separate setting:

  • 1=Object
  • 2=Character
  • 3=Word
  • 4=Line
  • 5=Paragraph
    <void>GetSeparationUpAxis <&index>axis <&boolean>flip

axis is In and Out parameter

flip is In and Out parameter

    <boolean>SetSeparationUpAxis <index>axis <boolean>flip

Gets or sets the Animation “Up” Axis and Flip Axis settings:

  • 1=X
  • 2=Y
  • 3=X

Character Setting Animation Methods

    <boolean>GetCharBaseline <index>index <time>time <&worldUnits>value <&interval>valid 
   <boolean>GetCharKerning <index>index <time>time <&worldUnits>value <&interval>valid
    <boolean>GetCharXScale <index>index <time>time <&float>value <&interval>valid
    <boolean>GetCharYScale <index>index <time>time <&float>value <&interval>valid

value is Out parameter

valid is In and Out parameter

These methods get baseline, kerning, X and Y scale values for the character at the specified index and time. These methods also return a validity interval for the value.

Character Mesh Methods

    <boolean>GetCharGlyphMesh <index>index <time>time <&mesh>mesh <&interval>valid
    <boolean>GetCharExtrasMesh <index>index <time>time <&mesh>mesh <&interval>valid
    <boolean>GetCharTotalMesh <index>index <time>time <&mesh>mesh <&interval>valid

mesh is In and Out parameter

valid is In and Out parameter

These methods get the Mesh objects associated with the character at the specified index and time. These methods return the mesh (as a trimesh object) and validity interval.

Code Sample

The following code sample constructs a TextPlus object, creates a formatted string, and animates individual characters.

--Simple text construction and Animation with TextPlus


actionMan.executeAction 0 "40005" -- Reset

TextPlus layouttype:0  Plane:0 transform:(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]) isSelected:on
$.ResetString()
-- Default font is Arial but you can set whatever
$.SetFont "Arial" 0
$.ResetStyle()
$.AppendString "My "
$.SetBold true
$.SetItalic true
$.AppendString "Text "
$.ResetStyle()
$.SetFont "Tahoma" 0
$.SetUnderline true
$.AppendString "String"
$.SetUnderline false
$.AppendChar 32    -- space
$.AppendChar 33 -- Exclamation

-- Now let's do some simple animation

set animate on

--M
$.SetCharBaseline 1 10 -40
$.SetCharBaseline 1 20 40
$.SetCharBaseline 1 30 -40
$.SetCharBaseline 1 40 0

--y
$.SetCharBaseline 2 10 40
$.SetCharBaseline 2 20 -40
$.SetCharBaseline 2 30 40
$.SetCharBaseline 2 40 0

--T
$.SetCharBaseline 4 10 0
$.SetCharBaseline 4 20 40
$.SetCharBaseline 4 30 -40
$.SetCharBaseline 4 40 40
$.SetCharBaseline 4 50 0

--e
$.SetCharBaseline 5 10 0
$.SetCharBaseline 5 20 -40
$.SetCharBaseline 5 30 40
$.SetCharBaseline 5 40 -40
$.SetCharBaseline 5 50 0

--!
$.SetCharYScale 16 10 1
$.SetCharYScale 16 20 3
$.SetCharYScale 16 30 -3
$.SetCharYScale 16 40 3
$.SetCharYScale 16 50 1

set animate off