Skip to content

Commit

Permalink
pep8 for cm_generation/cm_genNodes.py
Browse files Browse the repository at this point in the history
  • Loading branch information
johnroper100 committed Oct 2, 2016
1 parent ca3f815 commit b02bcb8
Showing 1 changed file with 39 additions and 21 deletions.
60 changes: 39 additions & 21 deletions cm_generation/cm_genNodes.py
Expand Up @@ -120,13 +120,14 @@ def draw_buttons(self, context, layout):
def getSettings(self):
return {"inputGroup": self.inputGroup}


class GeoSwitchNode(CrowdMasterAGenTreeNode):
'''The geo switch node'''
bl_idname = 'GeoSwitchNodeType'
bl_label = 'Geo Switch'
bl_icon = 'SOUND'

switchAmount = FloatProperty(name="Amount", default = 0.5, min=0.0, max=1.0, precision=0)
switchAmount = FloatProperty(name="Amount", default=0.5, min=0.0, max=1.0, precision=0)

def init(self, context):
self.inputs.new('GeoSocketType', "Object 1")
Expand All @@ -142,13 +143,14 @@ def draw_buttons(self, context, layout):
def getSettings(self):
return {"switchAmout": self.switchAmount}


class TemplateSwitchNode(CrowdMasterAGenTreeNode):
'''The template switch node'''
bl_idname = 'TemplateSwitchNodeType'
bl_label = 'Template Switch'
bl_icon = 'SOUND'

switchAmount = FloatProperty(name="Amount", default = 0.5, min=0.0, max=1.0, precision=0)
switchAmount = FloatProperty(name="Amount", default=0.5, min=0.0, max=1.0, precision=0)

def init(self, context):
self.inputs.new('TemplateSocketType', "Template 1")
Expand All @@ -164,6 +166,7 @@ def draw_buttons(self, context, layout):
def getSettings(self):
return {"switchAmout": self.switchAmount}


class ParentNode(CrowdMasterAGenTreeNode):
'''The parent node'''
bl_idname = 'ParentNodeType'
Expand All @@ -187,6 +190,7 @@ def draw_buttons(self, context, layout):
def getSettings(self):
return {"parentTo": self.parentTo}


class TemplateNode(CrowdMasterAGenTreeNode):
'''The template node'''
bl_idname = 'TemplateNodeType'
Expand All @@ -213,6 +217,7 @@ def getSettings(self):
return {"brainType": self.brainType,
"deferGeo": self.deferGeo}


class OffsetNode(CrowdMasterAGenTreeNode):
'''The offset node'''
bl_idname = 'OffsetNodeType'
Expand All @@ -227,10 +232,10 @@ class OffsetNode(CrowdMasterAGenTreeNode):
description="An object in the scene from which to get the location")
locationOffset = FloatVectorProperty(name="Location Offset",
description="Also add this to the location",
default = [0, 0, 0], subtype = "XYZ")
default=[0, 0, 0], subtype="XYZ")
rotationOffset = FloatVectorProperty(name="Rotation Offset",
description="Also add this to the rotation",
default = [0, 0, 0], subtype = "XYZ")
default=[0, 0, 0], subtype="XYZ")

def init(self, context):
self.inputs.new("TemplateSocketType", "Template")
Expand All @@ -250,12 +255,14 @@ def getSettings(self):
"locationOffset": self.locationOffset,
"rotationOffset": self.rotationOffset}


def updateRandomNode(self, context):
if self.minRandRot > self.maxRandRot:
self.maxRandRot = self.minRandRot
if self.minRandSz > self.maxRandSz:
self.maxRandSz = self.minRandSz


class RandomNode(CrowdMasterAGenTreeNode):
'''The random node'''
bl_idname = 'RandomNodeType'
Expand All @@ -265,20 +272,20 @@ class RandomNode(CrowdMasterAGenTreeNode):

minRandRot = FloatProperty(name="Min Rand Rotation",
description="The minimum random rotation in the Z axis for each agent.",
default = -10, min=-360.0, max=360,
default=-10, min=-360.0, max=360,
update=updateRandomNode)
maxRandRot = FloatProperty(name="Max Rand Rotation",
description="The maximum random rotation in the Z axis for each agent.",
default = 10, min=-360, max=360.0,
default=10, min=-360, max=360.0,
update=updateRandomNode)

minRandSz = FloatProperty(name="Min Rand Scale",
description="The minimum random scale for each agent.",
default = 1.0, min=0, precision=3,
default=1.0, min=0, precision=3,
update=updateRandomNode)
maxRandSz = FloatProperty(name="Max Rand Scale",
description="The maximum random scale for each agent.",
default = 1.0, min=0, precision=3,
default=1.0, min=0, precision=3,
update=updateRandomNode)

def init(self, context):
Expand Down Expand Up @@ -357,6 +364,7 @@ def update(self):
if inps[-1].is_linked:
self.inputs.new("TemplateSocketType", "Template {}".format(len(inps)))


class RandomPositionNode(CrowdMasterAGenTreeNode):
'''The random positioing node'''
bl_idname = 'RandomPositionNodeType'
Expand All @@ -369,10 +377,10 @@ class RandomPositionNode(CrowdMasterAGenTreeNode):
default=1)

locationType = EnumProperty(
items = [("radius", "Radius", "Within radius of requested")],
name = "Location Type",
description = "Which location type to use",
default = "radius"
item=[("radius", "Radius", "Within radius of requested")],
name="Location Type",
description="Which location type to use",
default="radius"
)

radius = FloatProperty(name="Radius",
Expand All @@ -391,16 +399,16 @@ class RandomPositionNode(CrowdMasterAGenTreeNode):

MaxX = FloatProperty(name="Max X",
description="The maximum distance in the X direction around the center point where the agents will be randomly spawned.",
default = 50.0)
default=50.0)
MaxY = FloatProperty(name="Max Y",
description="The maximum distance in the Y direction around the center point where the agents will be randomly spawned.",
default = 50.0)
default=50.0)
MinX = FloatProperty(name="Min X",
description="The minimum distance in the X direction around the center point where the agents will be randomly spawned.",
default = -50.0)
default=-50.0)
MinY = FloatProperty(name="Min Y",
description="The minimum distance in the Y direction around the center point where the agents will be randomly spawned.",
default = -50.0)
default=-50.0)

def init(self, context):
self.inputs.new('TemplateSocketType', "Template")
Expand Down Expand Up @@ -442,6 +450,7 @@ def getSettings(self):
"relaxIterations": self.relaxIterations,
"relaxRadius": self.relaxRadius}


class FormationPositionNode(CrowdMasterAGenTreeNode):
'''The formation positioing node'''
bl_idname = 'FormationPositionNodeType'
Expand Down Expand Up @@ -481,6 +490,7 @@ def getSettings(self):
"ArrayRowMargin": self.ArrayRowMargin,
"ArrayColumnMargin": self.ArrayColumnMargin}


class TargetPositionNode(CrowdMasterAGenTreeNode):
'''The target positioing node'''
bl_idname = 'TargetPositionNodeType'
Expand All @@ -489,11 +499,11 @@ class TargetPositionNode(CrowdMasterAGenTreeNode):
bl_width_default = 300.0

targetType = EnumProperty(
items = [("object", "Object", "Use the locations of each object in a group"),
("vertex", "Vertex", "Use the location of each vertex on an object")],
name = "Target Type",
description = "Which target type to use",
default = "object"
items=[("object", "Object", "Use the locations of each object in a group"),
("vertex", "Vertex", "Use the location of each vertex on an object")],
name="Target Type",
description="Which target type to use",
default="object"
)

targetObject = StringProperty(name="Target Object",
Expand Down Expand Up @@ -524,6 +534,7 @@ def getSettings(self):
"targetGroups": self.targetGroups,
"overwritePosition": self.overwritePosition}


class ObstacleNode(CrowdMasterAGenTreeNode):
'''The obstacle node'''
bl_idname = 'ObstacleNodeType'
Expand All @@ -548,6 +559,7 @@ def getSettings(self):
return {"obstacleGroup": self.obstacleGroup,
"margin": self.margin}


class GroundNode(CrowdMasterAGenTreeNode):
'''The ground node'''
bl_idname = 'GroundNodeType'
Expand Down Expand Up @@ -580,6 +592,7 @@ def get_lines(text_file):
for line in text_file.lines:
yield line.body


class NoteNode(CrowdMasterAGenTreeNode):
"""For keeping the graph well organised"""
bl_label = 'Note'
Expand Down Expand Up @@ -649,6 +662,7 @@ def to_text(self):
text.clear()
text.write(self.text)


class GenNoteTextFromClipboard(bpy.types.Operator):
"""Grab whatever text is in the clipboard"""
bl_idname = "node.gen_note_from_clipboard"
Expand All @@ -664,6 +678,7 @@ def execute(self, context):
node.text = text
return {'FINISHED'}


class GenNoteClear(bpy.types.Operator):
"""Clear Note Node"""
bl_idname = "node.gen_note_clear"
Expand All @@ -679,6 +694,7 @@ def execute(self, context):
import nodeitems_utils
from nodeitems_utils import NodeCategory, NodeItem


class CrowdMasterAGenCategories(NodeCategory):
@classmethod
def poll(cls, context):
Expand Down Expand Up @@ -717,6 +733,7 @@ def poll(cls, context):
])
]


def register():
bpy.utils.register_class(CrowdMasterAGenTree)
bpy.utils.register_class(GeoSocket)
Expand Down Expand Up @@ -747,6 +764,7 @@ def register():

nodeitems_utils.register_node_categories("AGEN_CUSTOM_NODES", agen_node_categories)


def unregister():
nodeitems_utils.unregister_node_categories("AGEN_CUSTOM_NODES")

Expand Down

0 comments on commit b02bcb8

Please sign in to comment.