diff options
Diffstat (limited to 'release/scripts/ui/properties_physics_fluid.py')
-rw-r--r-- | release/scripts/ui/properties_physics_fluid.py | 99 |
1 files changed, 35 insertions, 64 deletions
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py index 32acd88654d..2c25270eb39 100644 --- a/release/scripts/ui/properties_physics_fluid.py +++ b/release/scripts/ui/properties_physics_fluid.py @@ -19,28 +19,26 @@ # <pep8 compliant> import bpy -narrowui = bpy.context.user_preferences.view.properties_width_check - -class PhysicButtonsPanel(bpy.types.Panel): +class PhysicButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "physics" - def poll(self, context): + @classmethod + def poll(cls, context): ob = context.object rd = context.scene.render return (ob and ob.type == 'MESH') and (not rd.use_game_engine) -class PHYSICS_PT_fluid(PhysicButtonsPanel): +class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Fluid" def draw(self, context): layout = self.layout md = context.fluid - wide_ui = context.region.width > narrowui split = layout.split() @@ -58,22 +56,16 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): else: # add modifier split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION' - if wide_ui: - split.label() + split.label() fluid = None if fluid: - if wide_ui: - row = layout.row() - row.prop(fluid, "type") - if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'): - row.prop(fluid, "active", text="") - else: - layout.prop(fluid, "type", text="") - if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'): - layout.prop(fluid, "active", text="") + row = layout.row() + row.prop(fluid, "type") + if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'): + row.prop(fluid, "active", text="") layout = layout.column() if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'): @@ -89,8 +81,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.label(text="Render Display:") col.prop(fluid, "render_display_mode", text="") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Required Memory: " + fluid.memory_estimate) col.prop(fluid, "preview_resolution", text="Preview") col.label(text="Viewport Display:") @@ -104,9 +95,8 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): sub.prop(fluid, "start_time", text="Start") sub.prop(fluid, "end_time", text="End") - if wide_ui: - col = split.column() - col.label() + col = split.column() + col.label() col.prop(fluid, "generate_speed_vectors") col.prop(fluid, "reverse_frames") @@ -120,8 +110,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "export_animated_mesh") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Initial Velocity:") col.prop(fluid, "initial_velocity", text="") @@ -133,8 +122,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "export_animated_mesh") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Slip Type:") col.prop(fluid, "slip_type", text="") if fluid.slip_type == 'PARTIALSLIP': @@ -152,8 +140,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "export_animated_mesh") col.prop(fluid, "local_coordinates") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Inflow Velocity:") col.prop(fluid, "inflow_velocity", text="") @@ -165,8 +152,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "export_animated_mesh") - if wide_ui: - split.column() + split.column() elif fluid.type == 'PARTICLE': split = layout.split() @@ -176,8 +162,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "particle_influence", text="Size") col.prop(fluid, "alpha_influence", text="Alpha") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Type:") col.prop(fluid, "drops") col.prop(fluid, "floats") @@ -193,8 +178,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): col.prop(fluid, "quality", slider=True) col.prop(fluid, "reverse_frames") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Time:") sub = col.column(align=True) sub.prop(fluid, "start_time", text="Start") @@ -208,28 +192,27 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel): sub.prop(fluid, "attraction_strength", text="Strength") sub.prop(fluid, "attraction_radius", text="Radius") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Velocity Force:") sub = col.column(align=True) sub.prop(fluid, "velocity_strength", text="Strength") sub.prop(fluid, "velocity_radius", text="Radius") -class PHYSICS_PT_domain_gravity(PhysicButtonsPanel): +class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Domain World" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): md = context.fluid - return md and (md.settings.type == 'DOMAIN') + return md and md.settings and (md.settings.type == 'DOMAIN') def draw(self, context): layout = self.layout fluid = context.fluid.settings scene = context.scene - wide_ui = context.region.width > narrowui split = layout.split() @@ -252,8 +235,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel): col.label(text="Real World Size:") col.prop(fluid, "real_world_size", text="Metres") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Viscosity Presets:") sub = col.column(align=True) sub.prop(fluid, "viscosity_preset", text="") @@ -267,19 +249,19 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel): col.prop(fluid, "compressibility", slider=True) -class PHYSICS_PT_domain_boundary(PhysicButtonsPanel): +class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Domain Boundary" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): md = context.fluid - return md and (md.settings.type == 'DOMAIN') + return md and md.settings and (md.settings.type == 'DOMAIN') def draw(self, context): layout = self.layout fluid = context.fluid.settings - wide_ui = context.region.width > narrowui split = layout.split() @@ -289,20 +271,20 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel): if fluid.slip_type == 'PARTIALSLIP': col.prop(fluid, "partial_slip_factor", slider=True, text="Amount") - if wide_ui: - col = split.column() + col = split.column() col.label(text="Surface:") col.prop(fluid, "surface_smoothing", text="Smoothing") col.prop(fluid, "surface_subdivisions", text="Subdivisions") -class PHYSICS_PT_domain_particles(PhysicButtonsPanel): +class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel): bl_label = "Domain Particles" bl_default_closed = True - def poll(self, context): + @classmethod + def poll(cls, context): md = context.fluid - return md and (md.settings.type == 'DOMAIN') + return md and md.settings and (md.settings.type == 'DOMAIN') def draw(self, context): layout = self.layout @@ -314,23 +296,12 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel): col.prop(fluid, "generate_particles") -classes = [ - PHYSICS_PT_fluid, - PHYSICS_PT_domain_gravity, - PHYSICS_PT_domain_boundary, - PHYSICS_PT_domain_particles] - - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + pass def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + pass if __name__ == "__main__": register() |