I am currently learning how to create addons in Blender and now I got a problem. I try to create an addon which creates x times a math node. But when I try to create an IntProperty, it doesn't show up in the panel
import bpy
from bpy.props import IntProperty
class AddManyNodesOP(bpy.types.Operator):
bl_idname = ".add_many_nodes"
bl_label = "Adds many Nodes"
bl_description = "Adds many Nodes"
number_Nodes : bpy.props.IntProperty(
name ="number_Nodes",
default =5,
min = 1
)
def execute(self,context):
tree = bpy.context.scene.node_tree
for i in range(self.number_Nodes):
math_node = tree.nodes.new(type="CompositorNodeMath")
math_node.location = (100*i,0)
return {'FINISHED'}
class TooManyNodesPanel(bpy.types.Panel):
bl_label = "Too many Nodes"
bl_idname = "TOO_MANY_NODES"
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(context.scene.node_tree, 'number_Nodes')
row = layout.row()
row.operator(".add_many_nodes",text= "Add")
classes = [AddManyNodesOP,TooManyNodesPanel]
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()