-
-
Save zeffii/501f3186567a86806e22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Author
zeffii
commented
Jul 30, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment