armory/blender/arm/props_collision_filter_mask.py
Lubos Lenco 98eeccd71d
Merge pull request #2082 from armory3d/blender2.9
Blender 2.9 LTS support
2021-05-10 11:14:39 +02:00

39 lines
1.1 KiB
Python

import bpy
class ARM_PT_RbCollisionFilterMaskPanel(bpy.types.Panel):
bl_label = "Collections Filter Mask"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "physics"
bl_parent_id = "ARM_PT_PhysicsPropsPanel"
@classmethod
def poll(self, context):
obj = context.object
if obj is None:
return False
return obj.rigid_body is not None
def draw(self, context):
layout = self.layout
layout.use_property_split = False
layout.use_property_decorate = False
obj = context.object
layout.prop(obj, 'arm_rb_collision_filter_mask', text="", expand=True)
col_mask = ''
for b in obj.arm_rb_collision_filter_mask:
col_mask = ('1' if b else '0') + col_mask
col = layout.column()
row = col.row()
row.alignment = 'RIGHT'
row.label(text=f'Integer Mask Value: {str(int(col_mask, 2))}')
def register():
bpy.utils.register_class(ARM_PT_RbCollisionFilterMaskPanel)
def unregister():
bpy.utils.unregister_class(ARM_PT_RbCollisionFilterMaskPanel)