Skip to content

Commit

Permalink
Setup the array positioning ui
Browse files Browse the repository at this point in the history
  • Loading branch information
johnroper100 committed Jul 15, 2016
1 parent 21b008a commit 2e1e5a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions simulation/main.py
Expand Up @@ -33,6 +33,7 @@ class CrowdMasterUIMain(bpy.types.Panel):
bl_context = "objectmode"
bl_category = "CrowdMaster"
bl_label = "Main"

def draw(self, context):
layout = self.layout
scene = context.scene
Expand All @@ -45,6 +46,8 @@ def draw(self, context):

row = layout.row()
row.scale_y = 1.2
if scene.agentGroup == "":
row.enabled = False
row.operator("scene.cm_run_simulation", icon_value=cicon('run_sim'))

class CrowdMasterUIPosition(bpy.types.Panel):
Expand All @@ -53,6 +56,15 @@ class CrowdMasterUIPosition(bpy.types.Panel):
bl_context = "objectmode"
bl_category = "CrowdMaster"
bl_label = "Position"

@classmethod
def poll(self, context):
try:
scene = context.scene
return (scene.agentGroup)
except (AttributeError, KeyError, TypeError):
return False

def draw(self, context):
layout = self.layout
scene = context.scene
Expand Down Expand Up @@ -82,3 +94,10 @@ def draw(self, context):
if scene.positionType == "formation":
row = layout.row()
row.prop(scene, "formationPositionType")

if scene.formationPositionType == "array":
row = layout.row()
row.prop(scene, "formationArrayX")

row = layout.row()
row.prop(scene, "formationArrayY")
3 changes: 3 additions & 0 deletions simulation/position.py
Expand Up @@ -28,3 +28,6 @@
name = "Formation Type",
description = "Where the spawn location is pulled from.",
default = "array")

bpy.types.Scene.formationArrayX = FloatProperty(name="Array X", description="The distance between each agent on the X axis.", default = 0)
bpy.types.Scene.formationArrayY = FloatProperty(name="Array Y", description="The distance between each agent on the Y axis.", default = 0)

0 comments on commit 2e1e5a5

Please sign in to comment.