From d53e460355aa2665b4a7887f6d818331b5e46edd Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Sun, 1 May 2022 18:51:57 +0200 Subject: [PATCH 01/16] adds two new properties --- nodes/network/file_path.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 98c61ce968..01139053eb 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -34,10 +34,16 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): files: CollectionProperty(name="File Path", type=OperatorFileListElement) directory: StringProperty(subtype='DIR_PATH') - filepath: bpy.props.StringProperty( - name="File Path", description="Filepath used for writing waveform files", + filepath: StringProperty( + name="File Path", description="Filepath used for writing files", maxlen=1024, default="", subtype='FILE_PATH') + filename_ext: StringProperty(default="")# ".tif" + filter_glob: StringProperty( + default="", #*.tif;*.png;*.jpeg;*.jpg", + options={'HIDDEN'}) + + def sv_execute(self, context, node): node.set_data(self.directory, self.files) @@ -61,6 +67,11 @@ class SvFilePathNode(bpy.types.Node, SverchCustomTreeNode): files: CollectionProperty(name="File Path", type=OperatorFileListElement) directory: StringProperty(subtype='DIR_PATH', update=updateNode) + filename_ext: StringProperty(default="")# ".tif" + filter_glob: StringProperty( + default="", #*.tif;*.png;*.jpeg;*.jpg", + options={'HIDDEN'}) + def sv_init(self, context): self.outputs.new('SvFilePathSocket', "File Path") @@ -68,7 +79,10 @@ def sv_init(self, context): def draw_buttons(self, context, layout): op = 'node.sv_file_path' - self.wrapper_tracked_ui_draw_op(layout, op, icon='FILE', text='') + file_path_operator = self.wrapper_tracked_ui_draw_op(layout, op, icon='FILE', text='') + file_path_operator.filename_ext = self.filename_ext + file_path_operator.filter_glob = self.filter_glob + if self.files_num == 0: layout.label(text=self.directory) elif self.files_num == 1: From 6150f8344512de2b398cab80733c850930f7951f Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Sun, 1 May 2022 20:55:40 +0200 Subject: [PATCH 02/16] reign in the complexity --- nodes/network/file_path.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 01139053eb..f8c0a679ee 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -38,13 +38,21 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): name="File Path", description="Filepath used for writing files", maxlen=1024, default="", subtype='FILE_PATH') - filename_ext: StringProperty(default="")# ".tif" - filter_glob: StringProperty( - default="", #*.tif;*.png;*.jpeg;*.jpg", - options={'HIDDEN'}) + def custom_config(self, context): + if self.mode == "FreeCAD": + self.filename_ext = ".FCStd" # ".tif" + self.filter_glob = "*.FCStd" # #*.tif;*.png;" (if more than one, separate by ;) + + mode: StringProperty(default='', update=custom_config) + filename_ext: StringProperty(default="") + filter_glob: StringProperty(default="", options={'HIDDEN'}) def sv_execute(self, context, node): + if self.mode == "FreeCAD": + print("can do something here") + # if len self.files == 1 , and it doesn't end in FCStd/FCStd1 set it. + node.set_data(self.directory, self.files) def invoke(self, context, event): @@ -67,11 +75,6 @@ class SvFilePathNode(bpy.types.Node, SverchCustomTreeNode): files: CollectionProperty(name="File Path", type=OperatorFileListElement) directory: StringProperty(subtype='DIR_PATH', update=updateNode) - filename_ext: StringProperty(default="")# ".tif" - filter_glob: StringProperty( - default="", #*.tif;*.png;*.jpeg;*.jpg", - options={'HIDDEN'}) - def sv_init(self, context): self.outputs.new('SvFilePathSocket', "File Path") @@ -80,8 +83,7 @@ def draw_buttons(self, context, layout): op = 'node.sv_file_path' file_path_operator = self.wrapper_tracked_ui_draw_op(layout, op, icon='FILE', text='') - file_path_operator.filename_ext = self.filename_ext - file_path_operator.filter_glob = self.filter_glob + file_path_operator.mode = self.mode if self.files_num == 0: layout.label(text=self.directory) From 044971194580ce7f395f386179036f47b3913496 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Sun, 1 May 2022 21:18:39 +0200 Subject: [PATCH 03/16] use mode --- nodes/network/file_path.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index f8c0a679ee..8af29c85ba 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -38,16 +38,15 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): name="File Path", description="Filepath used for writing files", maxlen=1024, default="", subtype='FILE_PATH') + filename_ext: StringProperty(default="") + filter_glob: StringProperty(default="", options={'HIDDEN'}) + + mode: StringProperty(default='') def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" self.filter_glob = "*.FCStd" # #*.tif;*.png;" (if more than one, separate by ;) - mode: StringProperty(default='', update=custom_config) - filename_ext: StringProperty(default="") - filter_glob: StringProperty(default="", options={'HIDDEN'}) - - def sv_execute(self, context, node): if self.mode == "FreeCAD": print("can do something here") @@ -56,6 +55,9 @@ def sv_execute(self, context, node): node.set_data(self.directory, self.files) def invoke(self, context, event): + + if self.mode: self.custom_config(context) + wm = context.window_manager wm.fileselect_add(self) return {'RUNNING_MODAL'} @@ -74,6 +76,7 @@ class SvFilePathNode(bpy.types.Node, SverchCustomTreeNode): files_num: IntProperty(name='files number ', default=0) files: CollectionProperty(name="File Path", type=OperatorFileListElement) directory: StringProperty(subtype='DIR_PATH', update=updateNode) + mode: StringProperty(default='', description="mode determines behaviour of the File Open Dialogue and Operator") def sv_init(self, context): From 65e54e04da379419596564e6bde283db7dadc7f6 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Sun, 1 May 2022 22:17:15 +0200 Subject: [PATCH 04/16] this sets the file extention after selecting! --- nodes/network/file_path.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 8af29c85ba..7df9f70d1b 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -49,8 +49,10 @@ def custom_config(self, context): def sv_execute(self, context, node): if self.mode == "FreeCAD": - print("can do something here") - # if len self.files == 1 , and it doesn't end in FCStd/FCStd1 set it. + # This is triggered after the file is selected or typed in by the user in the Text Field of path + if self.directory and len(self.files) == 1: + if self.files[0].name and not self.files[0].name.endswith(".FCStd"): + self.files[0].name = self.files[0].name + ".FCStd" node.set_data(self.directory, self.files) From 1bf024835aa68f7ad4ea737dc03d885bf4cde4f3 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Mon, 2 May 2022 15:54:38 +0200 Subject: [PATCH 05/16] add update --- nodes/network/file_path.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 7df9f70d1b..8b8797ae72 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -42,6 +42,7 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): filter_glob: StringProperty(default="", options={'HIDDEN'}) mode: StringProperty(default='') + def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" From f406aba2978830e5b263b1ac1800c1a813e713dc Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Thu, 5 May 2022 16:00:20 +0200 Subject: [PATCH 06/16] listens to socket.other filepath_node_mode --- core/sockets.py | 3 +++ nodes/exchange/FCStd_write.py | 2 +- nodes/network/file_path.py | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/sockets.py b/core/sockets.py index 7f3dd59b7b..e14ee2e9c8 100644 --- a/core/sockets.py +++ b/core/sockets.py @@ -1060,6 +1060,9 @@ class SvFilePathSocket(NodeSocket, SvSocketCommon): color = (0.9, 0.9, 0.3, 1.0) quick_link_to_node = 'SvFilePathNode' + filepath_node_mode: StringProperty( + name="filepath node mode", + description="use this property to configure the behaviour of a quicklinked filepath node") class SvSvgSocket(NodeSocket, SvSocketCommon): diff --git a/nodes/exchange/FCStd_write.py b/nodes/exchange/FCStd_write.py index 431be64d80..936811c294 100644 --- a/nodes/exchange/FCStd_write.py +++ b/nodes/exchange/FCStd_write.py @@ -89,7 +89,7 @@ def draw_buttons(self, context, layout): def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "File Path") + self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="FreeCAD") if self.obj_format == 'mesh': self.inputs.new('SvVerticesSocket', "Verts") diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 8b8797ae72..a16271a11f 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -112,10 +112,26 @@ def set_data(self, dirname, files): else: self.files_num = len(files) + def get_linked_socket_mode_and_set_operator(self): + """ + only call this mode if the output(s) .is_linked returns true + """ + socket = self.outputs[0] + if socket.is_linked: + other_socket = socket.other + if hasattr(other_socket, "filepath_node_mode"): + print("YES!", other_socket.filepath_node_mode) + self.mode = other_socket.filepath_node_mode + else: + self.mode = '' + def process(self): # return if no outputs are connected if not any(s.is_linked for s in self.outputs): return + + self.get_linked_socket_mode_and_set_operator() + directory = self.directory if self.files: files = [] From 96f01b1b86c10a1d2a6b793abfc80f5adbd742a0 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Thu, 5 May 2022 16:09:46 +0200 Subject: [PATCH 07/16] reset self.mode preemptively --- nodes/network/file_path.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index a16271a11f..c50ca7d7fe 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -117,13 +117,11 @@ def get_linked_socket_mode_and_set_operator(self): only call this mode if the output(s) .is_linked returns true """ socket = self.outputs[0] + self.mode = "" if socket.is_linked: other_socket = socket.other if hasattr(other_socket, "filepath_node_mode"): - print("YES!", other_socket.filepath_node_mode) self.mode = other_socket.filepath_node_mode - else: - self.mode = '' def process(self): # return if no outputs are connected From bd00aa7d5de527938fb54c7780334fbaa0b3d2aa Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 14:39:10 +0200 Subject: [PATCH 08/16] adds a way to force a filetype mode, and reset all --- nodes/network/file_path.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index c50ca7d7fe..cd94247937 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -13,7 +13,7 @@ from bpy.props import ( StringProperty, CollectionProperty, - IntProperty, + IntProperty, EnumProperty ) from bpy.types import ( Operator, @@ -39,14 +39,20 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): maxlen=1024, default="", subtype='FILE_PATH') filename_ext: StringProperty(default="") - filter_glob: StringProperty(default="", options={'HIDDEN'}) + filter_glob: StringProperty(default="") - mode: StringProperty(default='') def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" self.filter_glob = "*.FCStd" # #*.tif;*.png;" (if more than one, separate by ;) + else: + self.filename_ext = '' + self.filter_glob = '' + + # mode: StringProperty(default='') + behaviours = ["FreeCAD", "None"] + mode: EnumProperty(items=[(i, i, '') for i in behaviours], update=custom_config) def sv_execute(self, context, node): if self.mode == "FreeCAD": From a9cad7e40323d8b9a0179e5470ca4056e8ce801c Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 14:44:25 +0200 Subject: [PATCH 09/16] allow backup files to show --- nodes/network/file_path.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index cd94247937..e11ab720aa 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -45,7 +45,7 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" - self.filter_glob = "*.FCStd" # #*.tif;*.png;" (if more than one, separate by ;) + self.filter_glob = "*.FCStd;*.FCStd1" # #*.tif;*.png;" (if more than one, separate by ;) else: self.filename_ext = '' self.filter_glob = '' @@ -58,7 +58,7 @@ def sv_execute(self, context, node): if self.mode == "FreeCAD": # This is triggered after the file is selected or typed in by the user in the Text Field of path if self.directory and len(self.files) == 1: - if self.files[0].name and not self.files[0].name.endswith(".FCStd"): + if self.files[0].name and not self.files[0].name.endswith((".FCStd", ".FCStd1")): self.files[0].name = self.files[0].name + ".FCStd" node.set_data(self.directory, self.files) From 2eb5248e30ebebc0a9fb9ba0711a518e27b51ce3 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 14:53:30 +0200 Subject: [PATCH 10/16] whitespace --- nodes/network/file_path.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index e11ab720aa..754a5108cb 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -41,7 +41,6 @@ class SvFilePathFinder(bpy.types.Operator, SvGenericNodeLocator): filename_ext: StringProperty(default="") filter_glob: StringProperty(default="") - def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" From 2dd9b29c92161d37f6d01b5b3465c33574c6c888 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 15:07:39 +0200 Subject: [PATCH 11/16] auto changes mode if detached, dangerous? --- nodes/network/file_path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 754a5108cb..9ab9aa62e5 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -94,7 +94,7 @@ def draw_buttons(self, context, layout): op = 'node.sv_file_path' file_path_operator = self.wrapper_tracked_ui_draw_op(layout, op, icon='FILE', text='') - file_path_operator.mode = self.mode + file_path_operator.mode = self.mode if self.outputs[0].is_linked else 'None' # not sure how stable this is. if self.files_num == 0: layout.label(text=self.directory) From 661159956a9a8b015b942fac54d73e2ce220f741 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 15:21:15 +0200 Subject: [PATCH 12/16] yikes.. --- nodes/network/file_path.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 9ab9aa62e5..e879e5dff2 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -64,7 +64,15 @@ def sv_execute(self, context, node): def invoke(self, context, event): - if self.mode: self.custom_config(context) + if self.mode: + node = self.get_node(context) + # this is a small check to see if the button was pressed while the node was connected to + # an output. if it was not connected, then the operator should be file agnostic by default. + # it's also a change to reset the node.mode. + if not node.outputs[0].is_linked: + node.mode = 'None' + else: + self.custom_config(context) wm = context.window_manager wm.fileselect_add(self) @@ -94,7 +102,7 @@ def draw_buttons(self, context, layout): op = 'node.sv_file_path' file_path_operator = self.wrapper_tracked_ui_draw_op(layout, op, icon='FILE', text='') - file_path_operator.mode = self.mode if self.outputs[0].is_linked else 'None' # not sure how stable this is. + file_path_operator.mode = self.mode if self.files_num == 0: layout.label(text=self.directory) From 55f3821c3b2611385a4fba47ea51b246ab0f7cee Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 15:26:39 +0200 Subject: [PATCH 13/16] remove that --- nodes/network/file_path.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index e879e5dff2..1e16c29342 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -51,7 +51,7 @@ def custom_config(self, context): # mode: StringProperty(default='') behaviours = ["FreeCAD", "None"] - mode: EnumProperty(items=[(i, i, '') for i in behaviours], update=custom_config) + mode: EnumProperty(items=[(i, i, '') for i in behaviours], update=custom_config, default='None') def sv_execute(self, context, node): if self.mode == "FreeCAD": @@ -64,15 +64,7 @@ def sv_execute(self, context, node): def invoke(self, context, event): - if self.mode: - node = self.get_node(context) - # this is a small check to see if the button was pressed while the node was connected to - # an output. if it was not connected, then the operator should be file agnostic by default. - # it's also a change to reset the node.mode. - if not node.outputs[0].is_linked: - node.mode = 'None' - else: - self.custom_config(context) + self.custom_config(context) wm = context.window_manager wm.fileselect_add(self) From 02eb31f233be04197163c5bf97c4aca63df714a4 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 15:40:31 +0200 Subject: [PATCH 14/16] what happens if node is connected to multiple destination sockets --- nodes/network/file_path.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes/network/file_path.py b/nodes/network/file_path.py index 1e16c29342..b73ca0af24 100644 --- a/nodes/network/file_path.py +++ b/nodes/network/file_path.py @@ -45,7 +45,7 @@ def custom_config(self, context): if self.mode == "FreeCAD": self.filename_ext = ".FCStd" # ".tif" self.filter_glob = "*.FCStd;*.FCStd1" # #*.tif;*.png;" (if more than one, separate by ;) - else: + elif self.mode == "None": self.filename_ext = '' self.filter_glob = '' @@ -84,7 +84,7 @@ class SvFilePathNode(bpy.types.Node, SverchCustomTreeNode): files_num: IntProperty(name='files number ', default=0) files: CollectionProperty(name="File Path", type=OperatorFileListElement) directory: StringProperty(subtype='DIR_PATH', update=updateNode) - mode: StringProperty(default='', description="mode determines behaviour of the File Open Dialogue and Operator") + mode: StringProperty(default='None', description="mode determines behaviour of the File Open Dialogue and Operator") def sv_init(self, context): @@ -122,7 +122,7 @@ def get_linked_socket_mode_and_set_operator(self): only call this mode if the output(s) .is_linked returns true """ socket = self.outputs[0] - self.mode = "" + self.mode = "None" if socket.is_linked: other_socket = socket.other if hasattr(other_socket, "filepath_node_mode"): From 5a4168875309775837b99459c0a53f7067440736 Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Fri, 6 May 2022 17:57:06 +0200 Subject: [PATCH 15/16] add other file types --- nodes/exchange/FCStd_read.py | 2 +- nodes/exchange/FCStd_sketch.py | 2 +- nodes/exchange/FCStd_spreadsheet.py | 2 +- nodes/solid/export_solid.py | 2 +- nodes/solid/import_solid.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nodes/exchange/FCStd_read.py b/nodes/exchange/FCStd_read.py index f507fafa75..b94c5182b8 100644 --- a/nodes/exchange/FCStd_read.py +++ b/nodes/exchange/FCStd_read.py @@ -76,7 +76,7 @@ def draw_buttons(self, context, layout): def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "File Path") + self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="FreeCAD") self.inputs.new('SvStringsSocket', "Part Filter") self.outputs.new('SvSolidSocket', "Solid") diff --git a/nodes/exchange/FCStd_sketch.py b/nodes/exchange/FCStd_sketch.py index 73ba06b3d2..43a38defe6 100644 --- a/nodes/exchange/FCStd_sketch.py +++ b/nodes/exchange/FCStd_sketch.py @@ -74,7 +74,7 @@ def draw_buttons(self, context, layout): self.wrapper_tracked_ui_draw_op(layout, SvReadFCStdSketchOperator.bl_idname, icon='FILE_REFRESH', text="UPDATE") def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "File Path") + self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="FreeCAD") self.inputs.new('SvStringsSocket', "Sketch Filter") self.outputs.new('SvVerticesSocket', "Verts") diff --git a/nodes/exchange/FCStd_spreadsheet.py b/nodes/exchange/FCStd_spreadsheet.py index 137e149ef9..37eed803e2 100644 --- a/nodes/exchange/FCStd_spreadsheet.py +++ b/nodes/exchange/FCStd_spreadsheet.py @@ -73,7 +73,7 @@ def draw_buttons(self, context, layout): self.wrapper_tracked_ui_draw_op(layout, SvFCStdSpreadsheetOperator.bl_idname, icon='FILE_REFRESH', text="UPDATE") def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "File Path") + self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="FreeCAD") self.inputs.new('SvStringsSocket', "cell_in").prop_name = 'cell_in' self.outputs.new('SvStringsSocket', "cell_out") diff --git a/nodes/solid/export_solid.py b/nodes/solid/export_solid.py index 1d61586beb..b13a1e78bb 100644 --- a/nodes/solid/export_solid.py +++ b/nodes/solid/export_solid.py @@ -110,7 +110,7 @@ def draw_buttons(self, context, layout): self.wrapper_tracked_ui_draw_op(layout, SvExportSolidOperator.bl_idname, icon='EXPORT', text="EXPORT") def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "Folder Path") + self.sv_new_input('SvFilePathSocket', "Folder Path", filepath_node_mode="Solids") self.inputs.new('SvSolidSocket', "Solids") def process(self): diff --git a/nodes/solid/import_solid.py b/nodes/solid/import_solid.py index 6008b61593..ef846a5eae 100644 --- a/nodes/solid/import_solid.py +++ b/nodes/solid/import_solid.py @@ -20,7 +20,7 @@ class SvImportSolidNode(bpy.types.Node, SverchCustomTreeNode): solid_catergory = "Inputs" def sv_init(self, context): - self.inputs.new('SvFilePathSocket', "File Path") + self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="BREP") self.outputs.new('SvSolidSocket', "Solid") def process(self): From 0f21050921102e48158c2454feab3d54b80a4e4c Mon Sep 17 00:00:00 2001 From: Dealga McArdle Date: Sat, 7 May 2022 12:09:58 +0200 Subject: [PATCH 16/16] explore other filetypes --- nodes/solid/export_solid.py | 2 +- nodes/solid/import_solid.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/solid/export_solid.py b/nodes/solid/export_solid.py index b13a1e78bb..1d61586beb 100644 --- a/nodes/solid/export_solid.py +++ b/nodes/solid/export_solid.py @@ -110,7 +110,7 @@ def draw_buttons(self, context, layout): self.wrapper_tracked_ui_draw_op(layout, SvExportSolidOperator.bl_idname, icon='EXPORT', text="EXPORT") def sv_init(self, context): - self.sv_new_input('SvFilePathSocket', "Folder Path", filepath_node_mode="Solids") + self.inputs.new('SvFilePathSocket', "Folder Path") self.inputs.new('SvSolidSocket', "Solids") def process(self): diff --git a/nodes/solid/import_solid.py b/nodes/solid/import_solid.py index ef846a5eae..195674fda1 100644 --- a/nodes/solid/import_solid.py +++ b/nodes/solid/import_solid.py @@ -20,7 +20,7 @@ class SvImportSolidNode(bpy.types.Node, SverchCustomTreeNode): solid_catergory = "Inputs" def sv_init(self, context): - self.sv_new_input('SvFilePathSocket', "File Path", filepath_node_mode="BREP") + self.sv_new_input('SvFilePathSocket', "File Path") #, filepath_node_mode="BREP") self.outputs.new('SvSolidSocket', "Solid") def process(self):