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!
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:
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()
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).
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]
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.
Uhm… my skills won’t go that far
But if someone can advice how to do that it would be awesome
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
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!
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
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.