Page 1 of 2 12 LastLast
Results 1 to 20 of 33
  1. #1
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62

    Asset Flinger Add-on - Simple Mesh Importer

    EDIT (2015-05-03):



    Asset Flinger
    Add-on for simple mesh importing via graphical menu.

    Hi!

    After a long journey that started of me trying to develop a Blender add-on by myself but eventually finding a couple of developers to contribute, Asset Flinger was made (even though it's not fully functional for all operating systems yet).

    It is now released as free to use for everyone. I hope you like it!

    Read more and Download from the GitHub page

    I would love to hear your comments on this!

    Cheers!
    Manu Järvinen

    manujarvinen.com
    fb.com/artofmanujarvinen
    @manujarvinen




    Original first post from 2013-05-28:


    Hi

    Having a folder full of single mesh objects like nuts, bolts and screws etc. as .blend or .obj files is a good start for an Asset Library.
    However, appending objects into a scene starts to get tedious if you need to add them often to your scene - like I do.
    So I really would like to have an addon for that.

    I made a search for an asset library addon but there seems not to be many.
    The best I found was this, but it makes each asset as a separate single addon and eventually menus get cluttered. Also distributing the whole asset library to others is immensely difficult.

    I would love to have the Asset Library Addon handle a folder full of .obj files, in this manner:

    image_1.jpg

    Or even better would be with thumbnails:

    image_2.jpg

    Do any of you think this would be a possible addon to make?

    I attached the assets as a .zip file to this post

    Cheers,
    mj
    Attached Files Attached Files
    Last edited by maxon; 03-May-15 at 16:37.



  2. #2
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62
    Yeehaa, I already have what I need with the help from my friend and Jonathan's menu tutorial.

    Next step would be to make a nice thumbnail list.
    And also an feature to sort the menu-entries into sub-menus in case the obj-folder has subfolders.

    The current addon is attached to the post.

    - First open the python file and define your OBJ directory into it
    - Then just put it into \scripts\addons as usual and activate it in Blender
    - Lastly, assign a hotkey for it and you're ready to go

    image.jpg

    And here's the code:
    Code:
    bl_info = {
            "name": "OBJ Asset Library Menu",
            "category": "Import-Export"
            }        
     
    import bpy
    
    import os
    # OBJ directory path. For example the following is c:\models\obj\
    full_path_to_directory = os.path.join('C:\\', 'models', 'obj')
    
    class PrimMaker( bpy.types.Operator ):
        filename = bpy.props.StringProperty()
        bl_idname = "bpt.obj_importer"
        bl_label = "Import OBJ file"
         
        def execute( self, context ):
            bpy.ops.import_scene.obj(filepath=self.filename)
            return {'FINISHED'}
       
    # Creates a menu for global 3D View
    class customMenu(bpy.types.Menu):
        bl_label = "OBJ Asset Library"
        bl_idname = "view3D.obj_asset_library_menu"
        # Set the menu operators and draw functions
        def draw(self, context):
            layout = self.layout
     
            # access this operator as a submenu
            # get list of all files in directory
            file_list = os.listdir(full_path_to_directory)
             
            # reduce the list to files ending in 'obj'
            # using 'list comprehensions'
            obj_list = [item for item in file_list if item[-3:] == 'obj']
             
            # loop through the strings in obj_list.
            for item in obj_list:
                filename = os.path.join(full_path_to_directory, item)
                layout.operator("bpt.obj_importer", text="" + item).filename = filename
    
    def register():
        bpy.utils.register_class( PrimMaker )
        bpy.utils.register_class(customMenu)
     
    def unregister():
        bpy.utils.unregister_class(customMenu)
        bpy.utils.register_class( PrimMaker )
     
    if __name__ == "__main__":
        register()
    Attached Files Attached Files



  3. #3
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62

    Asset Library Addon version 2.0

    - sub-menus added
    - installation is a breeze, all the .obj files come with the addon
    - it's easy to add your own .obj files and subfolders
    - it goes straight to the add mesh menu, no need for a keyboard shortcut

    If someone happened to know how to get those thumbnail-images to be listed instead of the file names, that would be just golden!
    I included the thumbnail-images to the released addon .zip file (attached to this post).

    Cheers!

    BlenderAid_Asset_Library_Addon_Installation.jpg

    Code:
    bl_info = {
            "name": "Asset Library",
            "version": (2, 0),
            "blender": (2, 67, 0),
            "location": "View3D > Add > Mesh > Asset Library",
            "description": "Asset Library of the .obj files in the addon's folder",
            "category": "Add Mesh"}        
     
    import bpy
    import os
    
    folderDict = {}
    
    
    # Fetching the path to Blender's addons directory
    path_to_addons = os.path.sys.path[1]
    if 'addons' not in path_to_addons:
        path_to_addons = os.path.sys.path[0]
    
    # Full path to "\addons\add_mesh_asset_library\assets\" -directory
    full_path_to_directory = os.path.join(path_to_addons, 'add_mesh_asset_library', 'assets')
    
    class opOBJImporter( bpy.types.Operator ):
        filename = bpy.props.StringProperty()
        bl_idname = "bpt.obj_importer"
        bl_label = "Import OBJ file"
         
        def execute( self, context ):
            bpy.ops.import_scene.obj(filepath=self.filename)
            return {'FINISHED'}
    
    class subMenuClass(bpy.types.Menu):
        bl_label = "Asset Library Submenu"
        bl_idname = "asset_library_submenu"
        
        # Set the menu operators and draw functions
        def draw(self, context):
            layout = self.layout
            folderName = self.bl_idname.split('.')[1]
            print (folderName)
            dir = os.path.join(full_path_to_directory, folderName)
            addOperatorsToLayout(dir, layout)    
                    
    def addOperatorsToLayout(dir, layout):
        file_list = os.listdir(dir)
        for name in file_list:
            if name[-3:] == 'obj':
                filename = os.path.join(dir, name)
                layout.operator("bpt.obj_importer", text="" + name, icon="MESH_ICOSPHERE").filename = filename
    
    def createSubMenu(folderName):
        class InheritedClass(subMenuClass):
            bl_idname = "asset_library_submenu" + "." + folderName
            
        return InheritedClass
      
    # Creates a menu for global 3D View
    class customMenu(bpy.types.Menu):
        bl_label = "Asset Library"
        bl_idname = "view3D.asset_library"
        
        # Set the menu operators and draw functions
        def draw(self, context):
           
            layout = self.layout
     
            # access this operator as a submenu
            # get list of all files in directory
            file_list = os.listdir(full_path_to_directory)
             
            # reduce the list to files ending in 'obj'
            # using 'list comprehensions'
            obj_list = [item for item in file_list if item[-3:] == 'obj']
            
            file_list = os.listdir(full_path_to_directory)
            for name in file_list:
                if os.path.isdir(os.path.join(full_path_to_directory, name)):
                    layout.menu(folderDict[name], text="" + name, icon="FILE_FOLDER")
                    
            addOperatorsToLayout(full_path_to_directory, layout)
    
            
    def menu_draw(self, context):
        layout = self.layout
        layout.separator()
        layout.menu(customMenu.bl_idname, icon='MOD_SCREW')
    
    
    def register():
        bpy.utils.register_class( opOBJImporter )
        bpy.utils.register_class( customMenu )
        file_list = os.listdir(full_path_to_directory)
        for name in file_list:
            if os.path.isdir(os.path.join(full_path_to_directory, name)):
                newMenuClass = createSubMenu(name)
                bpy.utils.register_class(newMenuClass)
                folderDict[name] = newMenuClass.bl_idname
        bpy.types.INFO_MT_mesh_add.append(menu_draw)
    
    
    def unregister():
        bpy.utils.unregister_class( customMenu )
        bpy.utils.unregister_class( opOBJImporter )
        bpy.types.INFO_MT_mesh_add.remove(menu_draw)
    
    if __name__ == "__main__":
        register()
    Attached Files Attached Files
    Last edited by maxon; 01-Jun-13 at 03:14.



  4. #4
    Member Meta-Androcto's Avatar
    Join Date
    Aug 2006
    Location
    australia
    Posts
    4,047
    hi maxon, very nice work, if your interested, drop into irc freenode #blenderpython for a chat.



  5. #5
    Member
    Join Date
    Oct 2012
    Location
    Budapest, Hungary
    Posts
    33
    this is amazing! please make those thumbnails fast before i'll find you and kill you because you didn't make those in time! :P
    WE NEED THIS!



  6. #6
    Member
    Join Date
    Jan 2008
    Location
    run-down motel
    Posts
    259
    I like this. I like it's simplicity.



  7. #7
    Member MmAaXx's Avatar
    Join Date
    Jun 2008
    Location
    Tokyo
    Posts
    1,757
    life saving script! thanks!



  8. #8
    Member kberes's Avatar
    Join Date
    Nov 2013
    Location
    Seattle, WA
    Posts
    92
    Would be cool to be able to use .blend files along with obj's. Would that be possible?



  9. #9
    This addon is not working with blender 2.69 any chance to update it, it looks super useful.



  10. #10
    Originally Posted by Renderluz View Post
    This addon is not working with blender 2.69 any chance to update it, it looks super useful.
    at line 16 from __init__.py into the addons folder replace from:
    path_to_addons = os.path.sys.path[1]
    if 'addons' not in path_to_addons:
    path_to_addons = os.path.sys.path[0]

    to:

    path_to_addons = os.path.sys.path[0]
    if 'addons' not in path_to_addons:
    path_to_addons = os.path.sys.path[1]



  11. #11
    Member
    Join Date
    Oct 2012
    Location
    Budapest, Hungary
    Posts
    33
    error.jpgit is not working under 2.71 gives me error messages, can You update it? Plese, plese, your addon is amazing!
    Last edited by jay27flow; 31-Aug-14 at 06:16.



  12. #12
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62
    Originally Posted by jay27flow View Post
    it is not working under 2.71 gives me error messages, can You update it? Plese, plese, your addon is amazing!
    Thanks for the feedback!

    I hassled something and got it somehow to work in Blender 2.71.
    Find the version 2.1 from attachment.

    At first when I was in Windows-computer predat's advice didn't work.
    But on my home Mac laptop it was needed to get it work

    Installing:
    - open the addons tab from user preferences
    - click: "Install from File..."
    - select: BlenderAid_Asset_Library_Addon_v2.1.zip

    Please, report back if it doesn't work

    However, I'm fully working on version 3.0, which has image thumbnails. Here's a sneak peek.
    I will probably publish it on the Blender Market.
    So it will have better support from me perhaps.

    Originally Posted by kberes View Post
    Would be cool to be able to use .blend files along with obj's. Would that be possible?
    Uhm... my skills won't go that far :/
    But if someone can advice how to do that it would be awesome
    Attached Files Attached Files
    Last edited by maxon; 05-Sep-14 at 17:45.



  13. #13
    Member
    Join Date
    Oct 2012
    Location
    Budapest, Hungary
    Posts
    33
    wow, the thumbnailed version will be awesome, probably will buy.
    Thanks for the trying to fix it, unfortunately it's still don't working for meer.jpg



  14. #14
    Member
    Join Date
    Aug 2011
    Location
    Germany
    Posts
    39
    I would buy that...



  15. #15
    Member
    Join Date
    Aug 2009
    Location
    Falster DK
    Posts
    34
    Originally Posted by jay27flow View Post
    wow, the thumbnailed version will be awesome, probably will buy.
    Thanks for the trying to fix it, unfortunately it's still don't working for meer.jpg


    I got the same error, but if you move the unziped folder to the addons folder like this:

    Capture.PNG

    It works for me.



  16. #16
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62
    Asset Flinger released!
    Check out the edited first post



  17. #17
    Member
    Join Date
    Mar 2010
    Posts
    1,122
    great job guys, thanks a lot..! a pleasure to use, and also your models are cool
    3d view overlay works nicely, but fails for me on quad view...
    anyway, hope the asset management system in developement looks a bit like this

    edit: you maybe should remove the smooth / subsurf code from thumbnailer
    also a picture because this is too cool: https://db.tt/EdXnESj4
    Last edited by liero; 03-May-15 at 22:27.



  18. #18
    Member maxon's Avatar
    Join Date
    Sep 2007
    Location
    Helsinki, Finland
    Posts
    62
    Thank you for the feedback!

    Yeah, I put the quad view bug as well to the known bugs list.

    Thanks, the code sure could be optimized a bit and clutter removed

    Thanks for the picture! :D
    I want to put it here straight to the thread for display!



    But yeah, in the image there's another of the known issues showing, which is that there is no possibility to scroll the list :/ - It is, however, relatively easy to change the thumbnail sizes in the code for the menu and thumbnailer and then render new thumbnails - in order to get the list more compact
    Last edited by maxon; 04-May-15 at 05:19.



  19. #19
    Member comeinandburn's Avatar
    Join Date
    Feb 2007
    Location
    toronto, canada
    Posts
    1,160
    Manu this is FANTASTIC!!!!!!! Thanks so much for sharing (thank the anonymous contributors as well )



  20. #20
    Member Toudou's Avatar
    Join Date
    May 2005
    Location
    Moriya, Japan
    Posts
    175
    Thank you for sharing this add-on. It's really great!
    I decided to use this in my work.

    This is my opinion.
    After pressing SHIFT+CTRL+ALT+A key, short cut keys (T key and N key for shelf) need to be enabled,
    because these shelves are overlapped on the Asset thumbnails.

    Anyway, Thanks!
    Toudou,



Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •