I struggle to understand why this does not work in my script, giving me the error that the context object has not attribute camera, while I use the original code from the properties_data_camera.py file.
File "C:\Users\info\Desktop\UI Testing.blend\studioTools_Shelf_Beta v2.py", line 709, in draw AttributeError: 'Context' object has no attribute 'camera'
I also added the following line at the beginning
from bl_ui.properties_data_camera import CameraButtonsPanel
from rna_prop_ui import PropertyPanel
# CAMERA ---------------------------------------------------------------------------
class CAMERA(bpy.types.Panel):
bl_label = "Camera"
bl_idname = "Camera"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = "Shading Toolbox"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
def draw(self, context):
layout = self.layout
cam = context.camera
layout.prop(cam, "type", expand=True)
Everything I would like is to show few buttons from the Camera UI in the toolshelf. Currently it is rendered empty because of the error I get.