Commit Graph

24 Commits

Author SHA1 Message Date
Campbell Barton 9b75187c55 initialize keymaps after python so python keymaps, solves the problem of keymaps complaining about python operators not existing, but at the expense of some annoying init flags/functions. :/
Brecht/Ton you may want to check that C->data.py_init is a good place to store this.
2009-07-18 19:40:26 +00:00
Campbell Barton 2f74b5a260 Console Space Type
* interactive console python console.
* display reports and filter types. defaults to operator display so you can see the python commands for tools as you use them,
  eventually it should be possible to select commands and make macto/tools from them.

Example use of autocomp.  b<tab>, bpy.<tab>, bpy.<tab>, bpy.data.<tab> etc.

basic instructions are printed when opening the console.

Details...
* Console exec and autocomp are done with operators written in python.
* added CTX_wm_reports() to get the global report list.
* The window manager had a report ListBase but reports have their own struct, switched to allocate and assign when initializing the WM since the type is not available in DNA.
* changed report types flags for easier display filtering.
* added report type RPT_OPERATOR
* logging operators also adds a python-syntax report into CTX_wm_reports() so they can be displayed in the console as well as calling a notifier for console to redraw.
* RnaAPI context.area.tag_redraw() to redraw the current area from a python operator.

Todo...
* better interactions with the console, scrolling, copy/paste.
* the text displayed doesnt load back.
* colors need to be themed.
* scroll limit needs to be a user pref.
* only tested with cmake and scons.
2009-07-16 00:50:27 +00:00
Campbell Barton 8a1caaed32 Object mode select grouped operator (Shift+G and Select manu)
Group option currently doesnt handle multiple groups.

Set makefiles python version to 2.6 for linux since its common now.
2009-07-11 11:31:49 +00:00
Brecht Van Lommel 242d9c31d3 RNA
* RNA_struct_name_get_alloc function to get the name from a
  pointer, instead of having to deal with name property.
* CTX_data_pointer_get_type to get data from context with
  a check for the RNA type.
2009-06-24 14:03:55 +00:00
Brecht Van Lommel ad07fc19c0 Context
Python dir(context) now gives the items from the data context
too, modified context callbacks to also return a list of items
in the context.
2009-06-20 14:55:28 +00:00
Brecht Van Lommel 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
Brecht Van Lommel 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
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
Brecht Van Lommel 6cc89b9d4e 2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:

* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
  the text editor. It's Bitstream Vera Sans Mono. This is the
  default gnome terminal font, but it doesn't fit entirely well
  with the other font I think, can be changed easily of course.

* Clipboard copy/cut/paste now always uses the system clipboard,
  the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
  as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
  windowmanager code.

* Find panel is now a kind of second header, instead of a panel.
  This needs especially a way to start editing the text field
  immediately on open still.

* Operators are independent of the actual space when possible,
  was a bit of puzzling but got it solved nice with notifiers,
  and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.

* Operators:
    * New, Open, Reload, Save, Save As, Make Internal
    * Run Script, Refresh Pyconstraints
    * Copy, Cut, Paste
    * Convert Whitespace, Uncomment, Comment, Indent, Unindent
    * Line Break, Insert
    * Next Marker, Previous Marker, Clear All Markers, Mark All
    * Select Line, Select All
    * Jump, Move, Move Select, Delete, Toggle Overwrite
	* Scroll, Scroll Bar, Set Cursor, Line Number
    * Find and Replace, Find, Replace, Find Set Selected,
	  Replace Set Selected
    * To 3D Object
    * Resolve Conflict
2009-02-28 23:33:35 +00:00
Joshua Leung d875386b06 2.5 Bugfixes:
* Removed unnecessary define for context loop (editable posechannels)

* Fixed crash in animation-channel filtering - missing check for no world animation.
2009-02-14 07:52:25 +00:00
Joshua Leung f3fac33688 2.5 - Adding context iterators for visible/editable (selection is irrelevant) for bones and pose-channels.
I'm not totally sure that these are needed, though it does make some tools simpler.
2009-02-14 07:27:12 +00:00
Joshua Leung 0a3697ccf7 2.5 - Bugfixes for Pose 'Clear' Operators
* Fixed context iterators for PoseChannels. The actual selection test was missing (but layer visibility was getting checked). Also added check for hidden bones here too.

* Removed unnecessary defines added by mfoxdogg in BKE_context.h

* Removed the old hacks in 'Clear ...' operators for ensuring that object animation (ipos/actions) don't overwrite poses. These are no longer necessary, since normal animation calculation is only done in a separate step on frame-changes now.
* Removed the manual checks for layer visibility from 'Clear ...' operators, since that's taken care of by context iterators.
2009-02-05 05:51:21 +00:00
Michael Fox 6947624afa 2.5
*******
-ported clear loc,rot,scale operators to pose mode operators
	- for some reason when animated and you clear anything, the whole aramture clears. somthing to do with the depsgraph stuff that was directly ported  from clear armature()
2009-02-05 05:13:08 +00:00
Joshua Leung f89e3d2517 2.5 - Context API access for Bones (EditMode and PoseMode)
* Added selected, selected+editable, and active to access EditBones for Armature Operators to use. These take into account X-Axis Mirror too, so there is really no need to check that sort of thing anymore in tools. 

* Added a quick testing operator for verifying that these loops filter the data correctly. I've dumped this in armature_ops.c for now. It can be activated using the TKEY hotkey in Armature EditMode only. This should be removed once we have a few more functional tools.

* Ported over cleaned up roll-calculation tools from AnimSys2
* Removed a few ugly stubs from posemode code
2009-02-05 03:28:07 +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 a6edbba8ec 2.5
- Added shift+d duplicate for object and editmode mesh.
  Note it uses WM_operator_name_call(), which is fine now,
  but in future might put again 2 undo's and operators on
  the stack. 
  Will have to spend some time on how Macros will work!

- added itterator CTX_selected_editable_objects()
  (named it first "edible" but that was too funny!)
  Also cleaned object_edit.c to use this correctly.

- added CTX_wm_view3d(), especially for hybrid tools
  that *can* use view3d, but don't have to.
  
- moved debug -d print for operators to the real invoke call
2009-01-17 18:35:33 +00:00
Brecht Van Lommel 9bcdb4b758 2.5: various warning fixes. 2009-01-17 00:51:42 +00:00
Brecht Van Lommel 52135dd4fa 2.5: Space Image ported back
Organized as follows:

uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack

space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons

Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.

* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.

* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.

* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
2009-01-15 04:38:18 +00:00
Nathan Letwory bdf6a002aa 2.5 / Nodes
* add Context accessor for selected nodes
* node translation uses transform code
* put transform defines in an enum (mode and numinput flags)
2009-01-02 23:58:03 +00:00
Ton Roosendaal c9b60a7b64 2.5
So, editmode mesh is back! :)
At the moment only TABkey works and mouse select, 1 vertex at a
time. More will follow of course.

Note for the devs:
- G.editMesh has been removed, be careful with old code.
- EditMesh now is property of Mesh itself
  Although it means unlimited editmodes, for migration purposes we
  better stick to 1 "obedit" per scene, which is in Context too
- G.obedit will get removed soon, so use CTX_data_edit_object(C)
  Or if you can't, just scene->obedit for now
- Also removed the CTX_data_edit_mesh(), this has no meaning 
  anymore. EditMesh is not context senstitive anymore, only the
  edit-object for time being is.
- Martin: I've already tucked some EditMesh pointer in T and
  removed all G.editMesh there.
2008-12-31 17:11:42 +00:00
Ton Roosendaal 9b2dec9631 2.5
Recode of 'select all objects by type' to show
how to use itterators.
2008-12-28 18:10:24 +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
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