2002-10-12 11:37:38 +00:00
|
|
|
/**
|
2007-12-24 18:27:28 +00:00
|
|
|
* $Id: wm_files.c
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2007-12-24 18:27:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
2007-12-24 18:27:28 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2007-12-24 18:27:28 +00:00
|
|
|
* Contributor(s): Blender Foundation 2007
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
2007-12-24 18:27:28 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* placed up here because of crappy
|
|
|
|
* winsock stuff.
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifdef WIN32
|
2006-06-12 19:13:17 +00:00
|
|
|
#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */
|
|
|
|
#ifndef _WIN32_IE
|
|
|
|
#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
|
|
|
|
#endif
|
|
|
|
#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_winstuff.h"
|
2003-03-24 01:46:05 +00:00
|
|
|
#include <process.h> /* getpid */
|
2002-10-12 11:37:38 +00:00
|
|
|
#else
|
|
|
|
#include <unistd.h> /* getpid */
|
|
|
|
#endif
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
2006-02-05 19:30:37 +00:00
|
|
|
#include "MEM_CacheLimiterC-Api.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_linklist.h"
|
|
|
|
|
2008-12-30 10:10:44 +00:00
|
|
|
#include "DNA_ipo_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_userdef_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"
|
2006-07-04 12:10:37 +00:00
|
|
|
#include "DNA_screen_types.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "BKE_blender.h"
|
2008-12-18 02:56:48 +00:00
|
|
|
#include "BKE_context.h"
|
2007-11-07 11:14:52 +00:00
|
|
|
#include "BKE_DerivedMesh.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_exotic.h"
|
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "BKE_global.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "BKE_library.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_packedFile.h"
|
2008-12-19 00:50:21 +00:00
|
|
|
#include "BKE_report.h"
|
2007-10-31 13:56:07 +00:00
|
|
|
#include "BKE_texture.h"
|
2003-05-05 21:28:54 +00:00
|
|
|
#include "BKE_utildefines.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
#include "BKE_verse.h"
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLO_readfile.h"
|
|
|
|
#include "BLO_writefile.h"
|
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
#include "ED_datafiles.h"
|
2008-11-27 17:58:46 +00:00
|
|
|
#include "ED_screen.h"
|
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
#include "UI_interface.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
|
|
|
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
// XXX #include "BPY_extern.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "WM_api.h"
|
2008-01-01 15:53:38 +00:00
|
|
|
#include "WM_types.h"
|
2007-12-24 18:27:28 +00:00
|
|
|
#include "wm.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/***/
|
|
|
|
|
2005-05-13 16:11:28 +00:00
|
|
|
/* define for setting colors in theme below */
|
|
|
|
#define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a;
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* patching UserDef struct and Themes */
|
|
|
|
static void init_userdef_themes(void)
|
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
|
|
|
{
|
Port of part of the Interface code to 2.50.
This is based on the current trunk version, so these files should not need
merges. There's two things (clipboard and intptr_t) that are missing in 2.50
and commented out with XXX 2.48, these can be enabled again once trunk is
merged into this branch.
Further this is not all interface code, there are many parts commented out:
* interface.c: nearly all button types, missing: links, chartab, keyevent.
* interface_draw.c: almost all code, with some small exceptions.
* interface_ops.c: this replaces ui_do_but and uiDoBlocks with two operators,
making it non-blocking.
* interface_regions: this is a part of interface.c, split off, contains code to
create regions for tooltips, menus, pupmenu (that one is crashing currently),
color chooser, basically regions with buttons which is fairly independent of
core interface code.
* interface_panel.c and interface_icons.c: not ported over, so no panels and
icons yet. Panels should probably become (free floating) regions?
* text.c: (formerly language.c) for drawing text and translation. this works
but is using bad globals still and could be cleaned up.
Header Files:
* ED_datafiles.h now has declarations for datatoc_ files, so those extern
declarations can be #included instead of repeated.
* The user interface code is in UI_interface.h and other UI_* files.
Core:
* The API for creating blocks, buttons, etc is nearly the same still. Blocks
are now created per region instead of per area.
* The code was made non-blocking, which means that any changes and redraws
should be possible while editing a button. That means though that we need
some sort of persistence even though the blender model is to recreate buttons
for each redraw. So when a new block is created, some matching happens to
find out which buttons correspond to buttons in the previously created block,
and for activated buttons some data is then copied over to the new button.
* Added UI_init/UI_init_userdef/UI_exit functions that should initialize code
in this module, instead of multiple function calls in the windowmanager.
* Removed most static/globals from interface.c.
* Removed UIafterfunc_ I don't think it's needed anymore, and not sure how it
would integrate here?
* Currently only full window redraws are used, this should become per region
and maybe per button later.
Operators:
* Events are currently handled through two operators: button activate and menu
handle. Operators may not be the best way to implement this, since there are
currently some issues with events being missed, but they can become a special
handler type instead, this should not be a big change.
* The button activate operator runs as long as a button is active, and will
handle all interaction with that button until the button is not activated
anymore. This means clicking, text editing, number dragging, opening menu
blocks, etc.
* Since this operator has to be non-blocking, the ui_do_but code needed to made
non-blocking. That means variables that were previously on the stack, now
need to be stored away in a struct such that they can be accessed again when
the operator receives more events.
* Additionally the place in the ui_do_but code indicated the state, now that
needs to be set explicit in order to handle the right events in the right
state. So an activated button can be in one of these states: init, highlight,
wait_flash, wait_release, wait_key_event, num_editing, text_editing,
text_selecting, block_open, exit.
* For each button type an ui_apply_but_* function has also been separated out
from ui_do_but. This makes it possible to continuously apply the button as
text is being typed for example, and there is an option in the code to enable
this. Since the code non-blocking and can deal with the button being deleted
even, it should be safe to do this.
* When editing text, dragging numbers, etc, the actual data (but->poin) is not
being edited, since that would mean data is being edited without correct
updates happening, while some other part of blender may be accessing that
data in the meantime. So data values, strings, vectors are written to a
temporary location and only flush in the apply function.
Regions:
* Menus, color chooser, tooltips etc all create screen level regions. Such menu
blocks give a handle to the button that creates it, which will contain the
results of the menu block once a MESSAGE event is received from that menu
block.
* For this type of menu block the coordinates used to be in window space. They
are still created that way and ui_positionblock still works with window
coordinates, but after that the block and buttons are brought back to region
coordinates since these are now contained in a region.
* The flush/overdraw frontbuffer drawing code was removed, the windowmanager
should have enough information with these screen level regions to have full
control over what gets drawn when and to then do correct compositing.
Testing:
* The header in the time space currently has some buttons to test the UI code.
2008-11-11 18:31:32 +00:00
|
|
|
// sets themes, fonts, .. from userdef
|
|
|
|
UI_init_userdef();
|
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
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// countall();
|
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
|
|
|
|
|
|
|
/* the UserDef struct is not corrected with do_versions() .... ugh! */
|
|
|
|
if(U.wheellinescroll == 0) U.wheellinescroll = 3;
|
|
|
|
if(U.menuthreshold1==0) {
|
|
|
|
U.menuthreshold1= 5;
|
|
|
|
U.menuthreshold2= 2;
|
|
|
|
}
|
|
|
|
if(U.tb_leftmouse==0) {
|
|
|
|
U.tb_leftmouse= 5;
|
|
|
|
U.tb_rightmouse= 5;
|
|
|
|
}
|
|
|
|
if(U.mixbufsize==0) U.mixbufsize= 2048;
|
|
|
|
if (BLI_streq(U.tempdir, "/")) {
|
|
|
|
char *tmp= getenv("TEMP");
|
|
|
|
|
|
|
|
strcpy(U.tempdir, tmp?tmp:"/tmp/");
|
|
|
|
}
|
|
|
|
if (U.savetime <= 0) {
|
|
|
|
U.savetime = 1;
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX error(".B.blend is buggy, please consider removing it.\n");
|
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
|
|
|
}
|
2005-03-21 14:20:04 +00:00
|
|
|
/* transform widget settings */
|
|
|
|
if(U.tw_hotspot==0) {
|
|
|
|
U.tw_hotspot= 14;
|
2005-04-02 13:57:23 +00:00
|
|
|
U.tw_size= 20; // percentage of window size
|
2005-04-24 13:22:24 +00:00
|
|
|
U.tw_handlesize= 16; // percentage of widget radius
|
2005-03-21 14:20:04 +00:00
|
|
|
}
|
2006-11-08 12:46:41 +00:00
|
|
|
if(U.pad_rot_angle==0)
|
|
|
|
U.pad_rot_angle= 15;
|
2005-03-21 14:20:04 +00:00
|
|
|
|
2007-11-07 11:14:52 +00:00
|
|
|
if(U.flag & USER_CUSTOM_RANGE)
|
|
|
|
vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */
|
|
|
|
|
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 (G.main->versionfile <= 191) {
|
|
|
|
strcpy(U.plugtexdir, U.textudir);
|
|
|
|
strcpy(U.sounddir, "/");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* patch to set Dupli Armature */
|
|
|
|
if (G.main->versionfile < 220) {
|
|
|
|
U.dupflag |= USER_DUP_ARM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* userdef new option */
|
|
|
|
if (G.main->versionfile <= 222) {
|
|
|
|
U.vrmlflag= USER_VRML_LAYERS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* added seam, normal color, undo */
|
|
|
|
if (G.main->versionfile <= 234) {
|
|
|
|
bTheme *btheme;
|
|
|
|
|
|
|
|
U.uiflag |= USER_GLOBALUNDO;
|
2007-01-12 05:29:59 +00:00
|
|
|
if (U.undosteps==0) U.undosteps=32;
|
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
|
|
|
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tv3d.edge_seam[3]==0) {
|
2005-05-13 16:11:28 +00:00
|
|
|
SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
|
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(btheme->tv3d.normal[3]==0) {
|
2005-05-13 16:11:28 +00:00
|
|
|
SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
|
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(btheme->tv3d.face_dot[3]==0) {
|
2005-05-13 16:11:28 +00:00
|
|
|
SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
|
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
|
|
|
btheme->tv3d.facedot_size= 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (G.main->versionfile <= 235) {
|
|
|
|
/* illegal combo... */
|
|
|
|
if (U.flag & USER_LMOUSESELECT)
|
|
|
|
U.flag &= ~USER_TWOBUTTONMOUSE;
|
|
|
|
}
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
if (G.main->versionfile <= 236) {
|
|
|
|
bTheme *btheme;
|
|
|
|
/* new space type */
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->ttime.back[3]==0) {
|
|
|
|
btheme->ttime = btheme->tsnd; // copy from sound
|
|
|
|
}
|
2005-05-13 16:11:28 +00:00
|
|
|
if(btheme->text.syntaxn[3]==0) {
|
|
|
|
SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
|
|
|
|
SETCOL(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
|
|
|
|
SETCOL(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
|
|
|
|
SETCOL(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
|
|
|
|
SETCOL(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
|
|
|
|
}
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
}
|
|
|
|
}
|
2005-07-12 15:47:53 +00:00
|
|
|
if (G.main->versionfile <= 237) {
|
|
|
|
bTheme *btheme;
|
|
|
|
/* bone colors */
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tv3d.bone_solid[3]==0) {
|
|
|
|
SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
|
2005-07-16 19:07:02 +00:00
|
|
|
SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);
|
2005-07-12 15:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-10-10 17:42:48 +00:00
|
|
|
if (G.main->versionfile <= 238) {
|
|
|
|
bTheme *btheme;
|
|
|
|
/* bone colors */
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tnla.strip[3]==0) {
|
|
|
|
SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
|
|
|
|
SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
if (G.main->versionfile <= 239) {
|
|
|
|
bTheme *btheme;
|
|
|
|
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* Lamp theme, check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tv3d.lamp[3]==0) {
|
|
|
|
SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
|
Patch #3365, Toolbox from Tuhopuu
Patch prvovided by Guillermo, code was - afaik - from Rob Haarsma.
This changes the toolbox (space menu) to have the first level aligned
vertically. Works much easier that way, and since the items open either
left or right, it doesn't flip order of the contents for it either.
To allow people to test (and to compare) it's a user menu setting (in
View & Controls, "Plain menus"). I've turned this on by default though,
since I propose to not have it a user setting. User setting can be
removed later.
Fixed two bugs in patch:
- if saved in user settings, first time usage of this toolbox opened in
wrong location
- Button for "plain menus" was writing a short in an int
(causing this new menu not to work for big endian systems)
As a bonus I've added the long wanted hotkey support for opening and
closing sublevels of pulldowns with arrow keys!
I didn't add the commenting out of correcting pulldown menu order, which
is based on location of the originating button in the UI. This uncommenting
didn't solve anything, since button definitions itself can be flipped too.
(Example: the data brose menus in top bar need to be corrected).
I can imagine the order flipping is sometimes annoying, but it still has
reasons to be there;
- the most important / most used items are always closest to the mouse.
(like opening properties panel, or "Add new" for material.
- it follows muscle memory and 'locus of attention' (mouse position).
- menus are configured to open to the top for bottom headers, and to the
bottom for top headers. We can expect the UI is configured consistantly
for headers, so in general the menus will appear consistant as well.
Where menu flipping fails is especially for alphabetic listings, like in
the menu button of fileselect. However, that one should be configured to
open by default to the bottom, so ordering is consistant as well.
If people like to check this themselves; uncomment the lines in the top
of the function uiBlockFlipOrder() in src/interface.c
2005-11-19 15:16:34 +00:00
|
|
|
/* TEMPORAL, remove me! (ton) */
|
|
|
|
U.uiflag |= USER_PLAINMENUS;
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
Patch by Matt Ebb: upgraded usablitiy of text button.
Textbuttons now allow a selection too (like any textbutton in other UIs).
By default, on activating a textbutton, the entire button text is selected
when you enter the button. A single arrowkey or LMB click reveils the
cursor then. Here's more user notes:
LMB click: If inside the button, places the text cursor at the clicked
position. If outside the button, confirms/finishes editing
LMB drag: Selects the text between the start and end point of the drag.
Backspace: Deletes selected text, or backspaces a character
Shift Backspace: Deletes all, as before.
Delete: Deletes selected text or forward deletes a character
Shift LeftArrow: Extends the selection left
Shift RightArrow: Extends the selection right
LeftArrow: If there's a selection, move the cursor to the left edge of the
selection, otherwise move the cursor left a character.
RightArrow: If there's a selection, move the cursor to the right edge of
the selection, otherwise move the cursor right a character.
UpArrow/Home: Move the cursor to the beginning of the line
DownArrow/End: Move the cursor to the end of the line
Ctrl Left arrow and Ctrl Right arrow to jump between directory separators
2005-11-20 10:04:45 +00:00
|
|
|
|
|
|
|
/* check for text field selection highlight, set it to text editor highlight by default */
|
|
|
|
if(btheme->tui.textfield_hi[3]==0) {
|
|
|
|
SETCOL(btheme->tui.textfield_hi,
|
|
|
|
btheme->text.shade2[0],
|
|
|
|
btheme->text.shade2[1],
|
|
|
|
btheme->text.shade2[2],
|
|
|
|
255);
|
|
|
|
}
|
2005-11-19 10:55:07 +00:00
|
|
|
}
|
|
|
|
if(U.obcenter_dia==0) U.obcenter_dia= 6;
|
|
|
|
}
|
2006-01-29 13:12:42 +00:00
|
|
|
if (G.main->versionfile <= 241) {
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
bTheme *btheme;
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* Node editor theme, check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tnode.syntaxn[3]==0) {
|
|
|
|
/* re-uses syntax color storage */
|
|
|
|
btheme->tnode= btheme->tv3d;
|
2006-01-04 12:13:13 +00:00
|
|
|
SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
|
2005-12-30 16:50:06 +00:00
|
|
|
SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
|
2006-06-16 04:32:39 +00:00
|
|
|
SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
|
|
|
|
SETCOL(btheme->tnode.syntaxb, 127,127,127, 255); /* operator */
|
|
|
|
SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
}
|
2007-04-04 13:18:41 +00:00
|
|
|
/* Group theme colors */
|
2006-03-11 18:51:41 +00:00
|
|
|
if(btheme->tv3d.group[3]==0) {
|
|
|
|
SETCOL(btheme->tv3d.group, 0x10, 0x40, 0x10, 255);
|
|
|
|
SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
|
|
|
|
}
|
2006-12-15 05:51:53 +00:00
|
|
|
/* Sequence editor theme*/
|
2006-06-08 19:05:58 +00:00
|
|
|
if(btheme->tseq.movie[3]==0) {
|
|
|
|
SETCOL(btheme->tseq.movie, 81, 105, 135, 255);
|
|
|
|
SETCOL(btheme->tseq.image, 109, 88, 129, 255);
|
|
|
|
SETCOL(btheme->tseq.scene, 78, 152, 62, 255);
|
|
|
|
SETCOL(btheme->tseq.audio, 46, 143, 143, 255);
|
|
|
|
SETCOL(btheme->tseq.effect, 169, 84, 124, 255);
|
|
|
|
SETCOL(btheme->tseq.plugin, 126, 126, 80, 255);
|
|
|
|
SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
|
|
|
|
SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
|
|
|
|
}
|
2006-12-29 04:46:47 +00:00
|
|
|
if(!(btheme->tui.iconfile)) {
|
|
|
|
BLI_strncpy(btheme->tui.iconfile, "", sizeof(btheme->tui.iconfile));
|
|
|
|
}
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
}
|
2006-04-25 12:26:46 +00:00
|
|
|
|
|
|
|
/* set defaults for 3D View rotating axis indicator */
|
|
|
|
/* since size can't be set to 0, this indicates it's not saved in .B.blend */
|
|
|
|
if (U.rvisize == 0) {
|
2006-04-26 01:42:35 +00:00
|
|
|
U.rvisize = 15;
|
|
|
|
U.rvibright = 8;
|
2006-04-25 12:26:46 +00:00
|
|
|
U.uiflag |= USER_SHOW_ROTVIEWICON;
|
|
|
|
}
|
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
}
|
2006-12-15 05:51:53 +00:00
|
|
|
if (G.main->versionfile <= 242) {
|
|
|
|
bTheme *btheme;
|
2007-01-10 08:51:24 +00:00
|
|
|
|
2006-12-15 05:51:53 +00:00
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
2007-04-04 13:18:41 +00:00
|
|
|
/* long keyframe color */
|
2006-12-15 05:51:53 +00:00
|
|
|
/* check for alpha==0 is safe, then color was never set */
|
|
|
|
if(btheme->tact.strip[3]==0) {
|
2007-01-03 05:50:17 +00:00
|
|
|
SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
|
2006-12-15 05:51:53 +00:00
|
|
|
SETCOL(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
|
|
|
|
SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
|
|
|
|
}
|
2007-01-10 08:51:24 +00:00
|
|
|
|
|
|
|
/* IPO-Editor - Vertex Size*/
|
2006-12-29 06:58:39 +00:00
|
|
|
if(btheme->tipo.vertex_size == 0) {
|
|
|
|
btheme->tipo.vertex_size= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-18 03:30:24 +00:00
|
|
|
if (G.main->versionfile <= 243) {
|
|
|
|
/* set default number of recently-used files (if not set) */
|
|
|
|
if (U.recent_files == 0) U.recent_files = 10;
|
|
|
|
}
|
2007-09-25 03:31:12 +00:00
|
|
|
if (G.main->versionfile < 245 || (G.main->versionfile == 245 && G.main->subversionfile < 3)) {
|
|
|
|
bTheme *btheme;
|
|
|
|
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
|
|
|
|
}
|
2007-10-31 13:56:07 +00:00
|
|
|
if(U.coba_weight.tot==0)
|
|
|
|
init_colorband(&U.coba_weight, 1);
|
2007-09-25 03:31:12 +00:00
|
|
|
}
|
2007-12-02 05:50:38 +00:00
|
|
|
if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) {
|
|
|
|
bTheme *btheme;
|
|
|
|
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* these should all use the same colour */
|
|
|
|
SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
|
|
|
|
}
|
|
|
|
}
|
2008-12-30 10:10:44 +00:00
|
|
|
if ((G.main->versionfile < 248) || (G.main->versionfile == 248 && G.main->subversionfile < 3)) {
|
|
|
|
bTheme *btheme;
|
|
|
|
|
|
|
|
/* adjust themes */
|
|
|
|
for (btheme= U.themes.first; btheme; btheme= btheme->next) {
|
|
|
|
/* DopeSheet - (Object) Channel color */
|
|
|
|
SETCOL(btheme->tact.ds_channel, 0x36, 0x13, 0xca, 255);
|
|
|
|
SETCOL(btheme->tact.ds_subchannel, 0x60, 0x43, 0xd2, 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* adjust grease-pencil distances */
|
|
|
|
U.gp_manhattendist= 1;
|
|
|
|
U.gp_euclideandist= 2;
|
|
|
|
|
|
|
|
/* adjust default interpolation for new IPO-curves */
|
|
|
|
U.ipo_new= IPO_BEZ;
|
|
|
|
}
|
Added the new Timeline Window, copied from Tuhopuu, coded by Matt Ebb.
Main change is that it's an own Space type now, not part of the Audio
window... the audio window should restrict to own options. This way
functionality is nicely separated.
Since it's the first time I added a new space (since long!) I've made an
extensive tutorial as well. You can find that here:
http://www.blender3d.org/cms/Adding_new_Space_Window.557.0.html
Notes for using timewindow;
- Add time markers with MKey
- CTRL+M gives option to name Marker
- Markers cannot be moved yet...
- Pageup-Pagedown keys moves current frame to next-prev Marker
- Xkey removes Markers
- If an object has Ipos or an Action, it draws key lines
- CTRL+Pageup-Pagedown moves current frame to next-prev Key
- Press S or E to set start/end frame for playback
Notes about the implementation in Tuhopuu:
- Add new Marker now selects new, deselects others
- Selecting Marker didn't work like elsewhere in Blender, on click it
should deselect all, except the indicated Marker. Not when holding SHIFT
of course
- Not exported functions are static now
- Removed unused defines (MARKER_NONE NEXT_AVAIL)
- Drawing order was confusing, doing too many matrix calls
- Removed not needed scrollbar, added new function to draw time values.
(Has advantage the MMB scroll works not confusing on a scrollbar)
- Added proper support for 'frame mapping'
- The string button (name Marker) had a bug (checked str[64] while str
was only 64 long)
- String button itself didn't allow "OK on enter"
- Made frame buttons in header larger, the arrows overlapped
- Removed support for negative frame values, that won't work so simple!
2005-05-05 17:19:21 +00:00
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
/* GL Texture Garbage Collection (variable abused above!) */
|
2005-07-27 07:50:28 +00:00
|
|
|
if (U.textimeout == 0) {
|
|
|
|
U.texcollectrate = 60;
|
|
|
|
U.textimeout = 120;
|
|
|
|
}
|
2006-02-05 19:30:37 +00:00
|
|
|
if (U.memcachelimit <= 0) {
|
|
|
|
U.memcachelimit = 32;
|
|
|
|
}
|
|
|
|
if (U.frameserverport == 0) {
|
|
|
|
U.frameserverport = 8080;
|
|
|
|
}
|
|
|
|
|
|
|
|
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);
|
2005-07-14 12:44:33 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* funny name, but it is GE stuff, moves userdef stuff to engine */
|
|
|
|
// XXX space_set_commmandline_options();
|
|
|
|
/* this timer uses U */
|
|
|
|
// XXX reset_autosave();
|
2005-01-19 13:53:43 +00:00
|
|
|
|
2006-10-12 11:53:50 +00:00
|
|
|
#ifdef WITH_VERSE
|
|
|
|
if(strlen(U.versemaster)<1) {
|
2007-12-24 18:27:28 +00:00
|
|
|
strcpy(U.versemaster, "master.uni-verse.org");
|
2006-10-12 11:53:50 +00:00
|
|
|
}
|
2006-10-19 05:06:41 +00:00
|
|
|
if(strlen(U.verseuser)<1) {
|
2008-01-08 16:17:26 +00:00
|
|
|
// XXX char *name = verse_client_name();
|
|
|
|
// XXX strcpy(U.verseuser, name);
|
|
|
|
// XXX MEM_freeN(name);
|
2006-10-19 05:06:41 +00:00
|
|
|
}
|
2006-10-12 11:53:50 +00:00
|
|
|
#endif
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* To be able to read files without windows closing, opening, moving
|
|
|
|
we try to prepare for worst case:
|
|
|
|
- active window gets active screen from file
|
|
|
|
- restoring the screens from non-active windows
|
|
|
|
Best case is all screens match, in that case they get assigned to proper window
|
|
|
|
*/
|
|
|
|
static void wm_window_match_init(bContext *C, ListBase *wmlist)
|
|
|
|
{
|
|
|
|
wmWindowManager *wm= G.main->wm.first;
|
|
|
|
wmWindow *win;
|
|
|
|
|
|
|
|
*wmlist= G.main->wm;
|
|
|
|
G.main->wm.first= G.main->wm.last= NULL;
|
|
|
|
|
2008-12-21 12:43:34 +00:00
|
|
|
/* first wrap up running stuff */
|
|
|
|
/* code copied from wm_init_exit.c */
|
|
|
|
for(wm= wmlist->first; wm; wm= wm->id.next) {
|
|
|
|
for(win= wm->windows.first; win; win= win->next) {
|
|
|
|
|
|
|
|
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
|
|
|
|
ED_screen_exit(C, win, win->screen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
return;
|
|
|
|
if(wm==NULL) return;
|
|
|
|
if(G.fileflags & G_FILE_NO_UI) return;
|
|
|
|
|
|
|
|
/* we take apart the used screens from non-active window */
|
|
|
|
for(win= wm->windows.first; win; win= win->next) {
|
|
|
|
BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
|
2008-12-18 02:56:48 +00:00
|
|
|
if(win!=wm->winactive) {
|
2007-12-24 18:27:28 +00:00
|
|
|
BLI_remlink(&G.main->screen, win->screen);
|
|
|
|
//BLI_addtail(screenbase, win->screen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-08-20 15:22:56 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* match old WM with new, 4 cases:
|
|
|
|
1- no current wm, no read wm: make new default
|
|
|
|
2- no current wm, but read wm: that's OK, do nothing
|
|
|
|
3- current wm, but not in file: try match screen names
|
|
|
|
4- current wm, and wm in file: try match ghostwin
|
|
|
|
|
|
|
|
*/
|
2008-12-21 12:43:34 +00:00
|
|
|
static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2007-12-24 18:27:28 +00:00
|
|
|
wmWindowManager *oldwm, *wm;
|
|
|
|
wmWindow *oldwin, *win;
|
|
|
|
|
|
|
|
/* cases 1 and 2 */
|
2008-12-21 12:43:34 +00:00
|
|
|
if(oldwmlist->first==NULL) {
|
2007-12-24 18:27:28 +00:00
|
|
|
if(G.main->wm.first); /* nothing todo */
|
|
|
|
else
|
|
|
|
wm_add_default(C);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* cases 3 and 4 */
|
|
|
|
|
|
|
|
/* we've read file without wm... */
|
|
|
|
if(G.main->wm.first==NULL) {
|
|
|
|
/* match oldwm to new dbase, only old files */
|
|
|
|
|
2008-12-21 12:43:34 +00:00
|
|
|
for(wm= oldwmlist->first; wm; wm= wm->id.next) {
|
2007-12-24 18:27:28 +00:00
|
|
|
for(win= wm->windows.first; win; win= win->next) {
|
|
|
|
win->screen= (bScreen *)find_id("SR", win->screenname);
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
|
2008-11-27 17:58:46 +00:00
|
|
|
if(win->screen==NULL)
|
2008-12-18 02:56:48 +00:00
|
|
|
win->screen= ED_screen_duplicate(win, CTX_wm_screen(C)); /* active screen */
|
2008-11-27 17:58:46 +00:00
|
|
|
|
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
|
|
|
if(win->screen->winid==0)
|
2007-12-24 18:27:28 +00:00
|
|
|
win->screen->winid= win->winid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* XXX still solve, case where multiple windows open */
|
|
|
|
|
2008-12-21 12:43:34 +00:00
|
|
|
G.main->wm= *oldwmlist;
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* what if old was 3, and loaded 1? */
|
|
|
|
/* this code could move to setup_appdata */
|
2008-12-21 12:43:34 +00:00
|
|
|
oldwm= oldwmlist->first;
|
2007-12-24 18:27:28 +00:00
|
|
|
wm= G.main->wm.first;
|
|
|
|
/* only first wm in list has ghostwins */
|
|
|
|
for(win= wm->windows.first; win; win= win->next) {
|
|
|
|
for(oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
|
|
|
|
|
|
|
|
if(oldwin->winid == win->winid ) {
|
|
|
|
win->ghostwin= oldwin->ghostwin;
|
|
|
|
oldwin->ghostwin= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-21 12:43:34 +00:00
|
|
|
wm_close_and_free_all(C, oldwmlist);
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-20 15:22:56 +00:00
|
|
|
#ifdef WITH_VERSE
|
2007-12-24 18:27:28 +00:00
|
|
|
static void verse_unsub(void)
|
|
|
|
{
|
|
|
|
extern ListBase session_list;
|
2006-08-20 15:22:56 +00:00
|
|
|
struct VerseSession *session;
|
|
|
|
struct VNode *vnode;
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2006-08-20 15:22:56 +00:00
|
|
|
session = session_list.first;
|
|
|
|
while(session) {
|
|
|
|
vnode = session->nodes.lb.first;
|
|
|
|
while(vnode) {
|
|
|
|
switch(vnode->type) {
|
|
|
|
case V_NT_OBJECT:
|
2008-01-08 16:17:26 +00:00
|
|
|
//XXX unsubscribe_from_obj_node(vnode);
|
2006-08-20 15:22:56 +00:00
|
|
|
break;
|
|
|
|
case V_NT_GEOMETRY:
|
2008-01-08 16:17:26 +00:00
|
|
|
//XXX unsubscribe_from_geom_node(vnode);
|
2006-08-20 15:22:56 +00:00
|
|
|
break;
|
|
|
|
case V_NT_BITMAP:
|
2008-01-08 16:17:26 +00:00
|
|
|
//XXX unsubscribe_from_bitmap_node(vnode);
|
2006-08-20 15:22:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
vnode = vnode->next;
|
|
|
|
}
|
|
|
|
session = session->next;
|
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
}
|
2006-08-20 15:22:56 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
void WM_read_file(bContext *C, char *name, ReportList *reports)
|
2007-12-24 18:27:28 +00:00
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
#ifdef WITH_VERSE
|
|
|
|
verse_unsub(); /* bad call here (ton) */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* first try to append data from exotic file formats... */
|
2006-06-21 11:50:57 +00:00
|
|
|
/* it throws error box when file doesnt exist and returns -1 */
|
2008-12-19 18:28:37 +00:00
|
|
|
/* note; it should set some error message somewhere... (ton) */
|
2006-06-21 11:50:57 +00:00
|
|
|
retval= BKE_read_exotic(name);
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* we didn't succeed, now try to read Blender file */
|
2006-06-21 11:50:57 +00:00
|
|
|
if (retval== 0) {
|
2007-12-24 18:27:28 +00:00
|
|
|
ListBase wmbase;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* put aside screens to match with persistant windows later */
|
|
|
|
wm_window_match_init(C, &wmbase);
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
retval= BKE_read_file(C, name, NULL, reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* match the read WM with current WM */
|
|
|
|
wm_window_match_do(C, &wmbase);
|
|
|
|
|
|
|
|
// XXX mainwindow_set_filename_to_title(G.main->name);
|
|
|
|
// countall(); <-- will be listener
|
|
|
|
// XXX sound_initialize_sounds();
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// winqueue_break= 1; /* leave queues everywhere */
|
|
|
|
|
2008-01-08 16:17:26 +00:00
|
|
|
// XXX if(retval==2) init_userdef_themes(); // in case a userdef is read from regular .blend
|
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
|
|
|
|
2007-11-24 17:08:40 +00:00
|
|
|
if (retval!=0) G.relbase_valid = 1;
|
2006-08-20 14:41:13 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX undo_editmode_clear();
|
2004-11-07 16:49:46 +00:00
|
|
|
BKE_reset_undo();
|
2007-12-24 18:27:28 +00:00
|
|
|
BKE_write_undo(C, "original"); /* save current state */
|
2006-08-16 18:14:42 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// refresh_interface_font();
|
2004-11-07 16:49:46 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
// else if(retval==1)
|
|
|
|
// XXX BIF_undo_push("Import file");
|
2008-12-29 13:38:08 +00:00
|
|
|
else if(retval == -1) {
|
|
|
|
if(reports && reports->list.first == NULL)
|
|
|
|
BKE_report(reports, RPT_ERROR, "Cannot read file.");
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-07-04 12:10:37 +00:00
|
|
|
static void outliner_242_patch(void)
|
|
|
|
{
|
|
|
|
ScrArea *sa;
|
|
|
|
|
2007-12-29 16:43:45 +00:00
|
|
|
// XXX
|
|
|
|
if(G.curscreen==NULL) return;
|
2006-07-04 12:10:37 +00:00
|
|
|
for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
for(; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_OOPS) {
|
|
|
|
SpaceOops *soops= (SpaceOops *)sl;
|
|
|
|
if(soops->type!=SO_OUTLINER) {
|
|
|
|
soops->type= SO_OUTLINER;
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX init_v2d_oops(sa, soops);
|
2006-07-04 12:10:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-07-05 09:35:05 +00:00
|
|
|
G.fileflags |= G_FILE_GAME_MAT;
|
2006-07-04 12:10:37 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* called on startup, (context entirely filled with NULLs) */
|
|
|
|
/* or called for 'Erase All' */
|
|
|
|
int WM_read_homefile(bContext *C, int from_memory)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2007-12-24 18:27:28 +00:00
|
|
|
ListBase wmbase;
|
2002-10-12 11:37:38 +00:00
|
|
|
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
|
|
|
|
char *home= BLI_gethome();
|
2003-05-09 12:48:21 +00:00
|
|
|
int success;
|
2005-06-10 13:12:59 +00:00
|
|
|
|
|
|
|
BLI_clean(home);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
free_ttfont(); /* still weird... what does it here? */
|
2006-07-04 12:10:37 +00:00
|
|
|
|
2006-08-20 14:41:13 +00:00
|
|
|
G.relbase_valid = 0;
|
2007-03-02 18:15:41 +00:00
|
|
|
if (!from_memory) BLI_make_file_string(G.sce, tstr, home, ".B.blend");
|
2007-12-24 18:27:28 +00:00
|
|
|
strcpy(scestr, G.sce); /* temporary store */
|
2004-12-04 17:52:44 +00:00
|
|
|
|
|
|
|
/* prevent loading no UI */
|
|
|
|
G.fileflags &= ~G_FILE_NO_UI;
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* put aside screens to match with persistant windows later */
|
|
|
|
wm_window_match_init(C, &wmbase);
|
|
|
|
|
2007-03-02 18:15:41 +00:00
|
|
|
if (!from_memory && BLI_exists(tstr)) {
|
2008-12-29 13:38:08 +00:00
|
|
|
success = BKE_read_file(C, tstr, NULL, NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
} else {
|
2008-12-29 13:38:08 +00:00
|
|
|
success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL, NULL);
|
2006-07-04 12:10:37 +00:00
|
|
|
/* outliner patch for 2.42 .b.blend */
|
|
|
|
outliner_242_patch();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2007-12-24 18:27:28 +00:00
|
|
|
|
|
|
|
/* match the read WM with current WM */
|
|
|
|
wm_window_match_do(C, &wmbase);
|
|
|
|
|
|
|
|
strcpy(G.sce, scestr); /* restore */
|
2006-05-11 17:58:23 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
init_userdef_themes();
|
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
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* XXX */
|
|
|
|
G.save_over = 0; // start with save preference untitled.blend
|
|
|
|
G.fileflags &= ~G_FILE_AUTOPLAY; /* disable autoplay in .B.blend... */
|
|
|
|
// mainwindow_set_filename_to_title(""); // empty string re-initializes title to "Blender"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
#ifdef INTERNATIONAL
|
|
|
|
// XXX read_languagefile();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// refresh_interface_font();
|
|
|
|
|
|
|
|
// undo_editmode_clear();
|
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
|
|
|
BKE_reset_undo();
|
2007-12-24 18:27:28 +00:00
|
|
|
BKE_write_undo(C, "original"); /* save current state */
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE])
|
|
|
|
{
|
|
|
|
char pidstr[32];
|
2007-09-04 15:53:22 +00:00
|
|
|
#ifdef WIN32
|
2007-04-16 07:01:51 +00:00
|
|
|
char subdir[9];
|
|
|
|
char savedir[FILE_MAXDIR];
|
2007-09-04 15:53:22 +00:00
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
sprintf(pidstr, "%d.blend", abs(getpid()));
|
2007-04-16 07:01:51 +00:00
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
if (!BLI_exists(U.tempdir)) {
|
|
|
|
BLI_strncpy(subdir, "autosave", sizeof(subdir));
|
|
|
|
BLI_make_file_string("/", savedir, BLI_gethome(), subdir);
|
|
|
|
|
|
|
|
/* create a new autosave dir
|
|
|
|
* function already checks for existence or not */
|
|
|
|
BLI_recurdir_fileops(savedir);
|
|
|
|
|
|
|
|
BLI_make_file_string("/", buf, savedir, pidstr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_make_file_string("/", buf, U.tempdir, pidstr);
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
void WM_read_autosavefile(bContext *C)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2007-01-18 20:06:48 +00:00
|
|
|
char tstr[FILE_MAX], scestr[FILE_MAX];
|
2002-10-12 11:37:38 +00:00
|
|
|
int save_over;
|
|
|
|
|
2007-01-18 20:06:48 +00:00
|
|
|
BLI_strncpy(scestr, G.sce, FILE_MAX); /* temporal store */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
get_autosave_location(tstr);
|
|
|
|
|
|
|
|
save_over = G.save_over;
|
2008-12-29 13:38:08 +00:00
|
|
|
BKE_read_file(C, tstr, NULL, NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
G.save_over = save_over;
|
2007-01-18 20:06:48 +00:00
|
|
|
BLI_strncpy(G.sce, scestr, FILE_MAX);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
void read_Blog(void)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2007-01-19 20:33:00 +00:00
|
|
|
char name[FILE_MAX], filename[FILE_MAX];
|
2002-10-12 11:37:38 +00:00
|
|
|
LinkNode *l, *lines;
|
2006-05-30 13:38:22 +00:00
|
|
|
struct RecentFile *recent;
|
2006-05-14 19:42:48 +00:00
|
|
|
char *line;
|
|
|
|
int num;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
BLI_make_file_string("/", name, BLI_gethome(), ".Blog");
|
|
|
|
lines= BLI_read_file_as_lines(name);
|
|
|
|
|
2006-05-30 13:38:22 +00:00
|
|
|
G.recent_files.first = G.recent_files.last = NULL;
|
|
|
|
|
|
|
|
/* read list of recent opend files from .Blog to memory */
|
2007-03-18 03:30:24 +00:00
|
|
|
for (l= lines, num= 0; l && (num<U.recent_files); l= l->next, num++) {
|
2006-05-14 19:42:48 +00:00
|
|
|
line = l->link;
|
|
|
|
if (!BLI_streq(line, "")) {
|
2007-01-19 20:33:00 +00:00
|
|
|
if (num==0)
|
|
|
|
strcpy(G.sce, line);
|
|
|
|
|
2006-05-30 13:38:22 +00:00
|
|
|
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
|
|
|
|
BLI_addtail(&(G.recent_files), recent);
|
|
|
|
recent->filename = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file");
|
|
|
|
recent->filename[0] = '\0';
|
2007-01-19 20:33:00 +00:00
|
|
|
|
2006-05-30 13:38:22 +00:00
|
|
|
strcpy(recent->filename, line);
|
2006-05-14 19:42:48 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2006-05-15 12:18:47 +00:00
|
|
|
if(G.sce[0] == 0)
|
|
|
|
BLI_make_file_string("/", G.sce, BLI_gethome(), "untitled.blend");
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_free_file_lines(lines);
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
/* Add the drive names to the listing */
|
|
|
|
{
|
|
|
|
__int64 tmp;
|
2006-03-19 16:36:37 +00:00
|
|
|
char folder[MAX_PATH];
|
2002-10-12 11:37:38 +00:00
|
|
|
char tmps[4];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
tmp= GetLogicalDrives();
|
|
|
|
|
|
|
|
for (i=2; i < 26; i++) {
|
|
|
|
if ((tmp>>i) & 1) {
|
|
|
|
tmps[0]='a'+i;
|
|
|
|
tmps[1]=':';
|
|
|
|
tmps[2]='\\';
|
|
|
|
tmps[3]=0;
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XX fsmenu_insert_entry(tmps, 0, 0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2006-03-19 16:36:37 +00:00
|
|
|
|
|
|
|
/* Adding Desktop and My Documents */
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_append_separator();
|
2006-06-12 19:13:17 +00:00
|
|
|
|
|
|
|
SHGetSpecialFolderPath(0, folder, CSIDL_PERSONAL, 0);
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_insert_entry(folder, 0, 0);
|
2006-06-12 19:13:17 +00:00
|
|
|
SHGetSpecialFolderPath(0, folder, CSIDL_DESKTOPDIRECTORY, 0);
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_insert_entry(folder, 0, 0);
|
2006-03-20 17:25:42 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_append_separator();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
|
|
|
|
lines= BLI_read_file_as_lines(name);
|
|
|
|
|
|
|
|
for (l= lines; l; l= l->next) {
|
|
|
|
char *line= l->link;
|
|
|
|
|
|
|
|
if (!BLI_streq(line, "")) {
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_insert_entry(line, 0, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_append_separator();
|
2005-01-07 14:51:55 +00:00
|
|
|
|
|
|
|
/* add last saved file */
|
2006-08-20 14:41:13 +00:00
|
|
|
BLI_split_dirfile(G.sce, name, filename); /* G.sce shouldn't be relative */
|
2005-01-07 14:51:55 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX fsmenu_insert_entry(name, 0, 0);
|
2005-01-07 14:51:55 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_free_file_lines(lines);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void writeBlog(void)
|
|
|
|
{
|
2006-05-30 13:38:22 +00:00
|
|
|
struct RecentFile *recent, *next_recent;
|
2002-10-12 11:37:38 +00:00
|
|
|
char name[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
FILE *fp;
|
2006-05-30 13:38:22 +00:00
|
|
|
int i;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
BLI_make_file_string("/", name, BLI_gethome(), ".Blog");
|
|
|
|
|
2006-05-31 09:54:26 +00:00
|
|
|
recent = G.recent_files.first;
|
|
|
|
/* refresh .Blog of recent opened files, when current file was changed */
|
|
|
|
if(!(recent) || (strcmp(recent->filename, G.sce)!=0)) {
|
|
|
|
fp= fopen(name, "w");
|
|
|
|
if (fp) {
|
|
|
|
/* add current file to the beginning of list */
|
|
|
|
recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
|
|
|
|
recent->filename = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file");
|
|
|
|
recent->filename[0] = '\0';
|
|
|
|
strcpy(recent->filename, G.sce);
|
|
|
|
BLI_addhead(&(G.recent_files), recent);
|
|
|
|
/* write current file to .Blog */
|
|
|
|
fprintf(fp, "%s\n", recent->filename);
|
|
|
|
recent = recent->next;
|
|
|
|
i=1;
|
|
|
|
/* write rest of recent opened files to .Blog */
|
2007-03-18 03:30:24 +00:00
|
|
|
while((i<U.recent_files) && (recent)){
|
2006-05-29 15:30:43 +00:00
|
|
|
/* this prevents to have duplicities in list */
|
2006-05-30 13:38:22 +00:00
|
|
|
if (strcmp(recent->filename, G.sce)!=0) {
|
|
|
|
fprintf(fp, "%s\n", recent->filename);
|
|
|
|
recent = recent->next;
|
2006-05-29 15:30:43 +00:00
|
|
|
}
|
2006-05-30 13:38:22 +00:00
|
|
|
else {
|
|
|
|
next_recent = recent->next;
|
|
|
|
MEM_freeN(recent->filename);
|
|
|
|
BLI_freelinkN(&(G.recent_files), recent);
|
|
|
|
recent = next_recent;
|
|
|
|
}
|
|
|
|
i++;
|
2006-05-29 15:30:43 +00:00
|
|
|
}
|
2006-09-16 11:58:38 +00:00
|
|
|
fclose(fp);
|
2006-05-14 19:42:48 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
static void do_history(char *name, ReportList *reports)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
char tempname1[FILE_MAXDIR+FILE_MAXFILE], tempname2[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
int hisnr= U.versions;
|
|
|
|
|
|
|
|
if(U.versions==0) return;
|
|
|
|
if(strlen(name)<2) return;
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
while(hisnr > 1) {
|
2002-10-12 11:37:38 +00:00
|
|
|
sprintf(tempname1, "%s%d", name, hisnr-1);
|
|
|
|
sprintf(tempname2, "%s%d", name, hisnr);
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
if(BLI_rename(tempname1, tempname2))
|
|
|
|
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
hisnr--;
|
|
|
|
}
|
|
|
|
|
2003-04-30 13:22:26 +00:00
|
|
|
/* is needed when hisnr==1 */
|
2002-10-12 11:37:38 +00:00
|
|
|
sprintf(tempname1, "%s%d", name, hisnr);
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
if(BLI_rename(name, tempname1))
|
|
|
|
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
void WM_write_file(bContext *C, char *target, ReportList *reports)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Library *li;
|
2007-10-21 09:32:18 +00:00
|
|
|
int writeflags, len;
|
|
|
|
char di[FILE_MAX];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2007-10-21 09:32:18 +00:00
|
|
|
len = strlen(target);
|
|
|
|
|
|
|
|
if (len == 0) return;
|
|
|
|
if (len >= FILE_MAX) {
|
2008-12-29 13:38:08 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Path too long, cannot save");
|
2007-10-21 09:32:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-08-17 04:26:00 +00:00
|
|
|
|
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
|
|
|
/* send the OnSave event */
|
2008-12-18 02:56:48 +00:00
|
|
|
// XXX if (G.f & G_DOSCRIPTLINKS) BPY_do_pyscript(&CTX_data_scene(C)->id, SCRIPT_ONSAVE);
|
2004-08-17 04:26:00 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (li= G.main->library.first; li; li= li->id.next) {
|
|
|
|
if (BLI_streq(li->name, target)) {
|
2008-12-29 13:38:08 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Cannot overwrite used library");
|
2002-10-12 11:37:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-21 09:32:18 +00:00
|
|
|
if (!BLO_has_bfile_extension(target) && (len+6 < FILE_MAX)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
sprintf(di, "%s.blend", target);
|
|
|
|
} else {
|
|
|
|
strcpy(di, target);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BLI_exists(di)) {
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX if(!saveover(di))
|
|
|
|
// XXX return;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(G.obedit) {
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX exit_editmode(0); /* 0 = no free data */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if (G.fileflags & G_AUTOPACK) {
|
|
|
|
packAll();
|
|
|
|
}
|
2005-07-25 10:58:21 +00:00
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX waitcursor(1); // exit_editmode sets cursor too
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
do_history(di, reports);
|
Patch provided by Shaul Kedem: Compressed files are back!
He even made a nice doc in wiki:
http://wiki.blender.org/bin/view.pl/Blenderdev/Blendgz
Usage: set the option "Compress File" in the main "File" pulldown menu.
This setting is a user-def, meaning it is not changed on reading files.
If you want it default, save it with CTRL+U.
The longest debate went over the file naming convention. Shaul started
with .blend.gz files, which gave issues in Blender because of the code
hanging out everywhere that detects blender files, and that appends the
.blend extension if needed.
Daniel Dunbar proposed to just save it as .blend, and not bother users
with such details. This is indeed the most elegant solution, with as
only drawback that old Blender executables cannot read it.
This drawback isn't very relevant at the moment, since we're heading
towards a release that isn't upward compatible anyway... the recode
going on on Meshes, Modfiers, Armatures, Poses, Actions, NLA already
have upward compatibility issues.
We might check - during the next month(s) - on a builtin system to
warn users in the future when we change things that make a file risky
to read in an older release.
2005-07-27 19:46:06 +00:00
|
|
|
|
|
|
|
/* we use the UserDef to define compression flag */
|
|
|
|
writeflags= G.fileflags & ~G_FILE_COMPRESS;
|
|
|
|
if(U.flag & USER_FILECOMPRESS)
|
|
|
|
writeflags |= G_FILE_COMPRESS;
|
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
if (BLO_write_file(CTX_data_main(C), di, writeflags, reports)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
strcpy(G.sce, di);
|
2006-08-20 14:41:13 +00:00
|
|
|
G.relbase_valid = 1;
|
2003-12-08 13:08:24 +00:00
|
|
|
strcpy(G.main->name, di); /* is guaranteed current file */
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX mainwindow_set_filename_to_title(G.main->name);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
G.save_over = 1;
|
|
|
|
|
|
|
|
writeBlog();
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
// XXX waitcursor(0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
/* operator entry */
|
|
|
|
int WM_write_homefile(bContext *C, wmOperator *op)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2008-12-19 00:50:21 +00:00
|
|
|
char tstr[FILE_MAXDIR+FILE_MAXFILE];
|
2002-10-12 11:37:38 +00:00
|
|
|
int write_flags;
|
|
|
|
|
2008-12-30 21:28:27 +00:00
|
|
|
BLI_make_file_string("/", tstr, BLI_gethome(), ".B.blend");
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-04-20 19:12:48 +00:00
|
|
|
/* force save as regular blend file */
|
2002-10-12 11:37:38 +00:00
|
|
|
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
|
2008-12-19 00:50:21 +00:00
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
BLO_write_file(CTX_data_main(C), tstr, write_flags, op->reports);
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2008-12-08 16:43:19 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 18:27:28 +00:00
|
|
|
void WM_write_autosave(bContext *C)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2008-12-19 00:50:21 +00:00
|
|
|
char tstr[FILE_MAXDIR+FILE_MAXFILE];
|
2002-10-12 11:37:38 +00:00
|
|
|
int write_flags;
|
|
|
|
|
|
|
|
get_autosave_location(tstr);
|
|
|
|
|
|
|
|
/* force save as regular blend file */
|
|
|
|
write_flags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_LOCK | G_FILE_SIGN);
|
2008-12-19 00:50:21 +00:00
|
|
|
|
2008-12-29 13:38:08 +00:00
|
|
|
/* error reporting to console */
|
|
|
|
BLO_write_file(CTX_data_main(C), tstr, write_flags, NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/* if global undo; remove tempsave, otherwise rename */
|
2007-12-24 18:27:28 +00:00
|
|
|
void delete_autosave(void)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2003-11-25 17:36:37 +00:00
|
|
|
char tstr[FILE_MAXDIR+FILE_MAXFILE];
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-11-25 17:36:37 +00:00
|
|
|
get_autosave_location(tstr);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (BLI_exists(tstr)) {
|
|
|
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
BLI_make_file_string("/", str, U.tempdir, "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
|
|
|
|
|
|
|
if(U.uiflag & USER_GLOBALUNDO) BLI_delete(tstr, 0, 0);
|
|
|
|
else BLI_rename(tstr, str);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|