[Bf-blender-cvs] [62b2675147b] blender2.8: Physics Smoke: Use Single Column and Grid Flow layout

Vuk Gardaáević noreply at git.blender.org
Fri Aug 17 12:05:48 CEST 2018


Commit: 62b2675147bab469e7c252265ab223b8bb9c3e39
Author: Vuk Gardašević
Date:   Fri Aug 17 11:58:21 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB62b2675147bab469e7c252265ab223b8bb9c3e39

Physics Smoke: Use Single Column and Grid Flow layout

See D3567

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

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

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 0a4f1c71126..01faa3496b4 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -17,9 +17,11 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
-import bpy
-from bpy.types import Panel
 
+import bpy
+from bpy.types import (
+    Panel,
+)
 from .properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
@@ -31,109 +33,241 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
-    @classmethod
-    def poll(cls, context):
+    def poll_smoke(context):
         ob = context.object
-        return (ob and ob.type == 'MESH') and (context.engine in cls.COMPAT_ENGINES) and (context.smoke)
+        if not ((ob and ob.type == 'MESH') and (context.smoke)):
+            return False
+
+        md = context.smoke
+        return md and (context.smoke.smoke_type != 'NONE') and (bpy.app.build_options.mod_smoke)
+
+    def poll_smoke_domain(context):
+        if not PhysicButtonsPanel.poll_smoke(context):
+            return False
+
+        md = context.smoke
+        return md and (md.smoke_type == 'DOMAIN')
 
 
 class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
     bl_label = "Smoke"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
 
+    @classmethod
+    def poll(cls, context):
+        ob = context.object
+        return (ob and ob.type == 'MESH') and (context.engine in cls.COMPAT_ENGINES) and (context.smoke)
+
     def draw(self, context):
         layout = self.layout
+        layout.use_property_split = True
 
         if not bpy.app.build_options.mod_smoke:
-            layout.label("Built without Smoke modifier")
+            col = layout.column(align=True)
+            col.alignment = 'RIGHT'
+            col.label("Built without Smoke modifier")
             return
 
         md = context.smoke
-        ob = context.object
 
-        layout.row().prop(md, "smoke_type", expand=True)
+        layout.prop(md, "smoke_type")
+
+
+class PHYSICS_PT_smoke_settings(PhysicButtonsPanel, Panel):
+    bl_label = "Settings"
+    bl_parent_id = 'PHYSICS_PT_smoke'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    @classmethod
+    def poll(cls, context):
+        if not PhysicButtonsPanel.poll_smoke(context):
+            return False
+
+        return (context.engine in cls.COMPAT_ENGINES)
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        md = context.smoke
+        ob = context.object
 
         if md.smoke_type == 'DOMAIN':
             domain = md.domain_settings
 
-            split = layout.split()
-
-            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.label(text="Empty Space:")
-            col.prop(domain, "clipping")
-
-            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")
+            flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
+            flow.enabled = (not domain.point_cache.is_baked)
+
+            col = flow.column()
+            col.prop(domain, "resolution_max", text="Resolution Divisions")
+            col.prop(domain, "time_scale", text="Time Scale")
+
+            col.separator()
+
+            col = flow.column()
+            col.prop(domain, "collision_extents", text="Border Collisions")
+            col.prop(domain, "clipping", text="Empty Space")
 
         elif md.smoke_type == 'FLOW':
+            flow_smoke = md.flow_settings
+
+            col = layout.column()
+            col.prop(flow_smoke, "smoke_flow_type", expand=False)
+
+            col.separator()
 
-            flow = md.flow_settings
-
-            layout.prop(flow, "smoke_flow_type", expand=False)
-
-            if flow.smoke_flow_type != 'OUTFLOW':
-                split = layout.split()
-                col = split.column()
-                col.label(text="Flow Source:")
-                col.prop(flow, "smoke_flow_source", expand=False, text="")
-                if flow.smoke_flow_source == 'PARTICLES':
-                    col.label(text="Particle System:")
-                    col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
-                    col.prop(flow, "use_particle_size", text="Set Size")
-                    sub = col.column()
-                    sub.active = flow.use_particle_size
-                    sub.prop(flow, "particle_size")
+            flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+            col = flow.column()
+
+            if flow_smoke.smoke_flow_type != 'OUTFLOW':
+                col.prop(flow_smoke, "smoke_flow_source", expand=False, text="Flow Source")
+
+                if flow_smoke.smoke_flow_source == 'PARTICLES':
+                    # Note: TODO prop_search doesn't align on the right.
+                    row = col.row(align=True)
+                    row.prop_search(
+                        flow_smoke, "particle_system", ob, "particle_systems",
+                        text="Particle System"
+                    )
+                    row.label(text="", icon='BLANK1')
                 else:
-                    col.prop(flow, "surface_distance")
-                    col.prop(flow, "volume_density")
-
-                sub = col.column(align=True)
-                sub.prop(flow, "use_initial_velocity")
-
-                sub = sub.column()
-                sub.active = flow.use_initial_velocity
-                sub.prop(flow, "velocity_factor")
-                if flow.smoke_flow_source == 'MESH':
-                    sub.prop(flow, "velocity_normal")
-                    #sub.prop(flow, "velocity_random")
-
-                sub = split.column()
-                sub.label(text="Initial Values:")
-                sub.prop(flow, "use_absolute")
-                if flow.smoke_flow_type in {'SMOKE', 'BOTH'}:
-                    sub.prop(flow, "density")
-                    sub.prop(flow, "temperature")
-                    sub.prop(flow, "smoke_color")
-                if flow.smoke_flow_type in {'FIRE', 'BOTH'}:
-                    sub.prop(flow, "fuel_amount")
-                sub.label(text="Sampling:")
-                sub.prop(flow, "subframes")
+                    col.prop(flow_smoke, "surface_distance")
+                    col.prop(flow_smoke, "volume_density")
+
+                col = flow.column()
+                col.prop(flow_smoke, "use_absolute")
+
+                if flow_smoke.smoke_flow_type in {'SMOKE', 'BOTH'}:
+                    col.prop(flow_smoke, "density")
+                    col.prop(flow_smoke, "temperature")
+
+                    col.separator()
+
+                    col = flow.column()
+                    col.prop(flow_smoke, "smoke_color")
+
+                if flow_smoke.smoke_flow_type in {'FIRE', 'BOTH'}:
+                    col.prop(flow_smoke, "fuel_amount")
+
+                col.prop(flow_smoke, "subframes", text="Sampling Subframes")
 
         elif md.smoke_type == 'COLLISION':
             coll = md.coll_settings
 
-            split = layout.split()
-
-            col = split.column()
+            col = layout.column()
             col.prop(coll, "collision_type")
 
 
+class PHYSICS_PT_smoke_settings_initial_velocity(PhysicButtonsPanel, Panel):
+    bl_label = "Initial Velocity"
+    bl_parent_id = 'PHYSICS_PT_smoke_settings'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    @classmethod
+    def poll(cls, context):
+        if not PhysicButtonsPanel.poll_smoke(context):
+            return False
+
+        md = context.smoke
+        return (md and (md.smoke_type == 'FLOW')
+                and md.flow_settings and md.flow_settings.smoke_flow_type != 'OUTFLOW'
+                and context.engine in cls.COMPAT_ENGINES)
+
+    def draw_header(self, context):
+        md = context.smoke
+        flow_smoke = md.flow_settings
+
+        self.layout.prop(flow_smoke, "use_initial_velocity", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+
+        md = context.smoke
+        flow_smoke = md.flow_settings
+
+        flow.active = flow_smoke.use_initial_velocity
+
+        col = flow.column(align=True)
+        col.prop(flow_smoke, "velocity_factor")
+
+        if flow_smoke.smoke_flow_source == 'MESH':
+            col = flow.column()
+            col.prop(flow_smoke, "velocity_normal")
+            # sub.prop(flow_smoke, "velocity_random")
+
+
+class PHYSICS_PT_smoke_settings_particle_size(PhysicButtonsPanel, Panel):
+    bl_label = "Particle Size"
+    bl_parent_id = 'PHYSICS_PT_smoke_settings'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+    @classmethod
+    def poll(cls, context):
+        if not PhysicButtonsPanel.poll_smoke(context):
+            return False
+
+        md = context.smoke
+        return (md and (md.smoke_type == 'FLOW')
+                and md.flow_settings and md.flow_settings.smoke_flow_type != 'OUTFLOW'
+                and md.flow_settings.smoke_flow_source == 'PARTICLES'
+      

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list