2002-10-12 11:37:38 +00:00
|
|
|
/* blender.c jan 94 MIXED MODEL
|
|
|
|
*
|
2003-04-25 15:48:11 +00:00
|
|
|
* common help functions and data
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** 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 WIN32
|
|
|
|
#include <unistd.h> // for read close
|
|
|
|
#include <sys/param.h> // for MAXPATHLEN
|
|
|
|
#else
|
|
|
|
#include <io.h> // for open close read
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h> // for open
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
#include "DNA_sdna_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
2004-11-07 16:49:46 +00:00
|
|
|
#include "BLI_dynstr.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
2004-03-28 08:46:35 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
2008-02-11 10:08:39 +00:00
|
|
|
#include "BKE_action.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_blender.h"
|
2006-07-04 10:19:26 +00:00
|
|
|
#include "BKE_curve.h"
|
|
|
|
#include "BKE_depsgraph.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_displist.h"
|
2006-07-04 10:19:26 +00:00
|
|
|
#include "BKE_font.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_global.h"
|
2006-07-04 10:19:26 +00:00
|
|
|
#include "BKE_library.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_main.h"
|
2007-03-31 18:18:30 +00:00
|
|
|
#include "BKE_node.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_object.h"
|
|
|
|
#include "BKE_scene.h"
|
2006-11-25 13:07:28 +00:00
|
|
|
#include "BKE_sound.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-28 08:46:35 +00:00
|
|
|
#include "BLI_editVert.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
#include "BLO_undofile.h"
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
#include "BLO_readfile.h"
|
|
|
|
#include "BLO_writefile.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BKE_bad_level_calls.h" // for freeAllRad editNurb free_editMesh free_editText free_editArmature
|
|
|
|
#include "BKE_utildefines.h" // O_BINARY FALSE
|
2004-07-16 03:08:43 +00:00
|
|
|
#include "BIF_mainqueue.h" // mainqenter for onload script
|
|
|
|
#include "mydevice.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "nla.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "blendef.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
Global G;
|
|
|
|
UserDef U;
|
|
|
|
|
|
|
|
char versionstr[48]= "";
|
|
|
|
|
|
|
|
/* ************************************************ */
|
2003-04-25 15:48:11 +00:00
|
|
|
/* pushpop facility: to store data temporally, FIFO! */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
ListBase ppmain={0, 0};
|
|
|
|
|
|
|
|
typedef struct PushPop {
|
|
|
|
struct PushPop *next, *prev;
|
|
|
|
void *data;
|
|
|
|
int len;
|
|
|
|
} PushPop;
|
|
|
|
|
|
|
|
void pushdata(void *data, int len)
|
|
|
|
{
|
|
|
|
PushPop *pp;
|
|
|
|
|
|
|
|
pp= MEM_mallocN(sizeof(PushPop), "pushpop");
|
|
|
|
BLI_addtail(&ppmain, pp);
|
|
|
|
pp->data= MEM_mallocN(len, "pushpop");
|
|
|
|
pp->len= len;
|
|
|
|
memcpy(pp->data, data, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
void popfirst(void *data)
|
|
|
|
{
|
|
|
|
PushPop *pp;
|
|
|
|
|
|
|
|
pp= ppmain.first;
|
|
|
|
if(pp) {
|
|
|
|
memcpy(data, pp->data, pp->len);
|
|
|
|
BLI_remlink(&ppmain, pp);
|
|
|
|
MEM_freeN(pp->data);
|
|
|
|
MEM_freeN(pp);
|
|
|
|
}
|
|
|
|
else printf("error in popfirst\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void poplast(void *data)
|
|
|
|
{
|
|
|
|
PushPop *pp;
|
|
|
|
|
|
|
|
pp= ppmain.last;
|
|
|
|
if(pp) {
|
|
|
|
memcpy(data, pp->data, pp->len);
|
|
|
|
BLI_remlink(&ppmain, pp);
|
|
|
|
MEM_freeN(pp->data);
|
|
|
|
MEM_freeN(pp);
|
|
|
|
}
|
|
|
|
else printf("error in poplast\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void free_pushpop()
|
|
|
|
{
|
|
|
|
PushPop *pp;
|
|
|
|
|
|
|
|
pp= ppmain.first;
|
|
|
|
while(pp) {
|
|
|
|
BLI_remlink(&ppmain, pp);
|
|
|
|
MEM_freeN(pp->data);
|
|
|
|
MEM_freeN(pp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void pushpop_test()
|
|
|
|
{
|
|
|
|
if(ppmain.first) printf("pushpop not empty\n");
|
|
|
|
free_pushpop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
/* ********** free ********** */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
void free_blender(void)
|
|
|
|
{
|
2006-11-25 13:07:28 +00:00
|
|
|
/* samples are in a global list..., also sets G.main->sound->sample NULL */
|
|
|
|
sound_free_all_samples();
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
free_main(G.main);
|
|
|
|
G.main= NULL;
|
|
|
|
|
|
|
|
IMB_freeImBufdata(); /* imbuf lib */
|
2006-11-25 13:07:28 +00:00
|
|
|
|
2007-03-31 18:18:30 +00:00
|
|
|
free_nodesystem();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2003-04-25 15:48:11 +00:00
|
|
|
void duplicatelist(ListBase *list1, ListBase *list2) /* copy from 2 to 1 */
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
struct Link *link1, *link2;
|
|
|
|
|
|
|
|
list1->first= list1->last= 0;
|
|
|
|
|
|
|
|
link2= list2->first;
|
|
|
|
while(link2) {
|
|
|
|
|
|
|
|
link1= MEM_dupallocN(link2);
|
|
|
|
BLI_addtail(list1, link1);
|
|
|
|
|
|
|
|
link2= link2->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-28 08:46:35 +00:00
|
|
|
static EditMesh theEditMesh;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void initglobals(void)
|
|
|
|
{
|
|
|
|
memset(&G, 0, sizeof(Global));
|
|
|
|
|
2005-12-02 18:00:38 +00:00
|
|
|
memset(&theEditMesh, 0, sizeof(theEditMesh));
|
2004-03-28 08:46:35 +00:00
|
|
|
G.editMesh = &theEditMesh;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
U.savetime= 1;
|
|
|
|
|
|
|
|
G.main= MEM_callocN(sizeof(Main), "initglobals");
|
|
|
|
|
|
|
|
strcpy(G.ima, "//");
|
|
|
|
|
|
|
|
G.version= BLENDER_VERSION;
|
|
|
|
|
|
|
|
G.order= 1;
|
|
|
|
G.order= (((char*)&G.order)[0])?L_ENDIAN:B_ENDIAN;
|
|
|
|
|
2006-11-26 21:17:15 +00:00
|
|
|
if(BLENDER_SUBVERSION)
|
|
|
|
sprintf(versionstr, "www.blender.org %d.%d", G.version, BLENDER_SUBVERSION);
|
|
|
|
else
|
|
|
|
sprintf(versionstr, "www.blender.org %d", G.version);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-05-08 16:24:58 +00:00
|
|
|
#ifdef _WIN32 // FULLSCREEN
|
|
|
|
G.windowstate = G_WINDOWSTATE_USERDEF;
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
clear_workob(); /* object.c */
|
2005-09-14 14:02:21 +00:00
|
|
|
|
|
|
|
G.charstart = 0x0000;
|
|
|
|
G.charmin = 0x0000;
|
|
|
|
G.charmax = 0xffff;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
static void clear_global(void)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
extern short winqueue_break; /* screen.c */
|
|
|
|
|
|
|
|
freeAllRad();
|
2006-05-28 11:49:22 +00:00
|
|
|
fastshade_free_render(); /* lamps hang otherwise */
|
|
|
|
free_main(G.main); /* free all lib data */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* force all queues to be left */
|
|
|
|
winqueue_break= 1;
|
|
|
|
|
|
|
|
if (G.obedit) {
|
|
|
|
freeNurblist(&editNurb);
|
EditMesh refactory + undo recode
The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
EditMesh refactor notes (user)
**** New selection modes
When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).
- Vertex Select
Select vertices as usual, fully compatible with how previous version work
- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.
- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.
While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.
The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:
**** Extrude
Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.
New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.
**** Other things to note
- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.
**** Todo
Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.
EditMesh refactor notes (coder)
**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.
**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT
- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.
- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect
- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);
- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices
**** Code hints for handling selection
If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.
However, by using the above calls, at least selections flush downward (to vertex level). You then can call:
void EM_selectmode_flush(void);
Which flushes selections back upward, based on the selectmode setting. This function does the following:
- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges
This works fine in nice controlled situations.
However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:
void EM_select_flush(void);
Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.
**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h
- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.
**** Unified undo for editmode
New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.
Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.
**** Going in/out editmode
As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.
ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.
2004-09-23 20:52:51 +00:00
|
|
|
free_editMesh(G.editMesh);
|
2002-10-12 11:37:38 +00:00
|
|
|
free_editText();
|
|
|
|
free_editArmature();
|
|
|
|
}
|
|
|
|
|
|
|
|
G.curscreen= NULL;
|
|
|
|
G.scene= NULL;
|
|
|
|
G.main= NULL;
|
|
|
|
|
|
|
|
G.obedit= NULL;
|
|
|
|
G.saction= NULL;
|
|
|
|
G.buts= NULL;
|
|
|
|
G.v2d= NULL;
|
|
|
|
G.vd= NULL;
|
|
|
|
G.soops= NULL;
|
|
|
|
G.sima= NULL;
|
|
|
|
G.sipo= NULL;
|
|
|
|
|
New: X-axis mirror weightpainting.
- Set the button in Paint Panel, Edit buttons context
- It assumes the mesh to be near-perfectly mirrored. Current threshold is
set to 0.0001 (maximum difference allowed).
In order to evaluate proper mirroring, a new option will be added in
Mesh editmode later.
- When the flipped group doesn't exist yet, it creates the group
- Of course this doesn't work for mirror modifier!
New: Select/activate flipped bone or vertex group
- Press SHIFT+F in PoseMode or WeightPaint mode to get the flipped bone.
Is especially to see while painting if the mirror copying works OK.
New: "Apply Envelope to VertexGroup" uses X-mirror option too.
Todo; check on mirror vertex painting, and mirror Mesh editmode....
The implementation is based on a 8x8x8 Octree, where vertex locations are
stored. Vertices on the threshold boundary of an Octree node are filled in
the neighbour nodes as well, ensuring that the lookup works with threshold.
The current size of the Octree gives good speedup, even for 128k vertices
it only needs 256 lookup cycles per checked vertex.
Same code could be used for the bevel tool for example.
src/meshtools.c:
int mesh_octree_table(Object *ob, float *co, char mode)
- mode 's' or 'e' is "start octree" or "end octree"
- mode 'u' is "use", it then returns an index nr of the found vertex.
(return -1 if not found)
2005-10-22 14:05:25 +00:00
|
|
|
free_vertexpaint();
|
|
|
|
|
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
|
|
|
G.f &= ~(G_WEIGHTPAINT + G_VERTEXPAINT + G_FACESELECT + G_PARTICLEEDIT);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-05-20 12:18:11 +00:00
|
|
|
/* make sure path names are correct for OS */
|
|
|
|
static void clean_paths(Main *main)
|
|
|
|
{
|
|
|
|
Image *image= main->image.first;
|
|
|
|
bSound *sound= main->sound.first;
|
|
|
|
Scene *scene= main->scene.first;
|
|
|
|
Editing *ed;
|
|
|
|
Sequence *seq;
|
|
|
|
Strip *strip;
|
|
|
|
|
|
|
|
while(image) {
|
|
|
|
BLI_clean(image->name);
|
|
|
|
image= image->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(sound) {
|
|
|
|
BLI_clean(sound->name);
|
|
|
|
sound= sound->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(scene) {
|
|
|
|
ed= scene->ed;
|
|
|
|
if(ed) {
|
|
|
|
seq= ed->seqbasep->first;
|
|
|
|
while(seq) {
|
|
|
|
if(seq->plugin) {
|
|
|
|
BLI_clean(seq->plugin->name);
|
|
|
|
}
|
|
|
|
strip= seq->strip;
|
|
|
|
while(strip) {
|
|
|
|
BLI_clean(strip->dir);
|
|
|
|
strip= strip->next;
|
|
|
|
}
|
|
|
|
seq= seq->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BLI_clean(scene->r.backbuf);
|
|
|
|
BLI_clean(scene->r.pic);
|
|
|
|
|
|
|
|
scene= scene->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
static void setup_app_data(BlendFileData *bfd, char *filename)
|
|
|
|
{
|
2005-09-12 13:02:36 +00:00
|
|
|
Object *ob;
|
2004-09-05 13:43:51 +00:00
|
|
|
bScreen *curscreen= NULL;
|
|
|
|
Scene *curscene= NULL;
|
|
|
|
char mode;
|
|
|
|
|
|
|
|
/* 'u' = undo save, 'n' = no UI load */
|
|
|
|
if(bfd->main->screen.first==NULL) mode= 'u';
|
|
|
|
else if(G.fileflags & G_FILE_NO_UI) mode= 'n';
|
|
|
|
else mode= 0;
|
|
|
|
|
2005-05-20 12:18:11 +00:00
|
|
|
clean_paths(bfd->main);
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
/* no load screens? */
|
|
|
|
if(mode) {
|
|
|
|
/* comes from readfile.c */
|
2005-07-28 11:05:21 +00:00
|
|
|
extern void lib_link_screen_restore(Main *, Scene *);
|
2004-09-05 13:43:51 +00:00
|
|
|
|
|
|
|
SWAP(ListBase, G.main->screen, bfd->main->screen);
|
|
|
|
|
|
|
|
/* we re-use current screen */
|
|
|
|
curscreen= G.curscreen;
|
|
|
|
/* but use new Scene pointer */
|
|
|
|
curscene= bfd->curscene;
|
|
|
|
if(curscene==NULL) curscene= bfd->main->scene.first;
|
|
|
|
/* and we enforce curscene to be in current screen */
|
|
|
|
curscreen->scene= curscene;
|
|
|
|
|
|
|
|
/* clear_global will free G.main, here we can still restore pointers */
|
2005-07-28 11:05:21 +00:00
|
|
|
lib_link_screen_restore(bfd->main, curscene);
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-11-25 13:07:28 +00:00
|
|
|
clear_global(); /* free Main database */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-11-14 16:19:34 +00:00
|
|
|
if(mode!='u') G.save_over = 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
G.main= bfd->main;
|
|
|
|
if (bfd->user) {
|
Essential cleanup for mess involved with reading files, initializing UI and
patching versions for UI settings.
Currently four different levels of routines for .blend file reading exist;
/* interface level */
1) BIF_init() -> calls 3
2) BIF_read_file() -> calls 11, optional 4
3) BIF_read_homefile() -> calls 11 or 12, and then 4
4) init_userdef_file()
/* kernel level */
11) BKE_read_file() -> calls 21, and then 14
12) BKE_read_file_from_memory() -> calls 22, and then 14
13) BKE_read_file_from_memfile() -> calls 23, and then 14
14) setup_app_data()
/* loader module level */
21) BLO_read_from_file() -> calls 24
22) BLO_read_from_memory() -> calls 24
23) BLO_read_from_memfile() -> calls 24
/* loader module, internal */
24) blo_read_file_internal()
Note:
- BIF_read_homefile() has additional UI initialize calls, like windows fullscreen and executing commandline options
- Reading from memory (12) only happens for the compiled-in .B.blend
- The "memfile" here is a name I gave to the undo "file" structure. Which is constructed out of memory chunks with basic compression features.
- the kernel function setup_app_data() sets globals like "current screen" and "current scene".
So far, so good. The levels as mentioned here clearly distinguish UI from kernel, and should enable for example game loading (runtime) or background (no UI) loading. In the past years however, 'bad level' dependencies were added, and especially the patches for 'file versions' were added in too many places. The latter is evidently a result of the problem that the "UserDef" struct cannot be initialized/patched if there's not a need for a UI.
Here's how the flow goes in four different cases:
----- Starting up Blender, in foreground with UI --------------------
- creator/creator.c, main() -> calls 1
- If the commandline contains a filename, it calls 11
----- Starting up Blender, in background without UI --------------------
- creator/creator.c, main() -> calls 11 if the commandline has a filename
Note: no Userdef is read, nor initialized. Please note that this was already an existing problem for using Yafray, not setting proper file paths in background mode. The Yafray paths don't belong in the User menu.
----- Starting up Blender as a runtime executable --------------------
This only has calls to 22
----- Loading a file from within the UI (with F1, CTRL+O, using pulldowns) -----
Only calls allowed to 2. It detects if a UserDef has been read too, and in that case the init_userdef_file() will be executed.
Hope this is understandable :)
-Ton-
2004-12-08 14:12:47 +00:00
|
|
|
|
|
|
|
/* only here free userdef themes... */
|
|
|
|
BLI_freelistN(&U.themes);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
U= *bfd->user;
|
|
|
|
MEM_freeN(bfd->user);
|
- Converted lamp buttons and world buttons, they're pretty!
- menu auto open now is user preset, including 2 thresholds you can set
- hilites of pulldown menus were not cleared, fixed
- changed F4 key to logic. F5 will show lamp buttons, when lamp active
- in 'shader context' buttons, clicking camera will show world
- Converted lamp buttons and world buttons, they're pretty!
- menu auto open now is user preset, including 2 thresholds you can set
- hilites of pulldown menus were not cleared, fixed
- changed F4 key to logic. F5 will show lamp buttons, when lamp active
- in 'shader context' buttons, clicking camera will show world
2003-10-12 13:58:56 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-11-25 13:07:28 +00:00
|
|
|
/* samples is a global list... */
|
|
|
|
sound_free_all_samples();
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
/* case G_FILE_NO_UI or no screens in file */
|
|
|
|
if(mode) {
|
|
|
|
G.curscreen= curscreen;
|
|
|
|
G.scene= curscene;
|
|
|
|
}
|
|
|
|
else {
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
G.winpos= bfd->winpos;
|
|
|
|
G.displaymode= bfd->displaymode;
|
2004-09-05 13:43:51 +00:00
|
|
|
G.fileflags= bfd->fileflags;
|
|
|
|
G.curscreen= bfd->curscreen;
|
|
|
|
G.scene= G.curscreen->scene;
|
|
|
|
}
|
2005-01-05 10:31:27 +00:00
|
|
|
/* this can happen when active scene was lib-linked, and doesnt exist anymore */
|
|
|
|
if(G.scene==NULL) {
|
|
|
|
G.scene= G.main->scene.first;
|
|
|
|
G.curscreen->scene= G.scene;
|
|
|
|
}
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
|
2004-07-16 03:08:43 +00:00
|
|
|
/* special cases, override loaded flags: */
|
New scripts:
- hotkeys, obdatacopier and renameobjectbyblock, all from Jean-Michel Soler (jms);
- bevel_center by Loic Berthe, suggested for inclusion by jms;
- doc_browser, by Daniel Dunbar (Zr)
Thanks to them for the new contributions!
(I included doc_browser at 'Misc' because only users interested in script writing would actually use it, but it could also be under 'Help'. Opinions?)
BPython related:
- Added scriptlink methods to object, lamp, camera and world.
- Object: added object.makeTrack and object.clearTrack (old track method).
- sys: made sys.exists(path) return 0 for not found; 1 for file, 2 for dir and -1 for neither.
- doc updates and fixes.
- made ONLOAD event work. G.f's SCENESCRIPT bit was being zeroed in set_app_data.
- Blender: updated functions Load and Save to support the builtin importers and exporters besides .blend (dxf, videoscape, vrml 1.0, stl, ...)
- Draw: added mouse wheel events.
- Scene: added scene.play to play back animations (like ALT+A and SHIFT+ALT+A). Makes a good counter, too, when the 'win' attribute is set to a space that doesn't "animate".
The scene.play() addition and the fix to ONLOAD scriptlinks is part of the work for a Blender demo mode. It already works, but I'll still add support for Radiosity calculations and fix a thing in main(): it executes onload scripts too early (BIF_Init), giving funny results in alt+a animations and renderings when firing up Blender. Loading after the program is up has no such problems. When I finish I'll post examples of demo mode scripts.
2004-07-03 05:17:04 +00:00
|
|
|
if (G.f & G_DEBUG) bfd->globalf |= G_DEBUG;
|
2004-07-16 03:08:43 +00:00
|
|
|
else bfd->globalf &= ~G_DEBUG;
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
if (!(G.f & G_DOSCRIPTLINKS)) bfd->globalf &= ~G_DOSCRIPTLINKS;
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2003-07-22 19:49:47 +00:00
|
|
|
G.f= bfd->globalf;
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (!G.background) {
|
|
|
|
setscreen(G.curscreen);
|
|
|
|
}
|
2006-07-04 10:19:26 +00:00
|
|
|
|
|
|
|
/* baseflags, groups, make depsgraph, etc */
|
2002-10-12 11:37:38 +00:00
|
|
|
set_scene_bg(G.scene);
|
2004-07-16 03:08:43 +00:00
|
|
|
|
2008-02-11 10:08:39 +00:00
|
|
|
/* clear BONE_UNKEYED flags, these are not valid anymore for proxies */
|
|
|
|
framechange_poses_clear_unkeyed();
|
|
|
|
|
2006-07-04 10:19:26 +00:00
|
|
|
/* last stage of do_versions actually, that sets recalc flags for recalc poses */
|
2006-06-20 12:41:52 +00:00
|
|
|
for(ob= G.main->object.first; ob; ob= ob->id.next) {
|
|
|
|
if(ob->type==OB_ARMATURE)
|
|
|
|
if(ob->recalc) object_handle_update(ob);
|
|
|
|
}
|
|
|
|
|
2006-07-04 10:19:26 +00:00
|
|
|
/* now tag update flags, to ensure deformers get calculated on redraw */
|
|
|
|
DAG_scene_update_flags(G.scene, G.scene->lay);
|
|
|
|
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
if (G.f & G_DOSCRIPTLINKS) {
|
2004-07-16 03:08:43 +00:00
|
|
|
/* there's an onload scriptlink to execute in screenmain */
|
|
|
|
mainqenter(ONLOAD_SCRIPT, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2007-10-25 20:30:18 +00:00
|
|
|
if (G.sce != filename) /* these are the same at times, should never copy to the same location */
|
|
|
|
strcpy(G.sce, filename);
|
|
|
|
|
2008-03-30 16:18:01 +00:00
|
|
|
BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
MEM_freeN(bfd);
|
|
|
|
}
|
|
|
|
|
2006-11-26 21:17:15 +00:00
|
|
|
static void handle_subversion_warning(Main *main)
|
|
|
|
{
|
|
|
|
if(main->minversionfile > BLENDER_VERSION ||
|
|
|
|
(main->minversionfile == BLENDER_VERSION &&
|
|
|
|
main->minsubversionfile > BLENDER_SUBVERSION)) {
|
|
|
|
|
|
|
|
char str[128];
|
|
|
|
|
|
|
|
sprintf(str, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile);
|
|
|
|
error(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Essential cleanup for mess involved with reading files, initializing UI and
patching versions for UI settings.
Currently four different levels of routines for .blend file reading exist;
/* interface level */
1) BIF_init() -> calls 3
2) BIF_read_file() -> calls 11, optional 4
3) BIF_read_homefile() -> calls 11 or 12, and then 4
4) init_userdef_file()
/* kernel level */
11) BKE_read_file() -> calls 21, and then 14
12) BKE_read_file_from_memory() -> calls 22, and then 14
13) BKE_read_file_from_memfile() -> calls 23, and then 14
14) setup_app_data()
/* loader module level */
21) BLO_read_from_file() -> calls 24
22) BLO_read_from_memory() -> calls 24
23) BLO_read_from_memfile() -> calls 24
/* loader module, internal */
24) blo_read_file_internal()
Note:
- BIF_read_homefile() has additional UI initialize calls, like windows fullscreen and executing commandline options
- Reading from memory (12) only happens for the compiled-in .B.blend
- The "memfile" here is a name I gave to the undo "file" structure. Which is constructed out of memory chunks with basic compression features.
- the kernel function setup_app_data() sets globals like "current screen" and "current scene".
So far, so good. The levels as mentioned here clearly distinguish UI from kernel, and should enable for example game loading (runtime) or background (no UI) loading. In the past years however, 'bad level' dependencies were added, and especially the patches for 'file versions' were added in too many places. The latter is evidently a result of the problem that the "UserDef" struct cannot be initialized/patched if there's not a need for a UI.
Here's how the flow goes in four different cases:
----- Starting up Blender, in foreground with UI --------------------
- creator/creator.c, main() -> calls 1
- If the commandline contains a filename, it calls 11
----- Starting up Blender, in background without UI --------------------
- creator/creator.c, main() -> calls 11 if the commandline has a filename
Note: no Userdef is read, nor initialized. Please note that this was already an existing problem for using Yafray, not setting proper file paths in background mode. The Yafray paths don't belong in the User menu.
----- Starting up Blender as a runtime executable --------------------
This only has calls to 22
----- Loading a file from within the UI (with F1, CTRL+O, using pulldowns) -----
Only calls allowed to 2. It detects if a UserDef has been read too, and in that case the init_userdef_file() will be executed.
Hope this is understandable :)
-Ton-
2004-12-08 14:12:47 +00:00
|
|
|
/* returns:
|
|
|
|
0: no load file
|
|
|
|
1: OK
|
|
|
|
2: OK, and with new user settings
|
|
|
|
*/
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
int BKE_read_file(char *dir, void *type_r)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
BlendReadError bre;
|
|
|
|
BlendFileData *bfd;
|
Essential cleanup for mess involved with reading files, initializing UI and
patching versions for UI settings.
Currently four different levels of routines for .blend file reading exist;
/* interface level */
1) BIF_init() -> calls 3
2) BIF_read_file() -> calls 11, optional 4
3) BIF_read_homefile() -> calls 11 or 12, and then 4
4) init_userdef_file()
/* kernel level */
11) BKE_read_file() -> calls 21, and then 14
12) BKE_read_file_from_memory() -> calls 22, and then 14
13) BKE_read_file_from_memfile() -> calls 23, and then 14
14) setup_app_data()
/* loader module level */
21) BLO_read_from_file() -> calls 24
22) BLO_read_from_memory() -> calls 24
23) BLO_read_from_memfile() -> calls 24
/* loader module, internal */
24) blo_read_file_internal()
Note:
- BIF_read_homefile() has additional UI initialize calls, like windows fullscreen and executing commandline options
- Reading from memory (12) only happens for the compiled-in .B.blend
- The "memfile" here is a name I gave to the undo "file" structure. Which is constructed out of memory chunks with basic compression features.
- the kernel function setup_app_data() sets globals like "current screen" and "current scene".
So far, so good. The levels as mentioned here clearly distinguish UI from kernel, and should enable for example game loading (runtime) or background (no UI) loading. In the past years however, 'bad level' dependencies were added, and especially the patches for 'file versions' were added in too many places. The latter is evidently a result of the problem that the "UserDef" struct cannot be initialized/patched if there's not a need for a UI.
Here's how the flow goes in four different cases:
----- Starting up Blender, in foreground with UI --------------------
- creator/creator.c, main() -> calls 1
- If the commandline contains a filename, it calls 11
----- Starting up Blender, in background without UI --------------------
- creator/creator.c, main() -> calls 11 if the commandline has a filename
Note: no Userdef is read, nor initialized. Please note that this was already an existing problem for using Yafray, not setting proper file paths in background mode. The Yafray paths don't belong in the User menu.
----- Starting up Blender as a runtime executable --------------------
This only has calls to 22
----- Loading a file from within the UI (with F1, CTRL+O, using pulldowns) -----
Only calls allowed to 2. It detects if a UserDef has been read too, and in that case the init_userdef_file() will be executed.
Hope this is understandable :)
-Ton-
2004-12-08 14:12:47 +00:00
|
|
|
int retval= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(1);
|
|
|
|
|
|
|
|
bfd= BLO_read_from_file(dir, &bre);
|
|
|
|
if (bfd) {
|
Essential cleanup for mess involved with reading files, initializing UI and
patching versions for UI settings.
Currently four different levels of routines for .blend file reading exist;
/* interface level */
1) BIF_init() -> calls 3
2) BIF_read_file() -> calls 11, optional 4
3) BIF_read_homefile() -> calls 11 or 12, and then 4
4) init_userdef_file()
/* kernel level */
11) BKE_read_file() -> calls 21, and then 14
12) BKE_read_file_from_memory() -> calls 22, and then 14
13) BKE_read_file_from_memfile() -> calls 23, and then 14
14) setup_app_data()
/* loader module level */
21) BLO_read_from_file() -> calls 24
22) BLO_read_from_memory() -> calls 24
23) BLO_read_from_memfile() -> calls 24
/* loader module, internal */
24) blo_read_file_internal()
Note:
- BIF_read_homefile() has additional UI initialize calls, like windows fullscreen and executing commandline options
- Reading from memory (12) only happens for the compiled-in .B.blend
- The "memfile" here is a name I gave to the undo "file" structure. Which is constructed out of memory chunks with basic compression features.
- the kernel function setup_app_data() sets globals like "current screen" and "current scene".
So far, so good. The levels as mentioned here clearly distinguish UI from kernel, and should enable for example game loading (runtime) or background (no UI) loading. In the past years however, 'bad level' dependencies were added, and especially the patches for 'file versions' were added in too many places. The latter is evidently a result of the problem that the "UserDef" struct cannot be initialized/patched if there's not a need for a UI.
Here's how the flow goes in four different cases:
----- Starting up Blender, in foreground with UI --------------------
- creator/creator.c, main() -> calls 1
- If the commandline contains a filename, it calls 11
----- Starting up Blender, in background without UI --------------------
- creator/creator.c, main() -> calls 11 if the commandline has a filename
Note: no Userdef is read, nor initialized. Please note that this was already an existing problem for using Yafray, not setting proper file paths in background mode. The Yafray paths don't belong in the User menu.
----- Starting up Blender as a runtime executable --------------------
This only has calls to 22
----- Loading a file from within the UI (with F1, CTRL+O, using pulldowns) -----
Only calls allowed to 2. It detects if a UserDef has been read too, and in that case the init_userdef_file() will be executed.
Hope this is understandable :)
-Ton-
2004-12-08 14:12:47 +00:00
|
|
|
if(bfd->user) retval= 2;
|
2002-10-12 11:37:38 +00:00
|
|
|
if (type_r)
|
|
|
|
*((BlenFileType*)type_r)= bfd->type;
|
|
|
|
|
|
|
|
setup_app_data(bfd, dir);
|
2006-11-26 21:17:15 +00:00
|
|
|
|
2006-11-27 10:43:00 +00:00
|
|
|
handle_subversion_warning(G.main);
|
2006-11-26 21:17:15 +00:00
|
|
|
}
|
|
|
|
else {
|
2002-10-12 11:37:38 +00:00
|
|
|
error("Loading %s failed: %s", dir, BLO_bre_as_string(bre));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(0);
|
|
|
|
|
Essential cleanup for mess involved with reading files, initializing UI and
patching versions for UI settings.
Currently four different levels of routines for .blend file reading exist;
/* interface level */
1) BIF_init() -> calls 3
2) BIF_read_file() -> calls 11, optional 4
3) BIF_read_homefile() -> calls 11 or 12, and then 4
4) init_userdef_file()
/* kernel level */
11) BKE_read_file() -> calls 21, and then 14
12) BKE_read_file_from_memory() -> calls 22, and then 14
13) BKE_read_file_from_memfile() -> calls 23, and then 14
14) setup_app_data()
/* loader module level */
21) BLO_read_from_file() -> calls 24
22) BLO_read_from_memory() -> calls 24
23) BLO_read_from_memfile() -> calls 24
/* loader module, internal */
24) blo_read_file_internal()
Note:
- BIF_read_homefile() has additional UI initialize calls, like windows fullscreen and executing commandline options
- Reading from memory (12) only happens for the compiled-in .B.blend
- The "memfile" here is a name I gave to the undo "file" structure. Which is constructed out of memory chunks with basic compression features.
- the kernel function setup_app_data() sets globals like "current screen" and "current scene".
So far, so good. The levels as mentioned here clearly distinguish UI from kernel, and should enable for example game loading (runtime) or background (no UI) loading. In the past years however, 'bad level' dependencies were added, and especially the patches for 'file versions' were added in too many places. The latter is evidently a result of the problem that the "UserDef" struct cannot be initialized/patched if there's not a need for a UI.
Here's how the flow goes in four different cases:
----- Starting up Blender, in foreground with UI --------------------
- creator/creator.c, main() -> calls 1
- If the commandline contains a filename, it calls 11
----- Starting up Blender, in background without UI --------------------
- creator/creator.c, main() -> calls 11 if the commandline has a filename
Note: no Userdef is read, nor initialized. Please note that this was already an existing problem for using Yafray, not setting proper file paths in background mode. The Yafray paths don't belong in the User menu.
----- Starting up Blender as a runtime executable --------------------
This only has calls to 22
----- Loading a file from within the UI (with F1, CTRL+O, using pulldowns) -----
Only calls allowed to 2. It detects if a UserDef has been read too, and in that case the init_userdef_file() will be executed.
Hope this is understandable :)
-Ton-
2004-12-08 14:12:47 +00:00
|
|
|
return (bfd?retval:0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int BKE_read_file_from_memory(char* filebuf, int filelength, void *type_r)
|
|
|
|
{
|
|
|
|
BlendReadError bre;
|
|
|
|
BlendFileData *bfd;
|
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(1);
|
|
|
|
|
|
|
|
bfd= BLO_read_from_memory(filebuf, filelength, &bre);
|
|
|
|
if (bfd) {
|
|
|
|
if (type_r)
|
|
|
|
*((BlenFileType*)type_r)= bfd->type;
|
|
|
|
|
2008-02-20 18:56:07 +00:00
|
|
|
setup_app_data(bfd, "<memory2>");
|
2002-10-12 11:37:38 +00:00
|
|
|
} else {
|
|
|
|
error("Loading failed: %s", BLO_bre_as_string(bre));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(0);
|
|
|
|
|
|
|
|
return (bfd?1:0);
|
|
|
|
}
|
2004-09-05 13:43:51 +00:00
|
|
|
|
2006-11-25 13:07:28 +00:00
|
|
|
/* memfile is the undo buffer */
|
2004-09-05 13:43:51 +00:00
|
|
|
int BKE_read_file_from_memfile(MemFile *memfile)
|
|
|
|
{
|
|
|
|
BlendReadError bre;
|
|
|
|
BlendFileData *bfd;
|
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(1);
|
|
|
|
|
2006-01-05 14:12:07 +00:00
|
|
|
bfd= BLO_read_from_memfile(G.sce, memfile, &bre);
|
2004-09-05 13:43:51 +00:00
|
|
|
if (bfd) {
|
2008-02-20 18:56:07 +00:00
|
|
|
setup_app_data(bfd, "<memory1>");
|
2004-09-05 13:43:51 +00:00
|
|
|
} else {
|
|
|
|
error("Loading failed: %s", BLO_bre_as_string(bre));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!G.background)
|
|
|
|
waitcursor(0);
|
|
|
|
|
|
|
|
return (bfd?1:0);
|
|
|
|
}
|
|
|
|
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
|
|
|
/* ***************** GLOBAL UNDO *************** */
|
|
|
|
|
|
|
|
#define UNDO_DISK 0
|
|
|
|
|
|
|
|
#define MAXUNDONAME 64
|
|
|
|
typedef struct UndoElem {
|
|
|
|
struct UndoElem *next, *prev;
|
|
|
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
char name[MAXUNDONAME];
|
|
|
|
MemFile memfile;
|
|
|
|
} UndoElem;
|
|
|
|
|
|
|
|
static ListBase undobase={NULL, NULL};
|
|
|
|
static UndoElem *curundo= NULL;
|
|
|
|
|
|
|
|
|
|
|
|
static int read_undosave(UndoElem *uel)
|
|
|
|
{
|
|
|
|
char scestr[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
int success=0, fileflags;
|
|
|
|
|
|
|
|
strcpy(scestr, G.sce); /* temporal store */
|
|
|
|
fileflags= G.fileflags;
|
|
|
|
G.fileflags |= G_FILE_NO_UI;
|
|
|
|
|
|
|
|
if(UNDO_DISK)
|
|
|
|
success= BKE_read_file(uel->str, NULL);
|
|
|
|
else
|
|
|
|
success= BKE_read_file_from_memfile(&uel->memfile);
|
|
|
|
|
|
|
|
/* restore */
|
|
|
|
strcpy(G.sce, scestr);
|
|
|
|
G.fileflags= fileflags;
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* name can be a dynamic string */
|
|
|
|
void BKE_write_undo(char *name)
|
|
|
|
{
|
|
|
|
int nr, success;
|
|
|
|
UndoElem *uel;
|
|
|
|
|
|
|
|
if( (U.uiflag & USER_GLOBALUNDO)==0) return;
|
2005-12-05 11:52:30 +00:00
|
|
|
if( U.undosteps==0) return;
|
|
|
|
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
/* remove all undos after (also when curundo==NULL) */
|
|
|
|
while(undobase.last != curundo) {
|
|
|
|
uel= undobase.last;
|
|
|
|
BLI_remlink(&undobase, uel);
|
|
|
|
BLO_free_memfile(&uel->memfile);
|
|
|
|
MEM_freeN(uel);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make new */
|
|
|
|
curundo= uel= MEM_callocN(sizeof(UndoElem), "undo file");
|
|
|
|
strncpy(uel->name, name, MAXUNDONAME-1);
|
|
|
|
BLI_addtail(&undobase, uel);
|
|
|
|
|
|
|
|
/* and limit amount to the maximum */
|
|
|
|
nr= 0;
|
|
|
|
uel= undobase.last;
|
|
|
|
while(uel) {
|
|
|
|
nr++;
|
2005-12-05 11:46:40 +00:00
|
|
|
if(nr==U.undosteps) break;
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
uel= uel->prev;
|
|
|
|
}
|
|
|
|
if(uel) {
|
|
|
|
while(undobase.first!=uel) {
|
|
|
|
UndoElem *first= undobase.first;
|
|
|
|
BLI_remlink(&undobase, first);
|
|
|
|
/* the merge is because of compression */
|
|
|
|
BLO_merge_memfile(&first->memfile, &first->next->memfile);
|
|
|
|
MEM_freeN(first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* disk save version */
|
|
|
|
if(UNDO_DISK) {
|
|
|
|
static int counter= 0;
|
|
|
|
char *err, tstr[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
char numstr[32];
|
|
|
|
|
|
|
|
/* calculate current filename */
|
|
|
|
counter++;
|
2005-12-05 11:46:40 +00:00
|
|
|
counter= counter % U.undosteps;
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
|
|
|
sprintf(numstr, "%d.blend", counter);
|
2008-02-13 13:55:22 +00:00
|
|
|
BLI_make_file_string("/", tstr, btempdir, numstr);
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
|
|
|
success= BLO_write_file(tstr, G.fileflags, &err);
|
|
|
|
|
|
|
|
strcpy(curundo->str, tstr);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
MemFile *prevfile=NULL;
|
|
|
|
char *err;
|
|
|
|
|
|
|
|
if(curundo->prev) prevfile= &(curundo->prev->memfile);
|
|
|
|
|
|
|
|
success= BLO_write_file_mem(prevfile, &curundo->memfile, G.fileflags, &err);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */
|
|
|
|
void BKE_undo_step(int step)
|
|
|
|
{
|
|
|
|
|
2004-11-07 16:49:46 +00:00
|
|
|
if(step==0) {
|
|
|
|
read_undosave(curundo);
|
|
|
|
}
|
|
|
|
else if(step==1) {
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
/* curundo should never be NULL, after restart or load file it should call undo_save */
|
|
|
|
if(curundo==NULL || curundo->prev==NULL) error("No undo available");
|
|
|
|
else {
|
2004-11-12 22:16:23 +00:00
|
|
|
if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
curundo= curundo->prev;
|
|
|
|
read_undosave(curundo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
/* curundo has to remain current situation! */
|
|
|
|
|
|
|
|
if(curundo==NULL || curundo->next==NULL) error("No redo available");
|
|
|
|
else {
|
|
|
|
read_undosave(curundo->next);
|
|
|
|
curundo= curundo->next;
|
2004-11-12 22:16:23 +00:00
|
|
|
if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BKE_reset_undo(void)
|
|
|
|
{
|
|
|
|
UndoElem *uel;
|
|
|
|
|
|
|
|
uel= undobase.first;
|
|
|
|
while(uel) {
|
|
|
|
BLO_free_memfile(&uel->memfile);
|
|
|
|
uel= uel->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_freelistN(&undobase);
|
|
|
|
curundo= NULL;
|
|
|
|
}
|
|
|
|
|
2004-11-07 16:49:46 +00:00
|
|
|
/* based on index nr it does a restore */
|
|
|
|
void BKE_undo_number(int nr)
|
|
|
|
{
|
|
|
|
UndoElem *uel;
|
|
|
|
int a=1;
|
|
|
|
|
|
|
|
for(uel= undobase.first; uel; uel= uel->next, a++) {
|
|
|
|
if(a==nr) break;
|
|
|
|
}
|
|
|
|
curundo= uel;
|
|
|
|
BKE_undo_step(0);
|
|
|
|
}
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
2004-11-07 16:49:46 +00:00
|
|
|
char *BKE_undo_menu_string(void)
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
{
|
2004-11-07 16:49:46 +00:00
|
|
|
UndoElem *uel;
|
|
|
|
DynStr *ds= BLI_dynstr_new();
|
|
|
|
char *menu;
|
|
|
|
|
|
|
|
BLI_dynstr_append(ds, "Global Undo History %t");
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
2004-11-07 16:49:46 +00:00
|
|
|
for(uel= undobase.first; uel; uel= uel->next) {
|
|
|
|
BLI_dynstr_append(ds, "|");
|
|
|
|
BLI_dynstr_append(ds, uel->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
menu= BLI_dynstr_get_cstring(ds);
|
|
|
|
BLI_dynstr_free(ds);
|
|
|
|
|
|
|
|
return menu;
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* saves quit.blend */
|
|
|
|
void BKE_undo_save_quit(void)
|
|
|
|
{
|
|
|
|
UndoElem *uel;
|
|
|
|
MemFileChunk *chunk;
|
|
|
|
int file;
|
|
|
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
|
|
|
|
if( (U.uiflag & USER_GLOBALUNDO)==0) return;
|
|
|
|
|
|
|
|
uel= curundo;
|
|
|
|
if(uel==NULL) {
|
|
|
|
printf("No undo buffer to save recovery file\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no undo state to save */
|
|
|
|
if(undobase.first==undobase.last) return;
|
|
|
|
|
2008-02-13 13:55:22 +00:00
|
|
|
BLI_make_file_string("/", str, btempdir, "quit.blend");
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
|
|
|
|
file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
|
|
|
|
if(file == -1) {
|
2008-02-22 00:03:03 +00:00
|
|
|
error("Unable to save %s, check you have permissions", str);
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
chunk= uel->memfile.chunks.first;
|
|
|
|
while(chunk) {
|
|
|
|
if( write(file, chunk->buf, chunk->size) != chunk->size) break;
|
|
|
|
chunk= chunk->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
close(file);
|
|
|
|
|
2008-02-22 00:03:03 +00:00
|
|
|
if(chunk) error("Unable to save %s, internal error", str);
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
else printf("Saved session recovery to %s\n", str);
|
|
|
|
}
|
|
|
|
|