[Bf-blender-cvs] [00fd2b57d15] blender2.8: UI: Single column layout for Force Fields

William Reynish noreply at git.blender.org
Wed Jun 20 16:11:22 CEST 2018


Commit: 00fd2b57d1558a7fa453696ba9d4623d640ea181
Author: William Reynish
Date:   Wed Jun 20 16:10:03 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB00fd2b57d1558a7fa453696ba9d4623d640ea181

UI: Single column layout for Force Fields

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_common.py
M	release/scripts/startup/bl_ui/properties_physics_field.py

===================================================================

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_P

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list