BGE Button types panel, can edit existing buttons but not add new ones yet.
[blender.git] / release / ui / space_logic.py
1 import bpy
2
3 class LOGIC_PT_physics(bpy.types.Panel):
4         __space_type__ = "LOGIC_EDITOR"
5         __region_type__ = "UI"
6         __label__ = "Physics"
7
8         def poll(self, context):
9                 ob = context.active_object
10                 return ob and ob.game
11
12         def draw(self, context):
13                 layout = self.layout
14                 ob = context.active_object
15                 
16                 game = ob.game
17
18                 flow = layout.column_flow()
19                 flow.active = True
20                 flow.itemR(game, "physics_type")
21                 flow.itemR(game, "actor")
22                 
23                 row = layout.row()
24                 row.itemR(game, "ghost")
25                 row.itemR(ob, "restrict_render", text="Invisible") # out of place but useful
26                 
27                 flow = layout.column_flow()
28                 flow.itemR(game, "mass")
29                 flow.itemR(game, "radius")
30                 flow.itemR(game, "no_sleeping")
31                 flow.itemR(game, "damping")
32                 flow.itemR(game, "rotation_damping")
33                 flow.itemR(game, "minimum_velocity")
34                 flow.itemR(game, "maximum_velocity")
35                 
36                 row = layout.row()
37                 row.itemR(game, "do_fh")
38                 row.itemR(game, "rotation_fh")
39                 
40                 flow = layout.column_flow()
41                 flow.itemR(game, "form_factor")
42                 flow.itemR(game, "anisotropic_friction")
43                 
44                 flow = layout.column_flow()
45                 flow.active = game.anisotropic_friction
46                 flow.itemR(game, "friction_coefficients")
47                 
48                 split = layout.split()
49                 sub = split.column()
50                 sub.itemR(game, "lock_x_axis")
51                 sub.itemR(game, "lock_y_axis")
52                 sub.itemR(game, "lock_z_axis")
53                 sub = split.column()
54                 sub.itemR(game, "lock_x_rot_axis")
55                 sub.itemR(game, "lock_y_rot_axis")
56                 sub.itemR(game, "lock_z_rot_axis")
57
58
59 class LOGIC_PT_collision_bounds(bpy.types.Panel):
60         __space_type__ = "LOGIC_EDITOR"
61         __region_type__ = "UI"
62         __label__ = "Collision Bounds"
63
64         def poll(self, context):
65                 ob = context.active_object
66                 return ob and ob.game
67         
68         def draw_header(self, context):
69                 layout = self.layout
70                 ob = context.active_object
71                 game = ob.game
72
73                 layout.itemR(game, "use_collision_bounds", text="")
74         
75         def draw(self, context):
76                 layout = self.layout
77                 
78                 ob = context.active_object
79                 game = ob.game
80                 
81                 flow = layout.column_flow()
82                 flow.active = game.use_collision_bounds
83                 flow.itemR(game, "collision_bounds")
84                 flow.itemR(game, "collision_compound")
85                 flow.itemR(game, "collision_margin")
86
87 class LOGIC_PT_properties(bpy.types.Panel):
88         __space_type__ = "LOGIC_EDITOR"
89         __region_type__ = "UI"
90         __label__ = "Properties"
91
92         def poll(self, context):
93                 ob = context.active_object
94                 return ob and ob.game
95         
96         def draw(self, context):
97                 layout = self.layout
98                 
99                 ob = context.active_object
100                 game = ob.game
101                 
102                 for prop in game.properties:
103                         flow = layout.row()
104                         flow.itemR(prop, "name", text="")
105                         flow.itemR(prop, "type", text="")
106                         flow.itemR(prop, "value", text="") # we dont care about the type. rna will display correctly
107                         flow.itemR(prop, "debug")
108
109 bpy.types.register(LOGIC_PT_physics)
110 bpy.types.register(LOGIC_PT_collision_bounds)
111 bpy.types.register(LOGIC_PT_properties)