[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17411] branches/blender2.5/blender/source /blender:

Brecht Van Lommel brecht at blender.org
Tue Nov 11 19:31:32 CET 2008


Revision: 17411
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17411
Author:   blendix
Date:     2008-11-11 19:31:32 +0100 (Tue, 11 Nov 2008)

Log Message:
-----------

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.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/include/BIF_interface_icons.h
    branches/blender2.5/blender/source/blender/editors/include/BIF_resources.h
    branches/blender2.5/blender/source/blender/editors/include/BIF_view2d.h
    branches/blender2.5/blender/source/blender/editors/include/ED_interface.h
    branches/blender2.5/blender/source/blender/editors/interface/Makefile
    branches/blender2.5/blender/source/blender/editors/interface/SConscript
    branches/blender2.5/blender/source/blender/editors/interface/resources.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d.c
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/screen/spacetypes.c
    branches/blender2.5/blender/source/blender/editors/screen/stubs.c
    branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_ops.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_windowmanager_types.h
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_init_exit.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/include/ED_datafiles.h
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/include/UI_resources.h
    branches/blender2.5/blender/source/blender/editors/include/UI_text.h
    branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/interface/interface.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_ops.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    branches/blender2.5/blender/source/blender/editors/interface/text.c

Modified: branches/blender2.5/blender/source/blender/editors/include/BIF_interface_icons.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/BIF_interface_icons.h	2008-11-11 18:28:00 UTC (rev 17410)
+++ branches/blender2.5/blender/source/blender/editors/include/BIF_interface_icons.h	2008-11-11 18:31:32 UTC (rev 17411)
@@ -1,72 +0,0 @@
-/**
- * $Id: BIF_interface_icons.h 11920 2007-09-02 17:25:03Z elubie $
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- * 
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BIF_PREVIEW_ICONS_H
-#define BIF_PREVIEW_ICONS_H
-
-struct Image;
-struct ImBuf;
-struct World;
-struct Tex;
-struct Lamp;
-struct Material;
-
-typedef struct IconFile {
-	struct IconFile *next, *prev;
-	char filename[80];	// FILE_MAXFILE size
-	int index;
-} IconFile;
-
-
-#define ICON_DEFAULT_HEIGHT 16
-#define PREVIEW_DEFAULT_HEIGHT 96
-
-/*
- Resizable Icons for Blender
-*/
-void BIF_icons_init(int first_dyn_id);
-int BIF_icon_get_width(int icon_id);
-int BIF_icon_get_height(int icon_id);
-
-void BIF_icon_draw(float x, float y, int icon_id);
-void BIF_icon_draw_preview(float x, float y, int icon_id, int nocreate);
-
-void BIF_icon_draw_aspect(float x, float y, int icon_id, float aspect);
-void BIF_icon_draw_aspect_blended(float x, float y, int icon_id, float aspect, int shade);
-void BIF_icons_free();
-void BIF_icons_free_drawinfo(void *drawinfo);
-
-struct ListBase *BIF_iconfile_list(void);
-int BIF_iconfile_get_index(char *filename);
-
-
-#endif /*  BIF_ICONS_H */

Modified: branches/blender2.5/blender/source/blender/editors/include/BIF_resources.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/BIF_resources.h	2008-11-11 18:28:00 UTC (rev 17410)
+++ branches/blender2.5/blender/source/blender/editors/include/BIF_resources.h	2008-11-11 18:31:32 UTC (rev 17411)
@@ -1,600 +0,0 @@
-/**
- * $Id: BIF_resources.h 13057 2007-12-30 12:08:28Z aligorith $
- *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- * 
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
- */
-
-#ifndef BIF_RESOURCES_H
-#define BIF_RESOURCES_H
-
-/* elubie: TODO: move the typedef for icons to BIF_interface_icons.h */
-/* and add/replace include of BIF_resources.h by BIF_interface_icons.h */
-typedef enum {
-#define BIFICONID_FIRST		(ICON_VIEW3D)
-	ICON_VIEW3D,
-	ICON_IPO,
-	ICON_OOPS,
-	ICON_BUTS,
-	ICON_FILESEL,
-	ICON_IMAGE_COL,
-	ICON_INFO,
-	ICON_SEQUENCE,
-	ICON_TEXT,
-	ICON_IMASEL,
-	ICON_SOUND,
-	ICON_ACTION,
-	ICON_NLA,
-	ICON_SCRIPTWIN,
-	ICON_TIME,
-	ICON_NODE,
-	ICON_SPACE2,
-	ICON_SPACE3,
-	ICON_SPACE4,
-	ICON_TRIA_LEFT,
-	ICON_TRIA_UP,
-	ICON_FONTPREVIEW,
-	ICON_BLANK4,
-	ICON_BLANK5,
-	ICON_BLANK6,
-	
-	ICON_ORTHO,
-	ICON_PERSP,
-	ICON_CAMERA,
-	ICON_PARTICLES,
-	ICON_BBOX,
-	ICON_WIRE,
-	ICON_SOLID,
-	ICON_SMOOTH,
-	ICON_POTATO,
-	ICON_MARKER_HLT,
-	ICON_PMARKER_ACT,
-	ICON_PMARKER_SEL,
-	ICON_PMARKER,
-	ICON_VIEWZOOM,
-	ICON_SORTALPHA,
-	ICON_SORTTIME,
-	ICON_SORTSIZE,
-	ICON_LONGDISPLAY,
-	ICON_SHORTDISPLAY,
-	ICON_TRIA_DOWN,
-	ICON_TRIA_RIGHT,
-	ICON_BLANK7,
-	ICON_BLANK8,
-	ICON_BLANK9,
-	ICON_BLANK10,
-
-	ICON_VIEW_AXIS_ALL,
-	ICON_VIEW_AXIS_NONE,
-	ICON_VIEW_AXIS_NONE2,
-	ICON_VIEW_AXIS_TOP,
-	ICON_VIEW_AXIS_FRONT,
-	ICON_VIEW_AXIS_SIDE,
-	ICON_POSE_DEHLT,
-	ICON_POSE_HLT,
-	ICON_BORDERMOVE,
-	ICON_MAYBE_ITS_A_LASSO,
-	ICON_BLANK1,	/* ATTENTION, someone decided to use this throughout blender
-	                   and didn't care to neither rename it nor update the PNG */
-	ICON_VERSE,
-	ICON_MOD_BOOLEAN,
-	ICON_ARMATURE,
-	ICON_PAUSE,
-	ICON_ALIGN,
-	ICON_REC,
-	ICON_PLAY,
-	ICON_FF,
-	ICON_REW,
-	ICON_PYTHON,
-	ICON_BLANK11,
-	ICON_BLANK12,
-	ICON_BLANK13,
-	ICON_BLANK14,
-
-	
-	ICON_DOTSUP,
-	ICON_DOTSDOWN,
-	ICON_MENU_PANEL,
-	ICON_AXIS_SIDE,
-	ICON_AXIS_FRONT,
-	ICON_AXIS_TOP,
-	ICON_STICKY_UVS_LOC,
-	ICON_STICKY_UVS_DISABLE,
-	ICON_STICKY_UVS_VERT,
-	ICON_PREV_KEYFRAME,
-	ICON_NEXT_KEYFRAME,
-	ICON_ENVMAP,
-	ICON_TRANSP_HLT,
-	ICON_TRANSP_DEHLT,
-	ICON_CIRCLE_DEHLT,
-	ICON_CIRCLE_HLT,
-	ICON_TPAINT_DEHLT,
-	ICON_TPAINT_HLT,
-	ICON_WPAINT_DEHLT,
-	ICON_WPAINT_HLT,
-	ICON_MARKER,
-	ICON_BLANK15,
-	ICON_BLANK16,
-	ICON_BLANK17,
-	ICON_BLANK18,
-	
-	ICON_X,
-	ICON_GO_LEFT,
-	ICON_NO_GO_LEFT,
-	ICON_UNLOCKED,
-	ICON_LOCKED,
-	ICON_PARLIB,
-	ICON_DATALIB,
-	ICON_AUTO,
-	ICON_MATERIAL_DEHLT2,
-	ICON_RING,
-	ICON_GRID,
-	ICON_PROPEDIT,
-	ICON_KEEPRECT,
-	ICON_DESEL_CUBE_VERTS,
-	ICON_EDITMODE_DEHLT,
-	ICON_EDITMODE_HLT,
-	ICON_VPAINT_DEHLT,
-	ICON_VPAINT_HLT,
-	ICON_FACESEL_DEHLT,
-	ICON_FACESEL_HLT,
-	ICON_EDIT_DEHLT,
-	ICON_BOOKMARKS,
-	ICON_BLANK20,
-	ICON_BLANK21,
-	ICON_BLANK22,
-	
-	ICON_HELP,
-	ICON_ERROR,
-	ICON_FOLDER_DEHLT,
-	ICON_FOLDER_HLT,
-	ICON_BLUEIMAGE_DEHLT,
-	ICON_BLUEIMAGE_HLT,
-	ICON_BPIBFOLDER_DEHLT,
-	ICON_BPIBFOLDER_HLT,
-	ICON_BPIBFOLDER_ERR,
-	ICON_UGLY_GREEN_RING,
-	ICON_GHOST,
-	ICON_SORTBYEXT,
-	ICON_SCULPTMODE_HLT,
-	ICON_VERTEXSEL,
-	ICON_EDGESEL,
-	ICON_FACESEL,
-	ICON_PLUS,
-	ICON_BPIBFOLDER_X,
-	ICON_BPIBFOLDERGREY,
-	ICON_MAGNIFY,
-	ICON_INFO2,
-	ICON_BLANK23,
-	ICON_BLANK24,
-	ICON_BLANK25,
-	ICON_BLANK26,
-	
-	ICON_RIGHTARROW,
-	ICON_DOWNARROW_HLT,
-	ICON_ROUNDBEVELTHING,
-	ICON_FULLTEXTURE,
-	ICON_HOOK,
-	ICON_DOT,
-	ICON_WORLD_DEHLT,
-	ICON_CHECKBOX_DEHLT,
-	ICON_CHECKBOX_HLT,
-	ICON_LINK,
-	ICON_INLINK,
-	ICON_ZOOMIN,
-	ICON_ZOOMOUT,
-	ICON_PASTEDOWN,
-	ICON_COPYDOWN,
-	ICON_CONSTANT,
-	ICON_LINEAR,
-	ICON_CYCLIC,
-	ICON_KEY_DEHLT,
-	ICON_KEY_HLT,
-	ICON_GRID2,
-	ICON_BLANK27,
-	ICON_BLANK28,
-	ICON_BLANK29,
-	ICON_BLANK30,
-	
-	ICON_EYE,
-	ICON_LAMP,
-	ICON_MATERIAL,
-	ICON_TEXTURE,
-	ICON_ANIM,
-	ICON_WORLD,
-	ICON_SCENE,
-	ICON_EDIT,
-	ICON_GAME,
-	ICON_PAINT,
-	ICON_RADIO,
-	ICON_SCRIPT,
-	ICON_SPEAKER,
-	ICON_PASTEUP,
-	ICON_COPYUP,
-	ICON_PASTEFLIPUP,
-	ICON_PASTEFLIPDOWN,
-	ICON_CYCLICLINEAR,
-	ICON_PIN_DEHLT,
-	ICON_PIN_HLT,
-	ICON_LITTLEGRID,
-	ICON_BLANK31,
-	ICON_BLANK32,
-	ICON_BLANK33,
-	ICON_BLANK34,
-	
-	ICON_FULLSCREEN,
-	ICON_SPLITSCREEN,
-	ICON_RIGHTARROW_THIN,
-	ICON_DISCLOSURE_TRI_RIGHT,
-	ICON_DISCLOSURE_TRI_DOWN,
-	ICON_SCENE_SEPIA,
-	ICON_SCENE_DEHLT,
-	ICON_OBJECT,
-	ICON_MESH,
-	ICON_CURVE,
-	ICON_MBALL,
-	ICON_LATTICE,
-	ICON_LAMP_DEHLT,
-	ICON_MATERIAL_DEHLT,
-	ICON_TEXTURE_DEHLT,
-	ICON_IPO_DEHLT,
-	ICON_LIBRARY_DEHLT,
-	ICON_IMAGE_DEHLT,
-	ICON_EYEDROPPER,
-	ICON_WINDOW_WINDOW,
-	ICON_PANEL_CLOSE,
-	ICON_PHYSICS,
-	ICON_BLANK36,
-	ICON_BLANK37,
-	ICON_BLANK38,
-	
-	ICON_BLENDER,
-	ICON_PACKAGE,
-	ICON_UGLYPACKAGE,
-	ICON_MATPLANE,
-	ICON_MATSPHERE,
-	ICON_MATCUBE,
-	ICON_SCENE_HLT,
-	ICON_OBJECT_HLT,
-	ICON_MESH_HLT,
-	ICON_CURVE_HLT,
-	ICON_MBALL_HLT,
-	ICON_LATTICE_HLT,
-	ICON_LAMP_HLT,
-	ICON_MATERIAL_HLT,
-	ICON_TEXTURE_HLT,
-	ICON_IPO_HLT,
-	ICON_LIBRARY_HLT,
-	ICON_IMAGE_HLT,
-	ICON_CONSTRAINT,
-	ICON_CAMERA_DEHLT,
-	ICON_ARMATURE_DEHLT,
-	ICON_SNAP_GEAR,
-	ICON_SNAP_GEO,
-	ICON_BLANK41,
-	ICON_BLANK42,
-	
-	ICON_SMOOTHCURVE,
-	ICON_SPHERECURVE,
-	ICON_ROOTCURVE,
-	ICON_SHARPCURVE,
-	ICON_LINCURVE,
-	ICON_NOCURVE,
-	ICON_RNDCURVE,
-	ICON_PROP_OFF,
-	ICON_PROP_ON,
-	ICON_PROP_CON,
-	ICON_SYNTAX,
-	ICON_SYNTAX_OFF,
-	ICON_MONKEY,
-	ICON_HAIR,
-	ICON_VIEWMOVE,
-	ICON_HOME,
-	ICON_CLIPUV_DEHLT,
-	ICON_CLIPUV_HLT,
-	ICON_BLANK2,
-	ICON_BLANK3,
-	ICON_VPAINT_COL,
-	ICON_RESTRICT_SELECT_OFF,
-	ICON_RESTRICT_SELECT_ON,
-	ICON_MUTE_IPO_OFF,
-	ICON_MUTE_IPO_ON,
-	
-	ICON_MAN_TRANS,
-	ICON_MAN_ROT,
-	ICON_MAN_SCALE,
-	ICON_MANIPUL,
-	ICON_BLANK_47,
-	ICON_MODIFIER,
-	ICON_MOD_WAVE,
-	ICON_MOD_BUILD,
-	ICON_MOD_DECIM,
-	ICON_MOD_MIRROR,
-	ICON_MOD_SOFT,
-	ICON_MOD_SUBSURF,
-	ICON_SEQ_SEQUENCER,
-	ICON_SEQ_PREVIEW,
-	ICON_SEQ_LUMA_WAVEFORM,
-	ICON_SEQ_CHROMA_SCOPE,
-	ICON_ROTATE,
-	ICON_CURSOR,
-	ICON_ROTATECOLLECTION,
-	ICON_ROTATECENTER,
-	ICON_ROTACTIVE,
-	ICON_RESTRICT_VIEW_OFF,
-	ICON_RESTRICT_VIEW_ON,
-	ICON_RESTRICT_RENDER_OFF,
-	ICON_RESTRICT_RENDER_ON,
-
-	VICON_VIEW3D,
-	VICON_EDIT,
-	VICON_EDITMODE_DEHLT,
-	VICON_EDITMODE_HLT,
-	VICON_DISCLOSURE_TRI_RIGHT,
-	VICON_DISCLOSURE_TRI_DOWN,
-	VICON_MOVE_UP,
-	VICON_MOVE_DOWN,
-	VICON_X
-
-#define BIFICONID_LAST		(VICON_X)
-#define BIFNICONIDS			(BIFICONID_LAST-BIFICONID_FIRST + 1)
-} BIFIconID;
-
-typedef enum {
-#define BIFCOLORSHADE_FIRST     (COLORSHADE_DARK)
-        COLORSHADE_DARK,
-        COLORSHADE_GREY,
-        COLORSHADE_MEDIUM,
-        COLORSHADE_HILITE,
-        COLORSHADE_LIGHT,
-        COLORSHADE_WHITE
-#define BIFCOLORSHADE_LAST      (COLORSHADE_WHITE)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list