28 lines
		
	
	
		
			907 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			907 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								from lnx.logicnode.lnx_nodes import *
							 | 
						||
| 
								 | 
							
								import json
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class TextBlockNode(LnxLogicTreeNode):
							 | 
						||
| 
								 | 
							
								    """Text Block"""
							 | 
						||
| 
								 | 
							
								    bl_idname = 'LNTextBlockNode'
							 | 
						||
| 
								 | 
							
								    bl_label = 'Text Block'
							 | 
						||
| 
								 | 
							
								    bl_description = 'Select a local text block directly from blender'
							 | 
						||
| 
								 | 
							
								    lnx_category = 'HTML'
							 | 
						||
| 
								 | 
							
								    lnx_version = 1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    @property
							 | 
						||
| 
								 | 
							
								    def property0(self):
							 | 
						||
| 
								 | 
							
								        return bpy.data.texts[self.property0_].as_string().replace('\r', '').replace('\n', '').replace('"','\\"') if self.property0_ in bpy.data.texts else ""
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    property0_: HaxeStringProperty('property0', name='Text', default='')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def lnx_init(self, context):
							 | 
						||
| 
								 | 
							
								        self.add_output('LnxStringSocket', 'Text')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def draw_buttons(self, context, layout):
							 | 
						||
| 
								 | 
							
								        layout.prop_search(self, 'property0_', bpy.data, 'texts', icon='NONE', text='')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def register():
							 | 
						||
| 
								 | 
							
								    add_category('HTML', icon='SEQ_STRIP_META')
							 | 
						||
| 
								 | 
							
								    TextBlockNode.on_register()
							 |