Hi, this is a rather simple outline of a project Im working on to test some posible improvements on Blender for python scripts.
Have a single script autorun on Blender Open/New/Load stage (this script will manage autorun scripts)
A new menu in the info space (the menu on top of the screen) called SCRIPTS, with a first item “Manage scripts”. This will run a script that will manage all installed scripts, deactivate some, add some others to favorites, etc. Favorite scripts may go below this first option in the menu, for easy access.
Have the option to turn on space-handler scripts via python (needs to be added to python API, currently there is only the possibilty of load a space-handler). Maybe also eliminate the need for the space-handler to reside in the blend as a Text object.
With these simple hacks it will be really easy to make scripts look and work more like “integrated features”, meaning they will “belong” to the blender setup, without the need of manually launch and setup them, over and over.
Many of these ideas carry “security” issues but I think the problem its already there. Python is powerfull enough to trash a system and it is easy with the current implementation to -lets say- make a chunk of code to replace the help scripts with malicious ones. The risks are ok to me, but I doubt this may be acepted in the main Blender tree, so its more intended for a custom build.
What you think? are you interested… wanna help me on this? Please post any thought you can think of.
Let me start by saying that your proposals sound very interesting. The current implementation of python in blender is for the general user still a bit too far out of the ordinary. For example space-handlers are a pain to set up in a file (opening them in a text window [or via the scripts window], and then activating them in a 3Dwindow). So in my opinion giving access to python in easier ways could greatly benefit blender and its users.
Now on to the specifics:
This is probably the biggest security issue of the three. I vaguely remember some discussion on the mailinglist about python scripts running automatically on startup and the idea was that .blend files with malignant python code could too easily wipe out your harddrive in that way. So what kind of scripts were you thinking of that would benefit from automatically running at startup? And what advantages does it have above for example spacehandlers that are saved with the .blend or the default .B?
The easier access would be a great improvement in the workflow. Currently you have to open a scriptswindow (= 2 clicks), and select the script you want (another 2 clicks). If you can select a script from the infowindow that will save 2 clicks (=50%). Another thing which I’d like to see is hotkey-access to scripts, for example Shift-Y. I’ve already got this working with a spacehandler in the 3Dwindow, but universal access in the blender interface would be great.
The idea of favourites is something I especially like. Question is of course where to save this information. I guess this would be a user preference in .B, but this raises questions about whether python scripts should have access to this. A notification, or confirmation question to the user is probably needed.
Turning on space-handlers via python is something I’ve been missing a lot, so I’d really appreciate if it were added. No idea why it wasn’t added yet, but probably because nobody had the time to do it yet, or because it’s a potential security issue. The last reason isn’t really an argument though, because space-handlers can already be saved in a .blend so then they’re already turned on at startup.
As you can probably tell, I’m very interested in this. Unfortunately I won’t be of much use as I don’t know any C and haven’t ever played with the blender source. Still I wish you a lot of good luck and I’ll be following this closely.
About the auto running scripts security issues… I was thinking in taking this approach: The code will look for a file with a list of the scripts the user want to auto run. This list will be configured using a “script manager center” or something like that. A hacker can obviously modify that file, and add a malicious script; but we can think in some sort of warning to the user if that file changes or something. Also the autorun scripts will need to be activated by the user as an option, so we can also give the user a warning that using this feature implies security risks (windows users are bugged by microsoft about this, every time they try to open an .exe downloaded from the net)
If you have used, for example, my visual location script (it adds extra visualization of distances on the 3d view) you know I mean. Lets the script autorun and it will be there, integrated and working as a “feature”, every time you load or make a new .blend.
Also utility scripts like layer managers or such can benefit from this, space-handlers wich change key mapings, etc.
Need to think about possible workarounds about this security problems.
Thanks for the thoughts :).