Age | Commit message (Collapse) | Author |
|
This means you can for example, uv unwrap in quad-view and change settings in the toolbar without defaulting back to the first quad-view region available.
This may be displayed to the user later, for now this is set on executing registrable operators.
|
|
from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
|
|
|
|
in particular.
For an detailed user-level description of new features see the following blogpost:
http://code.blender.org/index.php/2012/05/node-editing-tweaks/
TL;DR:
* Frame node gets more usable bounding-box behavior
* Node resizing has helpful mouse cursor indicators and works on all borders
* Node selection/active colors are themeable independently
* Customizable background colors for nodes (useful for frames visual
distinction).
|
|
|
|
|
|
|
|
without the underscores these clogged up the namespace for autocompleation which was annoying.
|
|
tooltip, since menus are used as buttons too.
|
|
was being done with static functions that were copied about.
|
|
http://markmail.org/message/fp7ozcywxum3ar7n
|
|
isn't inlined all over.
|
|
When rendering, during processing scene data, drawing in 3d window
is now locked. Can get extended to more areas in UI easily.
At least this solves all crashes with conflicting memory access in
render && 3d drawing. Deleting objects via operators or delete
modifiers isn't locked yet.
Also fixed: crash on quitting a renderwindow when it was rendering.
|
|
|
|
scene/view functions from view3d_view.c into BKE_screen since they need to be accessed when changing cameras from outside the view.
|
|
|
|
|
|
This commit adds a few more execution contexts for operators, given the increasing tendency for some special regiontypes to exist within areas that must have their own set of special operators.
Examples of these include the "channel" operators in the Animation Editors (i.e. those in the 'Channels' menu), and the "Fit to Preview Window" operator for the Sequencer.
Previously, operators such as these would not function when clicked on from the menus, and they would not show the hotkeys they were mapped to.
Also, fixed a few operator definitions in the Animation Editors which were missing ot->prop defines. This meant that some hotkeys (mainly selection) were shown incorrectly in the menus.
|
|
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
|
|
animated its over 4x faster.
* utility function BLI_findstring to avoid listbase lookup loops everywhere.
eg:
ListBase *lb= objects= &CTX_data_main(C)->object;
Object *ob= BLI_findstring(lb, name, offsetof(ID, name) + 2);
* made some more math functions use const's, (fix warnings I made in previous commits)
|
|
allowed,
for panels it would fail silently but for menu's it meant further references would give errors.
increase the registered class name from 32 to 64 and raise an error if the limit reached.
|
|
from screen.
|
|
3D add menu can be shared.
|
|
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
|
|
This calls a registered menu as a popup so we can reuse header menus , currently used for Node editor and Sequencer add menu (Shift+A), can be used for toolbox too.
|
|
* Move function to compute visible screen layers to BKE.
* Use this now in the depsgraph, was still using this all layers
to flush. Still missing a way to get the current scene in
background mode..
* Also two more function to not require a scene pointer anymore:
* DAG_object_update_flags is now DAG_id_update_flags.
* DAG_ids_flush_update is now available next to DAG_scene_flush_update.
|
|
* ID blocks can now get RNA properties defined from python, e.g.:
bpy.types.Scene.BoolProperty(..)
* RNA structs/functions/properties can now get pointers duplicated
(mostly strings), since we can't point to some static string then.
* Added ExtensionRNA struct to add into *Type structs for subclassing,
is a bit more compact than defining the 4 variables each time.
Only disadvantage is it requires including RNA in more places.
|
|
* Added suppport for generating code without verifying with DNA,
this doesn't give good errors and is more error prone, but makes
it easier to wrap things like EditBone which are not in DNA.
* RNA_define_verify_sdna(0), and set to 1 again afterwards.
|
|
More toolbar functionality for workflow review.
- Split the region in two parts, bottom has the Tool Properties, the
top part shows 2 panels, one for python defined tools, other for a
"tool shelf" which (later) will get saved in files.
- Added a full context driven framework for this toolbar, showing
the tools depending on 3D window 'mode'. Both python defined tools
as the shelf respect this. So - for example - you will see different
tools in editmode mesh, as in vertex paint mode, etc.
- First template for the python tools will be committed after this commit;
it has placeholder tools to just show/test functioning.
NOTE: if you had saved a layout that shows tools region, open/close it
once to get the new region created for properties.
TODO:
- Moving paint properties to tool settings
- Test a layout with horizontal toolbar (without properties)
- Bring back floating panels, and put tool-properties here. (as option)
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* Wrapped HeaderType/Header.
* Some tweaks to get type properties wrapped with less code.
* Made Panel space and region types enum instead of string.
|
|
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).
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
* 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
* 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;
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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).
|