Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objects in Lite, can optionally create json-stored object as a Scene object #4046

Merged
merged 8 commits into from
Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nodes/scene/objects_in_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class SvObjInLite(bpy.types.Node, SverchCustomTreeNode):
description='Apply modifier geometry to import (original untouched)',
name='Modifiers', default=False, update=updateNode)

do_not_add_obj_to_scene: BoolProperty(
default=False,
description="Do not add the object to the scene if this node is imported from elsewhere")

currently_storing: BoolProperty()
obj_name: StringProperty(update=updateNode)
node_dict = {}
Expand Down Expand Up @@ -129,6 +133,7 @@ def draw_buttons(self, context, layout):

row.prop(self, 'modifiers', text='', icon='MODIFIER')
layout.label(text=display_text)
layout.row().prop(self, "do_not_add_obj_to_scene", text="do not add to scene")


def pass_data_to_sockets(self):
Expand Down Expand Up @@ -167,6 +172,11 @@ def load_from_json(self, node_data: dict, import_version: float):
materials = unrolled_geom.get('MaterialIdx', [])
matrix = unrolled_geom['Matrix']

if self.do_not_add_obj_to_scene:
self.node_dict[hash(self)] = unrolled_geom
self.obj_name = name
return

with self.sv_throttle_tree_update():
bm = bmesh_from_pydata(verts, edges, polygons)
if materials:
Expand Down