I have a addon that needs to be in the tool shelf. This works fine with Blender 2.69, since there is just one tab. Blender 2.7 comes with several tabs though. And now the same addon adds in all tabs.
I am still a rookie when it comes to Python. What can i do to install it in a specific tab? And what happens with all the old scripts that uses the old method?
Examplescript:
import bpy
# ----------------------------------------- create isometric camera
class createtrueisocam(bpy.types.Operator):
"""Creates a mcamera for mathematical correct isometric view"""
bl_idname = "scene.create_trueisocam"
bl_label = "TrueIsocam"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
# ----------------------------Create Camera with correct position and rotation
bpy.ops.object.camera_add(location=(30.60861, -30.60861, 30.60861))
object = bpy.context.scene.objects.active
object.rotation_euler = (0.955324, 0, 0.785398) #Attention, these are radians. Euler angles are (54.736,0,45)
# ------------------------------Here we adjust some settings ---------------------------------
object.data.type = 'ORTHO' # We want Iso, so set the type of the camera to orthographic
bpy.ops.view3d.object_as_camera() # Set the current camera as the active one to look through
return {'FINISHED'}
class MyPanel(bpy.types.Panel):
bl_label = "Create IsoCam"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
def draw(self, context):
self.layout.operator("scene.create_trueisocam")
# -------------------------------------------------------------------------------------------
def menu_func(self, context):
self.layout.operator(createtrueisocam.bl_idname)
def register():
bpy.utils.register_class(createtrueisocam)
bpy.types.VIEW3D_MT_view.append(menu_func)
bpy.utils.register_class(MyPanel)
def unregister():
bpy.utils.unregister_class(createtrueisocam)
bpy.types.VIEW3D_MT_view.remove(menu_func)
bpy.utils.register_class(MyPanel)
if __name__ == "__main__":
register()