Skip to content

Commit

Permalink
Add a panel to always display collision collections
Browse files Browse the repository at this point in the history
Blender hides the collections settings for bodies which are a child of a
COMPOUND_PARENT; this panel makes those settings visible again. Fixes #6
  • Loading branch information
eoineoineoin committed Jan 15, 2024
1 parent 7f4576e commit 3bfcf71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,3 @@ Here, we can see the inital linear/angular velocities of the body (represented h

Collision geometry may not have the minimal required volume for that particular shape type if vertices are offset from node; this matches Blender's behaviour.

Blender's UI hides collision filtering information for children of a "Compound Parent" body - to set the collision filtering information for such an object, the child needs to be temporarily unparented from the compound.

2 changes: 1 addition & 1 deletion addons/KHR_physics_rigid_bodies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
bl_info = {
"name": "KHR_physics_rigid_bodies",
"category": "Import-Export",
"version": (0, 2, 0),
"version": (0, 2, 1),
"blender": (3, 6, 0),
"location": "File > Export > glTF 2.0",
"description": "Extension for adding rigid body information to exported glTF file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,25 @@ def draw(self, context):
row.prop(obj.khr_physics_extra_props, "cone_capsule_height")
row.prop(obj.khr_physics_extra_props, "cone_capsule_radius_top")

class KHR_PT_rigid_body_collections(KHR_PT_rigid_body_panel_base):
"""Additional panel to display collision collections for a body, as, by default,
Blender will not show collections for children of a COMPOUND_PARENT"""
bl_label = "Collections"
bl_parent_id = "KHR_PT_rigid_body_panel"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "physics"
bl_options = {"DEFAULT_CLOSED"}

@classmethod
def poll(cls, context):
return KHR_PT_rigid_body_panel_base.rigid_body_selected(context)

def draw(self, context):
obj = context.object
layout = self.layout
layout.prop(obj.rigid_body, "collision_collections")


class KHR_PT_rigid_body_constraint_panel_base(bpy.types.Panel):
bl_label = "KHR Physics Constraint Extensions"
Expand Down Expand Up @@ -668,6 +687,7 @@ def draw(self, context):
KHR_PT_rigid_body_panel,
KHR_PT_rigid_body_motion,
KHR_PT_rigid_body_shape,
KHR_PT_rigid_body_collections,
KHR_PT_rigid_body_mass,
KHR_PT_rigid_body_constraint_panel,
KHR_PT_rigid_body_constraint_drives,
Expand Down

0 comments on commit 3bfcf71

Please sign in to comment.