From 9e3deee808e127e3700a91d6547c22716f7d7ccd Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 10 Nov 2011 19:10:23 +0000 Subject: [PATCH] 2.6 Physics UI Files: * Remove redundant check for md, this is already done in the super class poll. --- .../startup/bl_ui/properties_physics_cloth.py | 80 +++---- .../bl_ui/properties_physics_dynamicpaint.py | 121 +++++----- .../startup/bl_ui/properties_physics_fluid.py | 222 +++++++++--------- .../startup/bl_ui/properties_physics_smoke.py | 83 ++++--- .../bl_ui/properties_physics_softbody.py | 27 +-- 5 files changed, 262 insertions(+), 271 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index afb3c000980..490b510587d 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -60,61 +60,59 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel): md = context.cloth ob = context.object + cloth = md.settings - if md: - cloth = md.settings + split = layout.split() - split = layout.split() + split.active = cloth_panel_enabled(md) - split.active = cloth_panel_enabled(md) + col = split.column() - col = split.column() + col.label(text="Presets:") + sub = col.row(align=True) + sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) + sub.operator("cloth.preset_add", text="", icon='ZOOMIN') + sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True - col.label(text="Presets:") - sub = col.row(align=True) - sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label) - sub.operator("cloth.preset_add", text="", icon='ZOOMIN') - sub.operator("cloth.preset_add", text="", icon='ZOOMOUT').remove_active = True + col.label(text="Quality:") + col.prop(cloth, "quality", text="Steps", slider=True) - col.label(text="Quality:") - col.prop(cloth, "quality", text="Steps", slider=True) + col.label(text="Material:") + col.prop(cloth, "mass") + col.prop(cloth, "structural_stiffness", text="Structural") + col.prop(cloth, "bending_stiffness", text="Bending") - col.label(text="Material:") - col.prop(cloth, "mass") - col.prop(cloth, "structural_stiffness", text="Structural") - col.prop(cloth, "bending_stiffness", text="Bending") + col = split.column() - col = split.column() + col.label(text="Damping:") + col.prop(cloth, "spring_damping", text="Spring") + col.prop(cloth, "air_damping", text="Air") - col.label(text="Damping:") - col.prop(cloth, "spring_damping", text="Spring") - col.prop(cloth, "air_damping", text="Air") + col.prop(cloth, "use_pin_cloth", text="Pinning") + sub = col.column() + sub.active = cloth.use_pin_cloth + sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="") + sub.prop(cloth, "pin_stiffness", text="Stiffness") - col.prop(cloth, "use_pin_cloth", text="Pinning") - sub = col.column() - sub.active = cloth.use_pin_cloth - sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="") - sub.prop(cloth, "pin_stiffness", text="Stiffness") + col.label(text="Pre roll:") + col.prop(cloth, "pre_roll", text="Frame") - col.label(text="Pre roll:") - col.prop(cloth, "pre_roll", text="Frame") + # Disabled for now + """ + if cloth.vertex_group_mass: + layout.label(text="Goal:") - # Disabled for now - """ - if cloth.vertex_group_mass: - layout.label(text="Goal:") + col = layout.column_flow() + col.prop(cloth, "goal_default", text="Default") + col.prop(cloth, "goal_spring", text="Stiffness") + col.prop(cloth, "goal_friction", text="Friction") + """ - col = layout.column_flow() - col.prop(cloth, "goal_default", text="Default") - col.prop(cloth, "goal_spring", text="Stiffness") - col.prop(cloth, "goal_friction", text="Friction") - """ + key = ob.data.shape_keys - key = ob.data.shape_keys - - if key: - col.label(text="Rest Shape Key:") - col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="") + if key: + col.label(text="Rest Shape Key:") + col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="") class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index fdaa1ae7a60..9d6013a2531 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -45,73 +45,72 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, bpy.types.Panel): md = context.dynamic_paint ob = context.object - if md: - layout.prop(md, "ui_type", expand=True) + layout.prop(md, "ui_type", expand=True) - if (md.ui_type == "CANVAS"): - canvas = md.canvas_settings + if (md.ui_type == "CANVAS"): + canvas = md.canvas_settings + + if (not canvas): + layout.operator("dpaint.type_toggle", text="Add Canvas").type = 'CANVAS' + else: + layout.operator("dpaint.type_toggle", text="Remove Canvas", icon='X').type = 'CANVAS' + + surface = canvas.canvas_surfaces.active + row = layout.row() + row.template_list(canvas, "canvas_surfaces", canvas.canvas_surfaces, "active_index", rows=2) + + col = row.column(align=True) + col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="") + col.operator("dpaint.surface_slot_remove", icon='ZOOMOUT', text="") - if (not canvas): - layout.operator("dpaint.type_toggle", text="Add Canvas").type = 'CANVAS' - else: - layout.operator("dpaint.type_toggle", text="Remove Canvas", icon='X').type = 'CANVAS' - - surface = canvas.canvas_surfaces.active - row = layout.row() - row.template_list(canvas, "canvas_surfaces", canvas.canvas_surfaces, "active_index", rows=2) - - col = row.column(align=True) - col.operator("dpaint.surface_slot_add", icon='ZOOMIN', text="") - col.operator("dpaint.surface_slot_remove", icon='ZOOMOUT', text="") + if surface: + layout.prop(surface, "name") + layout.prop(surface, "surface_format", expand=False) + col = layout.column() - if surface: - layout.prop(surface, "name") - layout.prop(surface, "surface_format", expand=False) - col = layout.column() - - if surface.surface_format != "VERTEX": - col.label(text="Quality:") - col.prop(surface, "image_resolution") - col.prop(surface, "use_antialiasing") - - col = layout.column() - col.label(text="Frames:") - split = col.split() - - col = split.column(align=True) - col.prop(surface, "frame_start", text="Start") - col.prop(surface, "frame_end", text="End") - - col = split.column() - col.prop(surface, "frame_substeps") - - elif (md.ui_type == "BRUSH"): - brush = md.brush_settings - engine = context.scene.render.engine + if surface.surface_format != "VERTEX": + col.label(text="Quality:") + col.prop(surface, "image_resolution") + col.prop(surface, "use_antialiasing") - if (not brush): - layout.operator("dpaint.type_toggle", text="Add Brush").type = 'BRUSH' - else: - layout.operator("dpaint.type_toggle", text="Remove Brush", icon='X').type = 'BRUSH' - - split = layout.split() - - col = split.column() - col.prop(brush, "absolute_alpha") - col.prop(brush, "paint_erase") - col.prop(brush, "paint_wetness", text="Wetness") + col = layout.column() + col.label(text="Frames:") + split = col.split() + + col = split.column(align=True) + col.prop(surface, "frame_start", text="Start") + col.prop(surface, "frame_end", text="End") col = split.column() - if (engine == 'BLENDER_RENDER'): - sub = col.column() - sub.active = (brush.paint_source != "PARTICLE_SYSTEM"); - sub.prop(brush, "use_material") - if brush.use_material and brush.paint_source != "PARTICLE_SYSTEM" and (engine == 'BLENDER_RENDER'): - col.prop(brush, "material", text="") - col.prop(brush, "paint_alpha", text="Alpha Factor") - else: - col.prop(brush, "paint_color", text="") - col.prop(brush, "paint_alpha", text="Alpha") + col.prop(surface, "frame_substeps") + + elif (md.ui_type == "BRUSH"): + brush = md.brush_settings + engine = context.scene.render.engine + + if (not brush): + layout.operator("dpaint.type_toggle", text="Add Brush").type = 'BRUSH' + else: + layout.operator("dpaint.type_toggle", text="Remove Brush", icon='X').type = 'BRUSH' + + split = layout.split() + + col = split.column() + col.prop(brush, "absolute_alpha") + col.prop(brush, "paint_erase") + col.prop(brush, "paint_wetness", text="Wetness") + + col = split.column() + if (engine == 'BLENDER_RENDER'): + sub = col.column() + sub.active = (brush.paint_source != "PARTICLE_SYSTEM"); + sub.prop(brush, "use_material") + if brush.use_material and brush.paint_source != "PARTICLE_SYSTEM" and (engine == 'BLENDER_RENDER'): + col.prop(brush, "material", text="") + col.prop(brush, "paint_alpha", text="Alpha Factor") + else: + col.prop(brush, "paint_color", text="") + col.prop(brush, "paint_alpha", text="Alpha") class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index ce65350e69b..a89249a6f75 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -40,151 +40,149 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): layout = self.layout md = context.fluid + fluid = md.settings - if md: - fluid = md.settings + row = layout.row() + if fluid is None: + row.label("Built without fluids") + return - row = layout.row() - if fluid is None: - row.label("Built without fluids") - return + row.prop(fluid, "type") + if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: + row.prop(fluid, "use", text="") - row.prop(fluid, "type") - if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: - row.prop(fluid, "use", text="") + layout = layout.column() + if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: + layout.active = fluid.use - layout = layout.column() - if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}: - layout.active = fluid.use + if fluid.type == 'DOMAIN': + layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM') + split = layout.split() - if fluid.type == 'DOMAIN': - layout.operator("fluid.bake", text="Bake (Req. Memory:" + " %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM') - split = layout.split() + col = split.column() + col.label(text="Resolution:") + col.prop(fluid, "resolution", text="Final") + col.label(text="Render Display:") + col.prop(fluid, "render_display_mode", text="") - col = split.column() - col.label(text="Resolution:") - col.prop(fluid, "resolution", text="Final") - col.label(text="Render Display:") - col.prop(fluid, "render_display_mode", text="") + col = split.column() + col.label() + col.prop(fluid, "preview_resolution", text="Preview") + col.label(text="Viewport Display:") + col.prop(fluid, "viewport_display_mode", text="") - col = split.column() - col.label() - col.prop(fluid, "preview_resolution", text="Preview") - col.label(text="Viewport Display:") - col.prop(fluid, "viewport_display_mode", text="") + split = layout.split() - split = layout.split() + col = split.column() + col.label(text="Time:") + sub = col.column(align=True) + sub.prop(fluid, "start_time", text="Start") + sub.prop(fluid, "end_time", text="End") - col = split.column() - col.label(text="Time:") - sub = col.column(align=True) - sub.prop(fluid, "start_time", text="Start") - sub.prop(fluid, "end_time", text="End") + col = split.column() + col.label() + col.prop(fluid, "use_speed_vectors") + col.prop(fluid, "use_reverse_frames") - col = split.column() - col.label() - col.prop(fluid, "use_speed_vectors") - col.prop(fluid, "use_reverse_frames") + layout.prop(fluid, "filepath", text="") - layout.prop(fluid, "filepath", text="") + elif fluid.type == 'FLUID': + split = layout.split() - elif fluid.type == 'FLUID': - split = layout.split() + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") + col = split.column() + col.label(text="Initial Velocity:") + col.prop(fluid, "initial_velocity", text="") - col = split.column() - col.label(text="Initial Velocity:") - col.prop(fluid, "initial_velocity", text="") + elif fluid.type == 'OBSTACLE': + split = layout.split() - elif fluid.type == 'OBSTACLE': - split = layout.split() + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") + col = split.column() + col.label(text="Slip Type:") + col.prop(fluid, "slip_type", text="") + if fluid.slip_type == 'PARTIALSLIP': + col.prop(fluid, "partial_slip_factor", slider=True, text="Amount") - col = split.column() - col.label(text="Slip Type:") - col.prop(fluid, "slip_type", text="") - if fluid.slip_type == 'PARTIALSLIP': - col.prop(fluid, "partial_slip_factor", slider=True, text="Amount") + col.label(text="Impact:") + col.prop(fluid, "impact_factor", text="Factor") - col.label(text="Impact:") - col.prop(fluid, "impact_factor", text="Factor") + elif fluid.type == 'INFLOW': + split = layout.split() - elif fluid.type == 'INFLOW': - split = layout.split() + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") + row = col.row() + row.active = not fluid.use_animated_mesh + row.prop(fluid, "use_local_coords") - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") - row = col.row() - row.active = not fluid.use_animated_mesh - row.prop(fluid, "use_local_coords") + col = split.column() + col.label(text="Inflow Velocity:") + col.prop(fluid, "inflow_velocity", text="") - col = split.column() - col.label(text="Inflow Velocity:") - col.prop(fluid, "inflow_velocity", text="") + elif fluid.type == 'OUTFLOW': + split = layout.split() - elif fluid.type == 'OUTFLOW': - split = layout.split() + col = split.column() + col.label(text="Volume Initialization:") + col.prop(fluid, "volume_initialization", text="") + col.prop(fluid, "use_animated_mesh") - col = split.column() - col.label(text="Volume Initialization:") - col.prop(fluid, "volume_initialization", text="") - col.prop(fluid, "use_animated_mesh") + split.column() - split.column() + elif fluid.type == 'PARTICLE': + split = layout.split() - elif fluid.type == 'PARTICLE': - split = layout.split() + col = split.column() + col.label(text="Influence:") + col.prop(fluid, "particle_influence", text="Size") + col.prop(fluid, "alpha_influence", text="Alpha") - col = split.column() - col.label(text="Influence:") - col.prop(fluid, "particle_influence", text="Size") - col.prop(fluid, "alpha_influence", text="Alpha") + col = split.column() + col.label(text="Type:") + col.prop(fluid, "use_drops") + col.prop(fluid, "use_floats") + col.prop(fluid, "show_tracer") - col = split.column() - col.label(text="Type:") - col.prop(fluid, "use_drops") - col.prop(fluid, "use_floats") - col.prop(fluid, "show_tracer") + layout.prop(fluid, "filepath", text="") - layout.prop(fluid, "filepath", text="") + elif fluid.type == 'CONTROL': + split = layout.split() - elif fluid.type == 'CONTROL': - split = layout.split() + col = split.column() + col.label(text="") + col.prop(fluid, "quality", slider=True) + col.prop(fluid, "use_reverse_frames") - col = split.column() - col.label(text="") - col.prop(fluid, "quality", slider=True) - col.prop(fluid, "use_reverse_frames") + col = split.column() + col.label(text="Time:") + sub = col.column(align=True) + sub.prop(fluid, "start_time", text="Start") + sub.prop(fluid, "end_time", text="End") - col = split.column() - col.label(text="Time:") - sub = col.column(align=True) - sub.prop(fluid, "start_time", text="Start") - sub.prop(fluid, "end_time", text="End") + split = layout.split() - split = layout.split() + col = split.column() + col.label(text="Attraction Force:") + sub = col.column(align=True) + sub.prop(fluid, "attraction_strength", text="Strength") + sub.prop(fluid, "attraction_radius", text="Radius") - col = split.column() - col.label(text="Attraction Force:") - sub = col.column(align=True) - sub.prop(fluid, "attraction_strength", text="Strength") - sub.prop(fluid, "attraction_radius", text="Radius") - - 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") + 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, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index e270b53d6bb..9f760f2f024 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -47,60 +47,59 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): md = context.smoke ob = context.object - if md: - layout.prop(md, "smoke_type", expand=True) + layout.prop(md, "smoke_type", expand=True) - if md.smoke_type == 'DOMAIN': - domain = md.domain_settings + if md.smoke_type == 'DOMAIN': + domain = md.domain_settings - split = layout.split() + split = layout.split() - split.enabled = not domain.point_cache.is_baked + split.enabled = not domain.point_cache.is_baked - col = split.column() - col.label(text="Resolution:") - col.prop(domain, "resolution_max", text="Divisions") - col.label(text="Time:") - col.prop(domain, "time_scale", text="Scale") - col.label(text="Border Collisions:") - col.prop(domain, "collision_extents", text="") + col = split.column() + col.label(text="Resolution:") + col.prop(domain, "resolution_max", text="Divisions") + col.label(text="Time:") + col.prop(domain, "time_scale", text="Scale") + col.label(text="Border Collisions:") + col.prop(domain, "collision_extents", text="") - col = split.column() - col.label(text="Behavior:") - col.prop(domain, "alpha") - col.prop(domain, "beta", text="Temp. Diff.") - col.prop(domain, "vorticity") - col.prop(domain, "use_dissolve_smoke", text="Dissolve") - sub = col.column() - sub.active = domain.use_dissolve_smoke - sub.prop(domain, "dissolve_speed", text="Time") - sub.prop(domain, "use_dissolve_smoke_log", text="Slow") + col = split.column() + col.label(text="Behavior:") + col.prop(domain, "alpha") + col.prop(domain, "beta", text="Temp. Diff.") + col.prop(domain, "vorticity") + col.prop(domain, "use_dissolve_smoke", text="Dissolve") + sub = col.column() + sub.active = domain.use_dissolve_smoke + sub.prop(domain, "dissolve_speed", text="Time") + sub.prop(domain, "use_dissolve_smoke_log", text="Slow") - elif md.smoke_type == 'FLOW': + elif md.smoke_type == 'FLOW': - flow = md.flow_settings + flow = md.flow_settings - split = layout.split() + split = layout.split() - col = split.column() - col.prop(flow, "use_outflow") - col.label(text="Particle System:") - col.prop_search(flow, "particle_system", ob, "particle_systems", text="") + col = split.column() + col.prop(flow, "use_outflow") + col.label(text="Particle System:") + col.prop_search(flow, "particle_system", ob, "particle_systems", text="") - sub = col.column() - sub.active = not md.flow_settings.use_outflow + sub = col.column() + sub.active = not md.flow_settings.use_outflow - sub.prop(flow, "initial_velocity", text="Initial Velocity") - sub = sub.column() - sub.active = flow.initial_velocity - sub.prop(flow, "velocity_factor", text="Multiplier") + sub.prop(flow, "initial_velocity", text="Initial Velocity") + sub = sub.column() + sub.active = flow.initial_velocity + sub.prop(flow, "velocity_factor", text="Multiplier") - sub = split.column() - sub.active = not md.flow_settings.use_outflow - sub.label(text="Initial Values:") - sub.prop(flow, "use_absolute") - sub.prop(flow, "density") - sub.prop(flow, "temperature") + sub = split.column() + sub.active = not md.flow_settings.use_outflow + sub.label(text="Initial Values:") + sub.prop(flow, "use_absolute") + sub.prop(flow, "density") + sub.prop(flow, "temperature") class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index b9f8910fa59..ea4180c891f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -39,8 +39,6 @@ class PhysicButtonsPanel(): def poll(cls, context): ob = context.object rd = context.scene.render -# return (ob and ob.type == 'MESH') and (not rd.use_game_engine) -# i really hate touching things i do not understand completely .. but i think this should read (bjornmose) return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body) @@ -53,22 +51,21 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel): md = context.soft_body ob = context.object - if md: - softbody = md.settings + softbody = md.settings - # General - split = layout.split() - split.enabled = softbody_panel_enabled(md) + # General + split = layout.split() + split.enabled = softbody_panel_enabled(md) - col = split.column() - col.label(text="Object:") - col.prop(softbody, "friction") - col.prop(softbody, "mass") - col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:") + col = split.column() + col.label(text="Object:") + col.prop(softbody, "friction") + col.prop(softbody, "mass") + col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:") - col = split.column() - col.label(text="Simulation:") - col.prop(softbody, "speed") + col = split.column() + col.label(text="Simulation:") + col.prop(softbody, "speed") class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, Panel):