Gyes : RMG and RTG ( Random Material and Texture Generator )

I’ve installed the addon, but it won’t ‘enable’ in the User Preferences window.
I click the little box, but a check box won’t appear.

I’ve tried 2.58, 2.58a, and 2.58 latest Graphicall, and the 2.59 release candidate.

do you have the gyes folder (with its subfolders) in scripts/addons/ ?

ahh…i just tried it, in the console (if you start blender with a console) it says what’s up:



    from gyes import random_material_generator
  File "/home/zeffii/blender258/blender-svn/build/linux/bin/2.59/scripts/addons/gyes/random_material_generator.py", line 118
    if mat.use_transparency == True :
   ^
IndentationError: unexpected indent

open up random_material_generator.py , scroll down to line 118 and notice an extra space, where the if statement doesn’t line up with the mat.use_ above it. To fix it remove the space infront of the if.

Kilon gave me write access to the github for gyes (before he went on holidays), so i commited that small fix. Thanks for heads up.

Oh boy isnt the community great !!! thanks zeffii for that, apparently I accidently inserted a space there before that if. I do these kind of mistakes I suck at typing, lol.Sorry for that terrachild, but with zeffii’s fix you should be fine now. Make sure you redownload so your script comes with the fix. If you have any problem dont hesitate to report it here. I willbe more careful with my future commits.

I am still on vacation in my mother’s beatiful island Crete , for anyone who has visited you know what I am talking about. For everyone else , here is a small sample.

But I am also working on GYES , I have added loads of code that I have not commited yet . I am in the process of finishing the last features for the history tool, that includes making every single parameter of a material able to be stored and recalled by history . Right now I am implementing the ability of history to store material nodes . I am also planning a tutorial on scripting material nodes and a script template for material nodes that will be included with other text editor templates probably in the next official release of blender , after the approval of ideasman.

The next commit will be my largest commit so far with which I will finish with the history tool and start with the biggest feature of Random Material Generator … TEMPLATES

fasten your seat belts :wink:

It’s working now.

I do have another question though.
what’s the best way to trigger this each frame in an animation?

Thanks.

Hi, testing you addon, it change materials in material preview, but not in render.
I get this error.

Traceback (most recent call last):
File “/daten/zwei5new/install/linux2/2.59/scripts/addons/gyes/random_material_generator.py”, line 551, in execute
rm.random_material(i.active_material,‘Random’)
File “/daten/zwei5new/install/linux2/2.59/scripts/addons/gyes/random_material_generator.py”, line 132, in random_material
self.store_to_history(mat)
File “/daten/zwei5new/install/linux2/2.59/scripts/addons/gyes/random_material_generator.py”, line 220, in store_to_history
for x in range(0,len(nt.nodes)):
AttributeError: ‘NoneType’ object has no attribute ‘nodes’

location:<unknown location>:-1

location:<unknown location>:-1

Thank you, mib.

hmm, i dont think you can do this , but I could add it as a feature, if i could make the history index animatable it could work like the way you want. I like it as a feature and i will try to implement it. Consider this a TODO.

yeap again my bad, the reason why it does this is because it tries to store the node tree even when you dont use nodes, i assumed that the node tree existed even when no nodes where used, i was wrong, I have fixed that before seeing your reply, It will no longer try to store the node tree if you have not enabled “use nodes” so you can redownload my script and should work with no problems , I hope :wink:

Ok boys and girls here is an update that will certainly make you smile.


1st as you figured out from the previous post my script can now store material nodes. Yeap, history can store your node materials , it can store not only the nodes themselves , but also the links between them and the their position so they appear the same way you placed them.

No it cannot randomise your nodes, sorry for that, but I did not want to mess things up for the time being, the node systems is quite delicate and complex and I am still trying to figure it out, node randomisation will be for my next feature “Templates”. So you will have to wait for that one

Also this is not finished yet because though it stores nodes, links and locations, it does not yet store node parameters. No worries, I am in the process of implementing that as well

2nd All non readonly material parameters are now stored in the history. That means every single parameter that is simple in format, this exclude for example nodes, SSS , mirror etc. That means now you can store a more complete material to the history


3rd You have been asking for a random assigner of materials , you got one now. You have a floor or wall of tiles and you want each tile to have a diffirent material but from a group of material of 4 or more , so that each tile wont have a complete unique material ? You can do this now with the “R” button, next to the activate button, it works exactly like activate button but unlike the activate button it does not take the current selected history index but it pick one index in random order from the available indices. Yes , Yes , Yes it even works on multiple object with a single clikc :wink: (MacKraken I hope you happy now:) )


4th Another complain I was getting was that the history was lost each time you closed your blend file and exited blender . No more ! Now history is saved with your blend file, now you can continue where you left. But I give you the option to load history from your saved blend file or create a new one :wink: If you want to create a new one, do nothing , if you want to continue from where you left and load it back , click the “Restore” button

==========================================================================
Still alot of things need to be done, finish material nodes, implement texture nodes that also will be saved with you material as a single entity and you will no longe have to worry which texture goes to what material and also I am thinking adding texture randomisation in material randomisation for more exciting results.

I am still alive, I am still coding, and still having loads of fun. Thanks for you support.

Grab it while its hot —> https://github.com/kilon/Gyes/blob/master/gyes/random_material_generator.py

Hi kilon, thanks, work now as expected.
Start playing. :slight_smile:

Cheers, mib

It would be nice to be able to keyframe the activation.
I don’t necessarily want it every frame, maybe every 5 frames or more.

or

Can I just call that button from a python script that runs “Pre-Render?”

nice !
keep me posted with any other problem you may have

you should be able to do that in theory. Animating the activation is something that interested me as well, having random animatable material is a very nice feature .

However you can already do this manually, as you can keyframe every single parameter. You can change your frame and then activate another history index , insert a keyframe for every parameter you want to change and voila its done. Of course you dont need to do this for every frame as blender guesses the animation of each parameter , only for key frames, that define the speed of the animation and the way the animation occures like animation anything else.

The only problem is that you will have to go trhough each material parameter, unless there is a overall keyframing of material parameters way that I am not aware of.

My script will do the same thing though it will do it with a click of a button instead of you going through each material parameter. However i dont think you can keyframe node creation and editing so it will not probably work for nodes.

I am working on it right now. Probably will have something for you during the next week .

Good news, it was much easier than I thought. In my latest commit I added 2 buttons , “Animate” and “X”, next to each other.

Animate –> insert a keyframe for the current frame for every non read only material button with a single button click. Read only paremeter are , color ramps, material nodes, textures, sss, mirror and maybe one more two thing I forget right now.

X–> is doing the opposite, removes the keyframe for each non read only material parameter. Make sure you are in the correct frame where the keyframe was inserted in the first place.

Obviously you can use animate and x not just for random material , but for any material you make and you want to quickly animate it without going through each parameter. History tool generally works perfectly for regular materials, so dont let the name “random material generator” fool you. The design of the script is made in such way to let you have the freedom to work anyway you like.

I also added a multi_label feature, its basically a python function that creates labels and wraps text into them, it can do what labels cant, display a multiline text wrapped (wraps means that the text is always alligned vertically at the start and in the end, so it look actually alot nicer) , the wrap width can be customised too with setting the amount of character used for the wrap.

Thus multi_label is perfect for displaying long multiline text on a panel. You can see it in use in "help"mode.

Grab it while its hot —> https://github.com/kilon/Gyes

Happy to report that the script works well with the new official release , blender 2.59

Summary ====> Well at last History tool is finished. What that means ? it means that at last you can , store complete materials with their nodes and their textures in history. Textures can even use texture nodes. With the completion of history tool, I can now move to the “Templates” feature.

Get while its hot —> https://github.com/kilon/Gyes

Long story ===> My idea to store every single material parameter to a index of the history did fail. The reasons were 3 : a) the dictionary that i used for the history tool was getting more and more complex , the problem begin cause I did not realise that changing material parameters was not as direct as I thought. Many of them were read only which meant I could not copy their sub-parameters as a group of just only one by one and there loads of them around making my code both huge and quite complex b) in case of material nodes a material that uses nodes can use another material which uses nodes which can use another material that uses nondes and so on and this loop could go forever making my dictionary even more complex c) I could not find a way to assign a material to material node.

So instead of storing each material parameter, I store only the name of the material, and I let the material itself to be saved with the blend file as its what blender already does. However each material that is stored in history it does not get lost after the blend file is saved as I have its F button always enabled (even if not mesh uses the material) . Normal blender discards useless materials. So dont be suprised if some materials are keeping saved with your blend file even if you dont use them. Even deleting from history wont disable the “F” button, you should do it manually. Ensures this way that you wont accidently delete your materials. This safe guard applies only for material you have randomised or stored in history not every material, so other material that have no user will be discarded in a save as this the blender’s normal behaviour.

The script does not change in any way the standard material workflow, what you have done already for your materials you will continue doing with this script, so there is nothing new to learn also the overall behaviour of the script remained the same, so even though I had to remove 330 lines of code (almost 1/2 of the script) and add another 30 , the script behaves pretty much as you expect. Actually the script’s concept became simpler and closer to how blender behaves.

The only big diffirence is that it can now save not only the first material slot but each single slot. It only saves one slot per index, but I am thinking expanding it to save every slot in one index.

Its still abit experimental, I am not so sure if that is exactly how I will leave it, but more or less this is the final version concerning what features have being implemented so far.

I am also thinking implementing randomisation for nodes and randomisation for textures. Textures are high priority right now but probably I will do both.

In any case this the last quick update for me, my vacation has ended and so is my luxurious free time, so it will be some time till you hear from me again. Have fun.

Ok more good news. I lifted the restrictions. RMG (Random Material Generator) no longer cares if your object has a material slot or a material assigned to it, in order to work. If no material slots exists, RGM creates one, if a material slot exist but no material is assigned to it, RGM creates a new material and assigns it to the first slot.

This is very important for you that wanted to create random materials on multiple selections , you no longer need to go one by one to your objects and create material slots and materials, RGM will do it automatically for you. It works of course on single selections too.

Also you will notice that the Gyes panel now displays even if you have not selected anything. This happens because the panel no longer will accommodate only RGM , there are 2 other gyes scripts that are in the making :

a) RLG , random landscape generator, follows the footsteps of the ANT Landscape Generator which is in the Add -> Mesh menu. I will open a seperate thread for it , but basically the goal is to convert any existing mesh into a landscape. It also use a similar history tool as the one found in RMG , to store presets.

b) TARTARA. TARTARA will become a tool that will connect with an online library which will allow the user to upload, download and update any kind of blender asset from inside blender without using an internet browser or any other tool. Those assets can be anything Scrips, meshes, entire blend files, materials, animation data ,etc etc. Again there is going to be a seperate thread for this project too.

All gyes scripts are called “tools” and they are selectable with the “Tool” menu. RMG is the default selection.

Dont hesitate to ask any question.

As always you can download Gyes from here —> https://github.com/kilon/Gyes

I am happy to report that I have finished Random Texture Generator and connected it with RMG , I also replaced the old tutorial with a new tutorial , cause I have added a ton of new features since then and many thing have changed .

Here is the new tutorial

and you can download Gyes from here https://github.com/kilon/Gyes

A tutorial for the History tool. As you know you can use history for easy management of materials and texture of any kind , with random assignment , multiple activation, range deletion, animation of randomisation and the ability to save History with your blend file as well restore or not restore it when you reopen it.

The History Tool is shared between RMG (Random Material Generator) and RTG (Random Texture Generator).

Enjoy

hi, the script works in 2.59 & 2.60
d/l here http://blenderpython.svn.sourceforge.net/viewvc/blenderpython/259/scripts/addons_extern/gyes/?view=tar

put the folder gyes in your addons folder
enable the script in the Other category
use script in the toolshelf

great script btw :slight_smile:

cheap nhl jersey

Meta-Androcto, kilon: oh ok, i will try putting the whole folder in. once the “gyes” folder is in the “addons” folder, does it show up in the addon list in blender, or i still need to do “Install Add-on”? Im not at my comp so cant try it at the moment, just thought i’d ask just in case…thanks!

kilon: thanks, once i get it up and running i’ll check out the history tool. it would be nice if there was an option to do it for faces…or even better, to assign to SELECTED faces…but i guess i can make it work by separating each face as an individual object, then rejoining. if you have time…consider this a feature request! :wink:

if it still doesnt work, i will definitely post the error, thanks much!

Got it up and running, and I think I figured out how to accomplish what I’m trying to do. Its a little tedious, so please tell me if there’s a more efficent way to do it:
For example: I have 8 materials, named “1” thru “8” each with a separate image texture. I select the first material index, hit “store” in the GYES buttons, then the next button (>). i then select the next material index, hit “store”, and then “>”, and so on. so each material has to be selected, stored, then the history index has to be advanced next. this could take a while, because my real project that I could use this for has more like 30-40 materials.

When thats all done, I create a bunch of planes, select all, and press “R” in the history buttons. all the planes are automatically assigned random materials from those 8 indexes, which of course, is awesome. :wink:
it would be nice if there was a way to control the randomness, for example, not having the same material repeated twice in a row. (a few of the planes were the same material as the one next to it)

So! thats what i have so far. Am i doing this right? Thanks, this script is awesome!

edit: oh, and in answer to myself:

does it show up in the addon list in blender, or i still need to do “Install Add-on”?
it shows up right away when you copy the gyes folder :slight_smile:

Yes thats exactly how it work, I am glad you like. I understand your pain storing 40 materials in a row, its not an issue for me to implememt this, its not even difficult to code and make a button to store all existing materials to history. I will also make a random face button.

About the double randoms in assignment, that one is a tough one, there is no way for my script to know that your planes are next to each other and share the same material, well there may be a way but it will be tough for me to code. I could make sure though that a material is not chosen a second time and offer it as an option.

All those feature will be implemented in the future update, so keep an email notification on this thread and you will be informed when they will be available.

its not an issue for me to implememt this, its not even difficult to code and make a button to store all existing materials to history.

perfect! if you want to get really fancy, you can add a “String” box where you type in “X”, so that any materials with “X” in the name are included…just a suggestion.

I will also make a random face button.
not sure what you mean by this…?:confused:

there is no way for my script to know that your planes are next to each other and share the same material

right, i was thinking that. if the planes are scattered, and not in a striaght line, then theres no real “order”.

I will definitely keep an eye out, thanks for all the help. just curious, do you have an estimated release date?