Commit Graph

31 Commits

Author SHA1 Message Date
Brecht Van Lommel f10541f7cf UI
* Added option for panel to be closed by default.
* Added support for RNA property and enum icons in buttons.
* Remove some deprecated RNA menu code.
* Fix issue with newly created panels not being inserted in the
  right place.
* Fix issue with 3-split layout not being divided correctly.
* FIx issue with menu items not drawing correct using python UI.
2009-06-16 01:08:39 +00:00
Brecht Van Lommel 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
Brecht Van Lommel 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
Brecht Van Lommel 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
Brecht Van Lommel 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
Brecht Van Lommel 25d0720dc4 2.5:
* Fix to make python panels callbacks get the actual
  blender Panel as an argument, instead of any instance.
* Fix for callback validation in python 2.5, worked OK
  in python 3.0 but gave error in 2.5 because it's a
  method instead of a function there.
2009-04-08 18:45:41 +00:00
Brecht Van Lommel 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
Brecht Van Lommel 1b94cb752c Context
* Made it based on string lookups rather than fixed enum, to make
  it extensible by python scripts.
* Context callbacks now also have to specify RNA type when returning
  pointers or collections. For non-RNA wrapped data, UnknownType can
  be used.
* RNA wrapped context. The WM entries are fixed, for data context
  only main and scene are defined properties. Other data entries have
  to be dynamically looked up.
* I've added some special code in python for the dynamic context
  lookups. Tried to hide it behind RNA but didn't find a clean way to
  do it yet. Still unused/untested.

* Also minor fix for warning about propertional edit property in
  transform code, and fix for usage of operator poll with checking if
  it was NULL.
2009-03-19 19:03:38 +00:00
Nathan Letwory c8583cac70 2.5 / Area management
* Add Area Swap: hold alt and drag with LMB from either actionzone. Release LMB on area you want to swap with. I added a matching cute cursor for this (and to make it a politically delicate issue, it's white on black).
  Note, there are still some error totblocks that I haven't been able to track down properly yet, so that's still a bit WIP.
2009-03-11 20:22:06 +00:00
Brecht Van Lommel 128c8167af 2.5: Fix for windows editmode tab crashes. This was due to
use of function pointers in the context callbacks. Apparently
MSVC decides that some of these functions are the same and
makes them into a single function with the same address. I
couldn't figure out if this was a compiler bug or according
to the C spec. Regardless, that means this method can't be
used, so now it uses separate CTX_DATA_DEFINES.
2009-01-30 16:45:25 +00:00
Ton Roosendaal bc63213844 2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:

- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes

Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).

To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.

Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.

Bugfix in transform: quat initialize in operator-invoke missed
one zero.

Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
Ton Roosendaal 2fe5005bbb 2.5
New: Custom region draw callbacks.

For Martin: an example is now in space_view3d/view3d_edit.c
On middlemouse rotate view, it draws a small square in center.

It works likes this:

#include "ED_space_api.h"

handle= ED_region_draw_cb_activate(region->type, drawfunc, type)

and to stop it:

ED_region_draw_cb_exit(region->type, handle)

drawfunc is of type (const bContext *C, ARegion *ar)
currently it gets called only as type REGION_DRAW_POST, later we
can add more (PRE, POST_XRAY, POST_2D, etc).

For correct usage, these calls should return leaving view transform
unaltered.
2009-01-09 15:04:52 +00:00
Ton Roosendaal df6caaed1e 2.5
Small cleanup in region-based cursor handling. 
- callback was in spacetype, now in regiontype
- made screen listener catch ND_MODE notifier and 
  call the active region cursor callback, if it's there.
2009-01-04 19:17:34 +00:00
Ton Roosendaal 3aeb63cad2 2.5
WM: added area-listener, which can be used to tag refreshes for
either the drawing call, or use the new ED_area_tag_refresh() 
function which will automatically call, after all notifiers
were handled, an the spacetype->refresh() you provided.

Added for Joshua, after reviewing Action/Dopesheet requirements.

Joshua: I've made two dummy functions in space_action.c:
- action_listener()
- action_refresh()

Wich now does a printf on activating a new object.
2009-01-04 17:45:54 +00:00
Brecht Van Lommel 76c035bd11 2.5: Data Context
* Worked out data context implementation more, now with initial context
  callbacks implemented for the screen and 3d view.
* For collections, switch from iterators to simpler ListBase. Though that still
  means it uses LinkData* rather than the actual Object* for example, since
  those can only be part of one list. So I added a macro as well to make
  iteration easier when possible.

CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
	printf("object name: %s\n", ob->id.name);
}
CTX_DATA_END;
2008-12-23 02:07:13 +00:00
Ton Roosendaal bac4d10174 2.5
Small area/space api fix: space->new() callbacks now require
Context pointer. Too many cases you want to initialize stuff...

Also: added dummy draw function for NLA channel region, was
too ugly.
2008-12-22 10:09:56 +00:00
Brecht Van Lommel ecc4e55b66 2.5
Context API

This adds the context API as described here. The main practical change
now is that C is not longer directly accessible but has to be accessed
through accessor functions. This basically adds the implementation of
the API and adaption of existing code with some minor changes. The next
task of course is to actually use this design to cleanup of bad level
calls and global access, in blenkernel, blenloader.

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

Error, Warning and Debug Info Reporting

This adds the error reporting API as described here. It should help
clean up error() calls in non-ui code, but eventually can become used
for gathering messages for a console window, and throwing exceptions
in python scripts when an error happens executing something.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Reports
2008-12-18 02:56:48 +00:00
Ton Roosendaal a16df53619 2.5
Mouse cursors now work again

- centralized screen-level cursor changes, no more operator
  running for it.
- spacetypes have callback to check/set individual cursor
  types. Use notifier SCREEN_CHANGED to make sure it works
  on mode changes etc.
- new calls WM_cursor_modal() and WM_cursor_restore() to
  make temporarily cursor types during modes.
- used above for view2d cursors.
2008-12-15 16:54:47 +00:00
Ton Roosendaal 131fa2e00c 2.5
Fix for crash on joining (previously splitted) areas.
Reason was the stored regions in pushed 'spaces' not being copied.

next: free running handlers on area join/split.
2008-12-14 17:25:46 +00:00
Ton Roosendaal 54c4ed469a 2.5
Cleanup in area/region management

- more intelligence in area management for adding handlers and setting
  data correct. Space/Region type callbacks only have to do own things.

- added option for adding default handlers to areas/regions. (flag in
  type definition)

- ensured that region-types store the minsizes for regions.

- added boundbox check for handlers; note that it accepts pointer to
  boundbox, because handlers don't get reset on area-resizing or
  view changes. Example: view2d handlers use mask rect.

- handlers get now added on correct context levels (example frame change
  also worked in header)

- removed ->refresh() callback. Context refreshing is Listener.
  
- the ->init() is being called on all WM level actions, also after a
  file read, moving areas, re-opening areas etc. 

- fixed bug: crash on exit was caused by cleaning up Screen too late.

- UI_view2d_size_update() removed from draw callback, is init()

- regions now store (winx, winy) subwindow size.
2008-12-10 13:56:54 +00:00
Ton Roosendaal 02e23c16dd 2.5
Part one of wrapping up area/region management.
Read design doc here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/AreaManager

This commit:
- brings keymap storage to WM, based on names/types. This structure
  allows rna-ifying it too, so you can browse keymaps etc.
- creating areas and regions works slightly different now, wich
  regiontypes stored in areatype.

Todo:
- better callbacks and structure for defining which handlers need to
  be added.
- using region types to validate regions
- proper implementation of local region data
- code method for customizing keymaps. Current idea is that you have
  to indicate an entire keymap to be custom, to prevent too complicated
  merging problems of default and custom maps (like order, multiple keys
  for same operator, disabling options, etc).
2008-12-08 15:02:57 +00:00
Brecht Van Lommel bdfe7d89e2 Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416

Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
  later added in trunk also, but reverted partially, specifically revision
  16683. I have left out this reversion in the 2.5 branch since I think it is
  needed there.
  http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
  for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
  -W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
  differently. Since this is changed so much, and I don't think those fixes
  would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
  initialized when running with -P. The code that initializes the screen there
  I had to disable, that can't work in 2.5 anymore but left it commented as a
  reminder.

Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.

Still to be done:
* Go over files and functions that were moved to a different location but could
  still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
Brecht Van Lommel 4a4b0732e5 Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
  create one timer per window, this replaces that with a way to let operators
  or other handlers add/remove their own timers as needed. This is currently
  delivered as an event with the timer handle, perhaps this should be a notifier
  instead? Also includes some fixes in ghost for timer events that were not
  delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
  operator. This is used in the UI code to communicate the results of opened
  blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
  operator or handler, so there were exceptions added for this, which is one
  of the reasons they might work better as notifiers, but currently these
  things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
  not.

* Added a free() callback for area regions, and added a free function for
  area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
  and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
  last created region on top. These are useful for tooltips, menus, etc, and
  are not saved to file. It's using the same ARegion struct as areas to avoid
  code duplication, but perhaps that should be renamed then. Note that redraws
  currently go correct, because only full window redraws are used, for partial
  redraws without any frontbuffer drawing, the window manager needs to get
  support for compositing subwindows.

* Minor changes in the subwindow code to retrieve the matrix, and moved
  setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
  with modal_handler.

* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
  created in. This means for example that when a transform operator is invoked
  from a region but registers a handler at the window level (since mouse motion
  across areas should work), it will still get removed when the region is closed
  while the operator is running.
2008-11-11 15:18:21 +00:00
Brecht Van Lommel a019f1d3d6 2.5 Branch
==========

* Changed wmOperatorType, removing init/exit callbacks and adding cancel
  callback, removed default storage in favor of properties. Defined return
  values for exec/invoke/modal/cancel.
* Don't allocate operator on the stack, and removed operator copy for
  handlers. Now it frees based on return values from callbacks, and just
  keeps a wmOperator on the heap. Also it now registers after the operator
  is fully finished, to get the correct final properties.
* Changed OP_get_* functions to return 1 if the property is found and 0
  otherwise, gives more readable code in my opinion. Added OP_verify_*
  functions to quickly check if the property is available and set if it's
  not, that's common for exec/invoke.
* Removed WM_operatortypelist_append in favor of WM_operatortype_append
  which takes a function pointer instead of a list, avoids macro's and
  duplicating code.
* Fix a crash where the handler would still be used while it was freed by
  the operator.

* Spacetypes now have operatortypes() and keymap() callbacks to abstract
  them a bit more.
* Renamed C->curarea to C->area for consistency. Removed View3D/View2D/
  SpaceIpo from bContext, seems bad to keep these.
* Set context variables like window/screen/area/region to NULL again when
  leaving that context, instead of leaving the pointers there.

* Added if(G.f & G_DEBUG) for many of the prints, makes output a bit
  cleaner and easier to debug.
* Fixed priority of the editors/interface module in scons, would otherwise
  give link errors.

* Added start of generic view2d api.
* Added space_time with some basic drawing and a single operator to change
  the frame.
2008-06-11 10:10:31 +00:00
Chris Want 5d0a207ecb Patch from GSR that a) fixes a whole bunch of GPL/BL license
blocks that were previously missed; and b) greatly increase my
ohloh stats!
2008-04-16 22:40:48 +00:00
Chris Want 5e3cffc64a Patch to change license to GPL only, from GSR. 2008-01-07 19:13:47 +00:00
Ton Roosendaal 1363134dee Whole lot of changes.... here a shortlist:
- removed editors/area and put this all in screen
- added first python calls (note, a new c file for scriptlinks)
- added view3d editor callbacks (no drawing yet)
- added files in editors/interface

(Cmake and Scons has to be fixed, help welcome!)

- now areas/headers are being converted on file read
- note: previously saved 2.50 files will crash!!! (.B.blend)
- area regions are being drawn, first handler for cursor added (on edge)
- window duplicate and scale works correct for screen subdiv

Todos for me:

- need to fix things in syntax (function names) a bit still
- more operators for screen
- define how Context will work... still unresolved when it gets set
- docs!

Reviews of code structure is welcome!
There are also more todos now for others, but it can wait a couple of days
2008-01-07 18:03:41 +00:00
Kent Mein f1c4f705a1 Removed the config.h thing from the .h's in the source dir.
So we should be all set now :)

Kent
--
mein@cs.umn.edu
2002-12-27 13:11:01 +00:00
Kent Mein b9a19f1ea7 Did all of the .h's in source
(adding)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

also the Makefile.in's were from previous patch adding
the system depend stuff to configure.ac

Kent
--
mein@cs.umn.edu
2002-11-25 11:16:17 +00:00
Kent Mein 01bff70383 fixed spacing in the headers to get rid of some warnings and some other
little minor spacing issues.
2002-10-30 02:07:20 +00:00
Hans Lambermont 12315f4d0e Initial revision 2002-10-12 11:37:38 +00:00