import BrushSet (addon)

ive created a addon a while back to import all textures from a folder at once, the main idea for me was that i dont have to load several textures manually that i want to use for texture painting or sculpting and to learn a bit about the new blender:D

here is the script:
(see attachment)
http://projects.blender.org/tracker/index.php?func=detail&aid=25702
http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Import-Export/BrushSet

(if anyone has a better place to upload this please let me know)

and here is how its done:
save the .py file to your scripts folder, start blender and activate the addon.

after that you will find a new import option
http://i54.tinypic.com/30aqbg7.jpg

from there select the folder where your textures are located that you want to import
http://i56.tinypic.com/s5cpow.jpg

depending on the amount of texture files this can take a moment:O

now you can go into texture paint or sculpt mode and open the texture selection, all the textures should be available to use now.
http://i53.tinypic.com/scap3q.jpg

hope you like it, comments and crits are always welcome:D

Attachments

io_import_BrushSet.zip (1.86 KB)

Awesome !! niceā€¦ its make easy ! :eyebrowlift2::eyebrowlift::eyebrowlift:

forget, could you share your texture library :smiley:

glad you like it, my texture library is a bit big to upload somewhereā€¦ but you can get free textures everywhere on the web, here is a good one: http://www.cgtextures.com

Thanx Kromar!

Great workā€¦

Do you thing to add a possibility to select manually a set of textures and not all the folder?

thats not a bad idea:D i dont know how to do that yet but i will try to find a way to do that:D

ive updated the script to work with the latest blender builds, if you have any problems let me know
io_import_BrushSet.py - 0.00MB

I have another suggestion if you or someone is inclined to work on this at some point, but I donā€™t anything about python and couldnā€™t y suggest a method of doing so. The ability to remove those imported brushes when they are no longer needed would be great. I recently accidentally imported a folder with a hundred or so images in it, and now have to remove them one by one to make the file small enough to distribute by email. Just a thought anyway.

well that is a bit of a problem the way blender works at the moment. the only way to do that is to import the brushes without fake user and then restart blender to get rid of all the brushes. if you have all your brushes with a fake user flag then here is something for you to remove all the fake users:

for tex in bpy.data.images:
	tex.use_fake_user = False
	print(tex)
	
for tex in bpy.data.textures:
	tex.use_fake_user = False
	print(tex)
	
for tex in bpy.data.brushes:
	tex.use_fake_user = False
	print(tex)

enter this in the console in blender and hit enter 2 times. then save youur scene (best as seperate blend ) and restart blender.

NOTE: this will also remove texture/vertex paint and sculpt brushes. these can be imported again with shift+F1 from a other blend file.

EDIT: not sure if you use my script or the option from the ā€œTexture Paint Layer Managerā€. my script should import the textures without fake user and a simple restart of blender will remove all the imported textures again.

Hi kromar, Iā€™ve tried to make a script that import automatically brush or other sets automatically in blender on start up, but iā€™m new on python so i canā€™t get the path by code. fortunately iā€™v discover you script so Thanks! :smiley:

however is not the same as i want so i make some change, so now it automatically load on start up the brush on a predefined folder specified on user preference.

this is the code so if some one want it this is it (if you have any problem let me know):

# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****

# ----------------------------------------------------------------------------#    

'''
todo:
- add file selection for single and multiple files

changelog:
    "version": (1,1,4),
        filename will be used as texture name (still limited by stringlength)


    "version": (1,1,3),
    fixed operator and registration
    added tracker and wiki url\
    
version": (1,1,2)
    replaced image.new() with image.load()
    changed addon category
    removed some unused/old code    
    
version":1.11:
    added type arg to texture.new() [L48]
    cleared default filename
''' 

# ----------------------------------------------------------------------------#    

import bpy
import os
from bpy.props import *

#addon description
bl_info = {
    "name": "Auto Load BrushSet",
    "author": "Daniel Grauer",
    "version": (1, 1, 5),
    "blender": (2, 6, 2),
    "category": "System",
    "location": "Automatically load on start up, User preference, File",
    "description": "Imports all image files from a folder",
    "warning": '', # used for warning icon and text in addons panel
    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Import-Export/BrushSet",
    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=25702&group_id=153&atid=467",
    }

breakpoint = bpy.types.bp.bp

#extension filter (alternative use mimetypes)
ext_list = ['jpg',
            'bmp',
            'iris',
            'png',
            'jpeg',
            'targa',
            'tga'];

def LoadBrushSet(filepath, filename):
     
    
    for file in os.listdir(filepath):
        path = (filepath + file)
        #get folder name
        (f1, f2) = os.path.split(filepath)
        (f3, filename) = os.path.split(f1)
        
        texturename = file         # file        "texture"    foldername
        
        #filter ext_list
        if file.split('.')[-1].lower() in ext_list: 
            #create new texture
            texture = bpy.data.textures.new(texturename, 'IMAGE')    #watch it, string limit 21 ?!

            #create new image
            image = bpy.data.images.load(path)
            image.source = "FILE"
            image.filepath = path
            bpy.data.textures[texture.name].image = image
       
       # for tex in bpy.data.textures:
       #     tex.name = filename   
             
#for tex in bpy.data.images:
#	tex.use_fake_user = False
#	print(tex)
	
#for tex in bpy.data.textures:
#	tex.use_fake_user = False
#	print(tex)
	
#for tex in bpy.data.brushes:
#	tex.use_fake_user = False
#	print(tex)

# ----------------------------------------------------------------------------#    

class BrushSetImporter(bpy.types.Operator):
    '''Load Brush Set'''
    bl_idname = "import_image.brushset"
    bl_label = "Import BrushSet"

    bpy.types.Scene.filename = StringProperty(name="File Name", description="filepath", default="", maxlen=1024, subtype='DIR_PATH')
    bpy.types.Scene.filepath = StringProperty(name="File Path", description="Brush location", default="", maxlen=1024, subtype='DIR_PATH')
    scn = bpy.context.scene
   
#    if scn.filepath == "":  #first run
#        os.mkdir("/temp")
#       scn.filepath = "/temp"
#    else:
#        scn.filepath = bpy.context.scene.filepath 
    
      
    if scn.filepath == "":
        pass
    else:
        LoadBrushSet(scn.filepath, scn.filename)
       



# ----------------------------------------------------------------------------#    
#def menu_func(self, context):
#    #clear the default name for import
#    default_name = "" 
#
#    self.layout.operator(BrushSetImporter.bl_idname, text="Brush Set").filename = default_name
# ----------------------------------------------------------------------------#    
class Brush_set_UI(bpy.types.Panel):

    bl_space_type ='USER_PREFERENCES'
    bl_label = 'Brush_Path'
    bl_region_type = 'WINDOW'
    bl_options = {'HIDE_HEADER'}
   
   

    def draw(self, context):
        
        scn = context.scene 
        layout = self.layout
        column = layout.column(align=True)
        column.label(text='Brush Directory:')
        column.prop(scn,'filepath')  
        
#if bpy.context.scene.filepath != "/temp":
#    os.rmdir('/temp')		
def register():    
    
    bpy.utils.register_class(Brush_set_UI)
    #bpy.types.INFO_MT_file_import.append(menu_func)
    bpy.utils.register_module(__name__)
    

def unregister():
    bpy.utils.unregister_class(Brush_set_UI)
    bpy.utils.unregister_class(BrushSetImporter)
    #bpy.types.INFO_MT_file_import.remove(menu_func)

if __name__ == "__main__":
    register()



oh sorry i did not see your post:O
i dont know if its possible to load something on start but im rewriting some of the addon at the moment and will take a look at what youve done :smiley:

Hello,

is there any update on this addon?
It doesnā€™t work on Blender 2.72.

I am working with Win 8.1.

NIWO

Yeah, me too Iā€™d like to have this updated. Itā€™s a really usefull addon. Please update it!

I was looking for this addon, and the realized it isnā€™t working at the moment. I gave it some thought, and realized that a similar functionality is available that works pretty well, already included in blender now.

I used the same technique to make an Alchemy styled brush setup with multiple images. The trick is to create a folder of images that you what to use, and batch rename them to make them into an image sequence. If need be, and they are all the same size, you coudl use the VSE to load them and export them as frames to the folder.

Loading them up all at the same time, blender sees them as a movie or image sequence, and is ready to use them as a texture. I had used the timeline before to ā€˜playā€™ the images through, cycling them through, but in this case you use the arrow key to find the one you want, looking at the texture properties panel preview to see what is current to frame.


I use this add on all the time, Thank you!

I didnā€™t know this addon existed and also made an addon for this. https://github.com/amb/blender-scripts/blob/master/load_alphas.py

It adds an ā€œTexture Autoloadā€ entry to the tool panel in the Tools tab for texture paint, sculpt and vertex paint. Thereā€™s a button to download everything from a folder. Another button is to remove all autoloaded textures that arenā€™t being used.

uh i did not get any message to this thread and missed all comments about it not workking:( i will put it on my menu to fix the functionality, thanks for reporting.

When I try adding your addon Blender Console says it does not have UTF-8 encoding. I am very interested in your add-on, maybe it is because of 2.78 blender maybe?

thanks for your interest, i was looking into this but it seems there is some issue with the versions, i have a newer one that the one that comes with blender. i will see if i figure it out whats going on there.

untli then you can get the latest version from here: https://github.com/kromar/Blender_Addons/blob/master/addons_contrib/io_import_BrushSet.py