MCPcopy Create free account
hub / github.com/coldtype/st2 / build_text

Method build_text

ST2/properties.py:494–561  ·  view source on GitHub ↗
(self, scene)

Source from the content-addressed store, hash-verified

492 return features
493
494 def build_text(self, scene):
495 text = ""
496
497 if self.text_mode == "FILE":
498 if self.text_file:
499 text_path = Path(self.text_file).expanduser().absolute()
500 text = text_path.read_text()
501 if self.text_indexed:
502 lines = text.split("\n\n")
503 try:
504 text = lines[self.text_index-1]
505 except IndexError:
506 text = lines[-1]
507 else:
508 text = "Select file"
509 fulltext = text
510 elif self.text_mode == "BLOCK":
511 if self.text_block:
512 try:
513 text = bpy.data.texts[self.text_block].as_string()
514 if self.text_indexed:
515 lines = text.split("\n\n")
516 try:
517 text = lines[self.text_index-1]
518 except IndexError:
519 text = lines[-1]
520 except KeyError:
521 text = "Invalid"
522 else:
523 text = "Enter block name"
524 fulltext = text
525 elif self.text_mode == "SEQUENCE":
526 text = ""
527 has_clips = False
528 for clip in scene.sequence_editor.strips:
529 if clip.channel == self.text_sequence_channel:
530 has_clips = True
531 if clip.frame_start <= scene.frame_current < clip.frame_final_end:
532 text = clip.text
533
534 if not has_clips:
535 text = "No clips"
536
537 fulltext = text
538 else:
539 if self.text == "":
540 text = "Text"
541 else:
542 text = self.text
543
544 lines = text.split(self.newline_character)
545 fulltext = "\n".join(lines)
546 if self.text_indexed:
547 try:
548 text = lines[self.text_index-1]
549 except IndexError:
550 text = lines[-1]
551 else:

Callers 1

__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected