~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to release/scripts/startup/bl_ui/properties_physics_field.py

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ##### BEGIN GPL LICENSE BLOCK #####
 
2
#
 
3
#  This program is free software; you can redistribute it and/or
 
4
#  modify it under the terms of the GNU General Public License
 
5
#  as published by the Free Software Foundation; either version 2
 
6
#  of the License, or (at your option) any later version.
 
7
#
 
8
#  This program is distributed in the hope that it will be useful,
 
9
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
#  GNU General Public License for more details.
 
12
#
 
13
#  You should have received a copy of the GNU General Public License
 
14
#  along with this program; if not, write to the Free Software Foundation,
 
15
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
16
#
 
17
# ##### END GPL LICENSE BLOCK #####
 
18
 
 
19
# <pep8 compliant>
 
20
import bpy
 
21
from bpy.types import Panel
 
22
 
 
23
from bl_ui.properties_physics_common import (
 
24
    basic_force_field_settings_ui,
 
25
    basic_force_field_falloff_ui,
 
26
    )
 
27
 
 
28
 
 
29
class PhysicButtonsPanel():
 
30
    bl_space_type = 'PROPERTIES'
 
31
    bl_region_type = 'WINDOW'
 
32
    bl_context = "physics"
 
33
 
 
34
    @classmethod
 
35
    def poll(cls, context):
 
36
        rd = context.scene.render
 
37
        return (context.object) and (not rd.use_game_engine)
 
38
 
 
39
 
 
40
class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
 
41
    bl_label = "Force Fields"
 
42
 
 
43
    @classmethod
 
44
    def poll(cls, context):
 
45
        ob = context.object
 
46
        rd = context.scene.render
 
47
        return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
 
48
 
 
49
    def draw(self, context):
 
50
        layout = self.layout
 
51
 
 
52
        ob = context.object
 
53
        field = ob.field
 
54
 
 
55
        split = layout.split(percentage=0.2)
 
56
        split.label(text="Type:")
 
57
 
 
58
        split.prop(field, "type", text="")
 
59
 
 
60
        if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}:
 
61
            split = layout.split(percentage=0.2)
 
62
            split.label(text="Shape:")
 
63
            split.prop(field, "shape", text="")
 
64
        elif field.type == 'TEXTURE':
 
65
            split = layout.split(percentage=0.2)
 
66
            split.label(text="Texture:")
 
67
            split.row().template_ID(field, "texture", new="texture.new")
 
68
 
 
69
        split = layout.split()
 
70
 
 
71
        if field.type == 'NONE':
 
72
            return  # nothing to draw
 
73
        elif field.type == 'GUIDE':
 
74
            col = split.column()
 
75
            col.prop(field, "guide_minimum")
 
76
            col.prop(field, "guide_free")
 
77
            col.prop(field, "falloff_power")
 
78
            col.prop(field, "use_guide_path_add")
 
79
            col.prop(field, "use_guide_path_weight")
 
80
 
 
81
            col = split.column()
 
82
            col.label(text="Clumping:")
 
83
            col.prop(field, "guide_clump_amount")
 
84
            col.prop(field, "guide_clump_shape")
 
85
 
 
86
            row = layout.row()
 
87
            row.prop(field, "use_max_distance")
 
88
            sub = row.row()
 
89
            sub.active = field.use_max_distance
 
90
            sub.prop(field, "distance_max")
 
91
 
 
92
            layout.separator()
 
93
 
 
94
            layout.prop(field, "guide_kink_type")
 
95
            if (field.guide_kink_type != 'NONE'):
 
96
                layout.prop(field, "guide_kink_axis")
 
97
 
 
98
                split = layout.split()
 
99
 
 
100
                col = split.column()
 
101
                col.prop(field, "guide_kink_frequency")
 
102
                col.prop(field, "guide_kink_shape")
 
103
 
 
104
                col = split.column()
 
105
                col.prop(field, "guide_kink_amplitude")
 
106
 
 
107
        elif field.type == 'TEXTURE':
 
108
            col = split.column()
 
109
            col.prop(field, "strength")
 
110
            col.prop(field, "texture_mode", text="")
 
111
            col.prop(field, "texture_nabla")
 
112
 
 
113
            col = split.column()
 
114
            col.prop(field, "use_object_coords")
 
115
            col.prop(field, "use_root_coords")
 
116
            col.prop(field, "use_2d_force")
 
117
        else:
 
118
            basic_force_field_settings_ui(self, context, field)
 
119
 
 
120
        if field.type not in {'NONE', 'GUIDE'}:
 
121
 
 
122
            layout.label(text="Falloff:")
 
123
            layout.prop(field, "falloff_type", expand=True)
 
124
 
 
125
            basic_force_field_falloff_ui(self, context, field)
 
126
 
 
127
            if field.falloff_type == 'CONE':
 
128
                layout.separator()
 
129
 
 
130
                split = layout.split(percentage=0.35)
 
131
 
 
132
                col = split.column()
 
133
                col.label(text="Angular:")
 
134
                col.prop(field, "use_radial_min", text="Use Minimum")
 
135
                col.prop(field, "use_radial_max", text="Use Maximum")
 
136
 
 
137
                col = split.column()
 
138
                col.prop(field, "radial_falloff", text="Power")
 
139
 
 
140
                sub = col.column()
 
141
                sub.active = field.use_radial_min
 
142
                sub.prop(field, "radial_min", text="Angle")
 
143
 
 
144
                sub = col.column()
 
145
                sub.active = field.use_radial_max
 
146
                sub.prop(field, "radial_max", text="Angle")
 
147
 
 
148
            elif field.falloff_type == 'TUBE':
 
149
                layout.separator()
 
150
 
 
151
                split = layout.split(percentage=0.35)
 
152
 
 
153
                col = split.column()
 
154
                col.label(text="Radial:")
 
155
                col.prop(field, "use_radial_min", text="Use Minimum")
 
156
                col.prop(field, "use_radial_max", text="Use Maximum")
 
157
 
 
158
                col = split.column()
 
159
                col.prop(field, "radial_falloff", text="Power")
 
160
 
 
161
                sub = col.column()
 
162
                sub.active = field.use_radial_min
 
163
                sub.prop(field, "radial_min", text="Distance")
 
164
 
 
165
                sub = col.column()
 
166
                sub.active = field.use_radial_max
 
167
                sub.prop(field, "radial_max", text="Distance")
 
168
 
 
169
 
 
170
class PHYSICS_PT_collision(PhysicButtonsPanel, Panel):
 
171
    bl_label = "Collision"
 
172
    #bl_options = {'DEFAULT_CLOSED'}
 
173
 
 
174
    @classmethod
 
175
    def poll(cls, context):
 
176
        ob = context.object
 
177
        rd = context.scene.render
 
178
        return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
 
179
 
 
180
    def draw(self, context):
 
181
        layout = self.layout
 
182
 
 
183
        md = context.collision
 
184
 
 
185
        split = layout.split()
 
186
 
 
187
        coll = md.settings
 
188
 
 
189
        if coll:
 
190
            settings = context.object.collision
 
191
 
 
192
            layout.active = settings.use
 
193
 
 
194
            split = layout.split()
 
195
 
 
196
            col = split.column()
 
197
            col.label(text="Particle:")
 
198
            col.prop(settings, "permeability", slider=True)
 
199
            col.prop(settings, "stickness")
 
200
            col.prop(settings, "use_particle_kill")
 
201
            col.label(text="Particle Damping:")
 
202
            sub = col.column(align=True)
 
203
            sub.prop(settings, "damping_factor", text="Factor", slider=True)
 
204
            sub.prop(settings, "damping_random", text="Random", slider=True)
 
205
 
 
206
            col.label(text="Particle Friction:")
 
207
            sub = col.column(align=True)
 
208
            sub.prop(settings, "friction_factor", text="Factor", slider=True)
 
209
            sub.prop(settings, "friction_random", text="Random", slider=True)
 
210
 
 
211
            col = split.column()
 
212
            col.label(text="Soft Body and Cloth:")
 
213
            sub = col.column(align=True)
 
214
            sub.prop(settings, "thickness_outer", text="Outer", slider=True)
 
215
            sub.prop(settings, "thickness_inner", text="Inner", slider=True)
 
216
 
 
217
            col.label(text="Soft Body Damping:")
 
218
            col.prop(settings, "damping", text="Factor", slider=True)
 
219
 
 
220
            col.label(text="Force Fields:")
 
221
            col.prop(settings, "absorption", text="Absorption")
 
222
 
 
223
if __name__ == "__main__":  # only for live edit.
 
224
    bpy.utils.register_module(__name__)