Matthew here with yet another question :p

Anyway...I found an answer by @zeffi on how to append an object using python, that's all goods, but the trouble is, every time I append that object, it imports the textures in, every time, which means that after about 5 appends, I have 5 copies of every single texture, which slows blender down dramatically, and also increases my file size from 150mb to something like 1gb...sooo, here is what I was thinking, in steps:

Append the object, then check if all the textures imported in with the last 'append' are there already, and if they are, then delete them, otherwise leave them there. It sounds pretty simple but I just don't know how to go about it. Here is the part of code that should concern so far:

class AddMacBook(bpy.types.Operator):
    bl_label = "Add MacBook"
    bl_idname = "macbook_controller.add_macbook"

    def execute(self, context):
        item = context.scene.ignit_panel.add()

        macbook_path = '/Users/MacBook/Documents/Blender/Blends/MacBook/Macbook.blend'

        macbook = 'Macbook'
        screen = 'Screen'
        Directory = macbook_path + "/Object/"
        m_path = Directory + macbook
        s_path = Directory + screen

        wm = bpy.ops.wm
        wm.append(filepath=m_path, filename=macbook, directory=Directory)
        wm.append(filepath=s_path, filename=screen, directory=Directory)
  • 1
    $\begingroup$ This should obviously be an builtin append feature. I guess the way that 3d studio max does it is best. It checks for materials that has the same name, If the names are the same, a dialogue box will pop up asking you if you would like to keep the material and rename it, or use the one already available in the blend file. $\endgroup$
    – hawkenfox
    Jan 8, 2016 at 7:34
  • $\begingroup$ Do you know how I could achieve the same effect? $\endgroup$
    – mr-matt
    Jan 8, 2016 at 7:55
  • $\begingroup$ related: blender.stackexchange.com/questions/44542/… and related blender.stackexchange.com/questions/17876/… $\endgroup$
    – zeffii
    Jan 8, 2016 at 12:21
  • $\begingroup$ lol, the first link is this exact question! And the second one, does it not import textures? $\endgroup$
    – mr-matt
    Jan 8, 2016 at 18:58


You must log in to answer this question.

Browse other questions tagged .