Post #4690: CamS2.py (1.7 KB)

📋 Metadata

  • Author: lee_blues
  • Date: 2023-04-20 02:39:59
  • Type: question
  • Quality Score: 5/10
  • Replies (1): post_04691

🏷️ Tags

pie-menu integration intermediate unsolved

  • Pie Menu Editor
  • Python Scripting

💬 Content

CamS2.py (1.7 KB)
Above is the complete code
Below is my part of the code that I want to use PME call class “cam.0v0” But it fails, please to tell me how can I Modify the code? @roaoao @Pluglug
image

i can use search to call these class But not with PME to call
image

class Cam_Base(bpy.types.Operator):
    bl_idname = "cam.base"
    bl_label = "Cam Base"
    cam_name = "C_"

    def execute(self, context):
        C = bpy.context

        # lock cam
        bpy.context.object.lock_scale = (True, True, True)
        bpy.context.object.lock_rotation = (True, True, True)
        bpy.context.object.lock_location = (True, True, True)

        # select cam
        bpy.context.space_data.camera = bpy.data.objects[self.cam_name]

        # Select Active Cam
        for area in C.screen.areas:
            if area.type == 'VIEW_3D':
                A = C.area.spaces.active.camera

        bpy.context.scene.camera = bpy.data.objects[A.name]
        return {'FINISHED'}


class Cam_0V0(Cam_Base):
    bl_idname = "cam.0v0"
    bl_label = "Cam_0V0"
    cam_name = "C_0V0"

🔗 View on Blender Artists