[Bf-blender-cvs] [502aabb9d0c] blender2.8: Physics Rigid Body: Use Single Column and Grid Flow layout
Vuk GardaáeviÃÂ
noreply at git.blender.org
Fri Aug 17 12:05:57 CEST 2018
Commit: 502aabb9d0c5b65614baf4d7785681f154abd77c
Author: Vuk GardaÅ¡eviÄ
Date: Fri Aug 17 12:05:16 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB502aabb9d0c5b65614baf4d7785681f154abd77c
Physics Rigid Body: Use Single Column and Grid Flow layout
(and Rigid Body Constraint)
See D3613
===================================================================
M release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
index d121b6a389d..e6e30d28c5c 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py
@@ -17,8 +17,17 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
+
import bpy
-from bpy.types import Panel
+from bpy.types import (
+ Panel,
+)
+
+
+def rigid_body_warning(layout):
+ row = layout.row(align=True)
+ row.alignment = 'RIGHT'
+ row.label("Object does not have a Rigid Body")
class PHYSICS_PT_rigidbody_panel:
@@ -34,8 +43,7 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -44,16 +52,43 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
ob = context.object
rbo = ob.rigid_body
- if rbo is not None:
- layout.prop(rbo, "type", text="Type")
+ if rbo is None:
+ rigid_body_warning(layout)
+ return
- if rbo.type == 'ACTIVE':
- layout.prop(rbo, "mass")
+ layout.prop(rbo, "type", text="Type")
- col = layout.column()
- if rbo.type == 'ACTIVE':
- col.prop(rbo, "enabled", text="Dynamic")
- col.prop(rbo, "kinematic", text="Animated")
+
+class PHYSICS_PT_rigid_body_settings(PHYSICS_PT_rigidbody_panel, Panel):
+ bl_label = "Settings"
+ bl_parent_id = 'PHYSICS_PT_rigid_body'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.object
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ ob = context.object
+ rbo = ob.rigid_body
+
+ if rbo is None:
+ rigid_body_warning(layout)
+ return
+
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+ col = flow.column()
+
+ if rbo.type == 'ACTIVE':
+ col.prop(rbo, "mass")
+ col.prop(rbo, "enabled", text="Dynamic")
+
+ col = flow.column()
+ col.prop(rbo, "kinematic", text="Animated")
class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
@@ -64,8 +99,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -92,18 +126,20 @@ class PHYSICS_PT_rigid_body_collisions_surface(PHYSICS_PT_rigidbody_panel, Panel
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
ob = context.object
rbo = ob.rigid_body
- layout.use_property_split = True
- col = layout.column()
+ col = flow.column()
col.prop(rbo, "friction")
+
+ col = flow.column()
col.prop(rbo, "restitution", text="Bounciness")
@@ -116,29 +152,30 @@ class PHYSICS_PT_rigid_body_collisions_sensitivity(PHYSICS_PT_rigidbody_panel, P
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
ob = context.object
rbo = ob.rigid_body
- layout.use_property_split = True
-
- col = layout.column()
if rbo.collision_shape in {'MESH', 'CONE'}:
+ col = layout.column()
col.prop(rbo, "collision_margin", text="Margin")
else:
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
+ col = flow.column()
col.prop(rbo, "use_margin")
- sub = col.column()
- sub.active = rbo.use_margin
- sub.prop(rbo, "collision_margin", text="Margin")
+
+ col = flow.column()
+ col.active = rbo.use_margin
+ col.prop(rbo, "collision_margin", text="Margin")
class PHYSICS_PT_rigid_body_collisions_collections(PHYSICS_PT_rigidbody_panel, Panel):
- bl_label = "Collision Collections"
+ bl_label = "Collections"
bl_parent_id = 'PHYSICS_PT_rigid_body_collisions'
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
@@ -146,8 +183,7 @@ class PHYSICS_PT_rigid_body_collisions_collections(PHYSICS_PT_rigidbody_panel, P
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
@@ -167,24 +203,26 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- obj.rigid_body.type == 'ACTIVE' and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body and obj.rigid_body.type == 'ACTIVE'
+ and (context.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
layout.use_property_split = True
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
ob = context.object
rbo = ob.rigid_body
- #col = layout.column(align=1)
+ # col = layout.column(align=True)
# col.label(text="Activation:")
# XXX: settings such as activate on collison/etc.
- col = layout.column()
- col.prop(rbo, "linear_damping", text="Translation Damping")
- col.prop(rbo, "angular_damping", text="Rotation Damping")
+ col = flow.column()
+ col.prop(rbo, "linear_damping", text="Damping Translation")
+
+ col = flow.column()
+ col.prop(rbo, "angular_damping", text="Rotation")
class PHYSICS_PT_rigid_body_dynamics_deactivation(PHYSICS_PT_rigidbody_panel, Panel):
@@ -196,9 +234,9 @@ class PHYSICS_PT_rigid_body_dynamics_deactivation(PHYSICS_PT_rigidbody_panel, Pa
@classmethod
def poll(cls, context):
obj = context.object
- return (obj and obj.rigid_body and
- obj.rigid_body.type == 'ACTIVE' and
- (context.engine in cls.COMPAT_ENGINES))
+ return (obj and obj.rigid_body
+ and obj.rigid_body.type == 'ACTIVE'
+ and (context.engine in cls.COMPAT_ENGINES))
def draw_header(self, context):
ob = context.object
@@ -208,21 +246,25 @@ class PHYSICS_PT_rigid_body_dynamics_deactivation(PHYSICS_PT_rigidbody_panel, Pa
def draw(self, context):
layout = self.layout
layout.use_property_split = True
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
ob = context.object
rbo = ob.rigid_body
layout.active = rbo.use_deactivation
- col = layout.column()
+ col = flow.column()
col.prop(rbo, "use_start_deactivated")
- col.prop(rbo, "deactivate_linear_velocity", text="Linear Velocity")
- col.prop(rbo, "deactivate_angular_velocity", text="Angular Velocity")
+
+ col = flow.column()
+ col.prop(rbo, "deactivate_linear_velocity", text="Velocity Linear")
+ col.prop(rbo, "deactivate_angular_velocity", text="Angular")
# TODO: other params such as time?
classes = (
PHYSICS_PT_rigid_body,
+ PHYSICS_PT_rigid_body_settings,
PHYSICS_PT_rigid_body_collisions,
PHYSICS_PT_rigid_body_collisions_surface,
PHYSICS_PT_rigid_body_collisions_sensitivity,
@@ -231,6 +273,7 @@ classes = (
PHYSICS_PT_rigid_body_dynamics_deactivation,
)
+
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
index 5e67caadc90..2c2d92be372 100644
--- a/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
@@ -17,8 +17,11 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
+
import bpy
-from bpy.types import Panel
+from bpy.types import (
+ Panel,
+)
class PHYSICS_PT_rigidbody_constraint_panel:
@@ -38,236 +41,458 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
ob = context.object
rbc = ob.rigid_body_constraint
layout.prop(rbc, "type")
- row = layout.row()
- row.prop(rbc, "enabled")
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list