UI: Single column layout for Force Fields

This commit is contained in:
William Reynish
2018-06-20 16:10:03 +02:00
committed by Pablo Vazquez
parent a8e132768a
commit 00fd2b57d1
2 changed files with 71 additions and 91 deletions

View File

@@ -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 = (

View File

@@ -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'}
basic_force_field_falloff_ui(self, context, field)
@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'})
if field.falloff_type == 'CONE':
layout.separator()
def draw(self, context):
layout = self.layout
layout.use_property_split = True
split = layout.split(percentage=0.35)
ob = context.object
field = ob.field
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")
layout.prop(field, "falloff_type", text="Shape")
col = split.column()
col.prop(field, "radial_falloff", text="Power")
basic_force_field_falloff_ui(self, context, field)
sub = col.column()
sub.active = field.use_radial_min
sub.prop(field, "radial_min", text="Angle")
if field.falloff_type == 'CONE':
layout.separator()
sub = col.column()
sub.active = field.use_radial_max
sub.prop(field, "radial_max", text="Angle")
col = layout.column()
col.prop(field, "radial_falloff", text="Power")
elif field.falloff_type == 'TUBE':
layout.separator()
col.label(text="Angular")
split = layout.split(percentage=0.35)
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")
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, "use_radial_max", text="Use Max Angle")
sub = col.column()
sub.active = field.use_radial_max
sub.prop(field, "radial_max", text="Max Angle")
col = split.column()
col.prop(field, "radial_falloff", text="Power")
elif field.falloff_type == 'TUBE':
layout.separator()
sub = col.column()
sub.active = field.use_radial_min
sub.prop(field, "radial_min", text="Distance")
col = layout.column()
sub = col.column()
sub.active = field.use_radial_max
sub.prop(field, "radial_max", text="Distance")
col.prop(field, "radial_falloff", text="Power")
col.label(text="Radial")
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")
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,
)