[Bf-blender-cvs] [6be8c64e9ad] master: Fix T61187: Fluid Particle settings UI elements

William Reynish noreply at git.blender.org
Mon Feb 18 04:00:26 CET 2019


Commit: 6be8c64e9ade1d0a37871c2b9276a2716d45740a
Author: William Reynish
Date:   Mon Feb 18 13:44:57 2019 +1100
Branches: master
https://developer.blender.org/rB6be8c64e9ade1d0a37871c2b9276a2716d45740a

Fix T61187: Fluid Particle settings UI elements

Some properties were accidentally hidden for particle fluids.

- Made sure we show the Forces and Integration
  sub-panels for particle fluids.
- Slightly re-ordered the sub-panels here, so that the same sub-panels
  are at the top for Newtonian and Fluid particles.
- Separated the Fluid Interaction sub-panel so we can give it a unique
  name.
- Removed lingering unnecessary 'Keys' label in the Keyed physics.

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

M	release/scripts/startup/bl_ui/properties_particle.py

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index b1d26b4dbd4..cc260ce0a96 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -479,8 +479,10 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        psys = context.particle_system
         engine = context.engine
+        if engine not in cls.COMPAT_ENGINES:
+            return False
+        psys = context.particle_system
         if psys is None:
             return False
         if psys.settings is None:
@@ -491,10 +493,10 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
         if phystype == 'NO' or phystype == 'KEYED':
             return False
         return (
-            (psys.settings.type in {'EMITTER', 'REACTOR'} or
-             (psys.settings.type == 'HAIR' and
-              (psys.use_hair_dynamics or psys.point_cache.is_baked))) and
-            engine in cls.COMPAT_ENGINES
+            psys.settings.type in {'EMITTER', 'REACTOR'} or (
+                (psys.settings.type == 'HAIR') and
+                (psys.use_hair_dynamics or psys.point_cache.is_baked)
+            )
         )
 
     def draw(self, context):
@@ -681,8 +683,6 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
             if psys:
                 col.prop(psys, "use_keyed_timing", text="Use Timing")
 
-            col.label(text="Keys")
-
 
 class PARTICLE_PT_physics_fluid_advanced(ParticleButtonsPanel, Panel):
     bl_label = "Advanced"
@@ -939,7 +939,7 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         part = particle_get_settings(context)
-        return part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}
+        return part.physics_type in {'KEYED', 'BOIDS'}
 
     def draw(self, context):
         layout = self.layout
@@ -982,12 +982,48 @@ class PARTICLE_PT_physics_relations(ParticleButtonsPanel, Panel):
                 sub.prop(key, "object")
                 sub.prop(key, "system", text="System")
                 layout.prop(key, "alliance")
-            elif part.physics_type == 'FLUID':
-                sub = layout.column()
-                # doesn't work yet
-                #sub.alert = key.valid
-                sub.prop(key, "object")
-                sub.prop(key, "system", text="System")
+
+
+class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
+    bl_label = "Fluid Interaction"
+    bl_parent_id = "PARTICLE_PT_physics"
+    bl_options = {'DEFAULT_CLOSED'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    @classmethod
+    def poll(cls, context):
+        part = particle_get_settings(context)
+        return part.physics_type == 'FLUID'
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        psys = context.particle_system
+        part = particle_get_settings(context)
+
+        row = layout.row()
+        row.template_list("UI_UL_list", "particle_targets", psys, "targets",
+                          psys, "active_particle_target_index", rows=4)
+
+        col = row.column()
+        sub = col.row()
+        subsub = sub.column(align=True)
+        subsub.operator("particle.new_target", icon='ADD', text="")
+        subsub.operator("particle.target_remove", icon='REMOVE', text="")
+        sub = col.row()
+        subsub = sub.column(align=True)
+        subsub.operator("particle.target_move_up", icon='TRIA_UP', text="")
+        subsub.operator("particle.target_move_down", icon='TRIA_DOWN', text="")
+
+        key = psys.active_particle_target
+
+        if key:
+            sub = layout.column()
+            # doesn't work yet
+            #sub.alert = key.valid
+            sub.prop(key, "object")
+            sub.prop(key, "system", text="System")
 
 
 class PARTICLE_PT_physics_deflection(ParticleButtonsPanel, Panel):
@@ -1025,7 +1061,7 @@ class PARTICLE_PT_physics_forces(ParticleButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         part = particle_get_settings(context)
-        return part.physics_type == 'NEWTON'
+        return part.physics_type in {'NEWTON', 'FLUID'}
 
     def draw(self, context):
         layout = self.layout
@@ -1052,7 +1088,7 @@ class PARTICLE_PT_physics_integration(ParticleButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         part = particle_get_settings(context)
-        return part.physics_type == 'NEWTON'
+        return part.physics_type in {'NEWTON', 'FLUID'}
 
     def draw(self, context):
         layout = self.layout
@@ -2096,10 +2132,6 @@ classes = (
     PARTICLE_PT_rotation,
     PARTICLE_PT_rotation_angular_velocity,
     PARTICLE_PT_physics,
-    PARTICLE_PT_physics_fluid_springs,
-    PARTICLE_PT_physics_fluid_springs_viscoelastic,
-    PARTICLE_PT_physics_fluid_springs_advanced,
-    PARTICLE_PT_physics_fluid_advanced,
     PARTICLE_PT_physics_boids_movement,
     PARTICLE_PT_physics_boids_battle,
     PARTICLE_PT_physics_boids_misc,
@@ -2107,6 +2139,11 @@ classes = (
     PARTICLE_PT_physics_deflection,
     PARTICLE_PT_physics_integration,
     PARTICLE_PT_physics_relations,
+    PARTICLE_PT_physics_fluid_springs,
+    PARTICLE_PT_physics_fluid_springs_viscoelastic,
+    PARTICLE_PT_physics_fluid_springs_advanced,
+    PARTICLE_PT_physics_fluid_advanced,
+    PARTICLE_PT_physics_fluid_interaction,
     PARTICLE_PT_boidbrain,
     PARTICLE_PT_render,
     PARTICLE_PT_render_line,



More information about the Bf-blender-cvs mailing list