Cannot create NodeTree subclass without icon #42389

Closed
opened 2014-10-25 15:25:02 +02:00 by Linus Yng · 7 comments

System Information
Ubuntu Linux

Blender Version
2.70a, 2.72, 2.72b

Short description of error
NodeTree needs an icon

Exact steps for others to reproduce the error

The following script doesn't work.

import bpy

class TestTree(bpy.types.NodeTree):
    bl_idname = 'TestTree'
    bl_label = 'My Test Tree'
    
bpy.utils.register_class(TestTree)

It gives the following error:


AttributeError: expected NodeTree, TestTree class to have an "bl_icon" attribute

Accoding to the documentation in custom_nodes.py

    - Icon identifier
    - NOTE: If no icon is defined, the node tree will not show up in the editor header!
    - This can be used to make additional tree types for groups and similar nodes (see below)
    - Only one base tree class is needed in the editor for selecting the general category
    bl_icon = 'NODETREE'

Asked Lukas about this at bcon and filed this report.

**System Information** Ubuntu Linux **Blender Version** 2.70a, 2.72, 2.72b **Short description of error** NodeTree needs an icon **Exact steps for others to reproduce the error** The following script doesn't work. ``` import bpy class TestTree(bpy.types.NodeTree): bl_idname = 'TestTree' bl_label = 'My Test Tree' bpy.utils.register_class(TestTree) ``` It gives the following error: ``` AttributeError: expected NodeTree, TestTree class to have an "bl_icon" attribute ``` Accoding to the documentation in custom_nodes.py ``` - Icon identifier - NOTE: If no icon is defined, the node tree will not show up in the editor header! - This can be used to make additional tree types for groups and similar nodes (see below) - Only one base tree class is needed in the editor for selecting the general category bl_icon = 'NODETREE' ``` Asked Lukas about this at bcon and filed this report.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @LinusYng

Added subscriber: @LinusYng
Lukas Tönne was assigned by Bastien Montagne 2014-10-26 08:38:08 +01:00

This issue was referenced by blender/blender@a6c2d02366

This issue was referenced by blender/blender@a6c2d02366682d9375b8b69185f657b99ac8f038
Member

Sorry for the confusion, the comment in the example script is actually outdated... In order to hide a node tree from the editor header you can instead write a poll function for the type:

http://www.blender.org/documentation/blender_python_api_2_71_6/bpy.types.NodeTree.html#bpy.types.NodeTree.poll

Sorry for the confusion, the comment in the example script is actually outdated... In order to hide a node tree from the editor header you can instead write a poll function for the type: http://www.blender.org/documentation/blender_python_api_2_71_6/bpy.types.NodeTree.html#bpy.types.NodeTree.poll
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

Closed by commit blender/blender@a6c2d02366.

Closed by commit blender/blender@a6c2d02366.
Author

Thanks for clearing that up.

Thanks for clearing that up.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#42389
No description provided.