Commit Graph

189 Commits

Author SHA1 Message Date
ca6a8a233b 2.5
Preview renders:

- Added proper button type (BUT_EXTRA) for preview buttons, to
  handle drawing better. It now first draws an alpha mask, to 
  ensure the preview is correctly fitting inside the widget style.
  It then draws the outline.
- Added protection for executing preview renders while regular
  rendering, that's not going to work...
2009-06-08 10:00:14 +00:00
bb06e311a1 added item_enumO() so python menu items can call enum types with string args.
Example sequencer menu
		self.layout.column()
		self.layout.item_enumO("SEQUENCER_OT_effect_strip_add", property='type', value='ADD', text="Effect Strip (Add)")
2009-06-07 14:53:08 +00:00
1c9079d6e1 UI:
* layout.split() now takes a percentage argument to control
  the split position.
* ID template now works for more than just the Text ID type,
  includes and icon, and some other fixes.
2009-06-07 13:20:41 +00:00
a8f69a7f5c UI/RNA:
* Added an icon entry to RNA structs, instead of the UI_GetIconRNA
  function, to keep code together a bit more and make the lookup
  faster.
2009-06-03 23:16:51 +00:00
9ed9acaf9a UI:
* Implemented scale_x/scale_y for layouts.
* Implemented left/right/center/expand alignment for row layouts.
2009-06-03 00:04:48 +00:00
ce334b1cd9 UI: Matt, check space_outliner.c diff to see how to get python
layouts in a header.
2009-05-28 23:58:18 +00:00
46b91bf162 UI:
* Added some properties of uiLayout that can be set. I've added
  some API code for more than the two I've implementeds, so
  ignore those for now.

  * layout.active = False will gray out buttons inside a layout.
  * layout.enabled = False will gray out and completely disable
    the buttons inside a layout.

* Also some function renames.
2009-05-28 23:37:55 +00:00
9cc638fb16 Context:
Added a system for adding a "local" context in a UI layout.
This way you can define for example within a modifier panel
all operators to get the modifier in the context.

In the layout code:

uiLayoutSetContextPointer(layout, "modifier", &ptr)
layout.set_context_pointer("modifier", md)

In the operator:

ptr = CTX_data_pointer_get(C, "modifier")
md = context.modifier
2009-05-28 23:13:42 +00:00
1b1667018e UI:
* Added Constraints template and Add Constraint operator.
* Added toggle=True/False parameter to uiItemR, to get a
  toggle button (actual button) rather than an "option"
  button (checkbox) 
* Added OPTION/OPTIONN button type, to distinguish with
  TOG/TOGN.

RNA:
* Make all modifier pointers editable, including correct updates.
* Added notifiers and updates to constraints.
* Fix a stack corruption, pointed out by Andrea, and potentially
  causing crashes.
2009-05-27 00:03:49 +00:00
94902dac97 2.5 UI: Modifier Template
* template_modifier creates the modifier box, and returns a layout
  to put the buttons in.
* Only the armature modifier is now done with python code, all other
  modifiers use C code. To convert a modifier to python, remove the
  corresponding C code and create a function in DATA_PT_modifiers.
* Some modifiers still require some RNA work to get it working well,
  especially to make pointers editable. Mostly that is a matter of
  defining an own _set callback and put some of the modifier C code
  into it.
* Still various buttons that don't work, like for hooks or mesh
  deform binding.
* Fix for crashing decimate modifier (still disabled).

* Removed UI_BUT_NO_HILITE, HMENU.
* Make uiLayoutBox work with align.
2009-05-21 15:34:09 +00:00
3cc2d61689 UI:
* Hide enable button in horizontal collapsed panels.
* Fix enable button not being in correct position when zooming.
* Fix n-key panels layout being messed up.
2009-05-20 17:18:48 +00:00
40ae17d2f6 UI
* Fix buttons jumping around when resizing and zoom. Part of this was
  adding a tiny a 0.001f offset in UI_view2d_view_ortho, otherwise the
  rounding is unpredictable (used to be 0.375f, but that was disabled).
* Fix various issues with zooming, panning panels.  V2D_LOCKOFS_X/Y is
  now taken into account in more places in the view2d code, to avoid
  zooming into the center or panning out of the view.
* Remove "Free" align mode in buttons window (it's not really useful).

* View3D/Graph/Image editors now use the same PanelType system as the
  buttons window, means some deprecated panel code could be removed.
* Some small visual tweaks for panels.
* View 2D Reset operator (Home key), to reset zoom and panning for panels.

* Added argument to set number buttons as sliders (slider=True for itemR).
* Ignore labels for button alignment (doesn't look right).
* Fix some use of context.main in py scripts, should get data from active
  object instead.
* Fix autotexspace -> auto_texspace in py script.
2009-05-19 17:13:33 +00:00
b4d46e5ded UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.

* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.

* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.

* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).

* Moved some more space variables into Style.
2009-05-15 11:19:59 +00:00
d576ee99ed 2.5
Cleanup of conventions for icon placement in menus.

Old code only allowed 1 icon per menu, forcing to pass on the sublevel
menu icon with exception handling.

Now sublevel icons are drawn automatically, allowing to add an icon
before name too. (Check shift+a menu)
2009-04-30 17:27:30 +00:00
58cdd37f52 UI:
* Made separator item work horizontal & vertical.
* Add colon (:) automatic for int/float/enum/string.
* Added space variables to uiStyle and use them in the
  layout engine.

* Added initial World buttons by Thomas Dinges, thanks!
* Added some code for modifiers in the Object Data context.
  This will become a template though.
* Use a common poll() callback in the scripts to reduce code.
2009-04-27 18:05:58 +00:00
9b82d1474f 2.5
Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
  can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
  reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
  shows the last operator, if appropriate.
  Nkey properties moved to the other side.

A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;

- Buttons now all have a complete set of colors, based on button classifications
  (See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types. 
  Currently colors are defined for Window, Header, List/Channels and
  for Button/Tool views. 
  The screen manager handles this btw, so a TH_BACK will always pick the
  right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
  the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
  Only Panel font, widget font and widget-label work now. The 'group label'
  will be for templates mostly.
  Style settings will be expanded with spacing defaults, label conventions, 
  etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
  Same goes for Panel title color.

Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.
2009-04-27 13:44:11 +00:00
af02a0aa4e UI
* Headers and menus can now be created in python.
* Replaced the uiMenuItem functions to create menus with equivalent
  uiItem functions using a layout, removing duplicated code.
* More uiItem functions are now exposed to python.
* The text editor header, panels and one of its menus are now created
  in space_text.py.
* Buttons window data context icon new changes depending on active
  object.

Issues
* Icons are not wrapped yet, hardcoded ints at the moment.
* The ID browse template is unfinished.
2009-04-22 18:39:44 +00:00
5146540095 changed some {} to {0}, these were causing errors on msvc. also got rid of some spurious prototypes I forgot to get rid off. 2009-04-19 20:09:31 +00:00
f1979f45ec RNA:
* Wrapped HeaderType/Header.
* Some tweaks to get type properties wrapped with less code.
* Made Panel space and region types enum instead of string.
2009-04-19 17:12:16 +00:00
adff6aeb1c RNA: Generic Type Registration
The Python API to define Panels and Operators is based on subclassing,
this makes that system more generic, and based on RNA. Hopefully that
will make it easy to make various parts of Blender more extensible.

* The system simply uses RNA properties and functions and marks them
  with REGISTER to make them part of the type registration process.
  Additionally, the struct must provide a register/unregister callback
  to create/free the PanelType or similar.
* From the python side there were some small changes, mainly that
  registration now goes trough bpy.types.register instead of
  bpy.ui.addPanel.

* Only Panels have been wrapped this way now.  Check rna_ui.c to see
  how this code works. There's still some rough edges and possibilities
  to make it cleaner, though it works without any manual python code.
* Started some docs here:

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNATypeRegistration

* Also changed some RNA_property and RNA_struct functions to not
  require a PointerRNA anymore, where they were not required (which
  is actually the cause of most changed files).
2009-04-19 13:37:59 +00:00
6386186d25 UI:
* Broke loading buttons_scene.py in last commit.
* Fix issue with space not being distributed equally
  in the layout engine.
2009-04-16 21:58:06 +00:00
38b6f8f167 UI:
* For new buttons spaces, automatically set horizontal/vertical
  align depending on size, instead of free.

* Cleaned up the UI panel API. There's now a new uiBeginPanel
  function which takes a panel type, and a uiEndPanel which takes
  the final size. uiNewPanel* functions will be phased out.
* Animate the re-alignment when a panel size changes, e.g. when
  enabling dupliframes.

* Load ui scripts from the release/ folder first if it is
  available. This makes it easier to edit ui scripts, since it
  will directly use the original files which avoids having to
  run the build system.
* Improve editing of panel types while blender is open. That
  means fixing some issues with lacking updates, overlaps, strange
  ordering. It even does an animation now when the panel resizes.
2009-04-16 21:39:45 +00:00
26a8c63eae UI:
* Don't call generic layout hints templates anymore, i.e.
  TemplateRow becomes Row, etc.
* Added more general layout nesting, using uiLayoutSplit()
  and uiLayoutBox() functions, for which the sublayouts
  can then be accessed using uiLayoutSub(), to put items
  in those sublayouts.
* Some steps to make the layout decisions, like which items
  to put in which columns, independent of the width of the
  window or the text in the buttons. We want the layout to
  be stable under resizes and translations.
* Added an "expand" parameter to uiItemR, used now to expand
  enums into a row instead of using a menu.
2009-04-16 12:17:58 +00:00
874c9e8c58 UI:
* Added simple row template to layout buttons
  in a horizontal row, so you don't need to use
  columns for it.
2009-04-15 15:09:36 +00:00
5b3d7bfdf6 2.5
More cleanup!

- removed old UI font completely, including from uiBeginBlock
- emboss hints for uiBlock only have three types now;
  Regular, Pulldown, or "Nothing" (only icon/text)
- removed old font path from Userdef
- removed all old button theme hinting
- removed old "auto block" to merge buttons in groups
  (was only in use for radiosity buttons)

And went over all warnings. One hooray for make giving clean output :)
Well, we need uniform definitions for warnings, so people at least fix
them... here's the real bad bugs I found:

- in mesh code, a call to editmesh mixed *em and *me
- in armature, ED_util.h was not included, so no warnings for wrong call
  to ED_undo_push()
- The extern Py api .h was not included in the bpy_interface.c, showing
  a several calls using different args.

Further just added the missing includes, and removed unused vars.
2009-04-14 15:59:52 +00:00
3ed5e21537 UI:
* Template slots are no longer specified per item, but are
  a state now, set with uiTemplateSlot.
* Some renaming of Layout functions for consistency.
* Fix for roundbox in stack template, now is always behind
  the other buttons.
* Improved python API for layout:
  http://www.pasteall.org/5008/python
2009-04-11 01:52:27 +00:00
a14630c9d3 2.5
Quick hack to enable zoom in buttons window again.
It uses bad old conventions for fixed panel width still, view2d has
to be tweaked for new system. But, it shows layout to work. :)
2009-04-10 17:39:37 +00:00
d2cc19dcc6 2.5
More font style work;

- hooked up almost all ui buttons code to new font
  system, including text clipping
- panel headers scale now too to smaller fonts
- added further style hints, for shadow/emboss. Is all going to
  be in UI designer control!
- for fun; changed layout engine to spread vertical buttons in
  window width

Next: removal of all usage of old font system, using 'styles'.
Will also move font blurring to blenfont module.
2009-04-10 14:06:24 +00:00
654a30aa2d 2.5
- Widgets now draw projected themselves, putting window/region matrix
  on 1:1 pixelspace. This allows zoomable buttons, but crispy.
- Note: text in smaller buttons dont get clipped correct now, WIP
- Fixed error with button types in some  menus.
- removed temp UI_2_50 define hack.
2009-04-07 17:08:26 +00:00
3906a62cc1 2.5: Added basic insert/remove keyframes from UI buttons.
- I key over a button inserts a keyframe.
- Alt+I removes a keyframe.
- With right mouse button a menu with these options pops up.
- Buttons are colored green if the property is animated, yellow
  if it is on a keyframe. I followed the colors from the UI
  mockups, but the flicker on keyframes seems too distracting in
  practice?

- This only works for properties on the ID itself at the moment,
  path callbacks need to be filled in for all structs but mesh
  still.
- It doesn't work when you're over a related label, that needs to
  be made to work.
- I made it insert keyframes outside of any keyingset. Not sure
  how this is supposed to integrate?
2009-04-03 23:30:32 +00:00
f408689e72 2.5
Some more work on UI drawing code, added a generic structure
for how widgets will be defined. It's still a wrapper on top
of old buttons. Docs follow still.

Some visual improvements;

- more button types supported (check render buttons)
- pressed state is shown
- better 'panel' triangle AA, and new divider style

Still a lot of work here. I expect the next days/weeks to
be much more coding too, had to catch up with a lot of other
Blender stuff. There's more (excitement) going on than code. :)
2009-04-02 15:01:11 +00:00
4bb41c3dcd UI: various panels fixes.
* Fix sometimes non-working close/open button.
* Fix panels being a bit out of the view on startup.
* Fix too large totrct region for view2d.
* Fix wrong panel order when changing vertical <-> horizontal.
* Fix wrong panel positions after switching contexts.
* Fix an access of freed memory when collapsing panels.

* Free align mode works again.
* Animations work again.
2009-04-02 01:39:33 +00:00
54ddfe1c48 2.5:
* Fix ANIM button, didn't work and was leaking memory.
* Transform ops: Edition -> Editing.
2009-03-30 18:26:58 +00:00
78a3db7d64 2.5
*******
ported some of the scene buttons to the new system
	- added RNA_SceneRenderData struct to rna
	- added a warning print to uiItemR when it can't find the property
	- what is not there is due to relating entry not being in RNA
	- anim button does not work

Im commiting this so we have much more wider test area then text and object buttons
2009-03-30 08:17:43 +00:00
6705b6f96e UI:
* Added a PanelType and HeaderType for registering panels
  and headers in regions. When the region draws, it will
  then automatically draw the ones that were registerd with
  poll and draw callbacks.

  Used for text header, properties and object buttons now.
2009-03-29 19:44:39 +00:00
d93fd9ffc1 UI:
* Screen level regions created for menus are now a separate
  CTX_wm_menu in the context, so they don't interfere with
  existing regions.
* Fix context in popup menus to always come from the area
  and region the popup was opened from.
* Removed some unused context stuff: tasks and reports.
  The places that were using context reports were using it
  wrong anyway.
* Fix F6 closing immediately after editing a button, by
  making uiBlockSetFlag not clear existing flags anymore.
* Don't use ":" in boolean X/Y/Z buttons.
2009-03-25 20:49:15 +00:00
2e48c4059a 2.5
WIP commit for new system to draw widgets and use themes or styles.

Not really interesting stuff to see in code now, the current 
structure will change quite a lot, this to make it hook up well
to the existing system.

What works quite well is a new full opengl vector method to draw 
scalable and pixel-aligned anti-aliased buttons.

http://download.blender.org/institute/rt3.jpg
http://download.blender.org/institute/rt4.jpg
2009-03-25 16:58:42 +00:00
8b3c2c0762 UI:
* Fix for F6 redo and similar popups closing when moving
  mouse outside of the popup while interacting with buttons.
* Simplify F6 redo popup code by using generated layout.
2009-03-25 14:34:17 +00:00
4c3d64116e 2.5: UI Layout Engine, initial code.
* As a test, used by:
  * Object buttons, tried to make it match the mockup.
  * Text window header.
  * Text window properties panel.
* Panel interaction with view2d is still problematic, need to make
  this work properly still.
* Templates are very basic, the ones there are simple but already
  can follow the object buttons mockup quite closely.
* It's based on a three level system: panels, templates and items.
  To get an idea of what that means in practice, see:

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/UI_LayoutEngine#Panels.2C_Templates_and_Items
2009-03-13 13:38:41 +00:00