Skip to content

Commit

Permalink
add massages of export/import is not supported inside node groups. Su…
Browse files Browse the repository at this point in the history
…pporting can be added easily but group input/output nodes should be excluded from exported nodes because in other way they can get into a normal tree during an import. Also for preset panel node group tree should get extra properties. Probably I did not switched off in all possible places (context menus?)
  • Loading branch information
Durman committed Jun 4, 2021
1 parent b531114 commit a65b233
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ def poll(cls, context):

def draw(self, context):
layout = self.layout
if len(context.space_data.path) > 1:
layout.label(text="Is not supported inside node groups")
return
ntree = context.space_data.node_tree
panel_props = ntree.preset_panel_properties

Expand Down
16 changes: 16 additions & 0 deletions ui/sv_IO_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def poll(cls, context):
return bool(context.space_data.node_tree)

def execute(self, context):
if len(context.space_data.path) > 1:
self.report({"WARNING"}, "Export is not supported inside node groups")
return {'CANCELLED'}

ng = bpy.data.node_groups[self.id_tree]

destination_path = self.filepath
Expand Down Expand Up @@ -206,6 +210,10 @@ class SvNodeTreeImporter(bpy.types.Operator):
new_nodetree_name: bpy.props.StringProperty()

def execute(self, context):
if len(context.space_data.path) > 1:
self.report({"WARNING"}, "Import is not supported inside node groups")
return {'CANCELLED'}

ng = context.scene.io_panel_properties.import_tree
if not ng:
self.report(type={'WARNING'}, message="The tree was not chosen, have a look at property (N) panel")
Expand Down Expand Up @@ -244,6 +252,10 @@ class SvNodeTreeImportFromGist(bpy.types.Operator):
gist_id: bpy.props.StringProperty()

def execute(self, context):
if len(context.space_data.path) > 1:
self.report({"WARNING"}, "Import is not supported inside node groups")
return {'CANCELLED'}

if not self.id_tree:
ng_name = self.new_nodetree_name
ng_params = {
Expand Down Expand Up @@ -278,6 +290,10 @@ def poll(cls, context):
return bool(context.space_data.node_tree)

def execute(self, context):
if len(context.space_data.path) > 1:
self.report({"WARNING"}, "Export is not supported inside node groups")
return {'CANCELLED'}

ng = context.space_data.node_tree

is_tree_exportable, msg = self.can_be_exported(ng)
Expand Down

0 comments on commit a65b233

Please sign in to comment.