Commit Graph

9475 Commits

Author SHA1 Message Date
Brecht Van Lommel
78a1c27c4a Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.

Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
  making it non-blocking. 
* interface_regions: this is a part of interface.c, split off, contains code to
  create regions for tooltips, menus, pupmenu (that one is crashing currently),
  color chooser, basically regions with buttons which is fairly independent of
  core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
  icons yet. Panels should probably become (free floating) regions? 
* text.c: (formerly language.c) for drawing text and translation. this works
  but is using bad globals still and could be cleaned up.

Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
  declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.

Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
  are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
  should be possible while editing a button. That means though that we need
  some sort of persistence even though the blender model is to recreate buttons
  for each redraw. So when a new block is created, some matching happens to
  find out which buttons correspond to buttons in the previously created block,
  and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
  in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
  would integrate here?
* Currently only full window redraws are used, this should become per region
  and maybe per button later.

Operators:
* Events are currently handled through two operators: button activate and menu
  handle. Operators may not be the best way to implement this, since there are
  currently some issues with events being missed, but they can become a special
  handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
  handle all interaction with that button until the button is not activated
  anymore. This means clicking, text editing, number dragging, opening menu
  blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
  non-blocking. That means variables that were previously on the stack, now
  need to be stored away in a struct such that they can be accessed again when
  the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
  needs to be set explicit in order to handle the right events in the right
  state. So an activated button can be in one of these states: init, highlight,
  wait_flash, wait_release, wait_key_event, num_editing, text_editing,
  text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
  from ui_do_but. This makes it possible to continuously apply the button as
  text is being typed for example, and there is an option in the code to enable
  this. Since the code non-blocking and can deal with the button being deleted
  even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
  being edited, since that would mean data is being edited without correct
  updates happening, while some other part of blender may be accessing that
  data in the meantime. So data values, strings, vectors are written to a
  temporary location and only flush in the apply function.

Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
  blocks give a handle to the button that creates it, which will contain the
  results of the menu block once a MESSAGE event is received from that menu
  block.
* For this type of menu block the coordinates used to be in window space. They
  are still created that way and ui_positionblock still works with window
  coordinates, but after that the block and buttons are brought back to region
  coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
  should have enough information with these screen level regions to have full
  control over what gets drawn when and to then do correct compositing.

Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
Brecht Van Lommel
44f94f7927 * Compile fix for RNA + makefiles.
* Fix for bug in collection string lookup function.
2008-11-11 18:28:00 +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
3bb5fc9c7d * RNA: utility function to retrieve strings. It will use a fixed
size buffer if it's big enough, and otherwise allocate memory.
* Added BLI_dynstr_appendf() to construct strings easily in printf
  style, this should make it easier to construct menu strings for
  example.
2008-11-11 15:03:26 +00:00
Nathan Letwory
6eaaf2ce72 === SCons ===
* merge the recent scons changes from trunk, so this means that the same rules now apply:
  - scons-local available
  - platform default configs updated
  - check your user-config.py if you have made a full copy of default config

Note: BGE and blenderplayer still not working, but that is normal ;) (so turn them off!)
2008-11-07 19:21:52 +00:00
Brecht Van Lommel
7e8ba5c84d RNA
* Added more error prints for wrong definitions, for cases that
  would laters cause problems compiling or crash at runtime, and
  also made messages more clear.
* Added some skeleton code for main/ID/mesh/vertex types for testing.
* Added support for automatic arrays as collections using SDNA.

* Changed how pointers to data work. Now they are always wrapped
  in a PointerRNA struct, which contains the data pointer and type,
  and also the data pointer and type of the ID datablock that this
  belongs to, since for example a vertex on it's own may not have
  enough information for some operations, it also needs the mesh.

* Added some code for defining dependencies with RNA, and looking up
  data with paths like: scenes[0].objects["Cube"].data.verts[7].co.
  Note sure either will end up being used, this is experimental.

http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA
2008-11-07 02:58:25 +00:00
Brecht Van Lommel
21a0e55c50 RNA compile error and warning fixes for MSVC. 2008-11-01 00:23:08 +00:00
Brecht Van Lommel
7f24dbe5fc RNA / Data API
This is the first code for the Data API, also known as RNA system in the
2.5 Branch. It does not include a user interface, and only wraps some
Scene properties for testing. It is integrated with Scons and Makefiles,
and compiles a 'makesrna' program that generates an RNA.c file.

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

The changes are quite local, basically adding a makesrna module which
works similar to the makesdna module. The one external change is in
moving genfile.c from blenloader to the makesdna module, so that it can
be reused by the RNA code. This also meant changing the DNA makefiles.
It seems to be doing dependencies correct still in my tests, but if
there is an issue with the DNA not being rebuilt this commit might be
the one causing it. Also it seems for scons the makesdna and makesrna
modules are compiling without warnings. Not a new issue but this should
be fixed.

The RNA code supports all types as defined in the Data API design, so
in that sense it is fairly complete and I hope that aspect will not
have to change much. Some obviously missing parts are context related
code, notify() functions for updates and user defined / ID properties.
2008-10-31 23:50:02 +00:00
Brecht Van Lommel
b589489ef8 2.5 Branch: use themes for drawing the time space, and make
view2d grid code a bit nicer.
2008-10-08 18:07:56 +00:00
Nathan Letwory
9d77cc9222 * use env.Clone() instead of deprecated env.Copy() 2008-10-05 21:36:36 +00:00
Brecht Van Lommel
40fb11efaf 2.5 Branch: added WM_report and WM_reportf functions for reporting
information, warnings and errors.
2008-10-03 18:03:30 +00:00
Campbell Barton
fdb0b003f0 patch from skejoe for gcc 4.3 compatibility 2008-06-24 14:51:02 +00:00
Andrea Weikert
a06f4f3817 == Rip Area into new Window Operator ==
- operator that rips current area into new window
- implemented on the window level.
- sets C->area in current context if necessary
== fix ==
- small bugfix: missing return in WM_event_add_keymap_handler
2008-06-19 19:09:21 +00:00
Brecht Van Lommel
7097c8a51e 2.5 Branch: makefile update for last commit, patch provided by Diego, thanks! 2008-06-11 17:24:27 +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
Andrea Weikert
161d60debf == join areas operator ==
- draw arrow in area that will removed and draw area that will be kept lighter (change from trunk: without arrow)
- not using notifications yet, but uses flag in ScrArea to determine draw type for area. (might be worth discussing)
- experimental: swapping of areas extended a bit, which allows user to choose area a bit more freely
2008-01-21 21:36:02 +00:00
Nathan Letwory
43f680bad8 *remove superfluous glEnd(); - made func internal too. 2008-01-20 21:37:39 +00:00
Nathan Letwory
107b0997e7 * grow AZone size
* remove ^M's
2008-01-20 21:10:55 +00:00
Diego Borghetti
a2074a1522 Changes to the "join area" operator.
This is a patch by Michael Fox (mfoxdogg) that make more
easy join two are, just RMB+Alt in the "origin" area,
drag the mouse to the "target" area and release the mouse.

Note that this is not a "final mouse-bind" for the join
operator, just an easy and simple option for test in 
this early stage of 2.5.

Other note: maybe it's a good idea add azones here ?
2008-01-20 04:39:50 +00:00
Diego Borghetti
0db1aed7e1 More change to the gesture manager.
After check this a little more I make some changes to the
API and now work on the following form:
	WM_gesture_init(C, type);

	while() {
		/* handler event, etc */
		/* if something change. */
		if(need_update) {
			/* update the gesture data and notify about it. */
			WM_gesture_update(C, data);
			WM_event_add_notifier (.. WM_NOTE_GESTURE_CHANGE ..);
		}
	}
	WM_gesture_end(C, type);

Another of the change is that now the gesture data is a link list
in the window struct, so we can have multiples "gestures" (but
of different type) at the same time.

Also take care that the "gesture data" is reusable, that mean that
only alloc it 1 time and use in all the place, that is
why don't support multiple gesture of the same type, but of course
that can be change.
2008-01-19 21:54:33 +00:00
Diego Borghetti
b80049a139 New "Gesture Manager" system.
This is a first implementation of the "gesture manager" system,
the idea is put the WM in a automatic draw mode so we can
implement different "Gesture types" to draw different class
of data (lasso, bound box, etc).

The gesture data is passed through the data field of the notifiers,
i think that we can change this to something like:
	WM_gesture_init(C, data); /* put the data in the context. */

	while() {
		/* send WM_NOTE_GESTURE_CHANGED to update screen */
	}

	/* send event and free the data in the context. */
	WM_gesture_end(C);

Also i add a new operator and event to test the gesture manager.
The new operator is the "border select" function, just press BKEY
in the window and LMB or ESCKEY to exit.
In the case of LMB you can see a print in the console about the
BORDERSELECT event.

All this still need a lot of work, comment are welcome.
2008-01-19 17:54:05 +00:00
Nathan Letwory
d7223cb3aa * clean up ^M
* make default size of action zones smaller (still draw them, but that could be also made optional).
2008-01-17 23:03:37 +00:00
Campbell Barton
4966e63f4f game engine wasnt compiling 2008-01-17 17:15:44 +00:00
Diego Borghetti
2dc143552f Fix uninitited list pointer when duplicate an area. 2008-01-17 16:22:37 +00:00
Nathan Letwory
d72af0a5a9 * First working version of a new split tool for areas.
- LMB+drag from lower left action zone. LMB release confirms
  - RMB or ESC cancel.

TODO:
  - subdiv (drag to center)
2008-01-17 13:50:54 +00:00
Nathan Letwory
e7539ef134 * don't copy azones- these are initiated runtime always. 2008-01-17 08:26:58 +00:00
Nathan Letwory
bd60122a2a * make sure we don't crash on window duplicate, or .B.blend read. There is still a bug with duplicate, but I'm working on it. 2008-01-17 08:21:21 +00:00
Nathan Letwory
0e476af66e * Start ActionZone support for areas. This is bScreen level stuff to be able to do funky stuff.
Right now 2 AZones are defined for each new ScrArea, and mouse over is now detected. Enter ugly triangle.
2008-01-17 05:33:54 +00:00
Nathan Letwory
7e14c5d119 * rearrange screen level drawing code a bit in preparation for tests. 2008-01-16 19:49:34 +00:00
Nathan Letwory
3eca7d1d06 * I gotta remember my mantra for real
"first compile, then commit".

Of course, if compile fails, don't commit.
2008-01-15 23:15:56 +00:00
Nathan Letwory
abc325092f * undutchification of printf's
* remove unnecessary printf's
* clean a bit, some doc strings
2008-01-15 23:08:10 +00:00
Andrea Weikert
da11a3f38e Operators: Join Areas
add split area to screen manager
- RMB+ALT down on area edge activates
- mouse move interactively to area that is to be removed
- LMB to confirm, ESC to cancel
TODO: 
- notifications for interactive drawing to mark area to remove

Some fixes
- uninitialized var warning.
- exit function of operators need to run before modal handler is removed if operator is used there.
- replaced MEM_mallocN with MEM_callocN to get rid of uninitialized mem for wmOperator.
- respect return value of wm_handler_operator_call() and break out of operator handling.
2008-01-15 20:42:00 +00:00
Nathan Letwory
9e9ebfc12c * check for NULL. Could crash if passed parameters were NULL. 2008-01-15 19:28:57 +00:00
Nathan Letwory
6ce20f2968 * add exit app with CTRLKEY+QKEY. 2008-01-15 18:54:38 +00:00
Nathan Letwory
3469906125 * area split:
- prevent a few more cases of Potential Crash.
- tweak moving stuff.
2008-01-15 14:40:43 +00:00
Diego Borghetti
5ed9571ea5 More "data types" for the Operator property system.
Now you can set/get: float, arrays (int and float) and string.

The only special function is OP_get_string, it is special
because return a pointer to the IDProperty data, so you can't
change/resize/free the string.

It's possible "fix" this with:
 1) Return a "const char"
 2) Return a duplicate string

All this new function are not in use yet, but i make a simple test
with the "move areas" operator (add a property of every type and then
print the result in the other size) and work fine, more test are welcome.

Other thing to check is the new OP_free_property function, because this
properties are only local to the operator, i choice free all this in the
"exit callback" of every operator (only move areas have property now), 
so comment about this are welcome too :)

Also add some notes to the WM_api.h file.
2008-01-15 04:49:09 +00:00
Nathan Letwory
8a7558a4fb * fix for crash when mouse cursor changed areas. Not enough was tested, so sometimes we got invalid edges. 2008-01-14 20:57:43 +00:00
Nathan Letwory
c89b96645e Operators: Split Area
This commit adds split area to the window/screen manager.
 - RMB down on area edge activates
 - mouse move interactively moves areas through new edge.
 - RMB up to confirm action
 - ESCKEY or LMB to cancel.

This still crashes in some situations, but I'm on it!
Also will start using new operator property system by bdiego
2008-01-14 20:46:42 +00:00
Diego Borghetti
2a0055401e New API to access Operator properties.
This is a simple API around IDProperty to store properties
in the Operator, it is really simple and this first commit
just add support for IDP_INT data type.

Take care that this "properties" are not save yet and you get
some "Error totblock" more with this.

I add some notes to the WM_api.h file, please check this,
comment and ideas are welcome.
2008-01-14 19:44:20 +00:00
Nicholas Bishop
49eb7a3eed Applied a couple sculpt/multires fixes from trunk to blender2.5. 2008-01-12 22:06:42 +00:00
Kent Mein
69f004f90d Reverting changes made yesterday to Makefile... (Its really messed up,
Going to do it over again from scratch)

Kent
2008-01-11 16:56:00 +00:00
Chris Want
6258c0979e The python lib name should be 'bf_python' instead of 'blender_python'
when linking.
2008-01-11 16:48:07 +00:00
Kent Mein
c562fdf095 Fixed typo from merge yesterday.
Kent
2008-01-11 14:15:59 +00:00
Kent Mein
6167882776 Cleaned up some things, more work to do here but its a little simpler now.
Kent
2008-01-10 19:53:57 +00:00
Kent Mein
ec4c6154fe Change vector structs from 3 to 4 so things are aligned for 64bit machines.
Kent
2008-01-10 19:22:58 +00:00
Ton Roosendaal
11ab3d7598 Add more memory clearing on file read for WindowManager. 2008-01-10 18:56:24 +00:00
Ton Roosendaal
42e2b4edde Two fixes in 2.5 branch:
- crash on start because of unitialized pointer
- Makefile had the python lib on weird location... I prefer all 
  blender/source/blender/ libs together on 1 place? The Make needs
  cleaning... it assumes publisher stuff. :)
2008-01-10 18:13:34 +00:00
Ton Roosendaal
43cf3af8c0 Blender 2.5 project: added first more complex handler + operator
- on mouse-over edge, you can drag area borders around.
- note it's a handerized system now, so it updates UI while you
  move mouse.

Feedback needed:

- read bottom part of the screen_edit.c file. It's the proposed
  method for adding tools and handlers. I think it's close, but
  might need some tweaks.
2008-01-10 17:38:17 +00:00
Nathan Letwory
b81b6be184 * fix linking order for bf_python 2008-01-09 23:07:34 +00:00
Andrea Weikert
ce975c1027 update to cmake files
- added python library
- small fix for ignored runtime library, needed for linking debug here
Note: still some problems linking with openexr in debug
2008-01-09 18:48:04 +00:00