| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | 
							- from .node_container_common import *
 
- from bpy.types import Node
 
- from .base_definitions import MantisNode
 
- def TellClasses():
 
-     return [
 
-              # Primitives
 
-              CirclePrimitive,
 
-             ]
 
- #*#-------------------------------#++#-------------------------------#*#
 
- # P R I M I T I V E S
 
- #*#-------------------------------#++#-------------------------------#*#
 
- class CirclePrimitive:
 
-     '''A node representing float input'''
 
-     def __init__(self, signature, base_tree):
 
-         self.base_tree=base_tree
 
-         self.signature = signature
 
-         self.inputs = {
 
-           "Name"               : NodeSocket(is_input = True, name = "Name", node = self),
 
-           "Radius"             : NodeSocket(is_input = True, name = "Radius", node = self),
 
-           "Number of Points"   : NodeSocket(is_input = True, name = "Number of Points", node = self),
 
-         }
 
-         self.outputs = {
 
-           "Circle" : NodeSocket(is_input = False, name = "Circle", node=self),
 
-         }
 
-         self.parameters = {
 
-           "Name":None,
 
-           "Radius":None,
 
-           "Number of Points":None, 
 
-           "Circle":None, 
 
-         }
 
-         self.node_type = "UTILITY"
 
-         self.hierarchy_connections = []
 
-         self.connections = []
 
-         self.hierarchy_dependencies = []
 
-         self.dependencies = []
 
-         self.prepared = True
 
-         self.executed = False
 
-     def bGetObject(self):
 
-         from bpy import data
 
-         # first try Curve, then try Mesh
 
-         bObject = data.curves.get(self.evaluate_input("Name"))
 
-         if not bObject:
 
-             bObject = data.meshes.get(self.evaluate_input("Name"))
 
-         return bObject
 
-         
 
-     def bExecute(self, bContext = None,):
 
-         # Get the datablock
 
-         data = self.bGetObject()
 
-         import bpy
 
-         if not data:
 
-             data = bpy.data.meshes.new( self.evaluate_input("Name") )
 
-         # make the circle
 
-         import bmesh; bm = bmesh.new()
 
-         bmesh.ops.create_circle( # lazy but easy
 
-             bm,
 
-             cap_ends=False,
 
-             radius=max(self.evaluate_input("Radius"), 0.0001),
 
-             segments=min( max( self.evaluate_input("Number of Points"), 3), 1024),
 
-             )
 
-         # this is rotated 90 degrees, we need Y-up instead of Z-up
 
-         from mathutils import Matrix
 
-         from math import pi
 
-         for v in bm.verts:
 
-             v.co = Matrix.Rotation(pi/2, 4, 'X') @ v.co
 
-         # done with this, push it to the data and free the bmesh.
 
-         bm.to_mesh(data); bm.free()
 
-         self.executed = True
 
- for c in TellClasses():
 
-     setup_container(c)
 
 
  |