How can I make a custom menu to append a whole scene?
I have got a need to add a custom menu.I got how to make it for a custom object, but I can’t understand how to add a custom menu to imjport in bender a whole scene that includes mesh, bones, controllers, layers etc etc
For example I want that when I press shift a together with armature bones I have my custom button to import my whole scene that is my rig. Just a way to make it less boring than opening the file everytime and run the scripts for sliders controllers that I made manually anytime.
Ok I found something and tried to modify it to fit my needs.
I tried to change it to get it in the Shift_A add menu so I could append my scene from there but it fails.Any advice?
import bpy
import bmesh
import math
from mathutils import *
class OBJECT_OT_addSubmarine(bpy.types.Operator):
‘’’
Class representing an operator for adding a yellow submarine
‘’’
bl_idname = “addSubmarineButton” #name used to refer to this operator
bl_label = “Add Submarine” #operator’s label
bl_options = {‘REGISTER’, ‘UNDO’}
bl_description = “Add a yellow submarine” #tooltip
def execute(self, context):
'''
Function to process a click on the "Add Submarine" button
'''
bpy.ops.wm.link_append(directory="C:\\Users\\Yourname\\Desktop\ est_append\\yellowsubmarine.blend\\Scene\\",
filename="Submarine", link=False) #append submarine from .blend file
return{'FINISHED'}
import bpy
import bmesh
import math
from mathutils import *
class OBJECT_OT_addSubmarine(bpy.types.Operator):
‘’’
Class representing an operator for adding a yellow submarine
‘’’
bl_idname = “addSubmarineButton” #name used to refer to this operator
bl_label = “Add Submarine” #operator’s label
bl_options = {‘REGISTER’, ‘UNDO’}
bl_description = “Add a yellow submarine” #tooltip
def execute(self, context):
'''
Function to process a click on the "Add Submarine" button
'''
bpy.ops.wm.link_append(directory="C:/Users/Youruser/Desktop/test_append/yellowsubmarine.blend/Scene/",
filename="Scene", link=False) #append submarine from .blend file
return{'FINISHED'}
import bpy
import bmesh
import math
from mathutils import *
class OBJECT_OT_addSubmarine(bpy.types.Operator):
‘’’
Class representing an operator for adding a yellow submarine
‘’’
bl_idname = “mesh.addsubmarine” #name used to refer to this operator
bl_label = “Add Submarine” #operator’s label
bl_options = {‘REGISTER’, ‘UNDO’}
bl_description = “Add a yellow submarine” #tooltip
def execute(self, context):
'''
Function to process a click on the "Add Submarine" button
'''
bpy.ops.wm.link_append(directory="C:/Users/Youruser/Desktop/test_append/yellowsubmarine.blend/Scene/",
filename="Scene", link=False) #append submarine from .blend file
return{'FINISHED'}
Perfect!!! one thousand million thanks, kesonmis It was that it seems it’s working now.This can be very helpful to give out custom rigs made with blender so they can just import it .Later I am going to publish also the code that I made for sliders.
import bpy
import bmesh
import math
from mathutils import *
class OBJECT_OT_addSubmarine(bpy.types.Operator):
‘’’
Class representing an operator for adding a yellow submarine
‘’’
bl_idname = “mesh.addsubmarine” #name used to refer to this operator
bl_label = “Add Submarine” #operator’s label
bl_options = {‘REGISTER’, ‘UNDO’}
bl_description = “Add a yellow submarine” #tooltip
def execute(self, context):
'''
Function to process a click on the "Add Submarine" button
'''
bpy.ops.wm.append(directory="C:/Users/Youruser/Desktop/test_append/yellowsubmarine.blend/Scene/",
filename="submarine", link=False) #append submarine from .blend file
return{'FINISHED'}