| 93 | |
| 94 | |
| 95 | class T(): |
| 96 | def __init__(self |
| 97 | , st2 |
| 98 | , obj |
| 99 | , scene |
| 100 | , collection="Global" |
| 101 | ): |
| 102 | self.st2 = st2 |
| 103 | self.scene = scene |
| 104 | self.obj = obj |
| 105 | self.collection = collection |
| 106 | |
| 107 | self.font = self.st2.font() |
| 108 | self.text = self.st2.build_text(scene) |
| 109 | self.base_name = self.build_base_name() |
| 110 | |
| 111 | def build_base_name(self): |
| 112 | if self.st2.text_mode == "UI": |
| 113 | return "ST2:" + self.text[:20].replace("\n", "") |
| 114 | elif self.st2.text_mode == "SEQUENCE": |
| 115 | return "ST2:Sequence" |
| 116 | elif self.st2.text_mode == "BLOCK": |
| 117 | return "ST2:TextBlock" |
| 118 | else: |
| 119 | return "ST2:File" |
| 120 | |
| 121 | def base_vectors(self): |
| 122 | if self.obj: |
| 123 | animating = self.obj.st2.has_keyframes(self.obj) or self.obj.st2.has_variable_offsets(self.obj) or self.obj.st2.has_calculations(self.obj) |
| 124 | else: |
| 125 | animating = False |
| 126 | |
| 127 | if not self.obj or not animating: |
| 128 | p = self.build_single_style() |
| 129 | else: |
| 130 | p = self.build_multi_style() |
| 131 | |
| 132 | self.align(p) |
| 133 | |
| 134 | # not good if we want to do stagger line-wise, need to preserve this info |
| 135 | #p.collapse() |
| 136 | return p |
| 137 | |
| 138 | def two_dimensional(self, glyphwise=False, shapewise=False, wordwise=False, linewise=False): |
| 139 | p = self.base_vectors() |
| 140 | |
| 141 | if self.st2.script_enabled: |
| 142 | p = self.apply_script(p).up() |
| 143 | |
| 144 | if wordwise: |
| 145 | p = p.wordPens(consolidate=True) |
| 146 | p.collapse() |
| 147 | elif not linewise: |
| 148 | p.collapse() |
| 149 | |
| 150 | if self.st2.combine_glyphs and not glyphwise and not wordwise and not linewise: |
| 151 | p = p.pen() |
| 152 |
nothing calls this directly
no outgoing calls
no test coverage detected