Physics Rigid Body: Use Single Column and Grid Flow layout
(and Rigid Body Constraint) See D3613
This commit is contained in:
parent
b19b708728
commit
502aabb9d0
Notes:
blender-bot
2023-02-14 07:39:44 +01:00
Referenced by commit f2d2bafe85
, fix rotational limits not showing for GENERIC ridgid body constraint
|
@ -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:
|
||||
|
|
|
@ -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")
|
||||
row.prop(rbc, "disable_collisions")
|
||||
|
||||
layout.prop(rbc, "object1")
|
||||
layout.prop(rbc, "object2")
|
||||
class PHYSICS_PT_rigid_body_constraint_settings(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Settings"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (ob and ob.rigid_body_constraint 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
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "enabled")
|
||||
col.prop(rbc, "disable_collisions")
|
||||
|
||||
if rbc.type != 'MOTOR':
|
||||
row = layout.row()
|
||||
row.prop(rbc, "use_breaking")
|
||||
sub = row.row()
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_breaking")
|
||||
|
||||
sub = col.column()
|
||||
sub.active = rbc.use_breaking
|
||||
sub.prop(rbc, "breaking_threshold", text="Threshold")
|
||||
|
||||
row = layout.row()
|
||||
row.prop(rbc, "use_override_solver_iterations", text="Override Iterations")
|
||||
sub = row.row()
|
||||
sub.active = rbc.use_override_solver_iterations
|
||||
sub.prop(rbc, "solver_iterations", text="Iterations")
|
||||
|
||||
if rbc.type == 'HINGE':
|
||||
col = layout.column(align=True)
|
||||
col.label("Limits:")
|
||||
class PHYSICS_PT_rigid_body_constraint_objects(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Objects"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_ang_z", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_limit_ang_z
|
||||
sub.prop(rbc, "limit_ang_z_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_z_upper", text="Upper")
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (ob and ob.rigid_body_constraint and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
elif rbc.type == 'SLIDER':
|
||||
col = layout.column(align=True)
|
||||
col.label("Limits:")
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_lin_x", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
layout.prop(rbc, "object1", text="First")
|
||||
layout.prop(rbc, "object2", text="Second")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_override_iterations(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Override Iterations"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (ob and ob.rigid_body_constraint and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
self.layout.row().prop(rbc, "use_override_solver_iterations", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
layout.active = rbc.use_override_solver_iterations
|
||||
layout.prop(rbc, "solver_iterations", text="Iterations")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_limits(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Limits"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and rbc and (rbc.type in {'GENERIC', 'GENERIC_SPRING', 'HINGE', 'SLIDER', 'PISTON'})
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
return # do nothing.
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_limits_linear(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Linear"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_limits'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and rbc
|
||||
and (rbc.type in {'GENERIC', 'GENERIC_SPRING', 'SLIDER', 'PISTON'})
|
||||
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
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
if rbc.type in {'PISTON', 'SLIDER'}:
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_lin_x")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_lin_x
|
||||
sub.prop(rbc, "limit_lin_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_lin_x_lower", text="X Lower")
|
||||
sub.prop(rbc, "limit_lin_x_upper", text="Upper")
|
||||
|
||||
elif rbc.type == 'PISTON':
|
||||
col = layout.column(align=True)
|
||||
col.label("Limits:")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_lin_x", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_limit_lin_x
|
||||
sub.prop(rbc, "limit_lin_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_lin_x_upper", text="Upper")
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_ang_x", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_limit_ang_x
|
||||
sub.prop(rbc, "limit_ang_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
|
||||
|
||||
elif rbc.type == 'MOTOR':
|
||||
col = layout.column(align=True)
|
||||
col.label("Linear motor:")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_motor_lin", toggle=True, text="Enable")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_motor_lin
|
||||
sub.prop(rbc, "motor_lin_target_velocity", text="Target Velocity")
|
||||
sub.prop(rbc, "motor_lin_max_impulse", text="Max Impulse")
|
||||
|
||||
col.label("Angular motor:")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_motor_ang", toggle=True, text="Enable")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_motor_ang
|
||||
sub.prop(rbc, "motor_ang_target_velocity", text="Target Velocity")
|
||||
sub.prop(rbc, "motor_ang_max_impulse", text="Max Impulse")
|
||||
|
||||
elif rbc.type in {'GENERIC', 'GENERIC_SPRING'}:
|
||||
if rbc.type == 'GENERIC_SPRING':
|
||||
row = layout.row()
|
||||
row.label("Spring Type:")
|
||||
row.prop(rbc, "spring_type", text="")
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_lin_x")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label("Limits:")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_lin_x", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_lin_x
|
||||
sub.prop(rbc, "limit_lin_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_lin_x_lower", text="X Lower")
|
||||
sub.prop(rbc, "limit_lin_x_upper", text="Upper")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_lin_y", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_lin_y")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_lin_y
|
||||
sub.prop(rbc, "limit_lin_y_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_lin_y_lower", text="Y Lower")
|
||||
sub.prop(rbc, "limit_lin_y_upper", text="Upper")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_lin_z", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_lin_z")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_lin_z
|
||||
sub.prop(rbc, "limit_lin_z_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_lin_z_lower", text="Z Lower")
|
||||
sub.prop(rbc, "limit_lin_z_upper", text="Upper")
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_ang_x", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_limit_ang_x
|
||||
sub.prop(rbc, "limit_ang_x_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
|
||||
class PHYSICS_PT_rigid_body_constraint_limits_angular(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Angular"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_limits'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_ang_y", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_limit_ang_y
|
||||
sub.prop(rbc, "limit_ang_y_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_y_upper", text="Upper")
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_limit_ang_z", toggle=True)
|
||||
sub = row.row(align=True)
|
||||
return (ob and rbc
|
||||
and (rbc.type in {'GENERIC_SPRING', 'HINGE', 'PISTON'})
|
||||
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
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
if rbc.type == 'HINGE':
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_ang_z")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_ang_z
|
||||
sub.prop(rbc, "limit_ang_z_lower", text="Lower")
|
||||
sub.prop(rbc, "limit_ang_z_lower", text="Z Lower")
|
||||
sub.prop(rbc, "limit_ang_z_upper", text="Upper")
|
||||
|
||||
if rbc.type == 'GENERIC_SPRING':
|
||||
col = layout.column(align=True)
|
||||
col.label("Springs:")
|
||||
elif rbc.type == 'PISTON':
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_ang_x")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_x", toggle=True, text="X Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_x
|
||||
sub.prop(rbc, "spring_stiffness_x", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_x", text="Damping")
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_ang_x
|
||||
sub.prop(rbc, "limit_ang_x_lower", text="X Lower")
|
||||
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_y", toggle=True, text="Y Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_y
|
||||
sub.prop(rbc, "spring_stiffness_y", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_y", text="Damping")
|
||||
elif rbc.type == 'GENERIC_SPRING':
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_ang_x")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_z", toggle=True, text="Z Axis")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_z
|
||||
sub.prop(rbc, "spring_stiffness_z", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_z", text="Damping")
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_ang_x
|
||||
sub.prop(rbc, "limit_ang_x_lower", text="X Lower")
|
||||
sub.prop(rbc, "limit_ang_x_upper", text="Upper")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_ang_y")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_x", toggle=True, text="X Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_x
|
||||
sub.prop(rbc, "spring_stiffness_ang_x", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_x", text="Damping")
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_ang_y
|
||||
sub.prop(rbc, "limit_ang_y_lower", text="Y Lower")
|
||||
sub.prop(rbc, "limit_ang_y_upper", text="Upper")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_y", toggle=True, text="Y Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_y
|
||||
sub.prop(rbc, "spring_stiffness_ang_y", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_y", text="Damping")
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_limit_ang_z")
|
||||
|
||||
row = col.row(align=True)
|
||||
sub = row.row(align=True)
|
||||
sub.scale_x = 0.5
|
||||
sub.prop(rbc, "use_spring_ang_z", toggle=True, text="Z Angle")
|
||||
sub = row.row(align=True)
|
||||
sub.active = rbc.use_spring_ang_z
|
||||
sub.prop(rbc, "spring_stiffness_ang_z", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_z", text="Damping")
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_limit_ang_z
|
||||
sub.prop(rbc, "limit_ang_z_lower", text="Z Lower")
|
||||
sub.prop(rbc, "limit_ang_z_upper", text="Upper")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_motor(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Motor"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and rbc and rbc.type == 'MOTOR'
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
return # do nothing.
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_motor_angular(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Angular"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_motor'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and rbc and rbc.type == 'MOTOR'
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
self.layout.row().prop(rbc, "use_motor_ang", text="")
|
||||
|
||||
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
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
flow.active = rbc.use_motor_ang
|
||||
|
||||
col = flow.column(align=True)
|
||||
col.prop(rbc, "motor_ang_target_velocity", text="Target Velocity")
|
||||
|
||||
col = flow.column(align=True)
|
||||
col.prop(rbc, "motor_ang_max_impulse", text="Max Impulse")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_motor_linear(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Linear"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_motor'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and rbc and rbc.type == 'MOTOR'
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
self.layout.row().prop(rbc, "use_motor_lin", text="")
|
||||
|
||||
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
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
flow.active = rbc.use_motor_lin
|
||||
|
||||
col = flow.column(align=True)
|
||||
col.prop(rbc, "motor_lin_target_velocity", text="Target Velocity")
|
||||
|
||||
col = flow.column(align=True)
|
||||
col.prop(rbc, "motor_lin_max_impulse", text="Max Impulse")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_springs(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Springs"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and ob.rigid_body_constraint
|
||||
and rbc.type in {'GENERIC_SPRING'}
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
layout.prop(rbc, "spring_type", text="Type")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_springs_angular(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Angular"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_springs'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and ob.rigid_body_constraint
|
||||
and rbc.type in {'GENERIC_SPRING'}
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_ang_x", text="X Angle")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_ang_x
|
||||
sub.prop(rbc, "spring_stiffness_ang_x", text="X Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_x", text="Damping")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_ang_y", text="Y Angle")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_ang_y
|
||||
sub.prop(rbc, "spring_stiffness_ang_y", text="Y Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_y", text="Damping")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_ang_z", text="Z Angle")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_ang_z
|
||||
sub.prop(rbc, "spring_stiffness_ang_z", text="Z Stiffness")
|
||||
sub.prop(rbc, "spring_damping_ang_z", text="Damping")
|
||||
|
||||
|
||||
class PHYSICS_PT_rigid_body_constraint_springs_linear(PHYSICS_PT_rigidbody_constraint_panel, Panel):
|
||||
bl_label = "Linear"
|
||||
bl_parent_id = 'PHYSICS_PT_rigid_body_constraint_springs'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
return (ob and ob.rigid_body_constraint
|
||||
and rbc.type in {'GENERIC_SPRING'}
|
||||
and context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
ob = context.object
|
||||
rbc = ob.rigid_body_constraint
|
||||
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_x", text="X Axis")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_x
|
||||
sub.prop(rbc, "spring_stiffness_x", text="X Stiffness")
|
||||
sub.prop(rbc, "spring_damping_x", text="Damping")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_y", text="Y Axis")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_y
|
||||
sub.prop(rbc, "spring_stiffness_y", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_y", text="Damping")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(rbc, "use_spring_z", text="Z Axis")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = rbc.use_spring_z
|
||||
sub.prop(rbc, "spring_stiffness_z", text="Stiffness")
|
||||
sub.prop(rbc, "spring_damping_z", text="Damping")
|
||||
|
||||
|
||||
classes = (
|
||||
PHYSICS_PT_rigid_body_constraint,
|
||||
PHYSICS_PT_rigid_body_constraint_settings,
|
||||
PHYSICS_PT_rigid_body_constraint_limits,
|
||||
PHYSICS_PT_rigid_body_constraint_limits_angular,
|
||||
PHYSICS_PT_rigid_body_constraint_limits_linear,
|
||||
PHYSICS_PT_rigid_body_constraint_motor,
|
||||
PHYSICS_PT_rigid_body_constraint_motor_angular,
|
||||
PHYSICS_PT_rigid_body_constraint_motor_linear,
|
||||
PHYSICS_PT_rigid_body_constraint_objects,
|
||||
PHYSICS_PT_rigid_body_constraint_override_iterations,
|
||||
PHYSICS_PT_rigid_body_constraint_springs,
|
||||
PHYSICS_PT_rigid_body_constraint_springs_angular,
|
||||
PHYSICS_PT_rigid_body_constraint_springs_linear,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
|
|
Loading…
Reference in New Issue