diff options
author | William Reynish <billreynish> | 2018-06-20 17:10:03 +0300 |
---|---|---|
committer | Pablo Vazquez <venomgfx@gmail.com> | 2018-06-20 17:11:18 +0300 |
commit | 00fd2b57d1558a7fa453696ba9d4623d640ea181 (patch) | |
tree | 5b56edd4e87fa494577f4ba5d65f1148de703c12 /release/scripts/startup/bl_ui | |
parent | a8e132768a58783295a15d3e62cdab48a9073c8c (diff) |
UI: Single column layout for Force Fields
Diffstat (limited to 'release/scripts/startup/bl_ui')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_common.py | 40 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_field.py | 122 |
2 files changed, 71 insertions, 91 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 05c72bf47ee..207608c410f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -240,12 +240,11 @@ def effector_weights_ui(self, context, weights, weight_type): def basic_force_field_settings_ui(self, context, field): layout = self.layout - split = layout.split() if not field or field.type == 'NONE': return - col = split.column() + col = layout.column() if field.type == 'DRAG': col.prop(field, "linear_drag", text="Linear") @@ -265,10 +264,10 @@ def basic_force_field_settings_ui(self, context, field): else: col.prop(field, "flow") - col = split.column() + col = layout.column() sub = col.column(align=True) sub.prop(field, "noise") - sub.prop(field, "seed") + sub.prop(field, "seed", text="Noise Seed") if field.type == 'TURBULENCE': col.prop(field, "use_global_coords", text="Global") elif field.type == 'HARMONIC': @@ -276,46 +275,33 @@ def basic_force_field_settings_ui(self, context, field): if field.type == 'FORCE': col.prop(field, "use_gravity_falloff", text="Gravitation") - split = layout.split() - - col = split.column() - col.label(text="Effect point:") + col.label(text="Effect point") col.prop(field, "apply_to_location") col.prop(field, "apply_to_rotation") - col = split.column() - col.label(text="Collision:") + col.label(text="Collision") col.prop(field, "use_absorption") - def basic_force_field_falloff_ui(self, context, field): layout = self.layout - split = layout.split(percentage=0.35) - if not field or field.type == 'NONE': return - col = split.column() - col.prop(field, "z_direction", text="") + col = layout.column() + col.prop(field, "z_direction") - col = split.column() col.prop(field, "falloff_power", text="Power") - split = layout.split() - col = split.column() - row = col.row(align=True) - row.prop(field, "use_min_distance", text="") - sub = row.row(align=True) + col.prop(field, "use_min_distance", text="Min Min Distance") + sub = col.column(align=True) sub.active = field.use_min_distance - sub.prop(field, "distance_min", text="Minimum") + sub.prop(field, "distance_min", text="Min Distance") - col = split.column() - row = col.row(align=True) - row.prop(field, "use_max_distance", text="") - sub = row.row(align=True) + col.prop(field, "use_max_distance", text="Use Max Distance") + sub = col.column(align=True) sub.active = field.use_max_distance - sub.prop(field, "distance_max", text="Maximum") + sub.prop(field, "distance_max", text="Max Distance") classes = ( diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 12e4feb8c0b..023eb08967c 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -47,44 +47,34 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): def draw(self, context): layout = self.layout + layout.use_property_split = True ob = context.object field = ob.field - split = layout.split(percentage=0.2) - split.label(text="Type:") - - split.prop(field, "type", text="") + layout.prop(field, "type") if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}: - split = layout.split(percentage=0.2) - split.label(text="Shape:") - split.prop(field, "shape", text="") + layout.prop(field, "shape", text="Shape") elif field.type == 'TEXTURE': - split = layout.split(percentage=0.2) - split.label(text="Texture:") - split.row().template_ID(field, "texture", new="texture.new") - - split = layout.split() + layout.row().template_ID(field, "texture", new="texture.new") if field.type == 'NONE': return # nothing to draw elif field.type == 'GUIDE': - col = split.column() + col = layout.column() col.prop(field, "guide_minimum") col.prop(field, "guide_free") col.prop(field, "falloff_power") col.prop(field, "use_guide_path_add") col.prop(field, "use_guide_path_weight") - col = split.column() - col.label(text="Clumping:") + col.label(text="Clumping") col.prop(field, "guide_clump_amount") col.prop(field, "guide_clump_shape") - row = layout.row() - row.prop(field, "use_max_distance") - sub = row.row() + col.prop(field, "use_max_distance") + sub = col.column() sub.active = field.use_max_distance sub.prop(field, "distance_max") @@ -94,83 +84,86 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel): if field.guide_kink_type != 'NONE': layout.prop(field, "guide_kink_axis") - split = layout.split() - - col = split.column() + col = layout.column() col.prop(field, "guide_kink_frequency") col.prop(field, "guide_kink_shape") - - col = split.column() col.prop(field, "guide_kink_amplitude") elif field.type == 'TEXTURE': - col = split.column() + col = layout.column() col.prop(field, "strength") - col.prop(field, "texture_mode", text="") + col.prop(field, "texture_mode") col.prop(field, "texture_nabla") - col = split.column() col.prop(field, "use_object_coords") col.prop(field, "use_2d_force") elif field.type == 'SMOKE_FLOW': - col = split.column() + col = layout.column() col.prop(field, "strength") col.prop(field, "flow") - col = split.column() - col.label(text="Domain Object:") - col.prop(field, "source_object", "") + col.prop(field, "source_object") col.prop(field, "use_smoke_density") else: basic_force_field_settings_ui(self, context, field) - if field.type not in {'NONE', 'GUIDE'}: - layout.label(text="Falloff:") - layout.row().prop(field, "falloff_type", expand=True) +class PHYSICS_PT_field_falloff(PhysicButtonsPanel, Panel): + bl_label = "Falloff" + bl_parent_id = "PHYSICS_PT_field" + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + + @classmethod + def poll(cls, context): + ob = context.object + return (context.engine in cls.COMPAT_ENGINES) and (ob.field) and (ob.field.type not in {'NONE', 'GUIDE'}) + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + ob = context.object + field = ob.field - basic_force_field_falloff_ui(self, context, field) + layout.prop(field, "falloff_type", text="Shape") - if field.falloff_type == 'CONE': - layout.separator() + basic_force_field_falloff_ui(self, context, field) - split = layout.split(percentage=0.35) + if field.falloff_type == 'CONE': + layout.separator() - col = split.column() - col.label(text="Angular:") - col.prop(field, "use_radial_min", text="Use Minimum") - col.prop(field, "use_radial_max", text="Use Maximum") + col = layout.column() + col.prop(field, "radial_falloff", text="Power") - col = split.column() - col.prop(field, "radial_falloff", text="Power") + col.label(text="Angular") - sub = col.column() - sub.active = field.use_radial_min - sub.prop(field, "radial_min", text="Angle") + col.prop(field, "use_radial_min", text="Use Min Angle") + sub = col.column() + sub.active = field.use_radial_min + sub.prop(field, "radial_min", text="Min Angle") - sub = col.column() - sub.active = field.use_radial_max - sub.prop(field, "radial_max", text="Angle") + col.prop(field, "use_radial_max", text="Use Max Angle") + sub = col.column() + sub.active = field.use_radial_max + sub.prop(field, "radial_max", text="Max Angle") - elif field.falloff_type == 'TUBE': - layout.separator() + elif field.falloff_type == 'TUBE': + layout.separator() - split = layout.split(percentage=0.35) + col = layout.column() - col = split.column() - col.label(text="Radial:") - col.prop(field, "use_radial_min", text="Use Minimum") - col.prop(field, "use_radial_max", text="Use Maximum") + col.prop(field, "radial_falloff", text="Power") - col = split.column() - col.prop(field, "radial_falloff", text="Power") + col.label(text="Radial") - sub = col.column() - sub.active = field.use_radial_min - sub.prop(field, "radial_min", text="Distance") + col.prop(field, "use_radial_min", text="Use Minimum") + sub = col.column() + sub.active = field.use_radial_min + sub.prop(field, "radial_min", text="Distance") - sub = col.column() - sub.active = field.use_radial_max - sub.prop(field, "radial_max", text="Distance") + col.prop(field, "use_radial_max", text="Use Maximum") + sub = col.column() + sub.active = field.use_radial_max + sub.prop(field, "radial_max", text="Distance") class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): @@ -228,6 +221,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, Panel): classes = ( PHYSICS_PT_field, + PHYSICS_PT_field_falloff, PHYSICS_PT_collision, ) |