Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/sv_tools.py
Created July 30, 2014 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/501f3186567a86806e22 to your computer and use it in GitHub Desktop.
Save zeffii/501f3186567a86806e22 to your computer and use it in GitHub Desktop.
class AddSVTreeWithSafety(bpy.types.Operator):
"""Tooltip"""
bl_idname = "node.new_sv_nodetree"
bl_label = "new sv nodetree with fake user"
@classmethod
def poll(cls, context):
space = context.space_data
return space.type == 'NODE_EDITOR'
def execute(self, context):
""" create new node tree / force fake user to True """
n = bpy.data.node_groups.new('NodeTree', 'SverchCustomTreeType')
n.use_fake_user = True
return {'FINISHED'}
class NODE_HT_header(bpy.types.Header):
bl_space_type = 'NODE_EDITOR'
def draw(self, context):
scene = context.scene
layout = self.layout
layout.template_ID(
data=scene, # not sure
property="node_tree", # not sure
new="node.new_sv_nodetree")
@zeffii
Copy link
Author

zeffii commented Jul 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment