Import the class def
If a type is in bpy.types.FOO it implies it is registered.
Wouldn't recommend unregistering using
bpy.utils.unregister_class(bpy.types.FOO)
particularly if you wish to re-register it, as unregistering it removes it from bpy.types.
Rather, would recommend importing them. If you are not sure where the classes are defined, turn on developer extras and view source or check the classes module property
>>> bpy.types.SCENE_PT_physics.__module__
'bl_ui.properties_scene'
Hence can import it, check if it is registered by looking at its is_registered property
>>> from bl_ui.properties_scene import SCENE_PT_physics
>>> SCENE_PT_physics.is_registered
True
>>> bpy.utils.unregister_class(SCENE_PT_physics)
and then re-register if need be to "uncustomize"
>>> SCENE_PT_physics.is_registered
False
>>> bpy.utils.register_class(SCENE_PT_physics)
Note, since most Blender UI code sticks to the convention of putting registerable classes in a list named classes can use this, or the modules register methods.
>>> from bl_ui.properties_scene import classes
>>> classes
(<class 'bl_ui.properties_scene.SCENE_UL_keying_set_paths'>, <class 'bl_ui.properties_scene.SCENE_PT_scene'>, <class 'bl_ui.properties_scene.SCENE_PT_unit'>, <class 'bl_ui.properties_scene.SCENE_PT_physics'>, <class 'bl_ui.properties_scene.SCENE_PT_keying_sets'>, <class 'bl_ui.properties_scene.SCENE_PT_keying_set_paths'>, <class 'bl_ui.properties_scene.SCENE_PT_keyframing_settings'>, <class 'bl_ui.properties_scene.SCENE_PT_audio'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_world'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_world_settings'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_cache'>, <class 'bl_ui.properties_scene.SCENE_PT_rigid_body_field_weights'>, <class 'bl_ui.properties_scene.SCENE_PT_custom_props'>)
Note.
The module bl_ui is blenders UI written in python. The classes listed above are all the UI elements listed in bl_ui.properties_scene ie the PROPERTIES area in SCENE tab.
The idea here is to not use the class from bpy.types rather import it from its appropriate UI submodule.
Hence in your addon code would
from bl_ui.properties_scene import SCENE_PT_physics
As an example, to take out all panels in the Scene Properties
import bpy
from bpy.types import Panel
import bl_ui
all panels in PROPERTIES > SCENE
scene_prop_panels = [cls for cls in bl_ui.properties_scene.classes
if issubclass(cls, Panel)]
def register():
# unregister default scene props panels
for cls in scene_prop_panels:
if cls.is_registered:
bpy.utils.unregister_class(cls)
def unregister():
# unregister default scene props panels
for cls in scene_prop_panels.reversed():
if not cls.is_registered:
bpy.utils.register_class(cls)
if name == "main":
register()