「Dev:Source/UI/Command Line」の版間の差分
細 (Bot: Fixing redirects) |
細 (1版 をインポートしました) |
(相違点なし)
|
2018年6月29日 (金) 02:45時点における最新版
目次
CommandLine
The purpose of this project is to add a whole new power to blender without removing anything which blender currently has. Old blender users will not notice any difference in blender interface, unless they wish to do so.
1. Introduction
First thing to notice is that blender uses fixed keyboard mappings. Every _blender action_ is internally mapped in blender to some keyboard combination.
Now, what will happen if we try to unfix keyboard mapping? First of all we should create a keyboard mapping file. By default it will contain default blender mappings.
1.1. Keyboard mappings
Change the way that keyboard mappings are handled _internally_ by blender. Every _blender action_ must be given a descriptive name (this name becomes a _blender command_), then a key binding is defined in a way: [conditions] [key] [name_of_the_command], for example:
object_mode g grab_selection=
Default key bindings will be the ones that blender currently has. Adding any new command to blender will require extending keybindigs.
Commands added by writing user python scripts will be treated equally with _blender commands_. Thus can be assigned a keybinding.
1.2. Introduce a command line
Upon user request a command line will appear and the user will be able to write commands there. Those commands will be just =[name_of_the_command]=. Also a shorter alias could be defined: =[alias] [name_of_the_command]=, for example:
alias sn popup_snap_menu alias mov grab_selection
Because every _internal blender action_ can be invoked from command line (by typing _blender command_), it will be possible to write command scripts then feed them to command line. (two possible uses spark to my mind: 1. blender demos - a user launches demo script and watches blender doing everything step by step, 2. automated drawing of models without a GUI)
2. More details - rules for keyboard mapping
2.1. How =.Bkeymap= should look like?
Here should be a full DefaultBkeymap file (still under construction ;). Some excerpts are below:
mode omod object_mode mode 3win 3d_window mode osel object_is_selected mode twin text_edit_window
true F1 load_file true shift-S popup_snap_menu omod,3win,osel f toggle_face_display twin alt-shift-s select_text_menu
alias sn popup_snap_menu
(compare with [1], and with [2])
If a user accidentally destroys this file he would restore it by invoking a command eg.
blender -k > .Bkeymap
2.2. Mapping _blender commands_
Every mapping is in the form: [conditions] [key] [name_of_the_command], where [conditions] is a comma separated list of conditions. All of the conditions must be true for the mapping to take effect.
2.3. Declare =mode= for shorter mapping rules
Writing:
text_edit_window alt-shift-s select_text_menu
is a little too long, we will use =mode= command to add more modes:
mode twin text_edit_window
now writing twin will be equal to writing text_edit_window, note that this is different than alias. The mode mapping has a scope of .Bkeymap file, while alias has a scope of command line. In fact alias is:
mode alias command_line_active
Any _blender command_ that takes no parameters and returns a value can be mapped to mode and then can be used in [condition] rule.
2.3. Example mapping
[conditions] [key] [name of command] omod,3win,osel f toggle_face_display
means that object mode must be active, 3d window must be active, and an object must be selected. This is exactly what is written in [3]
2.4. Adding aliases
For faster invocation of _blender commands_ (including invocation of python script commands written by users), we can use an =alias= mapping rule:
alias mov grab_selection
This alias means, that everytime we write into command line =mov= and press =enter= the selection will be moved. In fact most users would prefer here =m= or =g=. Another example:
alias space enter alias mouse_button_2 enter
Now, those two seem a little confusing. For sure this is not the default blender behaviour. But this is the default behaviour for AutoCAD, and users of that program will be very happy to use those two aliases. It does following: if the command line is active you could write a _blender command_ then press space or right mouse button to invoke it (note that this is an =alias= rule, and =alias= rules only take effect when command line is active).
I hope this explanation is clear and you get the idea.
3. Overall benefits of Command Line
3.1. Old blender functionality kept
By introducing file =.Bkeymap= describing current blender behaviour the users will not notice any difference. They will work with blender the same way they did before. By pressing keyboard shortcuts.
3.2. Custom keyboard bindings
Users will be able to define custom keyboard mappings (like mapping =m= to =grab=)
3.3. Command Line
Now every command will have a name within blender. For example declare:
alias sn popup_snap_menu
and the user types a command: sn, and voila, snap menu appears! :)
3.4. Easily mappable python scripts
All python scripts written for blender will have a name too. A name which will be treated equally the same way that _blender commands_ are treated. One writes a cool python script which introduces a command called do_this_funny_thing_to_the_texture, then maps this command:
true ctrl-alt-shift-F12 do_this_funny_thing_to_the_texture alias dt do_this_funny_thing_to_the_texture
And voila - now this command feels and works like it was an internal command of blender!
3.5. Blender demos
Launch a blender with an input file that will be feed to command line. Now the user watches as blender does everything step by step.
3.6. Automated blender work
You could work on models without even invoking a GUI, just feed blender with _blender commands_ and enjoy the output! (like thumbnail of a .blend file, or a mandelbrot fractal drawn to the very detail)
4. Current Progress
To see the progress see MailArchive
-- DeveloperWikiJanekKozicki - 29 May 2004