I was tweaking a script by Kevin Morgan (forTe) - the random theme generator. The script had all the color functions, but it randomized everything, so the interface looked a bit scary afterwards.
I took some time with it to make a ‘unified’ version, that randomizes the colors, but makes them the same for every window. I made mad calculations to it to make different variations but with similar hues.
The calculations are a bit goofy, since I’m no programmer, it might crash because of bad boundaries etc etc. And this kind of script might already be available and be better but I was merely learning the syntax of the Blender python … ^^
That was kinda freaky, I loaded up the script and my computer started beeping at me and all this gibberish appeared in the console. I tried it three times and it happened every time.
Here is a screenshot of the console:
I actually really want to try this script out so if anyone has any ideas on what to do then thanks.
I’m running Window’s XP Home with Blender 2.48 and Python 2.5 if it helps
Yes, there are some missing int() tags in the script, but it shouldn’t throw that much stuff on you … I run it without errors, but then again I’m in Linux …
I can add the description on the file if someone wants to install it … it needs a GUI first though. You should load the script into the texteditor and press ALT+P (Play script).
Cool script. I added the missing int(), so now it shouldn’t spit out any gibberish. I made it spit out the color values instead though, to help with debugging.
[edit: forgot i commented these out. It shouldn’t spit out anything to the console now.]
It seems that it is vertex and text_hi that makes it break, namely because:int(power + random() * power)
can produce values larger than 255. So i changed it to:int(power + random() * power * (1-power/255.))
Try it out, works 100% of the time for me now. randtheme-uni_debugged.py
Hey, That’s pretty cool that somebody took my acid trip machine and made it generate really nice themes!
Perhaps I should have posted the script that actually generated my original script, though, to make it easier to modify. Perhaps I should also add my information to the original script too, so people can find me from it…
Scratch that. Uncommented the print lines again, as it still sometimes fails.
*Sometimes fails with hue values over 100
*Seems lamp and textc can get values below 0
Excellent, I can host the debugged version. I was about to attach the code to an UI I did on the Python GUI creator, but I have no understanding how the variables change from the slider controls. I just keep getting error after error (I don’t know the Python syntax properly yet).
I would suggest that instead of load it from the menu, run it as a ScriptLink activated on FrameChanged
And if you add this in the top:
#from Blender.noise import random ### I think is better to use the random below, can delete this line in fact :::
from random import random
from random import seed
seed(Blender.Get("curframe"))
You have a new theme each frame, and because of the seed you can produce the same theme again. Press Alt+A and pick your theme
And I would only suggest that you always avoid to set the same color for the text editor background and foreground.
EDIT::
And if you create a:
[DEBUG = 0] in the top
and use [if DEBUG:] before all the print statements you run it (way) faster
Took my debugged version and put it into your gui, and hooked up the variables and stuff. Fixed the hue bug as well i think (implemented a check, if lamp or textc created color values below 0, it became 0 instead) I think it was because of multiple int().
Latest version. The script now:
*Have a gui
*Uses seed, so lets you change the different values independently + you can regenerate the same theme if you know its values
*Updates automatically when values change
*Catches any rgba values that are outside 0-255
*Has a working randomize function
Wicked mon!
I’ll host this from my server, if it’s ok. The code must’ve been messy, I did it for about 5h and at the last few minutes I couldn’t see line from the other. And my math sucks worse than ever. :D:D
Well, I didnt bother much with the math to be honest, and those were the messy lines :rolleyes:
I think it works quite nicely, there are still some things that could be improved though i think…
*if dark > bright, text doesnt do anything sometimes.
*It’s difficult to generate a usable theme with light text on dark
I like the GUI thing, however I still think that this is more useful running as a ScriptLink. There is a way to run the GUI once, configure the parameters and load the parameters from a ScriptLink?
I think it is just a matter of store the parameters in Blender module or something similar.
And if it is to make all the generation through GUI, I would suggest a button to randomly create a new seed and a new theme. That way you can recreate the theme, but don’t need to change parameters all the time to have a different, random, theme.
I was thinking about the same thing after your script link idea. I think one needs 2 different scripts though, one with gui and one without. But saving parameters should be possible.