Skip to content

Commit

Permalink
tweaks text socket to look better (#4454)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeffii authored May 4, 2022
1 parent 51e0708 commit 69cd5f5
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions nodes/svg/svg_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class SvSvgDocumentNode(bpy.types.Node, SverchCustomTreeNode):
update=updateNode)

file_name: StringProperty(name="Name", default="Sv_svg",
description="this variable holds the name of the file only, the file extension will be added automatically by sverchok")
description="File Name: this variable holds the name of the file only, the file extension will be added automatically by sverchok")
live_update: BoolProperty(name='Live Update', description="Automatically write file when input changes")

suffix_filename_with_framenumber: BoolProperty(
Expand All @@ -211,10 +211,26 @@ def sv_init(self, context):
self.inputs.new('SvFilePathSocket', 'Folder Path')
self.inputs.new('SvFilePathSocket', 'Template Path')
self.inputs.new('SvSvgSocket', 'SVG Objects')
self.sv_new_input('SvTextSocket', 'File Name', prop_name="file_name", quick_link_to_node="NoteNode")
self.sv_new_input('SvTextSocket', 'File Name',
custom_draw="draw_filename_socket",
prop_name="file_name",
quick_link_to_node="NoteNode")
self.outputs.new('SvVerticesSocket', 'Canvas Vertices')
self.outputs.new('SvStringsSocket', 'Canvas Edges')

def draw_filename_socket(self, socket, context, layout):
linked = socket.is_linked
text = f"{socket.name}. {socket.objects_number if linked else ''}"

if not linked:
row = layout.row(align=True)
socket.draw_quick_link(context, row, self)
split = row.split(factor=0.2)
split.label(text=text)
split.prop(self, socket.prop_name, text='')
else:
layout.label(text=text)

def draw_buttons(self, context, layout):
layout.prop(self, "live_update")
self.wrapper_tracked_ui_draw_op(layout, "node.sv_svg_server", icon='RNA', text="Open Server")
Expand Down

0 comments on commit 69cd5f5

Please sign in to comment.