New scripts for 2.5: materials, selectionmodes,manipulator

Here are 3 scripts I’ve submitted for inclusion with blender…
I thought I’d post here to see if there’s user interest.

install by navigating to your .blender/scripts/addons folder and put the scripts inside.

enable each from the PREFERENCES “ADDONS” panel.

the first are small, the 3rd is a BIG script…

“cycle selection modes” is for editmode. Hit the spacebar to cycle from vertex selection to edge selection to face selection and back to vertex mode (familiar to lightwaveand modo users)

“manipulator menu” restores the 2.49 behaviour of “alt space” offering amenu to change the manipulator;

http://www.cowtoolsmedia.co.uk/scripts/manipulator.jpg
translate
rotate
scale
combo
disable

“master material menu” is a port of some of my material scripts from 2.49

http://www.cowtoolsmedia.co.uk/scripts/materialmenu.jpg
the key feature is that you assign materials in a very direct way, straight to the selection… you don’t have to worry about managing material slots or think about what materials are attached to the mesh…

hit the “q” key in the 3d view to get the following menu;

assign material
select by material
clean material slots
material to texface
replace material

assign material offers a menu of all the materials in the current blend file and “new”
what you chooses gets assigned to all selected objects (and their faces) in object mode.

in edit mode it assigns the material to the selected faces

as additional cleanup it automatically cleans material slots and performs material to texface… for explanations of that see the description below.

select by material : in object mode you choose any material in the blend:

all objects that use the material, are selected, the rest isn’t.

in edit mode it selects faces with the material and deselects faces that use other materials.

Clean material slots; again it works on multiple objects in object mode or just one…
it checks all the material slots attached to the object… if they aren’t used by the faces of the mesh they are removed

material to texface
Could do with a more catchy name, but when in solid mode rather than textured GLSL the faces of the mesh show the image assigned in the uv editor…

this function looks through the material for the first image texture and assigns it to the faces that use that texture slot… very handy as many of the exporters look to the uv assigned textures rather than those assigned in the material definition… and also good for visibility in the 3d view

finally is
replace material This will replace one material with another (either for selected items or for the whole blend file) It’s mainpurpose is for when you merge or import data into your scene and get name clashes and like to clean up… I need to do a bit more UI work…

Anyway…I hope these are useful! (use with recent builds!)

get them here!
http://www.cowtoolsmedia.co.uk/scripts/2.5scripts.zip

Great scripts. Thanks for sharing Michael. :yes:

Thanks Demohero…

I’ve just edited the first post to show a screenshot of the material menu…

thanks for theses scripts

i looked at the picture for material

looks interesting but how it works

i can see some materials on the right like snow rock ect

can you explain where you get theses mat
i mean is it added to a new folder you need to create ?

Thanks

does this have anything to do with the new list of embeded material that will be included in 2.5?

or will it be able to use these mats?

Thanks

Ricky, those are the materials that are already in the blend file…

the point of the script is to allow instant access to all the materials in the blend and to assign them directly…

no need for the properties window, or slots, ids whatever…

EDIT:

I don’t know how the presets system will work for materials, but i dare say that this’ll work with that…

man 2.5 seems to be a heaven for custom UI designs.

nice scripts

well, I had this all working in 2.4!

(check the top right of this image…)

http://www.cowtoolsmedia.co.uk/scripts/249.jpg

something else here and very nice

peoples 2 weeks ago were asking how to start a menu with a key sequence and i just saw in your mat script that you simply Q key to start the window menu for mat

and that’s on problem out of the way for menu selection in window port

Thanks for this new way to start a menu in window

salutations and happy 2.5

Mike, thanks for the scripts, especially for the selection cycling script. It makes modeling immensely easier!

oh wow dude that is so amazing, blender feels so much easier to use now with one hand just a quick glance of where buttons are and back to being creative

Cool scripts, especially like the material selector.

Q: Script cycle selection modes - Can you add selection types with your script, as you can with shift key?

3point edit, no it doesn’t do that…

I could make a partner operator that adds to the current state rather than explicitely setting it and map that to shift space…

maybe…
I hear that joeedh wants to get rid of multimode for bmesh though… It makes doing more context sensitive stuff easier…

what do you mean by multimode for Bmesh?

for the key activation here is it possible for instance to have a sequence of keys like
Alt - shift - P or whatever key sequence you want

cause there are lot’s of key’s used already by blender internaly

Thanks

i meean multi selection mode… at the moment you can shift click on the selection icons in the 3d header so you can enable combinations: select edges, faces and vertices all at once should you choose…

for the key activation here is it possible for instance to have a sequence of keys like
Alt - shift - P or whatever key sequence you want

cause there are lot’s of key’s used already by blender internaly

Thanks

yes you can, it’s just adding the shortcut to the current keymap …

in the “register” function change:

kmi = km.items.add(‘wm.call_menu’, ‘Q’, ‘PRESS’)

to

kmi = km.items.add(‘wm.call_menu’, ‘P’, ‘PRESS’, alt = True, shift =True)

…and if it doesn’t clash with an existing item (or get overidden by another entry… it’ll work…

just manually test in the userprefs/input keymaps section before automating by adding this to a script…

cool scripts. thanks man!

Folks, just and update…

This script is now in “Trunk” so it’ll be in the addons menu by default…

I’ve just updated it so it also includes “texface to material” (will take a few days for builds with the latest version I guess)

This function (in the q key menu) will look at all uv editor assigned images (for the active uv layer) on the selected objects and creates materials for each (with the image used in the colour channel)

It’ll check of those materials and texture data blocks exist and will re-use them if present.

It’s a really fast way to block out materials on faces and will go well with the drag and drop feature for assigning texface images…

TODO:
a decent “macro style” menu for “Replace Material”

loading and assigning materials in one step from a user created material presets library

nice to see it evolve over time

when you say preset lib
is this the new lib for pre defined materials - like a 1000 mat
that is supposed to come with 2.5

did you get any update when this is going to be included in 2.5?

Thanks

officially I don’t know…
I’ve been busy with other things, but am close to adding something using python…

whether that gets accepted or not is another matter…

I’m looking at two strategies for what a material preset should be:

one: that material presets are python files that when run in blender will create a material, set all its rna to some defined state and create its associated texture blocks
(tricky part is nodes and image based textures… absolute/relativepaths, a place to store them etc…

2: that material presets are blend files… and I just load a material data block…
(problem that I need to read the contents of external blend files to retrieve data block names to present to the user — no api access but i’ve been given some code for this…

with either strategy from a UI standpoint I’d add to the assign material menu:
currently that offers a list of all materials already in the open blend file and new
(which creates a new material block and assigns it to the selection…)
i propose adding from library to this menu… it will offer sub menus for the material presets folders and their contents… requirements:

  • present a menu that mimics an arbitrary directory structure(arbitrary depth and sub categories…
  • allow the user to organise that anyway they like (by just adding folders, blends or py presets…
  • allow the user to save their own presets
  • make it one step: picking a preset will load/create the material and assign it to the selection (multiple objects, selected faces… whatever)

i like the idea of being able to have sub folders by categories
like stone and bricks another folder for woods another for metals ect

did you talk with the peoples involved with the new mat lib for 2.5

they may already have done some works on this !

might save you some times and may be get some codes if it’s been done!

this structure could also be used to manage lot’s of scripts too i guess

anyway i like the idea of mat lib in one way or another

happy 2.5