[WIP] Script Shortcut - Easily create panel buttons to external python scripts

add-ons

(snu) #1

So with some inspiration from Wegg in the #blender irc channel, I decided to make this Addon. With Script Shortcut, you can set simple python scripts as buttons in customizable panels.
You can add as many buttons as you like, add labels and spacers between the buttons, and make buttons conditional on a python true/false statement included in the script.

A little demo video showing the functionality:

You can get the script and a couple buttons I have made at:
http://www.snuq.com/scripts/scriptshortcut/

So far, there isn’t much, but I would like to have a bit of a repository of buttons in the future - if anyone comes up with a useful one, let me know!

If you are interested in writing a button script, take a look at:
http://www.snuq.com/scripts/scriptshortcut/buttons/test.py
Which has some info on the format.

Hopefully you find this useful, and don’t forget to throw any problems you have or feature requests my way, thanks!

Attachments

Script Shortcut 0.5.0.zip (5.74 KB)


(erdinc) #2

Seems very useful. Thanks!


(jimpaw80) #3

Fantastic Work!

I have not been able to try this yet but this is exactly the type of addons that Blender should be working on fulltime for the next 5 years to come. I am using a similar scripts but for pie menus that you can find here:

https://cgcookiemarkets.com/all-products/pie-menu-editor/ which is just amazing!

I have some questions regarding this addon:

  1. Is it possible to add buttons from just copt commands inside Blender instead of linking to an external script?
  2. what kind of buttons are supported? It would be great with on/off icons (like the display face normal in the n panel for example) , value sliders,checkboxes etc. I actually have not tried this yet so i will get back to you with more feedback. I would love to chat some with you on Skype to see what you are up to GREAT WORK!

ps. why don’t you team up with the creator of “Tune up”? seems like you could do some cool stuff together.


(Spirou4D) #4

Thanks @snu, it’s a great idea specially for batch job…
Congratulations.


(Nikos_) #5

Cool ! Great idea indeed !


(snu) #6

Thanks for the kind words! If you guys make any useful scripts, post them here and i’ll add them to directory on my website.

Hmm, hadnt thought about that, actually.
Honestly, that is not really what i envisioned this script was geared towards: its more for implementing commands that arent already in blender, without having to deal with an entire addon.
In truth tho, any internal command in blender should be able to be implemented through a script file (like how i used the duplicate and delete functions in the demo video), and i might include a few of those in the script files. Which commands were you thinking about adding?

It just does basic “do something” buttons right now, tho it might be useful to have the ability to add properties as well (sliders/checkboxes/values), ill have to give that some thought. anyone else interested in that feature?

I dont use skype, but im on irc all the time, freenode network #blender and #blendercoders
Havnt heard of tune up, ill take a look at it, but im kindof more of a lone ranger coder :slight_smile:

Also a little todo im thinking about:
Im thinking of adding a drop-down menu at the top of the panel to switch between multiple layouts, gotta figure out the logistics a bit on it, but I think it would be a nice addition.
I want to add the ability to have multiple buttons/labels per row
I also really need to add a way to switch the script file for a button…


(Cyaoeu) #7

Thanks for the addon. Can you add keymap functionality so we can add shortcuts for the buttons?


(snu) #8

I updated the script some to version 0.4:
Added popup menu with the shortcut ctrl-shift-space that pops up the current panel for an area
Added a change script button to the button editor dialog
Implemented stored panel presets through a drop-down menu

Were you thinking of the popup shortcut like I just added, or direct shortcuts to each button? I could map shortcuts to Alt-1, Alt-2, etc to the first second and so on buttons, but I’m not sure how to add custom shortcuts without reimplementing blender’s keymap editor…

Attachments

Script Shortcut 0.4.0.zip (5.59 KB)


(snu) #9

Updated to version 0.5
Not a huge update, but a couple nice additions:
Made panel settings into addon preferences, they no longer clog up the window view menu with a settings menu
Resolved error messages when loading script

Attachments

Script Shortcut 0.5.0.zip (5.74 KB)


(wilnix) #10

Hi
Great script, but can the script remeber last session so I do not need to load all the buttons every time I start Blender

//W


(snu) #11

The script should save the panel settings to the current scene, if you want the buttons to be on a new file, start a new file, set up the buttons, and save as your startup .blend file.
Also, you can save and load your button layouts at any time


(wilnix) #12

Thanks, now I understand how it works. Very useful.

//W


(system) #13

Hi thanks for sharing ! Can I use it also with addons? For example instead of installing an addon, add it to a button?
That would also be great since I expect that some addons are causing problems, and this way I can just load easily only what I need at that moment.


(snu) #14

Hmm, i think it would probably work, but I can’t confirm or guarantee it… it’s possible that some addons won’t work right like that, and menus might get added more than once if you run it again.
worth trying out tho, let me know if there are any problems.


(tuomo) #15

Thank you for this script. Extremely useful for small scripts.

Idea:
“Clear” button could ask “are you sure you want to clear the buttons”. It is easy to press it accidentally.

Ctrl shift space is good addition. Thank you for that.


(AlanGameDev) #16

This is one of the most useful scripts ever! Thank you!


(snu) #17

Script Shortcut is now on GitHub:


A detailed readme is included there, and all the buttons that I have created (that are worth releasing at least).

Also, I released version 0.6 with a couple small new updates:

  • Added ability to call buttons with Ctrl-Shift-‘Number Key’
  • When creating a new button, the filename is first used for the title, then the user is asked to rename.