Attribute Error
Verfasst: Freitag 20. April 2018, 14:35
Hallo Zusammen
Ich programmiere den Space Colonization Algorithmus als Addon für Blender. Und jetzt kommt diese Fehlermeldung:
TypeError: __init__() missing 1 required positional argument: 'p'
bei tree = Tree() und bei setup(self) in def execute
Und hier nochmals in der linie self.branches = array[Branch()]
Ich verstehe nicht wieso er gerade ein 'p' vermisst.
Vielen Dank schon im Voraus
Ich programmiere den Space Colonization Algorithmus als Addon für Blender. Und jetzt kommt diese Fehlermeldung:
TypeError: __init__() missing 1 required positional argument: 'p'
bei tree = Tree() und bei setup(self) in def execute
Code: Alles auswählen
import bpy
from .tree import Tree, grow, show
from .Branch import Branch, reset, nextv
from .Leaf import Leaf
def setup(self):
tree = Tree()
def main(context,self,tree):
self.tree.show()
self.tree.grow()
class AddTree(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
def execute(self, context):
setup(self)
main(context,self,tree)
def register():
bpy.utils.register_class(AddTree)
def unregister():
bpy.utils.unregister_class(AddTree)
if __name__ == "__main__":
register()
bpy.ops.object.simple_operator()
Code: Alles auswählen
class Tree:
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_label = 'Tools Tab Label'
bl_context = 'objectmode'
bl_category = 'SC'
def __init__(self):
self.branches = array[Branch()]
self.leaves = array[Leaf()]
i = 0
while(i < 1000):
self.leaves.add(Leaf())
i += 1
root = Branch(Vector(0,0,0), Vector(0, -1))
self.branches.add(root)
current = Branch(root)
while not self.closeEnough(current):
trunk = Branch(current)
self.branches.add(trunk)
current = trunk
Vielen Dank schon im Voraus