LNXSDK/leenkx/blender/lnx/logicnode/custom/LN_html_text_block.py
2025-01-22 16:18:30 +01:00

28 lines
948 B
Python

from lnx.logicnode.lnx_nodes import *
class HtmlTextBlockNode(LnxLogicTreeNode):
"""HTML Text Block"""
bl_idname = 'LNHtmlTextBlockNode'
bl_label = 'HTML Text Block'
bl_description = 'Select and unescape local JS/CSS/HTML 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', 'JS/CSS/HTML')
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')
HtmlTextBlockNode.on_register()