Skip to content

Commit

Permalink
Basic text node (#4485)
Browse files Browse the repository at this point in the history
* add to menu

* rename file

* add newline
  • Loading branch information
zeffii authored May 20, 2022
1 parent 76ea56e commit 232bf0b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/nodes/text/simple_text.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Simple Text
===========

Functionality
-------------

This node can be used to pass a single string into the Node Tree, through a Text socket.

.. image:: https://user-images.githubusercontent.com/619340/169515003-bb510280-686b-407d-a7a4-af1d8a633e56.png



1 change: 0 additions & 1 deletion docs/nodes/text/stethoscope_v28.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Stethoscope
===========

*destination after Beta: basic data*

Functionality
-------------
Expand Down
1 change: 1 addition & 0 deletions docs/nodes/text/text_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Text
stethoscope_v28
gtext
string_tools
simple_text
1 change: 1 addition & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@
SvGTextNode
---
SvStringsToolsNode
SvSimpleTextNode

## BPY Data
SvGetPropNode
Expand Down
27 changes: 27 additions & 0 deletions nodes/text/simple_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import bpy
import sverchok

class SvSimpleTextNode(bpy.types.Node, sverchok.node_tree.SverchCustomTreeNode):
"""
Triggers: Text string
Tooltip: simple text
"""
bl_idname = 'SvSimpleTextNode'
bl_label = 'Simple Text'
bl_icon = 'FILE_TEXT'

def sv_init(self, context):
item = self.outputs.new('SvTextSocket', "Text")
item.custom_draw = "draw_output"

def draw_output(self, socket, context, layout):
row = layout.row(align=True)
row.prop(socket, "default_property", text="")

def process(self):
text_socket = self.outputs[0]
text_socket.sv_set([[text_socket.default_property]])


classes = [SvSimpleTextNode]
register, unregister = bpy.utils.register_classes_factory(classes)

0 comments on commit 232bf0b

Please sign in to comment.