2003-04-26 18:01:01 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +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
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +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.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2004-06-23 18:22:51 +00:00
|
|
|
*
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-27 21:31:44 +00:00
|
|
|
#include "zlib.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
#include "winsock2.h"
|
|
|
|
#include "BLI_winstuff.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h> // for printf fopen fwrite fclose sprintf FILE
|
|
|
|
#include <stdlib.h> // for getenv atoi
|
|
|
|
#include <fcntl.h> // for open
|
2005-04-02 15:36:57 +00:00
|
|
|
#include <string.h> // for strrchr strncmp strstr
|
2004-04-24 20:04:37 +00:00
|
|
|
#include <math.h> // for fabs
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
#ifndef WIN32
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <unistd.h> // for read close
|
|
|
|
#include <sys/param.h> // for MAXPATHLEN
|
|
|
|
#else
|
|
|
|
#include <io.h> // for open close read
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "nla.h"
|
|
|
|
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_action_types.h"
|
|
|
|
#include "DNA_armature_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_ID.h"
|
|
|
|
#include "DNA_actuator_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_camera_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_controller_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
|
|
|
#include "DNA_effect_types.h"
|
|
|
|
#include "DNA_fileglobal_types.h"
|
|
|
|
#include "DNA_group_types.h"
|
|
|
|
#include "DNA_ipo_types.h"
|
|
|
|
#include "DNA_image_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_key_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_lattice_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_lamp_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_meta_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2004-03-20 22:55:42 +00:00
|
|
|
#include "DNA_meshdata_types.h"
|
2005-07-19 20:14:17 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_nla_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_object_force.h"
|
2005-09-18 13:27:12 +00:00
|
|
|
#include "DNA_object_fluidsim.h" // NT
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_oops_types.h"
|
|
|
|
#include "DNA_object_force.h"
|
|
|
|
#include "DNA_packedFile_types.h"
|
|
|
|
#include "DNA_property_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_text_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_sensor_types.h"
|
|
|
|
#include "DNA_sdna_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_sequence_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_sound_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_texture_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "DNA_userdef_types.h"
|
2005-05-02 13:28:13 +00:00
|
|
|
#include "DNA_vfont_types.h"
|
|
|
|
#include "DNA_world_types.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#include "BLI_blenlib.h"
|
2004-09-13 06:57:24 +00:00
|
|
|
#include "BLI_arithb.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_storage_types.h" // for relname flags
|
|
|
|
|
|
|
|
#include "BKE_bad_level_calls.h" // for reopen_text build_seqar (from WHILE_SEQ) open_plugin_seq set_rects_butspace check_imasel_copy
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_action.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_armature.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_constraint.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_curve.h"
|
2005-04-16 14:01:49 +00:00
|
|
|
#include "BKE_deform.h"
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
#include "BKE_depsgraph.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_effect.h" // for give_parteff
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_global.h" // for G
|
|
|
|
#include "BKE_property.h" // for get_property
|
2005-08-15 10:30:53 +00:00
|
|
|
#include "BKE_lattice.h"
|
2004-06-23 18:22:51 +00:00
|
|
|
#include "BKE_library.h" // for wich_libbase
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_main.h" // for Main
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_mesh.h" // for ME_ defines (patching)
|
2005-07-20 04:14:21 +00:00
|
|
|
#include "BKE_modifier.h"
|
2004-09-13 06:57:24 +00:00
|
|
|
#include "BKE_object.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_sca.h" // for init_actuator
|
2004-09-13 06:57:24 +00:00
|
|
|
#include "BKE_scene.h"
|
2005-04-02 13:57:23 +00:00
|
|
|
#include "BKE_softbody.h" // sbNew()
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BKE_texture.h" // for open_plugin_tex
|
|
|
|
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Another huge commit!!!
First, check on the new files, which are listed below.
The new butspace.h is a local include, only to be used for the buttons
drawn in the buttonswindow.
- editbuts, animbuts, gamebuts, displaybuts, paintbuts, work now
- i quite completely reorganized it, it's now nicely telling you what
context it is in
- sorting error in panel align fixed (tabs were flipping)
- align works correctly automatic when you click around in Blender
- editsca.c renamed to buttons_logic.h
- button names are truncated from the right for allmost all buttons
(except text buttons and number buttons)
- while dragging panels, you cannot move them outside window anymore
And of course fixed loads of little bugs I encountered while testing
it all. This is a version I really need good test & feedback for.
Next step: restoring material/lamp/texture/world
2003-10-10 17:29:01 +00:00
|
|
|
#include "BIF_butspace.h" // for do_versions, patching event codes
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLO_readfile.h"
|
2004-09-05 13:43:51 +00:00
|
|
|
#include "BLO_undofile.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BLO_readblenfile.h" // streaming read pipe, for BLO_readblenfile BLO_readblenfilememory
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "readfile.h"
|
|
|
|
|
|
|
|
#include "genfile.h"
|
|
|
|
|
|
|
|
#include "mydevice.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "blendef.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
|
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
|
|
|
#include <errno.h>
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/*
|
2003-04-26 18:01:01 +00:00
|
|
|
Remark: still a weak point is the newadress() function, that doesnt solve reading from
|
|
|
|
multiple files at the same time
|
|
|
|
|
|
|
|
(added remark: oh, i thought that was solved? will look at that... (ton)
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
READ
|
|
|
|
- Existing Library (Main) push or free
|
|
|
|
- allocate new Main
|
2002-10-12 11:37:38 +00:00
|
|
|
- load file
|
|
|
|
- read SDNA
|
|
|
|
- for each LibBlock
|
|
|
|
- read LibBlock
|
2003-04-26 18:01:01 +00:00
|
|
|
- if a Library
|
2002-10-12 11:37:38 +00:00
|
|
|
- make a new Main
|
2003-04-26 18:01:01 +00:00
|
|
|
- attach ID's to it
|
2004-06-23 18:22:51 +00:00
|
|
|
- else
|
2003-04-26 18:01:01 +00:00
|
|
|
- read associated 'direct data'
|
|
|
|
- link direct data (internal and to LibBlock)
|
|
|
|
- read FileGlobal
|
|
|
|
- read USER data, only when indicated (file is ~/.B.blend)
|
|
|
|
- free file
|
|
|
|
- per Library (per Main)
|
|
|
|
- read file
|
|
|
|
- read SDNA
|
|
|
|
- find LibBlocks and attach IDs to Main
|
|
|
|
- if external LibBlock
|
2004-06-23 18:22:51 +00:00
|
|
|
- search all Main's
|
2003-04-26 18:01:01 +00:00
|
|
|
- or it's already read,
|
|
|
|
- or not read yet
|
|
|
|
- or make new Main
|
2002-10-12 11:37:38 +00:00
|
|
|
- per LibBlock
|
2003-04-26 18:01:01 +00:00
|
|
|
- read recursive
|
|
|
|
- read associated direct data
|
|
|
|
- link direct data (internal and to LibBlock)
|
|
|
|
- free file
|
|
|
|
- per Library with unread LibBlocks
|
|
|
|
- read file
|
|
|
|
- read SDNA
|
2002-10-12 11:37:38 +00:00
|
|
|
- per LibBlock
|
2003-04-26 18:01:01 +00:00
|
|
|
- read recursive
|
|
|
|
- read associated direct data
|
|
|
|
- link direct data (internal and to LibBlock)
|
|
|
|
- free file
|
|
|
|
- join all Mains
|
|
|
|
- link all LibBlocks and indirect pointers to libblocks
|
|
|
|
- initialize FileGlobal and copy pointers to Global
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* also occurs in library.c */
|
|
|
|
/* GS reads the memory pointed at in a specific ordering. There are,
|
|
|
|
* however two definitions for it. I have jotted them down here, both,
|
|
|
|
* but I think the first one is actually used. The thing is that
|
|
|
|
* big-endian systems might read this the wrong way round. OTOH, we
|
|
|
|
* constructed the IDs that are read out with this macro explicitly as
|
|
|
|
* well. I expect we'll sort it out soon... */
|
|
|
|
|
|
|
|
/* from blendef: */
|
|
|
|
#define GS(a) (*((short *)(a)))
|
|
|
|
|
|
|
|
/* from misc_util: flip the bytes from x */
|
|
|
|
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
|
|
|
|
|
|
|
|
// only used here in readfile.c
|
|
|
|
#define SWITCH_LONGINT(a) { \
|
|
|
|
char s_i, *p_i; \
|
|
|
|
p_i= (char *)&(a); \
|
|
|
|
s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \
|
|
|
|
s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \
|
|
|
|
s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \
|
|
|
|
s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; }
|
|
|
|
// only used here in readfile.c
|
|
|
|
#define SWITCH_SHORT(a) { \
|
|
|
|
char s_i, *p_i; \
|
|
|
|
p_i= (char *)&(a); \
|
|
|
|
s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
|
|
|
|
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
|
|
|
typedef struct OldNew {
|
|
|
|
void *old, *newp;
|
|
|
|
int nr;
|
|
|
|
} OldNew;
|
|
|
|
|
|
|
|
typedef struct OldNewMap {
|
|
|
|
OldNew *entries;
|
|
|
|
int nentries, entriessize;
|
2005-12-15 18:42:02 +00:00
|
|
|
int sorted;
|
2002-10-12 11:37:38 +00:00
|
|
|
int lasthit;
|
|
|
|
} OldNewMap;
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
|
|
|
|
/* local prototypes */
|
|
|
|
extern short freeN(void *vmemh); /* defined in util.h */
|
|
|
|
|
|
|
|
|
2005-12-13 19:21:56 +00:00
|
|
|
static OldNewMap *oldnewmap_new(void)
|
|
|
|
{
|
2005-12-16 17:35:38 +00:00
|
|
|
OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap");
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
onm->entriessize= 1024;
|
|
|
|
onm->entries= MEM_mallocN(sizeof(*onm->entries)*onm->entriessize, "OldNewMap.entries");
|
2005-12-16 17:35:38 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return onm;
|
|
|
|
}
|
|
|
|
|
2005-12-15 18:42:02 +00:00
|
|
|
static int verg_oldnewmap(const void *v1, const void *v2)
|
|
|
|
{
|
|
|
|
const struct OldNew *x1=v1, *x2=v2;
|
|
|
|
|
|
|
|
if( x1->old > x2->old) return 1;
|
|
|
|
else if( x1->old < x2->old) return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void oldnewmap_sort(FileData *fd)
|
|
|
|
{
|
|
|
|
qsort(fd->libmap->entries, fd->libmap->nentries, sizeof(OldNew), verg_oldnewmap);
|
|
|
|
fd->libmap->sorted= 1;
|
|
|
|
}
|
|
|
|
|
2005-12-14 23:00:01 +00:00
|
|
|
/* nr is zero for data, and ID code for libdata */
|
2005-12-13 19:21:56 +00:00
|
|
|
static void oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int nr)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
OldNew *entry;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
if(oldaddr==NULL || newaddr==NULL) return;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (onm->nentries==onm->entriessize) {
|
|
|
|
int osize= onm->entriessize;
|
|
|
|
OldNew *oentries= onm->entries;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
onm->entriessize*= 2;
|
|
|
|
onm->entries= MEM_mallocN(sizeof(*onm->entries)*onm->entriessize, "OldNewMap.entries");
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
memcpy(onm->entries, oentries, sizeof(*oentries)*osize);
|
|
|
|
MEM_freeN(oentries);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
entry= &onm->entries[onm->nentries++];
|
|
|
|
entry->old= oldaddr;
|
|
|
|
entry->newp= newaddr;
|
|
|
|
entry->nr= nr;
|
|
|
|
}
|
|
|
|
|
2005-12-13 19:21:56 +00:00
|
|
|
static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
int i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (onm->lasthit<onm->nentries-1) {
|
|
|
|
OldNew *entry= &onm->entries[++onm->lasthit];
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (entry->old==addr) {
|
|
|
|
entry->nr++;
|
|
|
|
return entry->newp;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<onm->nentries; i++) {
|
|
|
|
OldNew *entry= &onm->entries[i];
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (entry->old==addr) {
|
|
|
|
onm->lasthit= i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
entry->nr++;
|
|
|
|
return entry->newp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-12-15 18:42:02 +00:00
|
|
|
/* for libdate, nr has ID code, no increment */
|
|
|
|
static void *oldnewmap_liblookup(OldNewMap *onm, void *addr, void *lib)
|
2005-12-13 19:21:56 +00:00
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
int i;
|
2005-12-13 19:21:56 +00:00
|
|
|
|
2005-12-15 18:42:02 +00:00
|
|
|
if(addr==NULL) return NULL;
|
|
|
|
|
|
|
|
/* lasthit works fine for non-libdata, linking there is done in same sequence as writing */
|
|
|
|
if(onm->sorted) {
|
|
|
|
OldNew entry_s, *entry;
|
|
|
|
|
|
|
|
entry_s.old= addr;
|
|
|
|
|
|
|
|
entry= bsearch(&entry_s, onm->entries, onm->nentries, sizeof(OldNew), verg_oldnewmap);
|
|
|
|
if(entry) {
|
2002-10-12 11:37:38 +00:00
|
|
|
ID *id= entry->newp;
|
2005-12-15 18:42:02 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (id && (!lib || id->lib)) {
|
|
|
|
return entry->newp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-12-15 18:42:02 +00:00
|
|
|
|
2005-12-14 23:00:01 +00:00
|
|
|
for (i=0; i<onm->nentries; i++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
OldNew *entry= &onm->entries[i];
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (entry->old==addr) {
|
|
|
|
ID *id= entry->newp;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (id && (!lib || id->lib)) {
|
|
|
|
return entry->newp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-12-13 19:21:56 +00:00
|
|
|
static void oldnewmap_free_unused(OldNewMap *onm)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
int i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<onm->nentries; i++) {
|
|
|
|
OldNew *entry= &onm->entries[i];
|
|
|
|
if (entry->nr==0) {
|
|
|
|
MEM_freeN(entry->newp);
|
|
|
|
entry->newp= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-13 19:21:56 +00:00
|
|
|
static void oldnewmap_clear(OldNewMap *onm)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
onm->nentries= 0;
|
|
|
|
onm->lasthit= 0;
|
|
|
|
}
|
|
|
|
|
2005-12-13 19:21:56 +00:00
|
|
|
static void oldnewmap_free(OldNewMap *onm)
|
|
|
|
{
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(onm->entries);
|
|
|
|
MEM_freeN(onm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
|
|
|
static void read_libraries(FileData *basefd, ListBase *mainlist);
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* ************ help functions ***************** */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
static void add_main_to_main(Main *mainvar, Main *from)
|
|
|
|
{
|
2004-04-22 19:58:54 +00:00
|
|
|
ListBase *lbarray[100], *fromarray[100]; // define in library.c too
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
a= set_listbasepointers(mainvar, lbarray);
|
|
|
|
a= set_listbasepointers(from, fromarray);
|
|
|
|
while(a--) {
|
|
|
|
addlisttolist(lbarray[a], fromarray[a]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void blo_join_main(ListBase *mainlist)
|
|
|
|
{
|
2002-12-20 02:08:46 +00:00
|
|
|
Main *tojoin, *mainl= mainlist->first;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-03-25 18:17:40 +00:00
|
|
|
while ((tojoin= mainl->next)) {
|
2002-12-20 02:08:46 +00:00
|
|
|
add_main_to_main(mainl, tojoin);
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_remlink(mainlist, tojoin);
|
|
|
|
MEM_freeN(tojoin);
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void split_libdata(ListBase *lb, Main *first)
|
|
|
|
{
|
|
|
|
ListBase *lbn;
|
|
|
|
ID *id, *idnext;
|
|
|
|
Main *mainvar;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
id= lb->first;
|
|
|
|
while(id) {
|
|
|
|
idnext= id->next;
|
|
|
|
if(id->lib) {
|
|
|
|
mainvar= first;
|
|
|
|
while(mainvar) {
|
|
|
|
if(mainvar->curlib==id->lib) {
|
|
|
|
lbn= wich_libbase(mainvar, GS(id->name));
|
|
|
|
BLI_remlink(lb, id);
|
|
|
|
BLI_addtail(lbn, id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
mainvar= mainvar->next;
|
|
|
|
}
|
|
|
|
if(mainvar==0) printf("error split_libdata\n");
|
|
|
|
}
|
|
|
|
id= idnext;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void blo_split_main(ListBase *mainlist)
|
|
|
|
{
|
2002-12-20 02:08:46 +00:00
|
|
|
Main *mainl= mainlist->first;
|
2002-10-12 11:37:38 +00:00
|
|
|
ListBase *lbarray[30];
|
|
|
|
Library *lib;
|
|
|
|
int i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-12-20 02:08:46 +00:00
|
|
|
for (lib= mainl->library.first; lib; lib= lib->id.next) {
|
2005-05-26 13:17:12 +00:00
|
|
|
Main *libmain= MEM_callocN(sizeof(Main), "libmain");
|
2002-10-12 11:37:38 +00:00
|
|
|
libmain->curlib= lib;
|
|
|
|
BLI_addtail(mainlist, libmain);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-12-20 02:08:46 +00:00
|
|
|
i= set_listbasepointers(mainl, lbarray);
|
2002-10-12 11:37:38 +00:00
|
|
|
while(i--)
|
2002-12-20 02:08:46 +00:00
|
|
|
split_libdata(lbarray[i], mainl->next);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-12-14 13:21:32 +00:00
|
|
|
static void cleanup_path(const char *relabase, char *name)
|
|
|
|
{
|
|
|
|
char filename[FILE_MAXFILE];
|
|
|
|
|
|
|
|
BLI_splitdirstring(name, filename);
|
|
|
|
BLI_cleanup_dir(relabase, name);
|
|
|
|
strcat(name, filename);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static Main *blo_find_main(ListBase *mainlist, char *name)
|
|
|
|
{
|
|
|
|
Main *m;
|
|
|
|
Library *lib;
|
2004-06-23 18:48:55 +00:00
|
|
|
char name1[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
char libname1[FILE_MAXDIR+FILE_MAXFILE];
|
2005-12-14 09:59:22 +00:00
|
|
|
|
|
|
|
// printf("G.sce %s\n", G.sce);
|
2005-12-14 13:21:32 +00:00
|
|
|
/* everything in absolute paths now */
|
|
|
|
|
2004-06-23 18:48:55 +00:00
|
|
|
strcpy(name1, name);
|
2005-12-14 13:21:32 +00:00
|
|
|
cleanup_path(G.sce, name1);
|
|
|
|
// printf("original in %s\n", name);
|
|
|
|
// printf("converted in %s\n", name1);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (m= mainlist->first; m; m= m->next) {
|
|
|
|
char *libname= (m->curlib)?m->curlib->name:m->name;
|
2004-06-23 18:48:55 +00:00
|
|
|
|
2005-12-14 09:59:22 +00:00
|
|
|
// printf("libname %s\n", libname);
|
2004-06-23 18:48:55 +00:00
|
|
|
strcpy(libname1, libname);
|
2005-12-14 13:21:32 +00:00
|
|
|
cleanup_path(G.sce, libname1);
|
2005-12-14 09:59:22 +00:00
|
|
|
// printf("libname1 %s\n", libname1, name1);
|
2004-06-23 18:48:55 +00:00
|
|
|
|
2005-12-14 13:21:32 +00:00
|
|
|
if (BLI_streq(name1, libname1)) {
|
|
|
|
printf("found library %s\n", libname);
|
2002-10-12 11:37:38 +00:00
|
|
|
return m;
|
2005-12-14 13:21:32 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2005-05-26 13:17:12 +00:00
|
|
|
m= MEM_callocN(sizeof(Main), "find_main");
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_addtail(mainlist, m);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib= alloc_libblock(&m->library, ID_LI, "lib");
|
|
|
|
strcpy(lib->name, name);
|
|
|
|
m->curlib= lib;
|
2005-12-14 09:59:22 +00:00
|
|
|
|
2005-12-14 13:21:32 +00:00
|
|
|
printf("added new lib %s\n", name);
|
2002-10-12 11:37:38 +00:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************ FILE PARSING ****************** */
|
|
|
|
|
|
|
|
static void switch_endian_bh4(BHead4 *bhead)
|
|
|
|
{
|
2003-04-26 18:01:01 +00:00
|
|
|
/* the ID_.. codes */
|
2002-10-12 11:37:38 +00:00
|
|
|
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
|
|
|
|
|
|
|
if (bhead->code != ENDB) {
|
|
|
|
SWITCH_INT(bhead->len);
|
|
|
|
SWITCH_INT(bhead->SDNAnr);
|
|
|
|
SWITCH_INT(bhead->nr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void switch_endian_bh8(BHead8 *bhead)
|
|
|
|
{
|
2003-04-26 18:01:01 +00:00
|
|
|
/* the ID_.. codes */
|
2002-10-12 11:37:38 +00:00
|
|
|
if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
|
|
|
|
|
|
|
|
if (bhead->code != ENDB) {
|
|
|
|
SWITCH_INT(bhead->len);
|
|
|
|
SWITCH_INT(bhead->SDNAnr);
|
|
|
|
SWITCH_INT(bhead->nr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
|
|
|
|
{
|
|
|
|
BHead4 *bhead4 = (BHead4 *) bhead;
|
2003-05-24 20:04:37 +00:00
|
|
|
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
2002-10-12 11:37:38 +00:00
|
|
|
__int64 old;
|
|
|
|
#else
|
|
|
|
long long old;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bhead4->code= bhead8->code;
|
|
|
|
bhead4->len= bhead8->len;
|
|
|
|
|
|
|
|
if (bhead4->code != ENDB) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// why is this here ??
|
|
|
|
if (do_endian_swap) {
|
|
|
|
SWITCH_LONGINT(bhead8->old);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* this patch is to avoid a long long being read from not-eight aligned positions
|
|
|
|
is necessary on SGI with -n32 compiling (no, is necessary on
|
|
|
|
any modern 64bit architecture) */
|
|
|
|
memcpy(&old, &bhead8->old, 8);
|
|
|
|
bhead4->old = (int) (old >> 3);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bhead4->SDNAnr= bhead8->SDNAnr;
|
|
|
|
bhead4->nr= bhead8->nr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4)
|
|
|
|
{
|
|
|
|
BHead8 *bhead8 = (BHead8 *) bhead;
|
|
|
|
|
|
|
|
bhead8->code= bhead4->code;
|
|
|
|
bhead8->len= bhead4->len;
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
if (bhead8->code != ENDB) {
|
2002-10-12 11:37:38 +00:00
|
|
|
bhead8->old= bhead4->old;
|
|
|
|
bhead8->SDNAnr= bhead4->SDNAnr;
|
|
|
|
bhead8->nr= bhead4->nr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static BHeadN *get_bhead(FileData *fd)
|
|
|
|
{
|
|
|
|
BHead8 bhead8;
|
|
|
|
BHead4 bhead4;
|
|
|
|
BHead bhead;
|
|
|
|
BHeadN *new_bhead = 0;
|
|
|
|
int readsize;
|
|
|
|
|
|
|
|
if (fd) {
|
|
|
|
if ( ! fd->eof) {
|
|
|
|
|
|
|
|
// First read the bhead structure.
|
|
|
|
// Depending on the platform the file was written on this can
|
|
|
|
// be a big or little endian BHead4 or BHead8 structure.
|
|
|
|
|
|
|
|
// As usual 'ENDB' (the last *partial* bhead of the file)
|
|
|
|
// needs some special handling. We don't want to EOF just yet.
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->flags & FD_FLAGS_FILE_POINTSIZE_IS_4) {
|
|
|
|
bhead4.code = DATA;
|
|
|
|
readsize = fd->read(fd, &bhead4, sizeof(bhead4));
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
if (readsize == sizeof(bhead4) || bhead4.code == ENDB) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
switch_endian_bh4(&bhead4);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
|
|
|
|
bh8_from_bh4(&bhead, &bhead4);
|
|
|
|
} else {
|
|
|
|
memcpy(&bhead, &bhead4, sizeof(bhead));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fd->eof = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
bhead8.code = DATA;
|
|
|
|
readsize = fd->read(fd, &bhead8, sizeof(bhead8));
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (readsize == sizeof(bhead8) || bhead8.code == ENDB) {
|
|
|
|
if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
switch_endian_bh8(&bhead8);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
|
|
|
|
bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN));
|
|
|
|
} else {
|
|
|
|
memcpy(&bhead, &bhead8, sizeof(bhead));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fd->eof = 1;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// bhead now contains the (converted) bhead structure. Now read
|
|
|
|
// the associated data and put everything in a BHeadN (creative naming !)
|
|
|
|
|
|
|
|
if ( ! fd->eof) {
|
|
|
|
new_bhead = MEM_mallocN(sizeof(BHeadN) + bhead.len, "new_bhead");
|
|
|
|
if (new_bhead) {
|
|
|
|
new_bhead->next = new_bhead->prev = 0;
|
|
|
|
new_bhead->bhead = bhead;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
readsize = fd->read(fd, new_bhead + 1, bhead.len);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (readsize != bhead.len) {
|
|
|
|
fd->eof = 1;
|
|
|
|
MEM_freeN(new_bhead);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fd->eof = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
// We've read a new block. Now add it to the list
|
2002-10-12 11:37:38 +00:00
|
|
|
// of blocks.
|
|
|
|
|
|
|
|
if (new_bhead) {
|
|
|
|
BLI_addtail(&fd->listbase, new_bhead);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return(new_bhead);
|
|
|
|
}
|
|
|
|
|
|
|
|
BHead *blo_firstbhead(FileData *fd)
|
|
|
|
{
|
|
|
|
BHeadN *new_bhead;
|
|
|
|
BHead *bhead = 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// Rewind the file
|
|
|
|
// Read in a new block if necessary
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
new_bhead = fd->listbase.first;
|
|
|
|
if (new_bhead == 0) {
|
|
|
|
new_bhead = get_bhead(fd);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (new_bhead) {
|
|
|
|
bhead = &new_bhead->bhead;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return(bhead);
|
|
|
|
}
|
|
|
|
|
|
|
|
BHead *blo_prevbhead(FileData *fd, BHead *thisblock)
|
|
|
|
{
|
|
|
|
BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - (int) (&((BHeadN*)0)->bhead));
|
|
|
|
BHeadN *prev= bheadn->prev;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return prev?&prev->bhead:NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
|
|
|
|
{
|
|
|
|
BHeadN *new_bhead = 0;
|
|
|
|
BHead *bhead = 0;
|
|
|
|
|
|
|
|
if (thisblock) {
|
|
|
|
// bhead is actually a sub part of BHeadN
|
|
|
|
// We calculate the BHeadN pointer from the BHead pointer below
|
|
|
|
new_bhead = (BHeadN *) (((char *) thisblock) - (int) (&((BHeadN*)0)->bhead));
|
|
|
|
|
|
|
|
// get the next BHeadN. If it doesn't exist we read in the next one
|
|
|
|
new_bhead = new_bhead->next;
|
|
|
|
if (new_bhead == 0) {
|
|
|
|
new_bhead = get_bhead(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_bhead) {
|
|
|
|
// here we do the reverse:
|
|
|
|
// go from the BHeadN pointer to the BHead pointer
|
|
|
|
bhead = &new_bhead->bhead;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(bhead);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void decode_blender_header(FileData *fd)
|
|
|
|
{
|
|
|
|
char header[SIZEOFBLENDERHEADER], num[4];
|
|
|
|
int readsize;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// read in the header data
|
|
|
|
readsize = fd->read(fd, header, sizeof(header));
|
|
|
|
|
|
|
|
if (readsize == sizeof(header)) {
|
|
|
|
if(strncmp(header, "BLENDER", 7) == 0) {
|
|
|
|
int remove_this_endian_test= 1;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
fd->flags |= FD_FLAGS_FILE_OK;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// what size are pointers in the file ?
|
|
|
|
if(header[7]=='_') {
|
|
|
|
fd->flags |= FD_FLAGS_FILE_POINTSIZE_IS_4;
|
|
|
|
if (sizeof(void *) != 4) {
|
|
|
|
fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sizeof(void *) != 8) {
|
|
|
|
fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// is the file saved in a different endian
|
|
|
|
// than we need ?
|
|
|
|
if (((((char*)&remove_this_endian_test)[0]==1)?L_ENDIAN:B_ENDIAN) != ((header[8]=='v')?L_ENDIAN:B_ENDIAN)) {
|
|
|
|
fd->flags |= FD_FLAGS_SWITCH_ENDIAN;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// get the version number
|
|
|
|
|
|
|
|
memcpy(num, header+9, 3);
|
|
|
|
num[3] = 0;
|
|
|
|
fd->fileversion = atoi(num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int read_file_dna(FileData *fd)
|
|
|
|
{
|
|
|
|
BHead *bhead;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
|
|
|
|
if (bhead->code==DNA1) {
|
|
|
|
int do_endian_swap= (fd->flags&FD_FLAGS_SWITCH_ENDIAN)?1:0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
fd->filesdna= dna_sdna_from_data(&bhead[1], bhead->len, do_endian_swap);
|
|
|
|
if (fd->filesdna)
|
|
|
|
fd->compflags= dna_get_structDNA_compareflags(fd->filesdna, fd->memsdna);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return 1;
|
|
|
|
} else if (bhead->code==ENDB)
|
|
|
|
break;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int fd_read_from_file(FileData *filedata, void *buffer, int size)
|
|
|
|
{
|
|
|
|
int readsize = read(filedata->filedes, buffer, size);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (readsize < 0) {
|
|
|
|
readsize = EOF;
|
|
|
|
} else {
|
|
|
|
filedata->seek += readsize;
|
|
|
|
}
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
return (readsize);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
static int fd_read_gzip_from_file(FileData *filedata, void *buffer, int size)
|
|
|
|
{
|
|
|
|
int readsize = gzread(filedata->gzfiledes, buffer, size);
|
|
|
|
|
|
|
|
if (readsize < 0) {
|
|
|
|
readsize = EOF;
|
|
|
|
} else {
|
|
|
|
filedata->seek += readsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (readsize);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static int fd_read_from_memory(FileData *filedata, void *buffer, int size)
|
|
|
|
{
|
|
|
|
// don't read more bytes then there are available in the buffer
|
|
|
|
int readsize = MIN2(size, filedata->buffersize - filedata->seek);
|
|
|
|
|
|
|
|
memcpy(buffer, filedata->buffer + filedata->seek, readsize);
|
|
|
|
filedata->seek += readsize;
|
|
|
|
|
|
|
|
return (readsize);
|
|
|
|
}
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
static int fd_read_from_memfile(FileData *filedata, void *buffer, int size)
|
|
|
|
{
|
|
|
|
static unsigned int seek= 1<<30; /* the current position */
|
|
|
|
static unsigned int offset= 0; /* size of previous chunks */
|
|
|
|
static MemFileChunk *chunk=NULL;
|
|
|
|
|
|
|
|
if(size==0) return 0;
|
|
|
|
|
|
|
|
if(seek != filedata->seek) {
|
|
|
|
chunk= filedata->memfile->chunks.first;
|
|
|
|
seek= 0;
|
|
|
|
|
|
|
|
while(chunk) {
|
2005-07-14 22:21:12 +00:00
|
|
|
if(seek + chunk->size > (unsigned) filedata->seek) break;
|
2004-09-05 13:43:51 +00:00
|
|
|
seek+= chunk->size;
|
|
|
|
chunk= chunk->next;
|
|
|
|
}
|
|
|
|
offset= seek;
|
|
|
|
seek= filedata->seek;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(chunk) {
|
|
|
|
/* first check if it's on the end if current chunk */
|
|
|
|
if( seek-offset == chunk->size) {
|
|
|
|
offset+= chunk->size;
|
|
|
|
chunk= chunk->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* debug, should never happen */
|
|
|
|
if(chunk==NULL) {
|
|
|
|
printf("illegal read, chunk zero\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if( (seek-offset)+size > chunk->size) {
|
|
|
|
size= chunk->size - (seek-offset);
|
|
|
|
printf("chunk too large, clipped to %d\n", size);
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(buffer, chunk->buf + (seek-offset), size);
|
|
|
|
filedata->seek += size;
|
|
|
|
seek+= size;
|
|
|
|
|
|
|
|
return (size);
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static FileData *filedata_new(void)
|
|
|
|
{
|
|
|
|
extern char DNAstr[]; /* DNA.c */
|
|
|
|
extern int DNAlen;
|
2005-05-26 13:17:12 +00:00
|
|
|
FileData *fd = MEM_callocN(sizeof(FileData), "FileData");
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
fd->filedes = -1;
|
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
|
|
|
fd->gzfiledes = NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* XXX, this doesn't need to be done all the time,
|
|
|
|
* but it keeps us reentrant, remove once we have
|
|
|
|
* a lib that provides a nice lock. - zr
|
|
|
|
*/
|
|
|
|
fd->memsdna = dna_sdna_from_data(DNAstr, DNAlen, 0);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
fd->datamap = oldnewmap_new();
|
|
|
|
fd->globmap = oldnewmap_new();
|
|
|
|
fd->libmap = oldnewmap_new();
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
static FileData *blo_decode_and_check(FileData *fd, BlendReadError *error_r)
|
|
|
|
{
|
|
|
|
decode_blender_header(fd);
|
|
|
|
|
|
|
|
if (fd->flags & FD_FLAGS_FILE_OK) {
|
|
|
|
if (!read_file_dna(fd)) {
|
|
|
|
*error_r = BRE_INCOMPLETE;
|
|
|
|
blo_freefiledata(fd);
|
|
|
|
fd= NULL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*error_r = BRE_NOT_A_BLEND;
|
|
|
|
blo_freefiledata(fd);
|
|
|
|
fd= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
FileData *blo_openblenderfile(char *name, BlendReadError *error_r)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
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
|
|
|
gzFile gzfile;
|
2004-06-23 18:48:55 +00:00
|
|
|
char name1[FILE_MAXDIR+FILE_MAXFILE];
|
|
|
|
|
2005-12-11 22:54:46 +00:00
|
|
|
/* relative path rescue... */
|
|
|
|
if(G.rt==111) {
|
|
|
|
int len= strlen(name);
|
|
|
|
printf("old %s\n", name);
|
|
|
|
while(len-- > 1) {
|
|
|
|
if(name[len]=='/' && name[len-1]=='/') {
|
|
|
|
strcpy(name, name+len-1);
|
|
|
|
printf("new %s\n", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-23 18:48:55 +00:00
|
|
|
/* library files can have stringcodes */
|
|
|
|
strcpy(name1, name);
|
2005-05-26 13:17:12 +00:00
|
|
|
if(name[0]=='/' && name[1]=='/')
|
|
|
|
BLI_convertstringcode(name1, G.sce, 0);
|
|
|
|
else
|
|
|
|
strcpy(G.sce, name); // global... is set in blender.c setup_app_data too. should be part of Main immediate?
|
2004-06-23 18:48:55 +00:00
|
|
|
|
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
|
|
|
gzfile= gzopen(name1, "rb");
|
2004-06-23 18:22:51 +00:00
|
|
|
|
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
|
|
|
if (NULL == gzfile) {
|
2005-07-25 18:35:49 +00:00
|
|
|
*error_r = BRE_UNABLE_TO_OPEN;
|
2002-10-12 11:37:38 +00:00
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
FileData *fd = filedata_new();
|
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
|
|
|
fd->gzfiledes = gzfile;
|
2005-06-02 17:38:42 +00:00
|
|
|
BLI_strncpy(fd->filename, name, sizeof(fd->filename)); // now only in use by library append
|
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
|
|
|
fd->read = fd_read_gzip_from_file;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
return blo_decode_and_check(fd, error_r);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
FileData *blo_openblendermemory(void *mem, int memsize, BlendReadError *error_r)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
if (!mem || memsize<SIZEOFBLENDERHEADER) {
|
2005-07-25 18:35:49 +00:00
|
|
|
*error_r = mem?BRE_UNABLE_TO_READ:BRE_UNABLE_TO_OPEN;
|
2002-10-12 11:37:38 +00:00
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
FileData *fd= filedata_new();
|
|
|
|
fd->buffer= mem;
|
|
|
|
fd->buffersize= memsize;
|
|
|
|
fd->read= fd_read_from_memory;
|
|
|
|
fd->flags|= FD_FLAGS_NOT_MY_BUFFER;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
return blo_decode_and_check(fd, error_r);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
FileData *blo_openblendermemfile(MemFile *memfile, BlendReadError *error_r)
|
2004-09-05 13:43:51 +00:00
|
|
|
{
|
|
|
|
if (!memfile) {
|
2005-07-25 18:35:49 +00:00
|
|
|
*error_r = BRE_UNABLE_TO_OPEN;
|
2004-09-05 13:43:51 +00:00
|
|
|
return NULL;
|
|
|
|
} else {
|
|
|
|
FileData *fd= filedata_new();
|
|
|
|
fd->memfile= memfile;
|
|
|
|
|
|
|
|
fd->read= fd_read_from_memfile;
|
|
|
|
fd->flags|= FD_FLAGS_NOT_MY_BUFFER;
|
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
return blo_decode_and_check(fd, error_r);
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void blo_freefiledata(FileData *fd)
|
|
|
|
{
|
|
|
|
if (fd) {
|
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
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->filedes != -1) {
|
|
|
|
close(fd->filedes);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
if (fd->gzfiledes != NULL)
|
|
|
|
{
|
|
|
|
gzclose(fd->gzfiledes);
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) {
|
|
|
|
MEM_freeN(fd->buffer);
|
|
|
|
fd->buffer = 0;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// Free all BHeadN data blocks
|
|
|
|
BLI_freelistN(&fd->listbase);
|
|
|
|
|
|
|
|
if (fd->memsdna)
|
|
|
|
dna_freestructDNA(fd->memsdna);
|
|
|
|
if (fd->filesdna)
|
|
|
|
dna_freestructDNA(fd->filesdna);
|
|
|
|
if (fd->compflags)
|
|
|
|
MEM_freeN(fd->compflags);
|
|
|
|
|
|
|
|
if (fd->datamap)
|
|
|
|
oldnewmap_free(fd->datamap);
|
|
|
|
if (fd->globmap)
|
|
|
|
oldnewmap_free(fd->globmap);
|
|
|
|
if (fd->libmap && !(fd->flags & FD_FLAGS_NOT_MY_LIBMAP))
|
|
|
|
oldnewmap_free(fd->libmap);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(fd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ DIV ****************** */
|
|
|
|
|
|
|
|
int BLO_has_bfile_extension(char *str)
|
|
|
|
{
|
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
|
|
|
return (BLI_testextensie(str, ".ble") || BLI_testextensie(str, ".blend")||BLI_testextensie(str, ".blend.gz"));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************** OLD POINTERS ******************* */
|
|
|
|
|
|
|
|
static void *newdataadr(FileData *fd, void *adr) /* only direct databocks */
|
|
|
|
{
|
|
|
|
return oldnewmap_lookup_and_inc(fd->datamap, adr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *newglobadr(FileData *fd, void *adr) /* direct datablocks with global linking */
|
|
|
|
{
|
|
|
|
return oldnewmap_lookup_and_inc(fd->globmap, adr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void *newlibadr(FileData *fd, void *lib, void *adr) /* only lib data */
|
|
|
|
{
|
2005-12-15 18:42:02 +00:00
|
|
|
return oldnewmap_liblookup(fd->libmap, adr, lib);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
static void *newlibadr_us(FileData *fd, void *lib, void *adr) /* increases user number */
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
ID *id= newlibadr(fd, lib, adr);
|
|
|
|
|
|
|
|
if(id) {
|
|
|
|
id->us++;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
static void change_idid_adr_fd(FileData *fd, void *old, void *new)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
int i;
|
2005-12-16 17:35:38 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<fd->libmap->nentries; i++) {
|
|
|
|
OldNew *entry= &fd->libmap->entries[i];
|
2005-12-16 17:35:38 +00:00
|
|
|
|
2005-12-14 23:00:01 +00:00
|
|
|
if (old==entry->newp && entry->nr==ID_ID) {
|
2002-10-12 11:37:38 +00:00
|
|
|
entry->newp= new;
|
2005-12-16 17:35:38 +00:00
|
|
|
if(new) entry->nr= GS( ((ID *)new)->name );
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, void *new)
|
|
|
|
{
|
|
|
|
Main *main;
|
|
|
|
|
|
|
|
for(main= mainlist->first; main; main= main->next) {
|
|
|
|
FileData *fd;
|
|
|
|
|
|
|
|
if(main->curlib) fd= main->curlib->filedata;
|
|
|
|
else fd= basefd;
|
|
|
|
|
|
|
|
if(fd) {
|
|
|
|
change_idid_adr_fd(fd, old, new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* ********** END OLD POINTERS ****************** */
|
2002-10-12 11:37:38 +00:00
|
|
|
/* ********** READ FILE ****************** */
|
|
|
|
|
|
|
|
static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead)
|
|
|
|
{
|
|
|
|
int blocksize, nblocks;
|
|
|
|
char *data;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
data= (char *)(bhead+1); /* BHEAD+DATA dependancy */
|
|
|
|
blocksize= filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ];
|
|
|
|
|
|
|
|
nblocks= bhead->nr;
|
|
|
|
while(nblocks--) {
|
|
|
|
dna_switch_endian_struct(filesdna, bhead->SDNAnr, data);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
data+= blocksize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-23 21:02:58 +00:00
|
|
|
static void *read_struct(FileData *fd, BHead *bh, char *blockname)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
void *temp= NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (bh->len) {
|
|
|
|
if (bh->SDNAnr && (fd->flags & FD_FLAGS_SWITCH_ENDIAN))
|
|
|
|
switch_endian_structs(fd->filesdna, bh);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd->compflags[bh->SDNAnr]) { /* flag==0: doesn't exist anymore */
|
|
|
|
if(fd->compflags[bh->SDNAnr]==2) {
|
|
|
|
temp= dna_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1));
|
|
|
|
} else {
|
2004-04-23 21:02:58 +00:00
|
|
|
temp= MEM_mallocN(bh->len, blockname);
|
2002-10-12 11:37:38 +00:00
|
|
|
memcpy(temp, (bh+1), bh->len); /* BHEAD+DATA dependancy */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
return temp;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
static void link_list(FileData *fd, ListBase *lb) /* only direct data */
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Link *ln, *prev;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(lb->first==0) return;
|
|
|
|
|
|
|
|
lb->first= newdataadr(fd, lb->first);
|
|
|
|
ln= lb->first;
|
|
|
|
prev= 0;
|
|
|
|
while(ln) {
|
|
|
|
ln->next= newdataadr(fd, ln->next);
|
|
|
|
ln->prev= prev;
|
|
|
|
prev= ln;
|
|
|
|
ln= ln->next;
|
|
|
|
}
|
|
|
|
lb->last= prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */
|
|
|
|
{
|
|
|
|
Link *ln, *prev;
|
|
|
|
void *poin;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(lb->first==0) return;
|
|
|
|
poin= newdataadr(fd, lb->first);
|
|
|
|
if(lb->first) {
|
|
|
|
oldnewmap_insert(fd->globmap, lb->first, poin, 0);
|
|
|
|
}
|
|
|
|
lb->first= poin;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ln= lb->first;
|
|
|
|
prev= 0;
|
|
|
|
while(ln) {
|
|
|
|
poin= newdataadr(fd, ln->next);
|
|
|
|
if(ln->next) {
|
|
|
|
oldnewmap_insert(fd->globmap, ln->next, poin, 0);
|
|
|
|
}
|
|
|
|
ln->next= poin;
|
|
|
|
ln->prev= prev;
|
|
|
|
prev= ln;
|
|
|
|
ln= ln->next;
|
|
|
|
}
|
|
|
|
lb->last= prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_pointer_array(FileData *fd, void **mat)
|
|
|
|
{
|
2003-05-24 20:04:37 +00:00
|
|
|
#if defined(WIN32) && !defined(FREE_WINDOWS)
|
2002-10-12 11:37:38 +00:00
|
|
|
__int64 *lpoin, *lmat;
|
|
|
|
#else
|
|
|
|
long long *lpoin, *lmat;
|
|
|
|
#endif
|
|
|
|
int len, *ipoin, *imat;
|
|
|
|
|
|
|
|
/* manually convert the pointer array in
|
|
|
|
* the old dna format to a pointer array in
|
|
|
|
* the new dna format.
|
|
|
|
*/
|
|
|
|
if(*mat) {
|
|
|
|
len= MEM_allocN_len(*mat)/fd->filesdna->pointerlen;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
|
|
|
|
ipoin=imat= MEM_mallocN( len*4, "newmatar");
|
|
|
|
lpoin= *mat;
|
|
|
|
|
|
|
|
while(len-- > 0) {
|
2004-06-23 18:22:51 +00:00
|
|
|
if((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
|
2002-10-12 11:37:38 +00:00
|
|
|
SWITCH_LONGINT(*lpoin);
|
|
|
|
*ipoin= (int) ((*lpoin) >> 3);
|
|
|
|
ipoin++;
|
|
|
|
lpoin++;
|
|
|
|
}
|
|
|
|
MEM_freeN(*mat);
|
|
|
|
*mat= imat;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
|
|
|
|
lpoin=lmat= MEM_mallocN( len*8, "newmatar");
|
|
|
|
ipoin= *mat;
|
|
|
|
|
|
|
|
while(len-- > 0) {
|
|
|
|
*lpoin= *ipoin;
|
|
|
|
ipoin++;
|
|
|
|
lpoin++;
|
|
|
|
}
|
|
|
|
MEM_freeN(*mat);
|
|
|
|
*mat= lmat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ PACKEDFILE *************** */
|
|
|
|
|
|
|
|
static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf)
|
|
|
|
{
|
|
|
|
PackedFile *pf= newdataadr(fd, oldpf);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (pf) {
|
|
|
|
pf->data= newdataadr(fd, pf->data);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return pf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ SCRIPTLINK *************** */
|
|
|
|
|
|
|
|
static void lib_link_scriptlink(FileData *fd, ID *id, ScriptLink *slink)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i=0; i<slink->totscript; i++) {
|
|
|
|
slink->scripts[i]= newlibadr(fd, id->lib, slink->scripts[i]);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
static void direct_link_scriptlink(FileData *fd, ScriptLink *slink)
|
|
|
|
{
|
2004-06-23 18:22:51 +00:00
|
|
|
slink->scripts= newdataadr(fd, slink->scripts);
|
2005-11-19 17:26:18 +00:00
|
|
|
test_pointer_array(fd, (void **)&slink->scripts);
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
slink->flag= newdataadr(fd, slink->flag);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<slink->totscript; a++) {
|
|
|
|
SWITCH_SHORT(slink->flag[a]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ ARMATURE ***************** */
|
|
|
|
|
|
|
|
static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
|
|
|
|
{
|
|
|
|
bActionStrip *strip;
|
|
|
|
|
|
|
|
for (strip=striplist->first; strip; strip=strip->next){
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
strip->object = newlibadr(fd, id->lib, strip->object);
|
2003-11-06 17:17:52 +00:00
|
|
|
strip->act = newlibadr_us(fd, id->lib, strip->act);
|
2002-10-12 11:37:38 +00:00
|
|
|
strip->ipo = newlibadr(fd, id->lib, strip->ipo);
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbase)
|
|
|
|
{
|
|
|
|
bConstraintChannel *chan;
|
|
|
|
|
|
|
|
for (chan=chanbase->first; chan; chan=chan->next){
|
|
|
|
chan->ipo = newlibadr_us(fd, id->lib, chan->ipo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
2003-11-19 15:20:18 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (con = conlist->first; con; con=con->next) {
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
/* patch for error introduced by changing constraints (dunno how) */
|
|
|
|
/* if con->data type changes, dna cannot resolve the pointer! (ton) */
|
2003-11-19 15:20:18 +00:00
|
|
|
if(con->data==NULL) {
|
|
|
|
con->type= CONSTRAINT_TYPE_NULL;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
switch (con->type) {
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data;
|
|
|
|
data= ((bActionConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
data->act = newlibadr(fd, id->lib, data->act);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data;
|
|
|
|
data= ((bLocateLikeConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data;
|
|
|
|
data= ((bRotateLikeConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data;
|
|
|
|
data = ((bKinematicConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data;
|
|
|
|
data = ((bTrackToConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
}
|
|
|
|
break;
|
2005-09-07 00:11:39 +00:00
|
|
|
case CONSTRAINT_TYPE_MINMAX:
|
|
|
|
{
|
|
|
|
bMinMaxConstraint *data;
|
|
|
|
data = ((bMinMaxConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
}
|
|
|
|
break;
|
2003-10-21 13:22:07 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data;
|
|
|
|
data= ((bLockTrackConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data;
|
|
|
|
data= ((bFollowPathConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
2004-03-25 18:17:40 +00:00
|
|
|
case CONSTRAINT_TYPE_DISTANCELIMIT:
|
|
|
|
{
|
|
|
|
bDistanceLimitConstraint *data;
|
|
|
|
data= ((bDistanceLimitConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data;
|
|
|
|
data= ((bStretchToConstraint*)con->data);
|
|
|
|
data->tar = newlibadr(fd, id->lib, data->tar);
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_constraints(FileData *fd, ListBase *lb)
|
|
|
|
{
|
|
|
|
bConstraint *cons;
|
|
|
|
|
|
|
|
link_list(fd, lb);
|
|
|
|
for (cons=lb->first; cons; cons=cons->next) {
|
|
|
|
cons->data = newdataadr(fd, cons->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2005-09-12 13:02:36 +00:00
|
|
|
bPoseChannel *pchan;
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
bArmature *arm= ob->data;
|
2005-12-14 20:36:04 +00:00
|
|
|
int rebuild= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
if (!pose)
|
|
|
|
return;
|
|
|
|
|
2005-09-12 13:02:36 +00:00
|
|
|
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
lib_link_constraints(fd, (ID *)ob, &pchan->constraints);
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
// hurms... loop in a loop, but yah... later... (ton)
|
2005-09-12 13:02:36 +00:00
|
|
|
pchan->bone= get_named_bone(arm, pchan->name);
|
2005-12-07 15:07:31 +00:00
|
|
|
pchan->custom= newlibadr(fd, arm->id.lib, pchan->custom);
|
2005-12-14 20:36:04 +00:00
|
|
|
if(pchan->bone==NULL)
|
|
|
|
rebuild= 1;
|
|
|
|
}
|
|
|
|
if(rebuild) {
|
|
|
|
ob->recalc= OB_RECALC;
|
|
|
|
pose->flag |= POSE_RECALC;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_armature(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
bArmature *arm;
|
|
|
|
|
|
|
|
arm= main->armature.first;
|
|
|
|
|
|
|
|
while(arm) {
|
|
|
|
if(arm->id.flag & LIB_NEEDLINK) {
|
|
|
|
arm->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
arm= arm->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_action(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
bAction *act;
|
|
|
|
bActionChannel *chan;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
act= main->action.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->id.flag & LIB_NEEDLINK) {
|
|
|
|
act->id.flag -= LIB_NEEDLINK;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (chan=act->chanbase.first; chan; chan=chan->next) {
|
|
|
|
chan->ipo= newlibadr_us(fd, act->id.lib, chan->ipo);
|
|
|
|
lib_link_constraint_channels(fd, &act->id, &chan->constraintChannels);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
act= act->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_bones(FileData *fd, Bone* bone)
|
|
|
|
{
|
|
|
|
Bone *child;
|
|
|
|
|
|
|
|
bone->parent= newdataadr(fd, bone->parent);
|
|
|
|
|
|
|
|
link_list(fd, &bone->childbase);
|
|
|
|
|
|
|
|
for (child=bone->childbase.first; child; child=child->next) {
|
|
|
|
direct_link_bones(fd, child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void direct_link_action(FileData *fd, bAction *act)
|
|
|
|
{
|
|
|
|
bActionChannel *achan;
|
|
|
|
|
|
|
|
link_list(fd, &act->chanbase);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (achan = act->chanbase.first; achan; achan=achan->next)
|
|
|
|
link_list(fd, &achan->constraintChannels);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_armature(FileData *fd, bArmature *arm)
|
|
|
|
{
|
2004-06-23 18:22:51 +00:00
|
|
|
Bone *bone;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
link_list(fd, &arm->bonebase);
|
|
|
|
|
|
|
|
bone=arm->bonebase.first;
|
|
|
|
while (bone) {
|
|
|
|
direct_link_bones(fd, bone);
|
|
|
|
bone=bone->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ CAMERA ***************** */
|
|
|
|
|
|
|
|
static void lib_link_camera(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Camera *ca;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ca= main->camera.first;
|
|
|
|
while(ca) {
|
|
|
|
if(ca->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ca->ipo= newlibadr_us(fd, ca->id.lib, ca->ipo);
|
|
|
|
|
|
|
|
lib_link_scriptlink(fd, &ca->id, &ca->scriptlink);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ca->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
ca= ca->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_camera(FileData *fd, Camera *ca)
|
|
|
|
{
|
|
|
|
direct_link_scriptlink(fd, &ca->scriptlink);
|
|
|
|
}
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* ************ READ LATTICE ***************** */
|
|
|
|
|
|
|
|
static void lib_link_latt(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Lattice *lt;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lt= main->latt.first;
|
|
|
|
while(lt) {
|
|
|
|
if(lt->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lt->ipo= newlibadr_us(fd, lt->id.lib, lt->ipo);
|
|
|
|
lt->key= newlibadr_us(fd, lt->id.lib, lt->key);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lt->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
lt= lt->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_latt(FileData *fd, Lattice *lt)
|
|
|
|
{
|
|
|
|
lt->def= newdataadr(fd, lt->def);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ LAMP ***************** */
|
|
|
|
|
|
|
|
static void lib_link_lamp(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Lamp *la;
|
|
|
|
MTex *mtex;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
la= main->lamp.first;
|
|
|
|
while(la) {
|
|
|
|
if(la->id.flag & LIB_NEEDLINK) {
|
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
mtex= la->mtex[a];
|
|
|
|
if(mtex) {
|
|
|
|
mtex->tex= newlibadr_us(fd, la->id.lib, mtex->tex);
|
|
|
|
mtex->object= newlibadr(fd, la->id.lib, mtex->object);
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
la->ipo= newlibadr_us(fd, la->id.lib, la->ipo);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib_link_scriptlink(fd, &la->id, &la->scriptlink);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
la->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
la= la->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_lamp(FileData *fd, Lamp *la)
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
|
|
|
|
direct_link_scriptlink(fd, &la->scriptlink);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
la->mtex[a]= newdataadr(fd, la->mtex[a]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ keys ***************** */
|
|
|
|
|
|
|
|
static void lib_link_key(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Key *key;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
key= main->key.first;
|
|
|
|
while(key) {
|
|
|
|
if(key->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
key->ipo= newlibadr_us(fd, key->id.lib, key->ipo);
|
|
|
|
key->from= newlibadr(fd, key->id.lib, key->from);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
key->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
key= key->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void switch_endian_keyblock(Key *key, KeyBlock *kb)
|
|
|
|
{
|
|
|
|
int elemsize, a, b;
|
|
|
|
char *data, *poin, *cp;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
elemsize= key->elemsize;
|
|
|
|
data= kb->data;
|
|
|
|
|
|
|
|
for(a=0; a<kb->totelem; a++) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
cp= key->elemstr;
|
2002-10-12 11:37:38 +00:00
|
|
|
poin= data;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
while( cp[0] ) { /* cp[0]==amount */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
switch(cp[1]) { /* cp[1]= type */
|
|
|
|
case IPO_FLOAT:
|
|
|
|
case IPO_BPOINT:
|
|
|
|
case IPO_BEZTRIPLE:
|
|
|
|
b= cp[0];
|
|
|
|
while(b--) {
|
|
|
|
SWITCH_INT((*poin));
|
|
|
|
poin+= 4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cp+= 2;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
data+= elemsize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_key(FileData *fd, Key *key)
|
|
|
|
{
|
|
|
|
KeyBlock *kb;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(key->block));
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
key->refkey= newdataadr(fd, key->refkey);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
kb= key->block.first;
|
|
|
|
while(kb) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
kb->data= newdataadr(fd, kb->data);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN)
|
|
|
|
switch_endian_keyblock(key, kb);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
kb= kb->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ mball ***************** */
|
|
|
|
|
|
|
|
static void lib_link_mball(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
MetaBall *mb;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
mb= main->mball.first;
|
|
|
|
while(mb) {
|
|
|
|
if(mb->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]);
|
|
|
|
|
|
|
|
mb->ipo= newlibadr_us(fd, mb->id.lib, mb->ipo);
|
|
|
|
|
|
|
|
mb->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
mb= mb->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_mball(FileData *fd, MetaBall *mb)
|
|
|
|
{
|
|
|
|
mb->mat= newdataadr(fd, mb->mat);
|
|
|
|
test_pointer_array(fd, (void **)&mb->mat);
|
|
|
|
|
|
|
|
link_list(fd, &(mb->elems));
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
mb->disp.first= mb->disp.last= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
mb->bb= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ WORLD ***************** */
|
|
|
|
|
|
|
|
static void lib_link_world(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
World *wrld;
|
|
|
|
MTex *mtex;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
wrld= main->world.first;
|
|
|
|
while(wrld) {
|
|
|
|
if(wrld->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
wrld->ipo= newlibadr_us(fd, wrld->id.lib, wrld->ipo);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
mtex= wrld->mtex[a];
|
|
|
|
if(mtex) {
|
|
|
|
mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex);
|
|
|
|
mtex->object= newlibadr(fd, wrld->id.lib, mtex->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lib_link_scriptlink(fd, &wrld->id, &wrld->scriptlink);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
wrld->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
wrld= wrld->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_world(FileData *fd, World *wrld)
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
|
|
|
|
direct_link_scriptlink(fd, &wrld->scriptlink);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************ READ IPO ***************** */
|
|
|
|
|
|
|
|
static void lib_link_ipo(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Ipo *ipo;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ipo= main->ipo.first;
|
|
|
|
while(ipo) {
|
|
|
|
if(ipo->id.flag & LIB_NEEDLINK) {
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
IpoCurve *icu;
|
|
|
|
for(icu= ipo->curve.first; icu; icu= icu->next) {
|
|
|
|
if(icu->driver)
|
|
|
|
icu->driver->ob= newlibadr(fd, ipo->id.lib, icu->driver->ob);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
ipo->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
ipo= ipo->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_ipo(FileData *fd, Ipo *ipo)
|
|
|
|
{
|
|
|
|
IpoCurve *icu;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(ipo->curve));
|
|
|
|
icu= ipo->curve.first;
|
|
|
|
while(icu) {
|
|
|
|
icu->bezt= newdataadr(fd, icu->bezt);
|
|
|
|
icu->bp= newdataadr(fd, icu->bp);
|
Version 1.0 of IpoDrivers.
First note that this is new functionality, unfinished, and only for
testing and feedback purposes. I'll list below what works, and what will
need work still.
This text is also in cms: http://www.blender.org/cms/Ipo_Drivers.680.0.html
An IpoDriver is like an IpoCurve, but instead of a Bezier curve, it allows
to connect a property of other Objects as input for the "channel". For
example, IpoDrivers can be used to have a Shape Key being "driven" by
the rotation of a Bone. Or the RGB colors of a Material get driven by the
XYZ location of an Object.
Editing of Drivers happens in the IpoWindow. Here you can notice that the
channels (right hand window) now have an "active" channel indicator.
To add a Driver, you have to use the "Transform Properties" Panel (Nkey).
Here you can add or remove a Driver to the active channel, and use the
buttons to fill in what kind of relationship you want to establish.
Driver Objects
Note that any Ipo Channel can become driven now, but that only Object
transformation or Pose Bone transformation can be used to become a
Driver now.
At this moment, only the local transformation is taken into account.
For Objects that means the location/rotation/scale value without Parent
transform (as shown in "Transform Properties" Panel for Objects).
For Pose Bones it means that only the Pose transform (changes of rest
position) is Driver information (also as shown in Transform Property
Panel in Pose Mode).
Mapping of Drivers
When an Ipo Channel is "driven", the mapping is by default one-to-one.
It is only restricted by already built-in limits for Channels, like
for Material the "R" value can only range from 0.0 to 1.0.
Also note that when mapping rotations, the actual rotation values
in Ipos are scaled down with a factor 10.0. (180 degrees actually has
in the Ipo system a value of 18.0). This is an ancient year zero
convention in Blender... it is a bit hidden, because the ruler
(vertical as well as horizontal) displays the virtual values correctly.
Only the Properties panel shows the actual value.
When you draw an IpoCurve in a Driven channel, this curve will define
the mapping between the Driver output (horizontal) and Driven input
(vertical, as usual).
A nice new option to use is "Insert one-to-one curve" (press I-key,
or in pulldown menu). This will also zoom the display in exactly to
fill the window, allowing easy edit. If you use this option with
degrees, it will map 180 degree rotation to a range of 1.0 unit.
Live updates
Since the Drivers are integrated in the Ipo system, they will always
be updated whenever an Ipo is evaluated. This happens at least on
frame changes.
For interactive feedback, updates while transforming objects were
added in these cases:
- Driven Object Ipos, by other Objects or Pose Bones
- Driven Shape Key Ipos, by other Objects or Pose Bones
You can also insert Drivers on Action Ipos, but these are only evaluated
on frame change now.
Todo
- Drivers can also get a text button, allowing a 1 line Python script
to be executed.
- Make UI for it a bit less hidden... maybe with visualization in 3D?
- Allowing global transform coordinates as Driver too.
Issues
- renaming Bones won't rename drivers
- (file) appending the Ipo won't append the linked driver Objects
2005-10-02 20:51:35 +00:00
|
|
|
icu->driver= newdataadr(fd, icu->driver);
|
2002-10-12 11:37:38 +00:00
|
|
|
icu= icu->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ VFONT ***************** */
|
|
|
|
|
|
|
|
static void lib_link_vfont(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
VFont *vf;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
vf= main->vfont.first;
|
|
|
|
while(vf) {
|
|
|
|
if(vf->id.flag & LIB_NEEDLINK) {
|
|
|
|
vf->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
vf= vf->id.next;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_vfont(FileData *fd, VFont *vf)
|
|
|
|
{
|
|
|
|
vf->data= NULL;
|
|
|
|
vf->packedfile= direct_link_packedfile(fd, vf->packedfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ TEXT ****************** */
|
|
|
|
|
|
|
|
static void lib_link_text(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Text *text;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
text= main->text.first;
|
|
|
|
while(text) {
|
|
|
|
if(text->id.flag & LIB_NEEDLINK) {
|
|
|
|
text->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
text= text->id.next;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_text(FileData *fd, Text *text)
|
|
|
|
{
|
|
|
|
TextLine *ln;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
text->name= newdataadr(fd, text->name);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
text->undo_pos= -1;
|
|
|
|
text->undo_len= TXT_INIT_UNDO;
|
|
|
|
text->undo_buf= MEM_mallocN(text->undo_len, "undo buf");
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
text->compiled= NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-03-25 15:54:46 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
if(text->flags & TXT_ISEXT) {
|
2003-03-25 15:54:46 +00:00
|
|
|
reopen_text(text);
|
2002-10-12 11:37:38 +00:00
|
|
|
} else {
|
2003-03-25 15:54:46 +00:00
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-03-25 15:54:46 +00:00
|
|
|
link_list(fd, &text->lines);
|
|
|
|
|
|
|
|
text->curl= newdataadr(fd, text->curl);
|
|
|
|
text->sell= newdataadr(fd, text->sell);
|
|
|
|
|
|
|
|
ln= text->lines.first;
|
|
|
|
while(ln) {
|
|
|
|
ln->line= newdataadr(fd, ln->line);
|
2005-05-13 16:11:28 +00:00
|
|
|
ln->format= NULL;
|
|
|
|
|
2003-03-25 15:54:46 +00:00
|
|
|
if (ln->len != (int) strlen(ln->line)) {
|
|
|
|
printf("Error loading text, line lengths differ\n");
|
|
|
|
ln->len = strlen(ln->line);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-03-25 15:54:46 +00:00
|
|
|
|
|
|
|
ln= ln->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-03-25 15:54:46 +00:00
|
|
|
|
|
|
|
text->flags = (text->flags|TXT_ISTMP) & ~TXT_ISEXT;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
text->id.us= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ IMAGE ***************** */
|
|
|
|
|
|
|
|
static void lib_link_image(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Image *ima;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ima= main->image.first;
|
|
|
|
while (ima) {
|
|
|
|
if(ima->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ima->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
ima= ima->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_image(FileData *fd, Image *ima)
|
|
|
|
{
|
|
|
|
ima->ibuf= 0;
|
|
|
|
ima->anim= 0;
|
|
|
|
memset(ima->mipmap, 0, sizeof(ima->mipmap));
|
|
|
|
ima->repbind= 0;
|
|
|
|
ima->bindcode= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ima->packedfile = direct_link_packedfile(fd, ima->packedfile);
|
|
|
|
|
|
|
|
ima->ok= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************ READ CURVE ***************** */
|
|
|
|
|
|
|
|
static void lib_link_curve(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Curve *cu;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cu= main->curve.first;
|
|
|
|
while(cu) {
|
|
|
|
if(cu->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]);
|
|
|
|
|
|
|
|
cu->bevobj= newlibadr(fd, cu->id.lib, cu->bevobj);
|
2004-08-29 09:21:52 +00:00
|
|
|
cu->taperobj= newlibadr(fd, cu->id.lib, cu->taperobj);
|
2002-10-12 11:37:38 +00:00
|
|
|
cu->textoncurve= newlibadr(fd, cu->id.lib, cu->textoncurve);
|
|
|
|
cu->vfont= newlibadr_us(fd, cu->id.lib, cu->vfont);
|
2005-06-17 21:04:27 +00:00
|
|
|
cu->vfontb= newlibadr_us(fd, cu->id.lib, cu->vfontb);
|
|
|
|
cu->vfonti= newlibadr_us(fd, cu->id.lib, cu->vfonti);
|
|
|
|
cu->vfontbi= newlibadr_us(fd, cu->id.lib, cu->vfontbi);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
cu->ipo= newlibadr_us(fd, cu->id.lib, cu->ipo);
|
|
|
|
cu->key= newlibadr_us(fd, cu->id.lib, cu->key);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cu->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
cu= cu->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void switch_endian_knots(Nurb *nu)
|
|
|
|
{
|
|
|
|
int len;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(nu->knotsu) {
|
|
|
|
len= KNOTSU(nu);
|
|
|
|
while(len--) {
|
|
|
|
SWITCH_INT(nu->knotsu[len]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nu->knotsv) {
|
|
|
|
len= KNOTSV(nu);
|
|
|
|
while(len--) {
|
|
|
|
SWITCH_INT(nu->knotsv[len]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_curve(FileData *fd, Curve *cu)
|
|
|
|
{
|
|
|
|
Nurb *nu;
|
2005-06-17 21:04:27 +00:00
|
|
|
TextBox *tb;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cu->mat= newdataadr(fd, cu->mat);
|
|
|
|
test_pointer_array(fd, (void **)&cu->mat);
|
|
|
|
cu->str= newdataadr(fd, cu->str);
|
2005-10-27 10:01:11 +00:00
|
|
|
cu->strinfo= newdataadr(fd, cu->strinfo);
|
|
|
|
cu->tb= newdataadr(fd, cu->tb);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(cu->vfont==0) link_list(fd, &(cu->nurb));
|
|
|
|
else {
|
|
|
|
cu->nurb.first=cu->nurb.last= 0;
|
2005-10-27 10:01:11 +00:00
|
|
|
|
2005-06-17 21:04:27 +00:00
|
|
|
tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBoxread");
|
|
|
|
if (cu->tb) {
|
|
|
|
memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox));
|
|
|
|
MEM_freeN(cu->tb);
|
|
|
|
cu->tb= tb;
|
|
|
|
} else {
|
|
|
|
cu->totbox = 1;
|
|
|
|
cu->actbox = 1;
|
|
|
|
cu->tb = tb;
|
|
|
|
cu->tb[0].w = cu->linewidth;
|
|
|
|
}
|
2005-06-17 23:05:59 +00:00
|
|
|
if (cu->wordspace == 0.0) cu->wordspace = 1.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cu->bev.first=cu->bev.last= 0;
|
|
|
|
cu->disp.first=cu->disp.last= 0;
|
|
|
|
cu->path= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
nu= cu->nurb.first;
|
|
|
|
while(nu) {
|
|
|
|
nu->bezt= newdataadr(fd, nu->bezt);
|
|
|
|
nu->bp= newdataadr(fd, nu->bp);
|
|
|
|
nu->knotsu= newdataadr(fd, nu->knotsu);
|
|
|
|
nu->knotsv= newdataadr(fd, nu->knotsv);
|
2005-06-25 22:51:51 +00:00
|
|
|
if (cu->vfont==0) nu->charidx= nu->mat_nr;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
switch_endian_knots(nu);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
nu= nu->next;
|
|
|
|
}
|
2005-07-13 13:30:51 +00:00
|
|
|
cu->bb= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ TEX ***************** */
|
|
|
|
|
|
|
|
static void lib_link_texture(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Tex *tex;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
tex= main->tex.first;
|
|
|
|
while(tex) {
|
|
|
|
if(tex->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
tex->ima= newlibadr_us(fd, tex->id.lib, tex->ima);
|
|
|
|
tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
|
|
|
|
if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
tex->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
tex= tex->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_texture(FileData *fd, Tex *tex)
|
|
|
|
{
|
|
|
|
tex->plugin= newdataadr(fd, tex->plugin);
|
|
|
|
if(tex->plugin) {
|
|
|
|
tex->plugin->handle= 0;
|
|
|
|
open_plugin_tex(tex->plugin);
|
|
|
|
}
|
|
|
|
tex->coba= newdataadr(fd, tex->coba);
|
|
|
|
tex->env= newdataadr(fd, tex->env);
|
|
|
|
if(tex->env) {
|
|
|
|
tex->env->ima= 0;
|
|
|
|
memset(tex->env->cube, 0, 6*sizeof(void *));
|
|
|
|
tex->env->ok= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ************ READ MATERIAL ***************** */
|
|
|
|
|
|
|
|
static void lib_link_material(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Material *ma;
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
MaterialLayer *ml;
|
2002-10-12 11:37:38 +00:00
|
|
|
MTex *mtex;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ma= main->mat.first;
|
|
|
|
while(ma) {
|
|
|
|
if(ma->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ma->ipo= newlibadr_us(fd, ma->id.lib, ma->ipo);
|
2005-12-06 12:14:53 +00:00
|
|
|
ma->group= newlibadr_us(fd, ma->id.lib, ma->group);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
mtex= ma->mtex[a];
|
|
|
|
if(mtex) {
|
|
|
|
mtex->tex= newlibadr_us(fd, ma->id.lib, mtex->tex);
|
|
|
|
mtex->object= newlibadr(fd, ma->id.lib, mtex->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lib_link_scriptlink(fd, &ma->id, &ma->scriptlink);
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
|
|
|
|
for (ml=ma->layers.first; ml; ml=ml->next)
|
|
|
|
ml->mat= newlibadr_us(fd, ma->id.lib, ml->mat);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ma->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
ma= ma->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_material(FileData *fd, Material *ma)
|
|
|
|
{
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
|
|
|
|
}
|
2004-06-30 18:54:09 +00:00
|
|
|
|
|
|
|
ma->ramp_col= newdataadr(fd, ma->ramp_col);
|
|
|
|
ma->ramp_spec= newdataadr(fd, ma->ramp_spec);
|
|
|
|
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
direct_link_scriptlink(fd, &ma->scriptlink);
|
|
|
|
|
|
|
|
link_list(fd, &ma->layers);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ MESH ***************** */
|
|
|
|
|
|
|
|
static void lib_link_mesh(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Mesh *me;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
me= main->mesh.first;
|
|
|
|
while(me) {
|
|
|
|
if(me->id.flag & LIB_NEEDLINK) {
|
|
|
|
int i;
|
|
|
|
|
2003-12-31 15:27:31 +00:00
|
|
|
/* this check added for python created meshes */
|
|
|
|
if(me->mat) {
|
2005-12-14 23:00:01 +00:00
|
|
|
for(i=0; i<me->totcol; i++) {
|
2003-12-31 15:27:31 +00:00
|
|
|
me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]);
|
2005-12-14 23:00:01 +00:00
|
|
|
}
|
2003-12-31 15:27:31 +00:00
|
|
|
}
|
|
|
|
else me->totcol= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
me->ipo= newlibadr_us(fd, me->id.lib, me->ipo);
|
|
|
|
me->key= newlibadr_us(fd, me->id.lib, me->key);
|
|
|
|
me->texcomesh= newlibadr_us(fd, me->id.lib, me->texcomesh);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(me->tface) {
|
|
|
|
TFace *tfaces= me->tface;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<me->totface; i++) {
|
|
|
|
TFace *tf= &tfaces[i];
|
|
|
|
|
|
|
|
tf->tpage= newlibadr(fd, me->id.lib, tf->tpage);
|
|
|
|
if(tf->tpage) {
|
|
|
|
Image *ima= tf->tpage;
|
|
|
|
if(ima->id.us==0)
|
|
|
|
ima->id.us= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
|
|
|
|
{
|
2005-08-12 21:55:50 +00:00
|
|
|
int i;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (!mdverts)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i=0; i<count; i++) {
|
|
|
|
mdverts[i].dw=newdataadr(fd, mdverts[i].dw);
|
|
|
|
if (!mdverts[i].dw)
|
|
|
|
mdverts[i].totweight=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_mesh(FileData *fd, Mesh *mesh)
|
|
|
|
{
|
|
|
|
mesh->mat= newdataadr(fd, mesh->mat);
|
|
|
|
test_pointer_array(fd, (void **)&mesh->mat);
|
|
|
|
|
2004-07-08 20:38:27 +00:00
|
|
|
mesh->mvert= newdataadr(fd, mesh->mvert);
|
|
|
|
mesh->medge= newdataadr(fd, mesh->medge);
|
2002-10-12 11:37:38 +00:00
|
|
|
mesh->mface= newdataadr(fd, mesh->mface);
|
|
|
|
mesh->tface= newdataadr(fd, mesh->tface);
|
|
|
|
mesh->mcol= newdataadr(fd, mesh->mcol);
|
|
|
|
mesh->msticky= newdataadr(fd, mesh->msticky);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-07-08 20:38:27 +00:00
|
|
|
mesh->dvert= newdataadr(fd, mesh->dvert);
|
|
|
|
direct_link_dverts(fd, mesh->totvert, mesh->dvert);
|
|
|
|
|
|
|
|
mesh->bb= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
mesh->oc= 0;
|
2004-07-08 20:38:27 +00:00
|
|
|
mesh->dface= NULL;
|
2005-07-26 02:44:59 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (mesh->tface) {
|
|
|
|
TFace *tfaces= mesh->tface;
|
|
|
|
int i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<mesh->totface; i++) {
|
|
|
|
TFace *tf= &tfaces[i];
|
|
|
|
|
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
SWITCH_INT(tf->col[0]);
|
|
|
|
SWITCH_INT(tf->col[1]);
|
|
|
|
SWITCH_INT(tf->col[2]);
|
|
|
|
SWITCH_INT(tf->col[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ OBJECT ***************** */
|
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
static void lib_link_modifiers__linkModifiers(void *userData, Object *ob, Object **obpoin)
|
2005-07-19 20:14:17 +00:00
|
|
|
{
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
FileData *fd = userData;
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
*obpoin = newlibadr(fd, ob->id.lib, *obpoin);
|
|
|
|
}
|
|
|
|
static void lib_link_modifiers(FileData *fd, Object *ob)
|
|
|
|
{
|
|
|
|
modifiers_foreachObjectLink(ob, lib_link_modifiers__linkModifiers, fd);
|
2005-07-19 20:14:17 +00:00
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void lib_link_object(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Object *ob;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
PartEff *paf;
|
2002-10-12 11:37:38 +00:00
|
|
|
bSensor *sens;
|
|
|
|
bController *cont;
|
|
|
|
bActuator *act;
|
|
|
|
void *poin;
|
|
|
|
int warn=0, a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
if(ob->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->parent= newlibadr(fd, ob->id.lib, ob->parent);
|
|
|
|
ob->track= newlibadr(fd, ob->id.lib, ob->track);
|
|
|
|
ob->ipo= newlibadr_us(fd, ob->id.lib, ob->ipo);
|
|
|
|
ob->action = newlibadr_us(fd, ob->id.lib, ob->action);
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group);
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
poin= ob->data;
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->data= newlibadr_us(fd, ob->id.lib, ob->data);
|
2005-12-16 17:35:38 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ob->data==NULL && poin!=NULL) {
|
|
|
|
ob->type= OB_EMPTY;
|
|
|
|
warn= 1;
|
|
|
|
if(ob->id.lib) printf("Can't find obdata of %s lib %s\n", ob->id.name+2, ob->id.lib->name);
|
|
|
|
else printf("Object %s lost data. Lib:%x\n", ob->id.name+2, (unsigned int) ob->id.lib);
|
|
|
|
}
|
|
|
|
for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob->id.flag -= LIB_NEEDLINK;
|
2003-04-26 18:01:01 +00:00
|
|
|
/* if id.us==0 a new base will be created later on */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* WARNING! Also check expand_object(), should reflect the stuff below. */
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
lib_link_pose(fd, ob, ob->pose);
|
2002-10-12 11:37:38 +00:00
|
|
|
lib_link_constraints(fd, &ob->id, &ob->constraints);
|
|
|
|
lib_link_nlastrips(fd, &ob->id, &ob->nlastrips);
|
|
|
|
lib_link_constraint_channels(fd, &ob->id, &ob->constraintChannels);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
for(paf= ob->effect.first; paf; paf= paf->next) {
|
|
|
|
if(paf->type==EFF_PARTICLE) {
|
|
|
|
paf->group= newlibadr_us(fd, ob->id.lib, paf->group);
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
sens= ob->sensors.first;
|
|
|
|
while(sens) {
|
2004-10-13 17:59:44 +00:00
|
|
|
if(ob->id.lib==NULL) { // done in expand_main
|
|
|
|
for(a=0; a<sens->totlinks; a++) {
|
|
|
|
sens->links[a]= newglobadr(fd, sens->links[a]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(sens->type==SENS_TOUCH) {
|
|
|
|
bTouchSensor *ts= sens->data;
|
|
|
|
ts->ma= newlibadr(fd, ob->id.lib, ts->ma);
|
|
|
|
}
|
|
|
|
else if(sens->type==SENS_MESSAGE) {
|
|
|
|
bMessageSensor *ms= sens->data;
|
|
|
|
ms->fromObject=
|
|
|
|
newlibadr(fd, ob->id.lib, ms->fromObject);
|
|
|
|
}
|
|
|
|
sens= sens->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cont= ob->controllers.first;
|
|
|
|
while(cont) {
|
2004-10-13 17:59:44 +00:00
|
|
|
if(ob->id.lib==NULL) { // done in expand_main
|
|
|
|
for(a=0; a<cont->totlinks; a++) {
|
|
|
|
cont->links[a]= newglobadr(fd, cont->links[a]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(cont->type==CONT_PYTHON) {
|
|
|
|
bPythonCont *pc= cont->data;
|
|
|
|
pc->text= newlibadr(fd, ob->id.lib, pc->text);
|
|
|
|
}
|
|
|
|
cont->slinks= NULL;
|
|
|
|
cont->totslinks= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cont= cont->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->type==ACT_SOUND) {
|
|
|
|
bSoundActuator *sa= act->data;
|
|
|
|
sa->sound= newlibadr_us(fd, ob->id.lib, sa->sound);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_CD) {
|
|
|
|
/* bCDActuator *cda= act->data; */
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_GAME) {
|
|
|
|
/* bGameActuator *ga= act->data; */
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_CAMERA) {
|
|
|
|
bCameraActuator *ca= act->data;
|
|
|
|
ca->ob= newlibadr(fd, ob->id.lib, ca->ob);
|
|
|
|
}
|
|
|
|
/* leave this one, it's obsolete but necessary to read for conversion */
|
|
|
|
else if(act->type==ACT_ADD_OBJECT) {
|
|
|
|
bAddObjectActuator *eoa= act->data;
|
|
|
|
if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_EDIT_OBJECT) {
|
|
|
|
bEditObjectActuator *eoa= act->data;
|
|
|
|
if(eoa==NULL) {
|
|
|
|
init_actuator(act);
|
|
|
|
}
|
|
|
|
eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
|
|
|
|
eoa->me= newlibadr(fd, ob->id.lib, eoa->me);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_SCENE) {
|
|
|
|
bSceneActuator *sa= act->data;
|
|
|
|
sa->camera= newlibadr(fd, ob->id.lib, sa->camera);
|
|
|
|
sa->scene= newlibadr(fd, ob->id.lib, sa->scene);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_ACTION) {
|
|
|
|
bActionActuator *aa= act->data;
|
|
|
|
aa->act= newlibadr(fd, ob->id.lib, aa->act);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_PROPERTY) {
|
|
|
|
bPropertyActuator *pa= act->data;
|
|
|
|
pa->ob= newlibadr(fd, ob->id.lib, pa->ob);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_MESSAGE) {
|
|
|
|
bMessageActuator *ma= act->data;
|
|
|
|
ma->toObject= newlibadr(fd, ob->id.lib, ma->toObject);
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib_link_scriptlink(fd, &ob->id, &ob->scriptlink);
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
lib_link_modifiers(fd, ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(warn) error("WARNING IN CONSOLE");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void direct_link_pose(FileData *fd, bPose *pose) {
|
|
|
|
|
2005-10-23 10:08:19 +00:00
|
|
|
bPoseChannel *pchan;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
if (!pose)
|
|
|
|
return;
|
|
|
|
|
|
|
|
link_list(fd, &pose->chanbase);
|
|
|
|
|
2005-10-23 10:08:19 +00:00
|
|
|
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
pchan->bone= NULL;
|
|
|
|
pchan->parent= newdataadr(fd, pchan->parent);
|
|
|
|
pchan->child= newdataadr(fd, pchan->child);
|
|
|
|
direct_link_constraints(fd, &pchan->constraints);
|
|
|
|
pchan->iktree.first= pchan->iktree.last= NULL;
|
|
|
|
pchan->path= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
static void direct_link_modifiers(FileData *fd, ListBase *lb)
|
|
|
|
{
|
|
|
|
ModifierData *md;
|
|
|
|
|
|
|
|
link_list(fd, lb);
|
|
|
|
|
|
|
|
for (md=lb->first; md; md=md->next) {
|
2005-08-04 07:25:43 +00:00
|
|
|
md->error = NULL;
|
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
if (md->type==eModifierType_Subsurf) {
|
|
|
|
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
|
|
|
|
|
|
|
smd->emCache = smd->mCache = 0;
|
- added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
indices)
- added ModifierType.foreachObjectLink for iterating over Object
links inside modifier data (used for file load, relinking, etc)
- switched various modifiers_ functions to take object argument
instead of ListBase
- added user editable name field to modifiers
- bug fix, duplicate and make single user didn't relink object
pointers in modifier data
- added modifiers to outliner, needs icon
- added armature, hook, and softbody modifiers (softbody doesn't
do anything atm). added conversion of old hooks to modifiers.
NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.
NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.
NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
|
|
|
} else if (md->type==eModifierType_Hook) {
|
|
|
|
HookModifierData *hmd = (HookModifierData*) md;
|
|
|
|
|
|
|
|
hmd->indexar= newdataadr(fd, hmd->indexar);
|
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
int a;
|
|
|
|
for(a=0; a<hmd->totindex; a++) {
|
|
|
|
SWITCH_INT(hmd->indexar[a]);
|
|
|
|
}
|
|
|
|
}
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void direct_link_object(FileData *fd, Object *ob)
|
|
|
|
{
|
|
|
|
PartEff *paf;
|
|
|
|
bProperty *prop;
|
|
|
|
bSensor *sens;
|
|
|
|
bController *cont;
|
|
|
|
bActuator *act;
|
2005-05-02 13:28:13 +00:00
|
|
|
int a;
|
2004-09-14 19:03:11 +00:00
|
|
|
|
2005-05-02 13:28:13 +00:00
|
|
|
ob->disp.first=ob->disp.last= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
ob->pose= newdataadr(fd, ob->pose);
|
|
|
|
direct_link_pose(fd, ob->pose);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &ob->defbase);
|
|
|
|
link_list(fd, &ob->nlastrips);
|
|
|
|
link_list(fd, &ob->constraintChannels);
|
|
|
|
|
|
|
|
direct_link_scriptlink(fd, &ob->scriptlink);
|
|
|
|
|
|
|
|
ob->mat= newdataadr(fd, ob->mat);
|
|
|
|
test_pointer_array(fd, (void **)&ob->mat);
|
2005-09-22 19:12:53 +00:00
|
|
|
|
|
|
|
/* do it here, below old data gets converted */
|
|
|
|
direct_link_modifiers(fd, &ob->modifiers);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &ob->effect);
|
|
|
|
paf= ob->effect.first;
|
|
|
|
while(paf) {
|
|
|
|
if(paf->type==EFF_PARTICLE) {
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
paf->keys= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(paf->type==EFF_WAVE) {
|
2005-07-26 02:44:59 +00:00
|
|
|
WaveEff *wav = (WaveEff*) paf;
|
|
|
|
PartEff *next = paf->next;
|
|
|
|
WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave);
|
|
|
|
|
|
|
|
wmd->damp = wav->damp;
|
|
|
|
wmd->flag = wav->flag;
|
|
|
|
wmd->height = wav->height;
|
|
|
|
wmd->lifetime = wav->lifetime;
|
|
|
|
wmd->narrow = wav->narrow;
|
|
|
|
wmd->speed = wav->speed;
|
|
|
|
wmd->startx = wav->startx;
|
|
|
|
wmd->starty = wav->startx;
|
|
|
|
wmd->timeoffs = wav->timeoffs;
|
|
|
|
wmd->width = wav->width;
|
|
|
|
|
|
|
|
BLI_addtail(&ob->modifiers, wmd);
|
|
|
|
|
|
|
|
BLI_remlink(&ob->effect, paf);
|
|
|
|
MEM_freeN(paf);
|
|
|
|
|
|
|
|
paf = next;
|
|
|
|
continue;
|
2005-07-20 04:14:21 +00:00
|
|
|
}
|
|
|
|
if(paf->type==EFF_BUILD) {
|
|
|
|
BuildEff *baf = (BuildEff*) paf;
|
|
|
|
PartEff *next = paf->next;
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build);
|
2005-07-20 04:14:21 +00:00
|
|
|
|
|
|
|
bmd->start = baf->sfra;
|
|
|
|
bmd->length = baf->len;
|
|
|
|
bmd->randomize = 0;
|
|
|
|
bmd->seed = 1;
|
|
|
|
|
|
|
|
BLI_addtail(&ob->modifiers, bmd);
|
|
|
|
|
|
|
|
BLI_remlink(&ob->effect, paf);
|
|
|
|
MEM_freeN(paf);
|
|
|
|
|
|
|
|
paf = next;
|
|
|
|
continue;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
paf= paf->next;
|
|
|
|
}
|
|
|
|
|
2004-06-26 18:18:11 +00:00
|
|
|
ob->pd= newdataadr(fd, ob->pd);
|
2005-04-02 13:57:23 +00:00
|
|
|
ob->soft= newdataadr(fd, ob->soft);
|
|
|
|
if(ob->soft) {
|
2005-05-02 13:28:13 +00:00
|
|
|
SoftBody *sb= ob->soft;
|
|
|
|
|
|
|
|
sb->bpoint= NULL; // init pointers so it gets rebuilt nicely
|
2005-04-02 13:57:23 +00:00
|
|
|
sb->bspring= NULL;
|
2005-05-02 13:28:13 +00:00
|
|
|
|
|
|
|
sb->keys= newdataadr(fd, sb->keys);
|
|
|
|
test_pointer_array(fd, (void **)&sb->keys);
|
|
|
|
if(sb->keys) {
|
|
|
|
for(a=0; a<sb->totkey; a++) {
|
|
|
|
sb->keys[a]= newdataadr(fd, sb->keys[a]);
|
|
|
|
}
|
|
|
|
}
|
2005-04-02 13:57:23 +00:00
|
|
|
}
|
2005-09-18 13:27:12 +00:00
|
|
|
ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
|
|
|
|
if(ob->fluidsimSettings) {
|
2005-11-23 12:49:22 +00:00
|
|
|
// reinit mesh pointers
|
|
|
|
ob->fluidsimSettings->orgMesh = NULL; //ob->data;
|
|
|
|
ob->fluidsimSettings->meshSurface = NULL;
|
|
|
|
ob->fluidsimSettings->meshBB = NULL;
|
2005-09-18 13:27:12 +00:00
|
|
|
}
|
2004-10-01 14:04:17 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &ob->prop);
|
|
|
|
prop= ob->prop.first;
|
|
|
|
while(prop) {
|
|
|
|
prop->poin= newdataadr(fd, prop->poin);
|
|
|
|
if(prop->poin==0) prop->poin= &prop->data;
|
|
|
|
prop= prop->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
link_list(fd, &ob->sensors);
|
|
|
|
sens= ob->sensors.first;
|
|
|
|
while(sens) {
|
2004-06-23 18:22:51 +00:00
|
|
|
sens->data= newdataadr(fd, sens->data);
|
2002-10-12 11:37:38 +00:00
|
|
|
sens->links= newdataadr(fd, sens->links);
|
|
|
|
test_pointer_array(fd, (void **)&sens->links);
|
|
|
|
sens= sens->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
direct_link_constraints(fd, &ob->constraints);
|
|
|
|
|
|
|
|
link_glob_list(fd, &ob->controllers);
|
|
|
|
cont= ob->controllers.first;
|
|
|
|
while(cont) {
|
|
|
|
cont->data= newdataadr(fd, cont->data);
|
|
|
|
cont->links= newdataadr(fd, cont->links);
|
|
|
|
test_pointer_array(fd, (void **)&cont->links);
|
|
|
|
cont= cont->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
link_glob_list(fd, &ob->actuators);
|
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
act->data= newdataadr(fd, act->data);
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
|
2004-09-14 19:03:11 +00:00
|
|
|
link_list(fd, &ob->hooks);
|
2005-08-11 02:23:52 +00:00
|
|
|
while (ob->hooks.first) {
|
|
|
|
ObHook *hook = ob->hooks.first;
|
|
|
|
HookModifierData *hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
|
|
|
|
|
2004-09-14 19:03:11 +00:00
|
|
|
hook->indexar= newdataadr(fd, hook->indexar);
|
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
int a;
|
|
|
|
for(a=0; a<hook->totindex; a++) {
|
|
|
|
SWITCH_INT(hook->indexar[a]);
|
|
|
|
}
|
|
|
|
}
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
|
2005-08-11 02:23:52 +00:00
|
|
|
/* Do conversion here because if we have loaded
|
|
|
|
* a hook we need to make sure it gets converted
|
|
|
|
* and free'd, regardless of version.
|
|
|
|
*/
|
|
|
|
VECCOPY(hmd->cent, hook->cent);
|
|
|
|
hmd->falloff = hook->falloff;
|
|
|
|
hmd->force = hook->force;
|
|
|
|
hmd->indexar = hook->indexar;
|
|
|
|
hmd->object = hook->parent;
|
|
|
|
memcpy(hmd->parentinv, hook->parentinv, sizeof(hmd->parentinv));
|
|
|
|
hmd->totindex = hook->totindex;
|
|
|
|
|
|
|
|
BLI_addhead(&ob->modifiers, hmd);
|
|
|
|
BLI_remlink(&ob->hooks, hook);
|
|
|
|
|
|
|
|
MEM_freeN(hook);
|
|
|
|
}
|
2004-09-14 19:03:11 +00:00
|
|
|
|
|
|
|
ob->bb= NULL;
|
2005-07-17 05:34:35 +00:00
|
|
|
ob->derivedDeform= NULL;
|
2005-07-19 02:36:21 +00:00
|
|
|
ob->derivedFinal= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ SCENE ***************** */
|
|
|
|
|
|
|
|
static void lib_link_scene(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Scene *sce;
|
|
|
|
Base *base, *next;
|
|
|
|
Editing *ed;
|
|
|
|
Sequence *seq;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce= main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
if(sce->id.flag & LIB_NEEDLINK) {
|
|
|
|
sce->id.us= 1;
|
|
|
|
sce->camera= newlibadr(fd, sce->id.lib, sce->camera);
|
|
|
|
sce->world= newlibadr_us(fd, sce->id.lib, sce->world);
|
|
|
|
sce->set= newlibadr(fd, sce->id.lib, sce->set);
|
|
|
|
sce->ima= newlibadr_us(fd, sce->id.lib, sce->ima);
|
|
|
|
|
|
|
|
base= sce->base.first;
|
|
|
|
while(base) {
|
|
|
|
next= base->next;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* base->object= newlibadr_us(fd, sce->id.lib, base->object); */
|
2005-12-16 17:35:38 +00:00
|
|
|
base->object= newlibadr_us(fd, sce->id.lib, base->object);
|
2004-10-18 22:39:14 +00:00
|
|
|
|
|
|
|
/* when save during radiotool, needs cleared */
|
|
|
|
base->flag &= ~OB_RADIO;
|
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
if(base->object==NULL) {
|
2002-10-12 11:37:38 +00:00
|
|
|
printf("LIB ERROR: base removed\n");
|
|
|
|
BLI_remlink(&sce->base, base);
|
|
|
|
if(base==sce->basact) sce->basact= 0;
|
|
|
|
MEM_freeN(base);
|
|
|
|
}
|
|
|
|
base= next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ed= sce->ed;
|
|
|
|
if(ed) {
|
2004-12-10 14:50:39 +00:00
|
|
|
WHILE_SEQ(&ed->seqbase) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
|
|
|
|
if(seq->scene) seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
if(seq->sound) {
|
|
|
|
seq->sound= newlibadr(fd, sce->id.lib, seq->sound);
|
|
|
|
if (seq->sound) {
|
|
|
|
seq->sound->id.us++;
|
|
|
|
seq->sound->flags |= SOUND_FLAGS_SEQUENCE;
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->anim= 0;
|
|
|
|
}
|
|
|
|
END_SEQ
|
|
|
|
}
|
2004-11-21 11:44:50 +00:00
|
|
|
|
|
|
|
lib_link_scriptlink(fd, &sce->id, &sce->scriptlink);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void link_recurs_seq(FileData *fd, ListBase *lb)
|
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
|
|
|
|
link_list(fd, lb);
|
|
|
|
seq= lb->first;
|
|
|
|
while(seq) {
|
|
|
|
if(seq->seqbase.first) link_recurs_seq(fd, &seq->seqbase);
|
|
|
|
seq= seq->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void direct_link_scene(FileData *fd, Scene *sce)
|
|
|
|
{
|
|
|
|
Editing *ed;
|
|
|
|
Sequence *seq;
|
2004-11-13 12:55:59 +00:00
|
|
|
MetaStack *ms;
|
2002-10-12 11:37:38 +00:00
|
|
|
StripElem *se;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-05-29 19:41:03 +00:00
|
|
|
sce->theDag = NULL;
|
|
|
|
sce->dagisvalid = 0;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(sce->base));
|
|
|
|
|
|
|
|
sce->basact= newdataadr(fd, sce->basact);
|
|
|
|
|
|
|
|
sce->radio= newdataadr(fd, sce->radio);
|
2005-08-24 20:37:25 +00:00
|
|
|
|
|
|
|
sce->toolsettings= newdataadr(fd, sce->toolsettings);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(sce->ed) {
|
|
|
|
ed= sce->ed= newdataadr(fd, sce->ed);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* recursive link sequences, lb will be correctly initialized */
|
2002-10-12 11:37:38 +00:00
|
|
|
link_recurs_seq(fd, &ed->seqbase);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-11-13 12:55:59 +00:00
|
|
|
WHILE_SEQ(&ed->seqbase) {
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->seq1= newdataadr(fd, seq->seq1);
|
|
|
|
seq->seq2= newdataadr(fd, seq->seq2);
|
|
|
|
seq->seq3= newdataadr(fd, seq->seq3);
|
2003-04-26 18:01:01 +00:00
|
|
|
/* a patch: after introduction of effects with 3 input strips */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(seq->seq3==0) seq->seq3= seq->seq2;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->curelem= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->plugin= newdataadr(fd, seq->plugin);
|
|
|
|
if(seq->plugin) open_plugin_seq(seq->plugin, seq->name+2);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
seq->effectdata= newdataadr(fd, seq->effectdata);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->strip= newdataadr(fd, seq->strip);
|
|
|
|
if(seq->strip && seq->strip->done==0) {
|
|
|
|
seq->strip->done= 1;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* standard: strips from effects/metas are not written, but are mallocced */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(seq->type==SEQ_IMAGE) {
|
|
|
|
seq->strip->stripdata= newdataadr(fd, seq->strip->stripdata);
|
|
|
|
se= seq->strip->stripdata;
|
|
|
|
if(se) {
|
|
|
|
for(a=0; a<seq->strip->len; a++, se++) {
|
|
|
|
se->ok= 1;
|
|
|
|
se->ibuf= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(seq->type==SEQ_MOVIE) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* only first stripelem is in file */
|
2002-10-12 11:37:38 +00:00
|
|
|
se= newdataadr(fd, seq->strip->stripdata);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(se) {
|
|
|
|
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
|
|
|
|
*seq->strip->stripdata= *se;
|
|
|
|
MEM_freeN(se);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
se= seq->strip->stripdata;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<seq->strip->len; a++, se++) {
|
|
|
|
se->ok= 1;
|
|
|
|
se->ibuf= 0;
|
|
|
|
se->nr= a + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
else if(seq->type==SEQ_SOUND) {
|
|
|
|
/* only first stripelem is in file */
|
|
|
|
se= newdataadr(fd, seq->strip->stripdata);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
if(se) {
|
|
|
|
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
|
|
|
|
*seq->strip->stripdata= *se;
|
|
|
|
MEM_freeN(se);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
se= seq->strip->stripdata;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
for(a=0; a<seq->strip->len; a++, se++) {
|
|
|
|
se->ok= 2; /* why? */
|
|
|
|
se->ibuf= 0;
|
|
|
|
se->nr= a + 1;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
|
|
|
else if(seq->len>0)
|
2002-10-12 11:37:38 +00:00
|
|
|
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
END_SEQ
|
2004-11-13 12:55:59 +00:00
|
|
|
|
|
|
|
/* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */
|
|
|
|
{
|
|
|
|
Sequence temp;
|
|
|
|
char *poin;
|
|
|
|
long offset;
|
2005-03-09 19:45:59 +00:00
|
|
|
/*int seted=0;*/ /*unused*/
|
2004-11-13 12:55:59 +00:00
|
|
|
|
|
|
|
offset= ((long)&(temp.seqbase)) - ((long)&temp);
|
|
|
|
|
|
|
|
/* root pointer */
|
|
|
|
poin= (char *)ed->seqbasep;
|
|
|
|
poin -= offset;
|
|
|
|
poin= newdataadr(fd, poin);
|
|
|
|
if(poin) ed->seqbasep= (ListBase *)(poin+offset);
|
|
|
|
else ed->seqbasep= &ed->seqbase;
|
|
|
|
|
|
|
|
/* stack */
|
|
|
|
link_list(fd, &(ed->metastack));
|
|
|
|
|
|
|
|
for(ms= ed->metastack.first; ms; ms= ms->next) {
|
|
|
|
ms->parseq= newdataadr(fd, ms->parseq);
|
|
|
|
|
|
|
|
poin= (char *)ms->oldbasep;
|
|
|
|
poin -= offset;
|
|
|
|
poin= newdataadr(fd, poin);
|
|
|
|
if(poin) ms->oldbasep= (ListBase *)(poin+offset);
|
|
|
|
else ms->oldbasep= &ed->seqbase;
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
direct_link_scriptlink(fd, &sce->scriptlink);
|
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
|
|
|
|
|
|
|
sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata);
|
|
|
|
if (sce->r.avicodecdata) {
|
|
|
|
sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat);
|
|
|
|
sce->r.avicodecdata->lpParms = newdataadr(fd, sce->r.avicodecdata->lpParms);
|
|
|
|
}
|
|
|
|
|
|
|
|
sce->r.qtcodecdata = newdataadr(fd, sce->r.qtcodecdata);
|
|
|
|
if (sce->r.qtcodecdata) {
|
|
|
|
sce->r.qtcodecdata->cdParms = newdataadr(fd, sce->r.qtcodecdata->cdParms);
|
|
|
|
}
|
|
|
|
|
|
|
|
link_list(fd, &(sce->markers));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************ READ SCREEN ***************** */
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
/* note: file read without screens option G_FILE_NO_UI;
|
|
|
|
check lib pointers in call below */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void lib_link_screen(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
bScreen *sc;
|
|
|
|
ScrArea *sa;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sc= main->screen.first;
|
|
|
|
while(sc) {
|
|
|
|
if(sc->id.flag & LIB_NEEDLINK) {
|
|
|
|
sc->id.us= 1;
|
|
|
|
sc->scene= newlibadr(fd, sc->id.lib, sc->scene);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sa->full= newlibadr(fd, sc->id.lib, sa->full);
|
2004-06-23 18:22:51 +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
|
|
|
/* space handler scriptlinks */
|
|
|
|
lib_link_scriptlink(fd, &sc->id, &sa->scriptlink);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
v3d->camera= newlibadr(fd, sc->id.lib, v3d->camera);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(v3d->bgpic) {
|
|
|
|
v3d->bgpic->ima= newlibadr_us(fd, sc->id.lib, v3d->bgpic->ima);
|
|
|
|
v3d->bgpic->tex= newlibadr_us(fd, sc->id.lib, v3d->bgpic->tex);
|
2004-09-18 18:34:50 +00:00
|
|
|
v3d->bgpic->rect= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(v3d->localvd) {
|
|
|
|
v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)sl;
|
|
|
|
sipo->editipo= 0;
|
2004-11-13 12:55:59 +00:00
|
|
|
|
|
|
|
if(sipo->blocktype==ID_SEQ) sipo->from= NULL; // no libdata
|
|
|
|
else sipo->from= newlibadr(fd, sc->id.lib, sipo->from);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sipo->ipokey.first= sipo->ipokey.last= 0;
|
|
|
|
sipo->ipo= newlibadr(fd, sc->id.lib, sipo->ipo);
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_BUTS) {
|
|
|
|
SpaceButs *sbuts= (SpaceButs *)sl;
|
2004-09-05 13:43:51 +00:00
|
|
|
sbuts->rect= NULL;
|
|
|
|
sbuts->lockpoin= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile<132) set_rects_butspace(sbuts);
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_FILE) {
|
|
|
|
SpaceFile *sfile= (SpaceFile *)sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sfile->filelist= 0;
|
|
|
|
sfile->libfiledata= 0;
|
|
|
|
sfile->returnfunc= 0;
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IMASEL) {
|
|
|
|
check_imasel_copy((SpaceImaSel *)sl);
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_ACTION) {
|
|
|
|
SpaceAction *saction= (SpaceAction *)sl;
|
|
|
|
saction->action = newlibadr(fd, sc->id.lib, saction->action);
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima= (SpaceImage *)sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sima->image= newlibadr_us(fd, sc->id.lib, sima->image);
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_NLA){
|
2004-01-24 12:24:58 +00:00
|
|
|
/* SpaceNla *snla= (SpaceNla *)sl; */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_TEXT) {
|
|
|
|
SpaceText *st= (SpaceText *)sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
st->text= newlibadr(fd, sc->id.lib, st->text);
|
2003-12-14 01:18:09 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_SCRIPT) {
|
|
|
|
SpaceScript *sc= (SpaceScript *)sl;
|
|
|
|
|
|
|
|
sc->script = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_OOPS) {
|
|
|
|
SpaceOops *so= (SpaceOops *)sl;
|
|
|
|
Oops *oops;
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
TreeStoreElem *tselem;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
oops= so->oops.first;
|
|
|
|
while(oops) {
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
oops->id= newlibadr(fd, NULL, oops->id);
|
2002-10-12 11:37:38 +00:00
|
|
|
oops= oops->next;
|
|
|
|
}
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
so->lockpoin= NULL;
|
|
|
|
so->tree.first= so->tree.last= NULL;
|
|
|
|
|
|
|
|
if(so->treestore) {
|
|
|
|
tselem= so->treestore->data;
|
|
|
|
for(a=0; a<so->treestore->usedelem; a++, tselem++) {
|
|
|
|
tselem->id= newlibadr(fd, NULL, tselem->id);
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_SOUND) {
|
|
|
|
SpaceSound *ssound= (SpaceSound *)sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ssound->sound= newlibadr_us(fd, sc->id.lib, ssound->sound);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc->id.flag -= LIB_NEEDLINK;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-05 17:18:17 +00:00
|
|
|
static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
|
2004-09-05 13:43:51 +00:00
|
|
|
{
|
|
|
|
ListBase *lb;
|
|
|
|
ID *idn=NULL;
|
|
|
|
|
|
|
|
if(id) {
|
|
|
|
lb= wich_libbase(mainp, GS(id->name));
|
2004-12-08 18:36:48 +00:00
|
|
|
|
|
|
|
if(lb) { // there's still risk of checking corrupt mem (freed Ids in oops)
|
|
|
|
idn= lb->first;
|
|
|
|
while(idn) {
|
|
|
|
if( strcmp(idn->name, id->name)==0) {
|
|
|
|
if(user && idn->us==0) idn->us++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
idn= idn->next;
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return idn;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called from kernel/blender.c */
|
2005-07-28 11:05:21 +00:00
|
|
|
/* used to link a file (without UI) to the current UI */
|
|
|
|
void lib_link_screen_restore(Main *newmain, Scene *curscene)
|
2004-09-05 13:43:51 +00:00
|
|
|
{
|
|
|
|
bScreen *sc;
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
sc= newmain->screen.first;
|
|
|
|
while(sc) {
|
2005-07-28 11:05:21 +00:00
|
|
|
|
|
|
|
sc->scene= curscene;
|
2004-09-05 13:43:51 +00:00
|
|
|
|
|
|
|
sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
BPython bug fixes:
- #2781, reported by Ed Blake: crash on undo when there were active space handlers. Space Handler script links belong to screen areas, which do not get saved on undo. Thanks Ton for pointing out the function that restores ui pointers gone bad.
- Applied patch #2822 by Ken Hughes for bug #2647 ("Setting a Face UV"), reported by Campbell Barton.
- #3022, reported by Timothy Wakeham: "Blender.BGL.glDrawPixels crashes when drawing more pixels then buffer size". Made glDrawPixels check buffer dimensions.
- #2882, reported by Campbell: crash in nmesh.getMaterials(arg == 0 or 1) when nmesh came from GetRawFromMesh(). Raw nmeshes are not linked to Blender meshes, so the method doesn't support these options (getting mat info from the actual mesh) for it.
- #2817, reported by Tod Koeckeritz: Dir_Depth var was not being decremented in BPY_Menus.c, causing dir depth limits to be reached prematurely.
- #2954, reported by Daniel Holtz: "Python scripts crash hard with valid windows paths". Blender.Load() was not meant for background mode, now it's been update to support it, using BKE_read_file instead of BIF_read_file in this case. Also found another issue with command line scripts using Blender.Load() that could crash Blender: trying to free the Text when it wasn't available anymore (loading a new .blend already removed it). There are still issues with one case, though, causing a crash on start or "Memoryblock winopen: double free" at end, when running a script that is already a Blender Text (only if the script calls Blender.Load, of course). Will investigate.
- #2897: reported by Timothy Wakeham: object.setMaterials was asking the length of a Python list w/o confirming first if the passed obj was really a list.
Thanks all for the help and for being patient (long delay, again).
2005-10-03 19:12:11 +00:00
|
|
|
if (sa->scriptlink.totscript) {
|
|
|
|
/* restore screen area script links */
|
|
|
|
ScriptLink *slink = &sa->scriptlink;
|
|
|
|
int script_idx;
|
|
|
|
for (script_idx = 0; script_idx < slink->totscript; script_idx++) {
|
|
|
|
slink->scripts[script_idx] = restore_pointer_by_name(newmain,
|
|
|
|
(ID *)slink->scripts[script_idx], 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
2004-11-14 12:56:56 +00:00
|
|
|
|
2005-07-28 11:05:21 +00:00
|
|
|
v3d->camera= sc->scene->camera;
|
2004-09-05 13:43:51 +00:00
|
|
|
|
|
|
|
if(v3d->bgpic) {
|
2004-11-05 17:18:17 +00:00
|
|
|
v3d->bgpic->ima= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->ima, 1);
|
|
|
|
v3d->bgpic->tex= restore_pointer_by_name(newmain, (ID *)v3d->bgpic->tex, 1);
|
2004-09-05 13:43:51 +00:00
|
|
|
if(v3d->bgpic->rect) freeN(v3d->bgpic->rect);
|
|
|
|
v3d->bgpic->rect= NULL;
|
|
|
|
}
|
|
|
|
if(v3d->localvd) {
|
2004-11-14 12:56:56 +00:00
|
|
|
Base *base;
|
2005-07-28 11:05:21 +00:00
|
|
|
|
|
|
|
v3d->localvd->camera= sc->scene->camera;
|
2004-11-14 12:56:56 +00:00
|
|
|
|
|
|
|
/* localview can become invalid during undo/redo steps, so we exit it when no could be found */
|
|
|
|
for(base= sc->scene->base.first; base; base= base->next) {
|
|
|
|
if(base->lay & v3d->lay) break;
|
|
|
|
}
|
2004-11-14 16:06:24 +00:00
|
|
|
if(base==NULL) {
|
|
|
|
v3d->lay= v3d->localvd->lay;
|
|
|
|
v3d->layact= v3d->localvd->layact;
|
|
|
|
MEM_freeN(v3d->localvd);
|
|
|
|
v3d->localvd= NULL;
|
|
|
|
v3d->localview= 0;
|
|
|
|
}
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
2004-11-14 12:56:56 +00:00
|
|
|
else if(v3d->scenelock) v3d->lay= sc->scene->lay;
|
|
|
|
|
2005-09-29 19:52:42 +00:00
|
|
|
/* not very nice, but could help */
|
|
|
|
if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)sl;
|
2004-11-13 12:55:59 +00:00
|
|
|
|
|
|
|
if(sipo->blocktype==ID_SEQ) sipo->from= NULL; // no libdata
|
|
|
|
else sipo->from= restore_pointer_by_name(newmain, (ID *)sipo->from, 0);
|
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
// not free sipo->ipokey, creates dependency with src/
|
2004-11-05 17:18:17 +00:00
|
|
|
sipo->ipo= restore_pointer_by_name(newmain, (ID *)sipo->ipo, 0);
|
2004-09-05 13:43:51 +00:00
|
|
|
if(sipo->editipo) MEM_freeN(sipo->editipo);
|
|
|
|
sipo->editipo= NULL;
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_BUTS) {
|
|
|
|
SpaceButs *sbuts= (SpaceButs *)sl;
|
|
|
|
sbuts->lockpoin= NULL;
|
2004-09-18 18:34:50 +00:00
|
|
|
sbuts->cury= 0; // we leave rect, for nicer redraws
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_FILE) {
|
|
|
|
SpaceFile *sfile= (SpaceFile *)sl;
|
2004-10-31 20:18:14 +00:00
|
|
|
if(sfile->libfiledata)
|
|
|
|
BLO_blendhandle_close(sfile->libfiledata);
|
|
|
|
sfile->libfiledata= 0;
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IMASEL) {
|
Another step in the undo evolution.
- Made unified API for undo calls, to be found in space.c
BIF_undo_push(char *str)
BIF_undo(void)
BIF_redo(void)
These calls will do all undo levels, including editmode and vpaint.
The transition is work in progress, because mesh undo needs recode.
- New global hotkey CTR+Z for undo
Note: 'shaded draw mode' still is SHIFT+Z, the old CTRL+Z was to recalc
the lighting in shaded mode, which already became much more interactive,
like during/after any transform().
Recalc hotkey now is SHIFT+ALT+Z
CTRL+<any modifier>+Z is redo.
- For OSX users; the Apple-key ("Command") now maps to CTRL as well. This
disables the one-mouse-button hack for rightmouse btw, will be fixed in
next commit. At least we can use Apple-Z :)
- Old Ukey for undo is still there, as a training period... my preference is
to restore Ukey to "reload original data" as in past, and only use new
CTRL+Z for undo.
- Added undo_push() for all of editobject.c and editview.c. Meaning we can
start using/testing global undo in the 3d window. Please dont comment on
missing parts for now, first I want someone to volunteer to tackle all of
that.
- Since the global undo has a full 'file' in memory, it can save extremely
fast on exit to <temp dir>/quit.blend. That's default now when global undo
is enabled. It prints "Saved session recovery to ..." in console then.
- In file menu, a new option is added "Recover Last Session". Note that this
reads the undo-save, which is without UI.
- With such nice new features we then can also kill the disputed
Cancel/Confirm menu on Q-KEY.
- Added fix which initializes seam/normal theme color on saved themes.
They showed black now.... (Note: that's in usiblender.c!)
2004-09-18 12:12:45 +00:00
|
|
|
;
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_ACTION) {
|
|
|
|
SpaceAction *saction= (SpaceAction *)sl;
|
2004-11-05 17:18:17 +00:00
|
|
|
saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1);
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima= (SpaceImage *)sl;
|
|
|
|
|
2004-11-05 17:18:17 +00:00
|
|
|
sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1);
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_NLA){
|
|
|
|
/* SpaceNla *snla= (SpaceNla *)sl; */
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_TEXT) {
|
|
|
|
SpaceText *st= (SpaceText *)sl;
|
|
|
|
|
2004-11-05 17:18:17 +00:00
|
|
|
st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1);
|
2004-10-29 15:00:11 +00:00
|
|
|
if(st->text==NULL) st->text= newmain->text.first;
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_SCRIPT) {
|
|
|
|
SpaceScript *sc= (SpaceScript *)sl;
|
|
|
|
|
|
|
|
sc->script = NULL;
|
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_OOPS) {
|
|
|
|
SpaceOops *so= (SpaceOops *)sl;
|
|
|
|
Oops *oops;
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
|
|
|
int a;
|
2004-09-05 13:43:51 +00:00
|
|
|
oops= so->oops.first;
|
|
|
|
while(oops) {
|
2004-11-05 17:18:17 +00:00
|
|
|
oops->id= restore_pointer_by_name(newmain, (ID *)oops->id, 0);
|
2004-09-05 13:43:51 +00:00
|
|
|
oops= oops->next;
|
|
|
|
}
|
|
|
|
so->lockpoin= NULL;
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
|
|
|
if(so->treestore) {
|
|
|
|
TreeStore *ts= so->treestore;
|
|
|
|
TreeStoreElem *tselem=ts->data;
|
|
|
|
for(a=0; a<ts->usedelem; a++, tselem++) {
|
2004-11-05 17:18:17 +00:00
|
|
|
tselem->id= restore_pointer_by_name(newmain, tselem->id, 0);
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
else if(sl->spacetype==SPACE_SOUND) {
|
|
|
|
SpaceSound *ssound= (SpaceSound *)sl;
|
|
|
|
|
2004-11-05 17:18:17 +00:00
|
|
|
ssound->sound= restore_pointer_by_name(newmain, (ID *)ssound->sound, 1);
|
2004-09-05 13:43:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void direct_link_screen(FileData *fd, bScreen *sc)
|
|
|
|
{
|
|
|
|
ScrArea *sa;
|
|
|
|
ScrVert *sv;
|
|
|
|
ScrEdge *se;
|
|
|
|
Oops *oops;
|
2005-10-27 13:56:41 +00:00
|
|
|
int a;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(sc->vertbase));
|
|
|
|
link_list(fd, &(sc->edgebase));
|
|
|
|
link_list(fd, &(sc->areabase));
|
|
|
|
sc->winakt= 0;
|
|
|
|
|
2005-10-27 13:56:41 +00:00
|
|
|
/* hacky patch... but people have been saving files with the verse-blender,
|
|
|
|
causing the handler to keep running for ever, with no means to disable it */
|
|
|
|
for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
|
|
|
|
if( sc->handler[a]==SCREEN_HANDLER_VERSE) {
|
|
|
|
sc->handler[a]= 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* edges */
|
|
|
|
se= sc->edgebase.first;
|
|
|
|
while(se) {
|
|
|
|
se->v1= newdataadr(fd, se->v1);
|
|
|
|
se->v2= newdataadr(fd, se->v2);
|
|
|
|
if( (long)se->v1 > (long)se->v2) {
|
|
|
|
sv= se->v1;
|
|
|
|
se->v1= se->v2;
|
|
|
|
se->v2= sv;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(se->v1==NULL) {
|
|
|
|
printf("error reading screen... file corrupt\n");
|
|
|
|
se->v1= se->v2;
|
|
|
|
}
|
|
|
|
se= se->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* areas */
|
|
|
|
sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
2003-10-05 13:19:08 +00:00
|
|
|
Panel *pa;
|
2002-10-12 11:37:38 +00:00
|
|
|
SpaceLink *sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(sa->spacedata));
|
2003-10-04 20:35:50 +00:00
|
|
|
link_list(fd, &(sa->panels));
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-10-14 20:13:51 +00:00
|
|
|
for(pa= sa->panels.first; pa; pa=pa->next) {
|
|
|
|
pa->paneltab= newdataadr(fd, pa->paneltab);
|
|
|
|
pa->active= 0;
|
2004-12-01 12:39:14 +00:00
|
|
|
pa->sortcounter= 0;
|
2003-10-14 20:13:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if (sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
v3d->bgpic= newdataadr(fd, v3d->bgpic);
|
|
|
|
v3d->localvd= newdataadr(fd, v3d->localvd);
|
2005-07-14 12:44:33 +00:00
|
|
|
v3d->afterdraw.first= v3d->afterdraw.last= NULL;
|
2005-08-20 19:18:35 +00:00
|
|
|
v3d->clipbb= newdataadr(fd, v3d->clipbb);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else if (sl->spacetype==SPACE_OOPS) {
|
|
|
|
SpaceOops *soops= (SpaceOops*) sl;
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
link_list(fd, &(soops->oops));
|
|
|
|
oops= soops->oops.first;
|
|
|
|
while(oops) {
|
|
|
|
oops->link.first= oops->link.last= 0;
|
|
|
|
oops= oops->next;
|
|
|
|
}
|
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
|
|
|
|
|
|
|
soops->treestore= newdataadr(fd, soops->treestore);
|
|
|
|
if(soops->treestore) {
|
|
|
|
soops->treestore->data= newdataadr(fd, soops->treestore->data);
|
|
|
|
/* we only saved what was used */
|
|
|
|
soops->treestore->totelem= soops->treestore->usedelem;
|
|
|
|
soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-12-18 13:46:01 +00:00
|
|
|
else if(sl->spacetype==SPACE_NODE) {
|
|
|
|
SpaceNode *snode= (SpaceNode *)sl;
|
|
|
|
snode->nodetree= NULL;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sa->v1= newdataadr(fd, sa->v1);
|
|
|
|
sa->v2= newdataadr(fd, sa->v2);
|
|
|
|
sa->v3= newdataadr(fd, sa->v3);
|
|
|
|
sa->v4= newdataadr(fd, sa->v4);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sa->win= sa->headwin= 0;
|
|
|
|
|
|
|
|
sa->uiblocks.first= sa->uiblocks.last= NULL;
|
2004-06-23 18:22:51 +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
|
|
|
/* space handler scriptlinks */
|
|
|
|
direct_link_scriptlink(fd, &sa->scriptlink);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sa= sa->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/* ********** READ LIBRARY *************** */
|
|
|
|
|
|
|
|
|
2005-12-14 09:59:22 +00:00
|
|
|
static void direct_link_library(FileData *fd, Library *lib, Main *main)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Main *newmain;
|
2005-12-14 09:59:22 +00:00
|
|
|
Library *libr;
|
|
|
|
|
|
|
|
for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
|
|
|
|
if(newmain->curlib) {
|
|
|
|
if(strcmp(newmain->curlib->name, lib->name)==0) {
|
|
|
|
printf("Fixed error in file; multiple instances of lib:\n %s\n", lib->name);
|
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
change_idid_adr_fd(fd, lib, newmain->curlib);
|
2005-12-14 09:59:22 +00:00
|
|
|
|
|
|
|
BLI_remlink(&main->library, lib);
|
|
|
|
MEM_freeN(lib);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* new main */
|
2002-10-12 11:37:38 +00:00
|
|
|
newmain= MEM_callocN(sizeof(Main), "directlink");
|
|
|
|
BLI_addtail(&fd->mainlist, newmain);
|
|
|
|
newmain->curlib= lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_library(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Library *lib;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib= main->library.first;
|
|
|
|
while(lib) {
|
|
|
|
lib->id.us= 1;
|
|
|
|
lib= lib->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************** READ SOUND ******************* */
|
|
|
|
|
|
|
|
static void direct_link_sound(FileData *fd, bSound *sound)
|
|
|
|
{
|
|
|
|
sound->sample = NULL;
|
|
|
|
sound->snd_sound = NULL;
|
|
|
|
|
|
|
|
sound->packedfile = direct_link_packedfile(fd, sound->packedfile);
|
|
|
|
sound->newpackedfile = direct_link_packedfile(fd, sound->newpackedfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_sound(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
bSound *sound;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sound= main->sound.first;
|
|
|
|
while(sound) {
|
|
|
|
if(sound->id.flag & LIB_NEEDLINK) {
|
|
|
|
sound->id.flag -= LIB_NEEDLINK;
|
|
|
|
sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo);
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
sound->stream = 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
sound= sound->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* ***************** READ GROUP *************** */
|
|
|
|
|
|
|
|
static void direct_link_group(FileData *fd, Group *group)
|
|
|
|
{
|
|
|
|
link_list(fd, &group->gobject);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_group(FileData *fd, Main *main)
|
|
|
|
{
|
|
|
|
Group *group= main->group.first;
|
|
|
|
GroupObject *go;
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
int add_us;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(group) {
|
|
|
|
if(group->id.flag & LIB_NEEDLINK) {
|
|
|
|
group->id.flag -= LIB_NEEDLINK;
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
|
|
|
|
add_us= 0;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
go= group->gobject.first;
|
|
|
|
while(go) {
|
|
|
|
go->ob= newlibadr(fd, group->id.lib, go->ob);
|
2005-12-06 15:39:25 +00:00
|
|
|
if(go->ob) {
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
/* if group has an object, it increments user... */
|
|
|
|
add_us= 1;
|
2005-12-06 15:39:25 +00:00
|
|
|
if(go->ob->id.us==0)
|
|
|
|
go->ob->id.us= 1;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
go= go->next;
|
|
|
|
}
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
if(add_us) group->id.us++;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
rem_from_group(group, NULL); /* removes NULL entries */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
group= group->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* ************** GENERAL & MAIN ******************** */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID **id_r)
|
|
|
|
{
|
2003-04-26 18:01:01 +00:00
|
|
|
/* this routine reads a libblock and its direct data. Use link functions
|
|
|
|
* to connect it all
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ID *id;
|
|
|
|
ListBase *lb;
|
2004-04-24 20:04:37 +00:00
|
|
|
char *str = NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(bhead->code==ID_ID) {
|
|
|
|
ID *linkedid= (ID *)(bhead + 1); /* BHEAD+DATA dependancy */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lb= wich_libbase(main, GS(linkedid->name));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lb= wich_libbase(main, bhead->code);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* read libblock */
|
2004-04-23 21:02:58 +00:00
|
|
|
id = read_struct(fd, bhead, "lib block");
|
2002-10-12 11:37:38 +00:00
|
|
|
if (id_r)
|
|
|
|
*id_r= id;
|
|
|
|
if (!id)
|
|
|
|
return blo_nextbhead(fd, bhead);
|
2005-12-14 23:00:01 +00:00
|
|
|
|
|
|
|
oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); /* for ID_ID check */
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_addtail(lb, id);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* clear first 8 bits */
|
2002-10-12 11:37:38 +00:00
|
|
|
id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK;
|
|
|
|
id->lib= main->curlib;
|
|
|
|
if(id->flag & LIB_FAKEUSER) id->us= 1;
|
|
|
|
else id->us= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* this case cannot be direct_linked: it's just the ID part */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(bhead->code==ID_ID) {
|
|
|
|
return blo_nextbhead(fd, bhead);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-04-23 21:02:58 +00:00
|
|
|
switch( GS(id->name) ) {
|
|
|
|
case ID_OB: str= "ID_OB"; break;
|
|
|
|
case ID_SCE: str= "ID_SCE"; break;
|
|
|
|
case ID_LI: str= "ID_LI"; break;
|
|
|
|
case ID_ME: str= "ID_ME"; break;
|
|
|
|
case ID_CU: str= "ID_CU"; break;
|
|
|
|
case ID_MB: str= "ID_MB"; break;
|
|
|
|
case ID_MA: str= "ID_MA"; break;
|
|
|
|
case ID_TE: str= "ID_TE"; break;
|
|
|
|
case ID_IM: str= "ID_IM"; break;
|
|
|
|
case ID_IK: str= "ID_IK"; break;
|
|
|
|
case ID_WV: str= "ID_WV"; break;
|
|
|
|
case ID_LT: str= "ID_LT"; break;
|
|
|
|
case ID_SE: str= "ID_SE"; break;
|
|
|
|
case ID_LF: str= "ID_LF"; break;
|
|
|
|
case ID_LA: str= "ID_LA"; break;
|
|
|
|
case ID_CA: str= "ID_CA"; break;
|
|
|
|
case ID_IP: str= "ID_IP"; break;
|
|
|
|
case ID_KE: str= "ID_KE"; break;
|
|
|
|
case ID_WO: str= "ID_WO"; break;
|
|
|
|
case ID_SCR: str= "ID_SCR"; break;
|
|
|
|
case ID_VF: str= "ID_VF"; break;
|
|
|
|
case ID_TXT : str= "ID_TXT"; break;
|
|
|
|
case ID_SO: str= "ID_SO"; break;
|
|
|
|
case ID_SAMPLE: str= "ID_SAMPLE"; break;
|
|
|
|
case ID_GR: str= "ID_GR"; break;
|
|
|
|
case ID_SEQ: str= "ID_SEQ"; break;
|
|
|
|
case ID_AR: str= "ID_AR"; break;
|
|
|
|
case ID_AC: str= "ID_AC"; break;
|
|
|
|
}
|
2003-04-26 18:01:01 +00:00
|
|
|
/* read all data */
|
2002-10-12 11:37:38 +00:00
|
|
|
while(bhead && bhead->code==DATA) {
|
2004-04-23 21:02:58 +00:00
|
|
|
void *data= read_struct(fd, bhead, str);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (data) {
|
|
|
|
oldnewmap_insert(fd->datamap, bhead->old, data, 0);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* init pointers direct data */
|
2002-10-12 11:37:38 +00:00
|
|
|
switch( GS(id->name) ) {
|
|
|
|
case ID_SCR:
|
|
|
|
direct_link_screen(fd, (bScreen *)id);
|
|
|
|
break;
|
|
|
|
case ID_SCE:
|
|
|
|
direct_link_scene(fd, (Scene *)id);
|
|
|
|
break;
|
|
|
|
case ID_OB:
|
|
|
|
direct_link_object(fd, (Object *)id);
|
|
|
|
break;
|
|
|
|
case ID_ME:
|
|
|
|
direct_link_mesh(fd, (Mesh *)id);
|
|
|
|
break;
|
|
|
|
case ID_CU:
|
|
|
|
direct_link_curve(fd, (Curve *)id);
|
|
|
|
break;
|
|
|
|
case ID_MB:
|
|
|
|
direct_link_mball(fd, (MetaBall *)id);
|
|
|
|
break;
|
|
|
|
case ID_MA:
|
|
|
|
direct_link_material(fd, (Material *)id);
|
|
|
|
break;
|
|
|
|
case ID_TE:
|
|
|
|
direct_link_texture(fd, (Tex *)id);
|
|
|
|
break;
|
|
|
|
case ID_IM:
|
|
|
|
direct_link_image(fd, (Image *)id);
|
|
|
|
break;
|
|
|
|
case ID_LA:
|
|
|
|
direct_link_lamp(fd, (Lamp *)id);
|
|
|
|
break;
|
|
|
|
case ID_VF:
|
|
|
|
direct_link_vfont(fd, (VFont *)id);
|
|
|
|
break;
|
|
|
|
case ID_TXT:
|
|
|
|
direct_link_text(fd, (Text *)id);
|
|
|
|
break;
|
|
|
|
case ID_IP:
|
|
|
|
direct_link_ipo(fd, (Ipo *)id);
|
|
|
|
break;
|
|
|
|
case ID_KE:
|
|
|
|
direct_link_key(fd, (Key *)id);
|
|
|
|
break;
|
|
|
|
case ID_LT:
|
|
|
|
direct_link_latt(fd, (Lattice *)id);
|
|
|
|
break;
|
|
|
|
case ID_WO:
|
|
|
|
direct_link_world(fd, (World *)id);
|
|
|
|
break;
|
|
|
|
case ID_LI:
|
2005-12-14 09:59:22 +00:00
|
|
|
direct_link_library(fd, (Library *)id, main);
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
case ID_CA:
|
|
|
|
direct_link_camera(fd, (Camera *)id);
|
|
|
|
break;
|
|
|
|
case ID_SO:
|
|
|
|
direct_link_sound(fd, (bSound *)id);
|
|
|
|
break;
|
|
|
|
case ID_GR:
|
|
|
|
direct_link_group(fd, (Group *)id);
|
|
|
|
break;
|
|
|
|
case ID_AR:
|
|
|
|
direct_link_armature(fd, (bArmature*)id);
|
|
|
|
break;
|
|
|
|
case ID_AC:
|
|
|
|
direct_link_action(fd, (bAction*)id);
|
|
|
|
break;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
oldnewmap_free_unused(fd->datamap);
|
|
|
|
oldnewmap_clear(fd->datamap);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return (bhead);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void link_global(FileData *fd, BlendFileData *bfd, FileGlobal *fg)
|
|
|
|
{
|
2004-09-05 13:43:51 +00:00
|
|
|
// this is nonsense... make it struct once (ton)
|
2002-10-12 11:37:38 +00:00
|
|
|
bfd->winpos= fg->winpos;
|
|
|
|
bfd->fileflags= fg->fileflags;
|
|
|
|
bfd->displaymode= fg->displaymode;
|
2003-07-21 19:41:07 +00:00
|
|
|
bfd->globalf= fg->globalf;
|
2002-10-12 11:37:38 +00:00
|
|
|
bfd->curscreen= newlibadr(fd, 0, fg->curscreen);
|
2004-09-05 13:43:51 +00:00
|
|
|
bfd->curscene= newlibadr(fd, 0, fg->curscene);
|
|
|
|
// this happens in files older than 2.35
|
|
|
|
if(bfd->curscene==NULL) {
|
|
|
|
if(bfd->curscreen) bfd->curscene= bfd->curscreen->scene;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void vcol_to_fcol(Mesh *me)
|
|
|
|
{
|
|
|
|
MFace *mface;
|
|
|
|
unsigned int *mcol, *mcoln, *mcolmain;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(me->totface==0 || me->mcol==0) return;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
mcoln= mcolmain= MEM_mallocN(4*sizeof(int)*me->totface, "mcoln");
|
|
|
|
mcol = (unsigned int *)me->mcol;
|
|
|
|
mface= me->mface;
|
|
|
|
for(a=me->totface; a>0; a--, mface++) {
|
|
|
|
mcoln[0]= mcol[mface->v1];
|
|
|
|
mcoln[1]= mcol[mface->v2];
|
|
|
|
mcoln[2]= mcol[mface->v3];
|
|
|
|
mcoln[3]= mcol[mface->v4];
|
|
|
|
mcoln+= 4;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(me->mcol);
|
|
|
|
me->mcol= (MCol *)mcolmain;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int map_223_keybd_code_to_224_keybd_code(int code)
|
|
|
|
{
|
|
|
|
switch (code) {
|
|
|
|
case 312: return F12KEY;
|
|
|
|
case 159: return PADSLASHKEY;
|
|
|
|
case 161: return PAD0;
|
|
|
|
case 154: return PAD1;
|
|
|
|
case 150: return PAD2;
|
|
|
|
case 155: return PAD3;
|
|
|
|
case 151: return PAD4;
|
|
|
|
case 156: return PAD5;
|
|
|
|
case 152: return PAD6;
|
|
|
|
case 157: return PAD7;
|
|
|
|
case 153: return PAD8;
|
|
|
|
case 158: return PAD9;
|
|
|
|
default: return code;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Armature "Envelope" editing.
For defining the deformation distances of Bones, three values are being
used now. The bone tip and root radius define the bone-shape itself and the
"dist" defines the soft area around it. A full (user) doc is in CMS here;
http://www.blender3d.org/cms/Armature_Envelopes.647.0.html
Note: todo still is allowing both Vertex Deform Groups and these Envelopes
together (and or per Bone).
Also part of this commit is:
- New: Hiding bones in EditMode. This is a separate 'hide flag', so you can
keep the PoseMode hidden Bones separate from EditMode.
(In the future we should do some kind of bone-grouping or so)
- While transform(), the hotkeys G,R,S only switch mode when the previous
mode was compatible. Caused conflicts with Crease/BoneDist/etc.
- Deleting the last VertexGroup now also deletes the entire Mesh 'dvert'
data. Sounds logical, but remember that VertexGroups are partial on a
Mesh, partial on Object. Weird design decision though...
Anyhoo, at this moment the only way to have Bone Envelopes deform, is
by deleting all VertexGroups!
- In PoseMode, the hotkey ALT+S now does both B-Bone size or Envelope,
depending draw type.
- In EditMode, Extrude now also works when only Root points were selected.
- Weight editing is also symmetrical btw, with the "X-axis Mirror" option
set.
2005-08-19 12:35:15 +00:00
|
|
|
static void bone_version_238(ListBase *lb)
|
|
|
|
{
|
|
|
|
Bone *bone;
|
|
|
|
|
|
|
|
for(bone= lb->first; bone; bone= bone->next) {
|
|
|
|
if(bone->rad_tail==0.0f && bone->rad_head==0.0f) {
|
|
|
|
bone->rad_head= 0.25f*bone->length;
|
|
|
|
bone->rad_tail= 0.1f*bone->length;
|
|
|
|
|
|
|
|
bone->dist-= bone->rad_head;
|
|
|
|
if(bone->dist<=0.0f) bone->dist= 0.0f;
|
|
|
|
}
|
|
|
|
bone_version_238(&bone->childbase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-07 12:36:26 +00:00
|
|
|
static void bone_version_239(ListBase *lb)
|
|
|
|
{
|
|
|
|
Bone *bone;
|
|
|
|
|
|
|
|
for(bone= lb->first; bone; bone= bone->next) {
|
|
|
|
if(bone->layer==0)
|
|
|
|
bone->layer= 1;
|
|
|
|
bone_version_239(&bone->childbase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-26 18:46:28 +00:00
|
|
|
static void do_versions(FileData *fd, Library *lib, Main *main)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
/* WATCH IT!!!: pointers from libdata have not been converted */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile == 100) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* tex->extend and tex->imageflag have changed: */
|
2002-10-12 11:37:38 +00:00
|
|
|
Tex *tex = main->tex.first;
|
|
|
|
while(tex) {
|
|
|
|
if(tex->id.flag & LIB_NEEDLINK) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(tex->extend==0) {
|
|
|
|
if(tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
|
|
|
|
else {
|
|
|
|
tex->extend= TEX_EXTEND;
|
|
|
|
tex->xrepeat= tex->yrepeat= 1;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(tex->imaflag & TEX_ANIM5) {
|
|
|
|
tex->imaflag |= TEX_MORKPATCH;
|
|
|
|
tex->imaflag |= TEX_ANTIALI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tex= tex->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 101) {
|
|
|
|
/* frame mapping */
|
|
|
|
Scene *sce = main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
sce->r.framapto= 100;
|
|
|
|
sce->r.images= 100;
|
|
|
|
sce->r.framelen= 1.0;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 102) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* init halo's at 1.0 */
|
2002-10-12 11:37:38 +00:00
|
|
|
Material *ma = main->mat.first;
|
|
|
|
while(ma) {
|
|
|
|
ma->add= 1.0;
|
|
|
|
ma= ma->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 103) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* new variable in object: colbits */
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob = main->object.first;
|
|
|
|
int a;
|
|
|
|
while(ob) {
|
|
|
|
ob->colbits= 0;
|
|
|
|
if(ob->totcol) {
|
|
|
|
for(a=0; a<ob->totcol; a++) {
|
|
|
|
if(ob->mat[a]) ob->colbits |= (1<<a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 104) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* timeoffs moved */
|
2002-10-12 11:37:38 +00:00
|
|
|
Object *ob = main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
if(ob->transflag & 1) {
|
|
|
|
ob->transflag -= 1;
|
|
|
|
ob->ipoflag |= OB_OFFS_OB;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 105) {
|
|
|
|
Object *ob = main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
ob->dupon= 1; ob->dupoff= 0;
|
|
|
|
ob->dupsta= 1; ob->dupend= 100;
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 106) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* mcol changed */
|
2002-10-12 11:37:38 +00:00
|
|
|
Mesh *me = main->mesh.first;
|
|
|
|
while(me) {
|
|
|
|
if(me->mcol) vcol_to_fcol(me);
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 107) {
|
|
|
|
Object *ob;
|
|
|
|
Scene *sce = main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
sce->r.mode |= R_GAMMA;
|
|
|
|
sce= sce->id.next;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
ob->ipoflag |= OB_OFFS_PARENT;
|
2005-08-14 06:08:41 +00:00
|
|
|
if(ob->dt==0) ob->dt= OB_SOLID;
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 109) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* new variable: gridlines */
|
2002-10-12 11:37:38 +00:00
|
|
|
bScreen *sc = main->screen.first;
|
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while (sl) {
|
|
|
|
if (sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
|
|
|
|
if (v3d->gridlines==0) v3d->gridlines= 20;
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 112) {
|
|
|
|
Mesh *me = main->mesh.first;
|
|
|
|
while(me) {
|
|
|
|
me->cubemapsize= 1.0;
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 113) {
|
|
|
|
Material *ma = main->mat.first;
|
|
|
|
while(ma) {
|
|
|
|
if(ma->flaresize==0.0) ma->flaresize= 1.0;
|
|
|
|
ma->subsize= 1.0;
|
|
|
|
ma->flareboost= 1.0;
|
|
|
|
ma= ma->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 134) {
|
|
|
|
Tex *tex = main->tex.first;
|
|
|
|
while (tex) {
|
|
|
|
if ((tex->rfac == 0.0) &&
|
|
|
|
(tex->gfac == 0.0) &&
|
|
|
|
(tex->bfac == 0.0)) {
|
|
|
|
tex->rfac = 1.0;
|
|
|
|
tex->gfac = 1.0;
|
|
|
|
tex->bfac = 1.0;
|
|
|
|
tex->filtersize = 1.0;
|
|
|
|
}
|
|
|
|
tex = tex->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 140) {
|
|
|
|
/* r-g-b-fac in texure */
|
|
|
|
Tex *tex = main->tex.first;
|
|
|
|
while (tex) {
|
|
|
|
if ((tex->rfac == 0.0) &&
|
|
|
|
(tex->gfac == 0.0) &&
|
|
|
|
(tex->bfac == 0.0)) {
|
|
|
|
tex->rfac = 1.0;
|
|
|
|
tex->gfac = 1.0;
|
|
|
|
tex->bfac = 1.0;
|
|
|
|
tex->filtersize = 1.0;
|
|
|
|
}
|
|
|
|
tex = tex->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 153) {
|
|
|
|
Scene *sce = main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
if(sce->r.blurfac==0.0) sce->r.blurfac= 1.0;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 163) {
|
|
|
|
Scene *sce = main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
if(sce->r.frs_sec==0) sce->r.frs_sec= 25;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 164) {
|
|
|
|
Mesh *me= main->mesh.first;
|
|
|
|
while(me) {
|
|
|
|
me->smoothresh= 30;
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 165) {
|
|
|
|
Mesh *me= main->mesh.first;
|
|
|
|
TFace *tface;
|
|
|
|
int nr;
|
|
|
|
char *cp;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(me) {
|
|
|
|
if(me->tface) {
|
|
|
|
nr= me->totface;
|
|
|
|
tface= me->tface;
|
|
|
|
while(nr--) {
|
|
|
|
cp= (char *)&tface->col[0];
|
|
|
|
if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
|
|
|
|
if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
|
|
|
|
if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
|
|
|
|
cp= (char *)&tface->col[1];
|
|
|
|
if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
|
|
|
|
if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
|
|
|
|
if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
|
|
|
|
cp= (char *)&tface->col[2];
|
|
|
|
if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
|
|
|
|
if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
|
|
|
|
if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
|
|
|
|
cp= (char *)&tface->col[3];
|
|
|
|
if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
|
|
|
|
if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
|
|
|
|
if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
tface++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 169) {
|
|
|
|
Mesh *me= main->mesh.first;
|
|
|
|
while(me) {
|
2005-07-27 20:16:41 +00:00
|
|
|
if(me->subdiv==0) me->subdiv= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 169) {
|
|
|
|
bScreen *sc= main->screen.first;
|
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while(sl) {
|
|
|
|
if(sl->spacetype==SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo*) sl;
|
|
|
|
sipo->v2d.max[0]= 15000.0;
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 170) {
|
|
|
|
Object *ob = main->object.first;
|
|
|
|
PartEff *paf;
|
|
|
|
while (ob) {
|
|
|
|
paf = give_parteff(ob);
|
|
|
|
if (paf) {
|
|
|
|
if (paf->staticstep == 0) {
|
|
|
|
paf->staticstep= 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 171) {
|
|
|
|
bScreen *sc= main->screen.first;
|
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while(sl) {
|
|
|
|
if(sl->spacetype==SPACE_TEXT) {
|
|
|
|
SpaceText *st= (SpaceText*) sl;
|
|
|
|
if(st->font_id>1) {
|
|
|
|
st->font_id= 0;
|
|
|
|
st->lheight= 13;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 173) {
|
|
|
|
int a, b;
|
|
|
|
Mesh *me= main->mesh.first;
|
|
|
|
while(me) {
|
|
|
|
if(me->tface) {
|
|
|
|
TFace *tface= me->tface;
|
|
|
|
for(a=0; a<me->totface; a++, tface++) {
|
|
|
|
for(b=0; b<4; b++) {
|
|
|
|
tface->uv[b][0]/= 32767.0;
|
|
|
|
tface->uv[b][1]/= 32767.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 191) {
|
|
|
|
bScreen *sc= main->screen.first;
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
Material *ma = main->mat.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* let faces have default add factor of 0.0 */
|
|
|
|
while(ma) {
|
|
|
|
if (!(ma->mode & MA_HALO)) ma->add = 0.0;
|
|
|
|
ma = ma->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(ob) {
|
|
|
|
ob->mass= 1.0f;
|
|
|
|
ob->damping= 0.1f;
|
2004-06-23 18:22:51 +00:00
|
|
|
ob->quat[1]= 1.0f;
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while(sl) {
|
|
|
|
if(sl->spacetype==SPACE_BUTS) {
|
|
|
|
SpaceButs *sbuts= (SpaceButs*) sl;
|
|
|
|
sbuts->scaflag= BUTS_SENS_LINK|BUTS_SENS_ACT|BUTS_CONT_ACT|BUTS_ACT_ACT|BUTS_ACT_LINK;
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 193) {
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
ob->inertia= 1.0f;
|
|
|
|
ob->rdamping= 0.1f;
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 196) {
|
|
|
|
Mesh *me= main->mesh.first;
|
|
|
|
int a, b;
|
|
|
|
while(me) {
|
|
|
|
if(me->tface) {
|
|
|
|
TFace *tface= me->tface;
|
|
|
|
for(a=0; a<me->totface; a++, tface++) {
|
|
|
|
for(b=0; b<4; b++) {
|
|
|
|
tface->mode |= TF_DYNAMIC;
|
|
|
|
tface->mode &= ~TF_INVISIBLE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me= me->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 200) {
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
ob->scaflag = ob->gameflag & (64+128+256+512+1024+2048);
|
|
|
|
/* 64 is do_fh */
|
|
|
|
ob->gameflag &= ~(128+256+512+1024+2048);
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 201) {
|
|
|
|
/* add-object + end-object are joined to edit-object actuator */
|
|
|
|
Object *ob = main->object.first;
|
|
|
|
bProperty *prop;
|
|
|
|
bActuator *act;
|
|
|
|
bIpoActuator *ia;
|
|
|
|
bEditObjectActuator *eoa;
|
|
|
|
bAddObjectActuator *aoa;
|
|
|
|
while (ob) {
|
|
|
|
act = ob->actuators.first;
|
|
|
|
while (act) {
|
|
|
|
if(act->type==ACT_IPO) {
|
|
|
|
ia= act->data;
|
|
|
|
prop= get_property(ob, ia->name);
|
|
|
|
if(prop) {
|
|
|
|
ia->type= ACT_IPO_FROM_PROP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_ADD_OBJECT) {
|
|
|
|
aoa= act->data;
|
|
|
|
eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
|
|
|
|
eoa->type= ACT_EDOB_ADD_OBJECT;
|
|
|
|
eoa->ob= aoa->ob;
|
|
|
|
eoa->time= aoa->time;
|
|
|
|
MEM_freeN(aoa);
|
|
|
|
act->data= eoa;
|
|
|
|
act->type= act->otype= ACT_EDIT_OBJECT;
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_END_OBJECT) {
|
|
|
|
eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
|
|
|
|
eoa->type= ACT_EDOB_END_OBJECT;
|
|
|
|
act->data= eoa;
|
|
|
|
act->type= act->otype= ACT_EDIT_OBJECT;
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 202) {
|
|
|
|
/* add-object and end-object are joined to edit-object
|
|
|
|
* actuator */
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
bActuator *act;
|
|
|
|
bObjectActuator *oa;
|
|
|
|
while(ob) {
|
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->type==ACT_OBJECT) {
|
|
|
|
oa= act->data;
|
|
|
|
oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 204) {
|
|
|
|
/* patches for new physics */
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
bActuator *act;
|
|
|
|
bObjectActuator *oa;
|
|
|
|
bSound *sound;
|
|
|
|
while(ob) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* please check this for demo20 files like
|
|
|
|
* original Egypt levels etc. converted
|
|
|
|
* rotation factor of 50 is not workable */
|
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->type==ACT_OBJECT) {
|
|
|
|
oa= act->data;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
oa->forceloc[0]*= 25.0;
|
|
|
|
oa->forceloc[1]*= 25.0;
|
|
|
|
oa->forceloc[2]*= 25.0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
oa->forcerot[0]*= 10.0;
|
|
|
|
oa->forcerot[1]*= 10.0;
|
|
|
|
oa->forcerot[2]*= 10.0;
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
2003-07-05 16:41:04 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sound = main->sound.first;
|
|
|
|
while (sound) {
|
|
|
|
if (sound->volume < 0.01) {
|
|
|
|
sound->volume = 1.0;
|
|
|
|
}
|
|
|
|
sound = sound->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 205) {
|
|
|
|
/* patches for new physics */
|
|
|
|
Object *ob= main->object.first;
|
|
|
|
bActuator *act;
|
|
|
|
bSensor *sens;
|
|
|
|
bEditObjectActuator *oa;
|
|
|
|
bRaySensor *rs;
|
|
|
|
bCollisionSensor *cs;
|
|
|
|
while(ob) {
|
|
|
|
/* Set anisotropic friction off for old objects,
|
|
|
|
* values to 1.0. */
|
|
|
|
ob->gameflag &= ~OB_ANISOTROPIC_FRICTION;
|
|
|
|
ob->anisotropicFriction[0] = 1.0;
|
|
|
|
ob->anisotropicFriction[1] = 1.0;
|
|
|
|
ob->anisotropicFriction[2] = 1.0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->type==ACT_EDIT_OBJECT) {
|
|
|
|
/* Zero initial velocity for newly
|
|
|
|
* added objects */
|
|
|
|
oa= act->data;
|
|
|
|
oa->linVelocity[0] = 0.0;
|
|
|
|
oa->linVelocity[1] = 0.0;
|
|
|
|
oa->linVelocity[2] = 0.0;
|
|
|
|
oa->localflag = 0;
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sens= ob->sensors.first;
|
|
|
|
while (sens) {
|
|
|
|
/* Extra fields for radar sensors. */
|
|
|
|
if(sens->type == SENS_RADAR) {
|
|
|
|
bRadarSensor *s = sens->data;
|
|
|
|
s->range = 10000.0;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Pulsing: defaults for new sensors. */
|
|
|
|
if(sens->type != SENS_ALWAYS) {
|
|
|
|
sens->pulse = 0;
|
|
|
|
sens->freq = 0;
|
|
|
|
} else {
|
|
|
|
sens->pulse = 1;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Invert: off. */
|
|
|
|
sens->invert = 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Collision and ray: default = trigger
|
|
|
|
* on property. The material field can
|
|
|
|
* remain empty. */
|
|
|
|
if(sens->type == SENS_COLLISION) {
|
|
|
|
cs = (bCollisionSensor*) sens->data;
|
|
|
|
cs->mode = 0;
|
|
|
|
}
|
|
|
|
if(sens->type == SENS_RAY) {
|
|
|
|
rs = (bRaySensor*) sens->data;
|
|
|
|
rs->mode = 0;
|
|
|
|
}
|
|
|
|
sens = sens->next;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
/* have to check the exact multiplier */
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 210) {
|
|
|
|
Scene *sce= main->scene.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(sce) {
|
|
|
|
if(sce->r.postmul== 0.0) sce->r.postmul= 1.0;
|
|
|
|
if(sce->r.postgamma== 0.0) sce->r.postgamma= 1.0;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 211) {
|
|
|
|
/* Render setting: per scene, the applicable gamma value
|
|
|
|
* can be set. Default is 1.0, which means no
|
|
|
|
* correction. */
|
|
|
|
bActuator *act;
|
|
|
|
bObjectActuator *oa;
|
|
|
|
Object *ob;
|
|
|
|
Scene *sce= main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
sce->r.gamma = 2.0;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* added alpha in obcolor */
|
|
|
|
ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
ob->col[3]= 1.0;
|
|
|
|
ob= ob->id.next;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* added alpha in obcolor */
|
|
|
|
ob= main->object.first;
|
|
|
|
while(ob) {
|
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if (act->type==ACT_OBJECT) {
|
|
|
|
/* multiply velocity with 50 in old files */
|
|
|
|
oa= act->data;
|
|
|
|
if (fabs(oa->linearvelocity[0]) >= 0.01f)
|
|
|
|
oa->linearvelocity[0] *= 50.0;
|
|
|
|
if (fabs(oa->linearvelocity[1]) >= 0.01f)
|
|
|
|
oa->linearvelocity[1] *= 50.0;
|
|
|
|
if (fabs(oa->linearvelocity[2]) >= 0.01f)
|
|
|
|
oa->linearvelocity[2] *= 50.0;
|
|
|
|
if (fabs(oa->angularvelocity[0])>=0.01f)
|
|
|
|
oa->angularvelocity[0] *= 50.0;
|
|
|
|
if (fabs(oa->angularvelocity[1])>=0.01f)
|
|
|
|
oa->angularvelocity[1] *= 50.0;
|
|
|
|
if (fabs(oa->angularvelocity[2])>=0.01f)
|
|
|
|
oa->angularvelocity[2] *= 50.0;
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 212) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bSound* sound;
|
|
|
|
bProperty *prop;
|
|
|
|
Object *ob;
|
|
|
|
Mesh *me;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sound = main->sound.first;
|
|
|
|
while (sound)
|
|
|
|
{
|
|
|
|
sound->max_gain = 1.0;
|
|
|
|
sound->min_gain = 0.0;
|
|
|
|
sound->distance = 1.0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (sound->attenuation > 0.0)
|
|
|
|
sound->flags |= SOUND_FLAGS_3D;
|
|
|
|
else
|
|
|
|
sound->flags &= ~SOUND_FLAGS_3D;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sound = sound->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob = main->object.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while (ob) {
|
|
|
|
prop= ob->prop.first;
|
|
|
|
while(prop) {
|
|
|
|
if (prop->type == PROP_TIME) {
|
|
|
|
// convert old PROP_TIME values from int to float
|
|
|
|
*((float *)&prop->data) = (float) prop->data;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
prop= prop->next;
|
|
|
|
}
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
/* me->subdiv changed to reflect the actual reparametization
|
2002-10-12 11:37:38 +00:00
|
|
|
* better, and smeshes were removed - if it was a smesh make
|
|
|
|
* it a subsurf, and reset the subdiv level because subsurf
|
|
|
|
* takes a lot more work to calculate.
|
|
|
|
*/
|
|
|
|
for (me= main->mesh.first; me; me= me->id.next) {
|
|
|
|
if (me->flag&ME_SMESH) {
|
|
|
|
me->flag&= ~ME_SMESH;
|
|
|
|
me->flag|= ME_SUBSURF;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
me->subdiv= 1;
|
|
|
|
} else {
|
|
|
|
if (me->subdiv<2)
|
|
|
|
me->subdiv= 1;
|
|
|
|
else
|
|
|
|
me->subdiv--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(main->versionfile <= 220) {
|
|
|
|
Object *ob;
|
|
|
|
Mesh *me;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
ob = main->object.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* adapt form factor in order to get the 'old' physics
|
|
|
|
* behaviour back...*/
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while (ob) {
|
|
|
|
/* in future, distinguish between different
|
|
|
|
* object bounding shapes */
|
|
|
|
ob->formfactor = 0.4f;
|
|
|
|
/* patch form factor , note that inertia equiv radius
|
|
|
|
* of a rotation symmetrical obj */
|
|
|
|
if (ob->inertia != 1.0) {
|
|
|
|
ob->formfactor /= ob->inertia * ob->inertia;
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/* Began using alpha component of vertex colors, but
|
|
|
|
* old file vertex colors are undefined, reset them
|
2004-06-23 18:22:51 +00:00
|
|
|
* to be fully opaque. -zr
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
for (me= main->mesh.first; me; me= me->id.next) {
|
|
|
|
if (me->mcol) {
|
|
|
|
int i;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<me->totface*4; i++) {
|
|
|
|
MCol *mcol= &me->mcol[i];
|
|
|
|
mcol->a= 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (me->tface) {
|
|
|
|
int i, j;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (i=0; i<me->totface; i++) {
|
|
|
|
TFace *tf= &((TFace*) me->tface)[i];
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
char *col= (char*) &tf->col[j];
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
col[0]= 255;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 221) {
|
|
|
|
Scene *sce= main->scene.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// new variables for std-alone player and runtime
|
|
|
|
while(sce) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce->r.xplay= 640;
|
|
|
|
sce->r.yplay= 480;
|
|
|
|
sce->r.freqplay= 60;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 222) {
|
|
|
|
Scene *sce= main->scene.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// new variables for std-alone player and runtime
|
|
|
|
while(sce) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sce->r.depth= 32;
|
|
|
|
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(main->versionfile <= 223) {
|
|
|
|
VFont *vf;
|
|
|
|
Image *ima;
|
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
for (vf= main->vfont.first; vf; vf= vf->id.next) {
|
|
|
|
if (BLI_streq(vf->name+strlen(vf->name)-6, ".Bfont")) {
|
|
|
|
strcpy(vf->name, "<builtin>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Old textures animate at 25 FPS */
|
|
|
|
for (ima = main->image.first; ima; ima=ima->id.next){
|
|
|
|
ima->animspeed = 25;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Zr remapped some keyboard codes to be linear (stupid zr) */
|
|
|
|
for (ob= main->object.first; ob; ob= ob->id.next) {
|
|
|
|
bSensor *sens;
|
|
|
|
|
|
|
|
for (sens= ob->sensors.first; sens; sens= sens->next) {
|
|
|
|
if (sens->type==SENS_KEYBOARD) {
|
|
|
|
bKeyboardSensor *ks= sens->data;
|
|
|
|
|
|
|
|
ks->key= map_223_keybd_code_to_224_keybd_code(ks->key);
|
|
|
|
ks->qual= map_223_keybd_code_to_224_keybd_code(ks->qual);
|
|
|
|
ks->qual2= map_223_keybd_code_to_224_keybd_code(ks->qual2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 224) {
|
|
|
|
bSound* sound;
|
|
|
|
Scene *sce;
|
|
|
|
Mesh *me;
|
|
|
|
bScreen *sc;
|
|
|
|
|
|
|
|
for (sound=main->sound.first; sound; sound=sound->id.next)
|
|
|
|
{
|
|
|
|
if (sound->packedfile) {
|
|
|
|
if (sound->newpackedfile == NULL) {
|
|
|
|
sound->newpackedfile = sound->packedfile;
|
|
|
|
}
|
|
|
|
sound->packedfile = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
|
|
|
|
for (me=main->mesh.first; me; me=me->id.next){
|
|
|
|
if ((me->flag & ME_SUBSURF) && (me->subdivr==0))
|
|
|
|
me->subdivr=me->subdiv;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (sce= main->scene.first; sce; sce= sce->id.next) {
|
|
|
|
sce->r.stereomode = 1; // no stereo
|
|
|
|
}
|
|
|
|
|
|
|
|
/* some oldfile patch, moved from set_func_space */
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if (sl->spacetype==SPACE_IPO) {
|
|
|
|
SpaceSeq *sseq= (SpaceSeq*) sl;
|
|
|
|
sseq->v2d.keeptot= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
}
|
2004-03-25 18:17:40 +00:00
|
|
|
if(main->versionfile <= 225) {
|
|
|
|
World *wo;
|
|
|
|
/* Use Sumo for old games */
|
|
|
|
for (wo = main->world.first; wo; wo= wo->id.next) {
|
|
|
|
wo->physicsEngine = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
if(main->versionfile <= 227) {
|
|
|
|
Scene *sce;
|
2003-07-19 20:31:29 +00:00
|
|
|
Material *ma;
|
2003-07-22 14:28:56 +00:00
|
|
|
bScreen *sc;
|
2004-03-25 18:17:40 +00:00
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
/* As of now, this insures that the transition from the old Track system
|
|
|
|
to the new full constraint Track is painless for everyone. - theeth
|
|
|
|
*/
|
|
|
|
ob = main->object.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-03-25 18:17:40 +00:00
|
|
|
while (ob) {
|
|
|
|
ListBase *list;
|
|
|
|
list = &ob->constraints;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-03-25 18:17:40 +00:00
|
|
|
/* check for already existing TrackTo constraint
|
|
|
|
set their track and up flag correctly */
|
|
|
|
|
|
|
|
if (list){
|
|
|
|
bConstraint *curcon;
|
|
|
|
for (curcon = list->first; curcon; curcon=curcon->next){
|
|
|
|
if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
|
|
|
|
bTrackToConstraint *data = curcon->data;
|
|
|
|
data->reserved1 = ob->trackflag;
|
|
|
|
data->reserved2 = ob->upflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ob->type == OB_ARMATURE) {
|
|
|
|
if (ob->pose){
|
|
|
|
bConstraint *curcon;
|
|
|
|
bPoseChannel *pchan;
|
2004-06-23 18:22:51 +00:00
|
|
|
for (pchan = ob->pose->chanbase.first;
|
2004-03-25 18:17:40 +00:00
|
|
|
pchan; pchan=pchan->next){
|
2004-06-23 18:22:51 +00:00
|
|
|
for (curcon = pchan->constraints.first;
|
2004-03-25 18:17:40 +00:00
|
|
|
curcon; curcon=curcon->next){
|
|
|
|
if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
|
|
|
|
bTrackToConstraint *data = curcon->data;
|
|
|
|
data->reserved1 = ob->trackflag;
|
|
|
|
data->reserved2 = ob->upflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Change Ob->Track in real TrackTo constraint */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-03-25 18:17:40 +00:00
|
|
|
if (ob->track){
|
|
|
|
bConstraint *con;
|
|
|
|
bTrackToConstraint *data;
|
|
|
|
|
|
|
|
list = &ob->constraints;
|
|
|
|
if (list)
|
|
|
|
{
|
|
|
|
con = MEM_callocN(sizeof(bConstraint), "constraint");
|
|
|
|
strcpy (con->name, "AutoTrack");
|
|
|
|
unique_constraint_name(con, list);
|
|
|
|
con->flag |= CONSTRAINT_EXPAND;
|
|
|
|
con->enforce=1.0F;
|
|
|
|
con->type = CONSTRAINT_TYPE_TRACKTO;
|
2004-06-23 18:22:51 +00:00
|
|
|
data = (bTrackToConstraint *)
|
2004-03-25 18:17:40 +00:00
|
|
|
new_constraint_data(CONSTRAINT_TYPE_TRACKTO);
|
|
|
|
|
|
|
|
data->tar = ob->track;
|
|
|
|
data->reserved1 = ob->trackflag;
|
|
|
|
data->reserved2 = ob->upflag;
|
|
|
|
con->data= (void*) data;
|
|
|
|
BLI_addtail(list, con);
|
|
|
|
}
|
|
|
|
ob->track = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
|
|
|
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
|
|
|
|
for (sce= main->scene.first; sce; sce= sce->id.next) {
|
|
|
|
sce->audio.mixrate = 44100;
|
2003-09-11 19:08:45 +00:00
|
|
|
sce->audio.flag |= AUDIO_SCRUB;
|
2003-09-23 21:05:51 +00:00
|
|
|
sce->r.mode |= R_ENVMAP;
|
Commit message and the brunt of the code courtesy of intrr, apologies for the
size of this;
Finally, the Sequencer audio support and global audio/animation sync stuff!
(See http://intrr.org/blender/audiosequencer.html)
Stuff that has been done:
./source/blender/blenloader/intern/writefile.c
./source/blender/blenloader/intern/readfile.c
Added code to make it handle sounds used by audio strips, and to convert
Scene data from older (<2.28) versions to init Scene global audio settings
(Scene->audio) to defaults.
./source/blender/include/BSE_seqaudio.h
./source/blender/src/seqaudio.c
The main audio routines that start/stop/scrub the audio stream at
a certain frame position, provide the frame reference for the current
stream position, mix the audio, convert the audio, mixdown the audio
into a file.
./source/blender/makesdna/DNA_sound_types.h
Introduced new variables in the bSound struct to accomodate the sample
data after converted to the scene's global mixing format (stream, streamlen).
Also added a new flag SOUND_FLAGS_SEQUENCE that gets set if the Sound
belongs to a sequence strip.
./source/blender/makesdna/DNA_scene_types.h
Added AudioData struct, which holds scene-global audio settings.
./source/blender/makesdna/DNA_sequence_types.h
Added support for audio strips. Some variables to hold Panning/Attenuation
information, position information, reference to the sample, and some flags.
./source/blender/makesdna/DNA_userdef_types.h
./source/blender/src/usiblender.c
Added a "Mixing buffer size" userpref. Made the versions stuff initialize
it to a default for versions <2.28.
./source/blender/makesdna/DNA_space_types.h
./source/blender/src/filesel.c
Added a Cyan dot to .WAV files. Any other suggestions on a better color? :)
./source/blender/src/editsound.c
Changes (fixes) to the WAV file loader, re-enabled some gameengine code that
is needed for dealing with bSounds and bSamples.
./source/blender/src/editipo.c
./source/blender/src/drawseq.c
./source/blender/src/editnla.c
./source/blender/src/space.c
./source/blender/src/drawview.c
./source/blender/src/renderwin.c
./source/blender/src/headerbuttons.c
- Created two different wrappers for update_for_newframe(), one which scrubs
the audio, one which doesn't.
- Replaced some of the occurences of update_for_newframe() with
update_for_newframe_muted(), which doesn't scrub the audio.
- In drawview.c: Changed the synchronization scheme to get the current audio
position from the audio engine, and use that as a reference for setting
CFRA. Implements a/v sync and framedrop.
- In editipo.c: Changed handling of Fac IPOs to be usable for audio strips as
volume envelopes.
- In space.c: Added the mixing buffer size Userpref, enabled audio scrubbing
(update_for_newframe()) for moving the sequence editor framebar.
./source/blender/src/editseq.c
Added support for audio strips and a default directory for WAV files which
gets saved from the last Shift-A operation.
./source/blender/src/buttons.c
Added Scene-global audio sequencer settings in Sound buttons.
./source/blender/src/sequence.c
Various stuff that deals with handling audio strips differently than
usual strips.
2003-07-13 20:16:56 +00:00
|
|
|
}
|
2003-07-22 14:28:56 +00:00
|
|
|
// init new shader vars
|
2003-07-19 20:31:29 +00:00
|
|
|
for (ma= main->mat.first; ma; ma= ma->id.next) {
|
2005-07-14 22:21:12 +00:00
|
|
|
ma->refrac= 4.0f;
|
|
|
|
ma->roughness= 0.5f;
|
|
|
|
ma->param[0]= 0.5f;
|
|
|
|
ma->param[1]= 0.1f;
|
|
|
|
ma->param[2]= 0.1f;
|
|
|
|
ma->param[3]= 0.05f;
|
2003-07-19 20:31:29 +00:00
|
|
|
}
|
2003-07-22 14:28:56 +00:00
|
|
|
// patch for old wrong max view2d settings, allows zooming out more
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if (sl->spacetype==SPACE_ACTION) {
|
|
|
|
SpaceAction *sac= (SpaceAction *) sl;
|
|
|
|
sac->v2d.max[0]= 32000;
|
|
|
|
}
|
|
|
|
else if (sl->spacetype==SPACE_NLA) {
|
|
|
|
SpaceNla *sla= (SpaceNla *) sl;
|
|
|
|
sla->v2d.max[0]= 32000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-04 20:35:50 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 228) {
|
|
|
|
Scene *sce;
|
|
|
|
bScreen *sc;
|
2003-10-21 13:22:07 +00:00
|
|
|
Object *ob;
|
|
|
|
|
|
|
|
|
|
|
|
/* As of now, this insures that the transition from the old Track system
|
|
|
|
to the new full constraint Track is painless for everyone.*/
|
|
|
|
ob = main->object.first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
while (ob) {
|
|
|
|
ListBase *list;
|
|
|
|
list = &ob->constraints;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-10-21 13:22:07 +00:00
|
|
|
/* check for already existing TrackTo constraint
|
|
|
|
set their track and up flag correctly */
|
|
|
|
|
|
|
|
if (list){
|
|
|
|
bConstraint *curcon;
|
|
|
|
for (curcon = list->first; curcon; curcon=curcon->next){
|
|
|
|
if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
|
|
|
|
bTrackToConstraint *data = curcon->data;
|
|
|
|
data->reserved1 = ob->trackflag;
|
|
|
|
data->reserved2 = ob->upflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ob->type == OB_ARMATURE) {
|
|
|
|
if (ob->pose){
|
|
|
|
bConstraint *curcon;
|
|
|
|
bPoseChannel *pchan;
|
2004-06-23 18:22:51 +00:00
|
|
|
for (pchan = ob->pose->chanbase.first;
|
2003-10-21 13:22:07 +00:00
|
|
|
pchan; pchan=pchan->next){
|
2004-06-23 18:22:51 +00:00
|
|
|
for (curcon = pchan->constraints.first;
|
2003-10-21 13:22:07 +00:00
|
|
|
curcon; curcon=curcon->next){
|
|
|
|
if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
|
|
|
|
bTrackToConstraint *data = curcon->data;
|
|
|
|
data->reserved1 = ob->trackflag;
|
|
|
|
data->reserved2 = ob->upflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ob = ob->id.next;
|
|
|
|
}
|
2003-10-04 20:35:50 +00:00
|
|
|
|
|
|
|
for (sce= main->scene.first; sce; sce= sce->id.next) {
|
|
|
|
sce->r.mode |= R_ENVMAP;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-10-04 20:35:50 +00:00
|
|
|
// convert old mainb values for new button panels
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if (sl->spacetype==SPACE_BUTS) {
|
|
|
|
SpaceButs *sbuts= (SpaceButs *) sl;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-07-14 22:21:12 +00:00
|
|
|
sbuts->v2d.maxzoom= 1.2f;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-10-04 20:35:50 +00:00
|
|
|
if(sbuts->mainb==BUTS_LAMP) {
|
|
|
|
sbuts->mainb= CONTEXT_SHADING;
|
|
|
|
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_MAT) {
|
|
|
|
sbuts->mainb= CONTEXT_SHADING;
|
|
|
|
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_TEX) {
|
|
|
|
sbuts->mainb= CONTEXT_SHADING;
|
|
|
|
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_ANIM) {
|
|
|
|
sbuts->mainb= CONTEXT_OBJECT;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_WORLD) {
|
|
|
|
sbuts->mainb= CONTEXT_SCENE;
|
|
|
|
sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_RENDER) {
|
|
|
|
sbuts->mainb= CONTEXT_SCENE;
|
|
|
|
sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_GAME) {
|
|
|
|
sbuts->mainb= CONTEXT_LOGIC;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_FPAINT) {
|
|
|
|
sbuts->mainb= CONTEXT_EDITING;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_RADIO) {
|
|
|
|
sbuts->mainb= CONTEXT_SHADING;
|
|
|
|
sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_CONSTRAINT) {
|
|
|
|
sbuts->mainb= CONTEXT_OBJECT;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_SCRIPT) {
|
|
|
|
sbuts->mainb= CONTEXT_OBJECT;
|
|
|
|
}
|
|
|
|
else if(sbuts->mainb==BUTS_EDIT) {
|
|
|
|
sbuts->mainb= CONTEXT_EDITING;
|
|
|
|
}
|
|
|
|
else sbuts->mainb= CONTEXT_SCENE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-10-15 12:26:26 +00:00
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
/* ton: made this 230 instead of 229,
|
2003-11-25 13:44:46 +00:00
|
|
|
to be sure (tuho files) and this is a reliable check anyway
|
2004-06-23 18:22:51 +00:00
|
|
|
nevertheless, we might need to think over a fitness (initialize)
|
2003-11-25 13:44:46 +00:00
|
|
|
check apart from the do_versions() */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
if(main->versionfile <= 230) {
|
2003-10-15 12:26:26 +00:00
|
|
|
bScreen *sc;
|
|
|
|
|
|
|
|
// new variable blockscale, for panels in any area
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
2005-07-14 22:21:12 +00:00
|
|
|
if(sl->blockscale==0.0) sl->blockscale= 0.7f;
|
2003-11-08 19:04:50 +00:00
|
|
|
/* added: 5x better zoom in for action */
|
|
|
|
if(sl->spacetype==SPACE_ACTION) {
|
|
|
|
SpaceAction *sac= (SpaceAction *)sl;
|
|
|
|
sac->v2d.maxzoom= 50;
|
|
|
|
}
|
2003-10-15 12:26:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-03-25 18:17:40 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 231) {
|
|
|
|
/* new bit flags for showing/hiding grid floor and axes */
|
|
|
|
bScreen *sc = main->screen.first;
|
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while (sl) {
|
|
|
|
if (sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
|
|
|
|
if (v3d->gridflag==0) {
|
|
|
|
v3d->gridflag |= V3D_SHOW_X;
|
|
|
|
v3d->gridflag |= V3D_SHOW_Y;
|
|
|
|
v3d->gridflag |= V3D_SHOW_FLOOR;
|
|
|
|
v3d->gridflag &= ~V3D_SHOW_Z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 231) {
|
2003-12-16 14:12:01 +00:00
|
|
|
Material *ma= main->mat.first;
|
2004-01-24 12:18:35 +00:00
|
|
|
bScreen *sc = main->screen.first;
|
2003-12-22 22:27:51 +00:00
|
|
|
Scene *sce;
|
Area lights and more...
- New lamp type added "Area". This uses the radiosity formula (Stoke) to
calculate the amount of energy which is received from a plane. Result
is very nice local light, which nicely spreads out.
- Area lamps have a 'gamma' option to control the light spread
- Area lamp builtin sizes: square, rect, cube & box. Only first 2 are
implemented. Set a type, and define area size
- Button area size won't affect the amount of energy. But scaling the lamp
in 3d window will do. This is to cover the case when you scale an entire
scene, the light then will remain identical
If you just want to change area lamp size, use buttons when you dont want
to make the scene too bright or too dark
- Since area lights realistically are sensitive for distance (quadratic), the
effect it has is quickly too much, or too less. For this the "Dist" value
in Lamp can be used. Set it at Dist=10 to have reasonable light on distance
10 Blender units (assumed you didnt scale lamp object).
- I tried square sized specularity, but this looked totally weird. Not
committed
- Plan is to extend area light with 3d dimensions, boxes and cubes.
- Note that area light is one-sided, towards negative Z. I need to design
a nice drawing method for it.
Area Shadow
- Since there are a lot of variables associated with soft shadow, they now
only are available for Area lights. Allowing spot & normal lamp to have
soft shadow is possible though, but will require a reorganisation of the
Lamp buttons. Is a point of research & feedback still.
- Apart from area size, you now can individually set amount of samples in
X and Y direction (for area lamp type 'Rect'). For box type area lamp,
this will become 3 dimensions
- Area shadows have four options:
"Clip circle" : only uses a circular shape of samples, gives smoother
results
"Dither" : use a 2x2 dither mask
"Jitter" : applys a pseudo-random offset to samples
"Umbra" : extra emphasis on area that's fully in shadow.
Raytrace speedup
- improved filling in faces in Octree. Large faces occupied too many nodes
- added a coherence check; rays fired sequentially that begin and end in
same octree nodes, and that don't intersect, are quickly rejected
- rendering shadow scenes benefits from this 20-40%. My statue test monkey
file now renders in 19 seconds (was 30).
Plus:
- adjusted specular max to 511, and made sure Blinn spec has again this
incredible small spec size
- for UI rounded theme: the color "button" displayed RGB color too dark
- fixed countall() function, to also include Subsurf totals
- removed setting the 'near' clipping for pressing dot-key numpad
- when you press the buttons-window icon for 'Shading Context' the context
automaticilly switches as with F5 hotkey
Please be warned that this is not a release... settings in files might not
work as it did, nor guaranteed to work when we do a release. :)
2003-12-29 16:52:51 +00:00
|
|
|
Lamp *la;
|
2003-12-30 18:03:37 +00:00
|
|
|
World *wrld;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-12-16 14:12:01 +00:00
|
|
|
while(ma) {
|
2003-12-23 22:31:48 +00:00
|
|
|
if(ma->fresnel_tra_i==0.0) ma->fresnel_tra_i= 1.25;
|
|
|
|
if(ma->fresnel_mir_i==0.0) ma->fresnel_mir_i= 1.25;
|
2003-12-16 14:12:01 +00:00
|
|
|
if(ma->ang==0.0) {
|
|
|
|
ma->ang= 1.0;
|
|
|
|
ma->ray_depth= 2;
|
|
|
|
ma->ray_depth_tra= 2;
|
2003-12-22 22:27:51 +00:00
|
|
|
ma->fresnel_tra= 0.0;
|
|
|
|
ma->fresnel_mir= 0.0;
|
2003-12-18 21:34:48 +00:00
|
|
|
}
|
|
|
|
else if(ma->ang<1.0) { // temporal, because of IOR & fresnel change
|
2005-07-14 22:21:12 +00:00
|
|
|
ma->ang= 1.0f/ma->ang;
|
2003-12-18 21:34:48 +00:00
|
|
|
ma->fresnel_tra= ma->ang;
|
|
|
|
ma->fresnel_mir= ma->ang;
|
2003-12-16 14:12:01 +00:00
|
|
|
}
|
|
|
|
ma= ma->id.next;
|
|
|
|
}
|
2003-12-22 22:27:51 +00:00
|
|
|
sce= main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
if(sce->r.gauss==0.0) sce->r.gauss= 1.0;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
Area lights and more...
- New lamp type added "Area". This uses the radiosity formula (Stoke) to
calculate the amount of energy which is received from a plane. Result
is very nice local light, which nicely spreads out.
- Area lamps have a 'gamma' option to control the light spread
- Area lamp builtin sizes: square, rect, cube & box. Only first 2 are
implemented. Set a type, and define area size
- Button area size won't affect the amount of energy. But scaling the lamp
in 3d window will do. This is to cover the case when you scale an entire
scene, the light then will remain identical
If you just want to change area lamp size, use buttons when you dont want
to make the scene too bright or too dark
- Since area lights realistically are sensitive for distance (quadratic), the
effect it has is quickly too much, or too less. For this the "Dist" value
in Lamp can be used. Set it at Dist=10 to have reasonable light on distance
10 Blender units (assumed you didnt scale lamp object).
- I tried square sized specularity, but this looked totally weird. Not
committed
- Plan is to extend area light with 3d dimensions, boxes and cubes.
- Note that area light is one-sided, towards negative Z. I need to design
a nice drawing method for it.
Area Shadow
- Since there are a lot of variables associated with soft shadow, they now
only are available for Area lights. Allowing spot & normal lamp to have
soft shadow is possible though, but will require a reorganisation of the
Lamp buttons. Is a point of research & feedback still.
- Apart from area size, you now can individually set amount of samples in
X and Y direction (for area lamp type 'Rect'). For box type area lamp,
this will become 3 dimensions
- Area shadows have four options:
"Clip circle" : only uses a circular shape of samples, gives smoother
results
"Dither" : use a 2x2 dither mask
"Jitter" : applys a pseudo-random offset to samples
"Umbra" : extra emphasis on area that's fully in shadow.
Raytrace speedup
- improved filling in faces in Octree. Large faces occupied too many nodes
- added a coherence check; rays fired sequentially that begin and end in
same octree nodes, and that don't intersect, are quickly rejected
- rendering shadow scenes benefits from this 20-40%. My statue test monkey
file now renders in 19 seconds (was 30).
Plus:
- adjusted specular max to 511, and made sure Blinn spec has again this
incredible small spec size
- for UI rounded theme: the color "button" displayed RGB color too dark
- fixed countall() function, to also include Subsurf totals
- removed setting the 'near' clipping for pressing dot-key numpad
- when you press the buttons-window icon for 'Shading Context' the context
automaticilly switches as with F5 hotkey
Please be warned that this is not a release... settings in files might not
work as it did, nor guaranteed to work when we do a release. :)
2003-12-29 16:52:51 +00:00
|
|
|
la= main->lamp.first;
|
|
|
|
while(la) {
|
|
|
|
if(la->k==0.0) la->k= 1.0;
|
|
|
|
if(la->ray_samp==0) la->ray_samp= 1;
|
|
|
|
if(la->ray_sampy==0) la->ray_sampy= 1;
|
|
|
|
if(la->ray_sampz==0) la->ray_sampz= 1;
|
|
|
|
if(la->area_size==0.0) la->area_size= 1.0;
|
|
|
|
if(la->area_sizey==0.0) la->area_sizey= 1.0;
|
|
|
|
if(la->area_sizez==0.0) la->area_sizez= 1.0;
|
|
|
|
la= la->id.next;
|
|
|
|
}
|
2003-12-30 18:03:37 +00:00
|
|
|
wrld= main->world.first;
|
|
|
|
while(wrld) {
|
|
|
|
if(wrld->range==0.0) {
|
2005-07-14 22:21:12 +00:00
|
|
|
wrld->range= 1.0f/wrld->exposure;
|
2003-12-30 18:03:37 +00:00
|
|
|
}
|
|
|
|
wrld= wrld->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-01-24 05:06:12 +00:00
|
|
|
/* new bit flags for showing/hiding grid floor and axes */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-01-24 05:06:12 +00:00
|
|
|
while(sc) {
|
|
|
|
ScrArea *sa= sc->areabase.first;
|
|
|
|
while(sa) {
|
|
|
|
SpaceLink *sl= sa->spacedata.first;
|
|
|
|
while (sl) {
|
|
|
|
if (sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D*) sl;
|
|
|
|
|
|
|
|
if (v3d->gridflag==0) {
|
|
|
|
v3d->gridflag |= V3D_SHOW_X;
|
|
|
|
v3d->gridflag |= V3D_SHOW_Y;
|
|
|
|
v3d->gridflag |= V3D_SHOW_FLOOR;
|
|
|
|
v3d->gridflag &= ~V3D_SHOW_Z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sl= sl->next;
|
|
|
|
}
|
|
|
|
sa= sa->next;
|
|
|
|
}
|
|
|
|
sc= sc->id.next;
|
|
|
|
}
|
2003-12-16 14:12:01 +00:00
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
if(main->versionfile <= 232) {
|
2004-04-03 13:59:27 +00:00
|
|
|
Tex *tex= main->tex.first;
|
Eeshlo AO patch, revised
- Ambient Occlusion is a more sophisticated ambient trick, which takes
nearby faces into account by firing a hemisphere of shadow-rays
around. AKA 'dirt shader'.
- Eeshlo made it a Lamp type, which doesn't fit well. I've moved the
settings to the World menu, and let the Material->ambient value control
the amount it contributes
- currently, the AO value is added/subtracted/mixed with the 'diffuse'
factor while shading, before it is multiplied with Material color
Buttons are in new Panel 'Amb Occ" in F8 menu. Note:
- "Dist:" by shortening the length of rays you get subtler effects and it
renders faster too
- "DistF:" the attennuation factor gives control over how the 'shadow'
spreads out.
Further it's just raytracing, so tends to be slooooow.... :)
Here same tricks as for other raytraced scenes apply, especially try to
keep the environment as small as possible (exclude faces from Octree by
giving them no Material Traceable).
I still have to think over a couple of aspects, will await feedback on it:
- AO color? Now it just adds 'white'
- other sampling patterns? I tried dithering, which was so-so
- method of controlling final 'samples' in F10? Might be useful for other
oversampling too (area light) to have it reacting to a percentage or so..
2004-04-05 21:04:13 +00:00
|
|
|
World *wrld= main->world.first;
|
2004-04-19 22:05:37 +00:00
|
|
|
bScreen *sc;
|
2004-04-23 21:02:58 +00:00
|
|
|
Scene *sce;
|
2004-04-19 22:05:37 +00:00
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
while(tex) {
|
2004-04-28 18:08:34 +00:00
|
|
|
if((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
|
|
|
|
tex->flag |= TEX_CHECKER_ODD;
|
|
|
|
}
|
2004-04-03 13:59:27 +00:00
|
|
|
/* copied from kernel texture.c */
|
2004-04-12 20:27:48 +00:00
|
|
|
if(tex->ns_outscale==0.0) {
|
|
|
|
/* musgrave */
|
2005-07-14 22:21:12 +00:00
|
|
|
tex->mg_H = 1.0f;
|
|
|
|
tex->mg_lacunarity = 2.0f;
|
|
|
|
tex->mg_octaves = 2.0f;
|
|
|
|
tex->mg_offset = 1.0f;
|
|
|
|
tex->mg_gain = 1.0f;
|
|
|
|
tex->ns_outscale = 1.0f;
|
2004-04-12 20:27:48 +00:00
|
|
|
/* distnoise */
|
2005-07-14 22:21:12 +00:00
|
|
|
tex->dist_amount = 1.0f;
|
2004-04-12 20:27:48 +00:00
|
|
|
/* voronoi */
|
2005-07-14 22:21:12 +00:00
|
|
|
tex->vn_w1 = 1.0f;
|
|
|
|
tex->vn_mexp = 2.5f;
|
2004-04-12 20:27:48 +00:00
|
|
|
}
|
2004-04-03 13:59:27 +00:00
|
|
|
tex= tex->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
Eeshlo AO patch, revised
- Ambient Occlusion is a more sophisticated ambient trick, which takes
nearby faces into account by firing a hemisphere of shadow-rays
around. AKA 'dirt shader'.
- Eeshlo made it a Lamp type, which doesn't fit well. I've moved the
settings to the World menu, and let the Material->ambient value control
the amount it contributes
- currently, the AO value is added/subtracted/mixed with the 'diffuse'
factor while shading, before it is multiplied with Material color
Buttons are in new Panel 'Amb Occ" in F8 menu. Note:
- "Dist:" by shortening the length of rays you get subtler effects and it
renders faster too
- "DistF:" the attennuation factor gives control over how the 'shadow'
spreads out.
Further it's just raytracing, so tends to be slooooow.... :)
Here same tricks as for other raytraced scenes apply, especially try to
keep the environment as small as possible (exclude faces from Octree by
giving them no Material Traceable).
I still have to think over a couple of aspects, will await feedback on it:
- AO color? Now it just adds 'white'
- other sampling patterns? I tried dithering, which was so-so
- method of controlling final 'samples' in F10? Might be useful for other
oversampling too (area light) to have it reacting to a percentage or so..
2004-04-05 21:04:13 +00:00
|
|
|
while(wrld) {
|
2004-04-26 14:17:48 +00:00
|
|
|
if(wrld->aodist==0.0) {
|
2005-07-14 22:21:12 +00:00
|
|
|
wrld->aodist= 10.0f;
|
|
|
|
wrld->aobias= 0.05f;
|
2004-04-26 14:17:48 +00:00
|
|
|
}
|
Eeshlo AO patch, revised
- Ambient Occlusion is a more sophisticated ambient trick, which takes
nearby faces into account by firing a hemisphere of shadow-rays
around. AKA 'dirt shader'.
- Eeshlo made it a Lamp type, which doesn't fit well. I've moved the
settings to the World menu, and let the Material->ambient value control
the amount it contributes
- currently, the AO value is added/subtracted/mixed with the 'diffuse'
factor while shading, before it is multiplied with Material color
Buttons are in new Panel 'Amb Occ" in F8 menu. Note:
- "Dist:" by shortening the length of rays you get subtler effects and it
renders faster too
- "DistF:" the attennuation factor gives control over how the 'shadow'
spreads out.
Further it's just raytracing, so tends to be slooooow.... :)
Here same tricks as for other raytraced scenes apply, especially try to
keep the environment as small as possible (exclude faces from Octree by
giving them no Material Traceable).
I still have to think over a couple of aspects, will await feedback on it:
- AO color? Now it just adds 'white'
- other sampling patterns? I tried dithering, which was so-so
- method of controlling final 'samples' in F10? Might be useful for other
oversampling too (area light) to have it reacting to a percentage or so..
2004-04-05 21:04:13 +00:00
|
|
|
if(wrld->aosamp==0.0) wrld->aosamp= 5;
|
2004-04-12 14:53:17 +00:00
|
|
|
if(wrld->aoenergy==0.0) wrld->aoenergy= 1.0;
|
Eeshlo AO patch, revised
- Ambient Occlusion is a more sophisticated ambient trick, which takes
nearby faces into account by firing a hemisphere of shadow-rays
around. AKA 'dirt shader'.
- Eeshlo made it a Lamp type, which doesn't fit well. I've moved the
settings to the World menu, and let the Material->ambient value control
the amount it contributes
- currently, the AO value is added/subtracted/mixed with the 'diffuse'
factor while shading, before it is multiplied with Material color
Buttons are in new Panel 'Amb Occ" in F8 menu. Note:
- "Dist:" by shortening the length of rays you get subtler effects and it
renders faster too
- "DistF:" the attennuation factor gives control over how the 'shadow'
spreads out.
Further it's just raytracing, so tends to be slooooow.... :)
Here same tricks as for other raytraced scenes apply, especially try to
keep the environment as small as possible (exclude faces from Octree by
giving them no Material Traceable).
I still have to think over a couple of aspects, will await feedback on it:
- AO color? Now it just adds 'white'
- other sampling patterns? I tried dithering, which was so-so
- method of controlling final 'samples' in F10? Might be useful for other
oversampling too (area light) to have it reacting to a percentage or so..
2004-04-05 21:04:13 +00:00
|
|
|
wrld= wrld->id.next;
|
|
|
|
}
|
2004-04-19 22:05:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// new variable blockscale, for panels in any area, do again because new
|
|
|
|
// areas didnt initialize it to 0.7 yet
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
2005-07-14 22:21:12 +00:00
|
|
|
if(sl->blockscale==0.0) sl->blockscale= 0.7f;
|
2004-04-22 12:36:27 +00:00
|
|
|
|
|
|
|
/* added: 5x better zoom in for nla */
|
|
|
|
if(sl->spacetype==SPACE_NLA) {
|
|
|
|
SpaceNla *snla= (SpaceNla *)sl;
|
|
|
|
snla->v2d.maxzoom= 50;
|
|
|
|
}
|
2004-04-19 22:05:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-04-23 21:02:58 +00:00
|
|
|
sce= main->scene.first;
|
|
|
|
while(sce) {
|
|
|
|
if(sce->r.ocres==0) sce->r.ocres= 64;
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
}
|
2004-06-30 18:54:09 +00:00
|
|
|
if(main->versionfile <= 233) {
|
2004-08-03 21:42:37 +00:00
|
|
|
bScreen *sc;
|
2004-06-30 18:54:09 +00:00
|
|
|
Material *ma= main->mat.first;
|
2004-07-26 22:46:56 +00:00
|
|
|
Object *ob= main->object.first;
|
2004-06-30 18:54:09 +00:00
|
|
|
|
|
|
|
while(ma) {
|
|
|
|
if(ma->rampfac_col==0.0) ma->rampfac_col= 1.0;
|
|
|
|
if(ma->rampfac_spec==0.0) ma->rampfac_spec= 1.0;
|
|
|
|
if(ma->pr_lamp==0) ma->pr_lamp= 3;
|
|
|
|
ma= ma->id.next;
|
|
|
|
}
|
2004-07-26 22:46:56 +00:00
|
|
|
|
|
|
|
/* this should have been done loooong before! */
|
|
|
|
while(ob) {
|
|
|
|
if(ob->ipowin==0) ob->ipowin= ID_OB;
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
2004-08-03 21:42:37 +00:00
|
|
|
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D *)sl;
|
|
|
|
v3d->flag |= V3D_SELECT_OUTLINE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-30 18:54:09 +00:00
|
|
|
}
|
EditMesh refactory + undo recode
The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
EditMesh refactor notes (user)
**** New selection modes
When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).
- Vertex Select
Select vertices as usual, fully compatible with how previous version work
- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.
- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.
While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.
The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:
**** Extrude
Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.
New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.
**** Other things to note
- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.
**** Todo
Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.
EditMesh refactor notes (coder)
**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.
**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT
- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.
- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect
- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);
- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices
**** Code hints for handling selection
If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.
However, by using the above calls, at least selections flush downward (to vertex level). You then can call:
void EM_selectmode_flush(void);
Which flushes selections back upward, based on the selectmode setting. This function does the following:
- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges
This works fine in nice controlled situations.
However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:
void EM_select_flush(void);
Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.
**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h
- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.
**** Unified undo for editmode
New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.
Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.
**** Going in/out editmode
As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.
ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.
2004-09-23 20:52:51 +00:00
|
|
|
if(main->versionfile <= 234) {
|
|
|
|
Scene *sce;
|
2004-11-17 17:15:36 +00:00
|
|
|
World *wo;
|
2004-09-30 22:29:19 +00:00
|
|
|
bScreen *sc;
|
|
|
|
int set_zbuf_sel=0;
|
EditMesh refactory + undo recode
The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
EditMesh refactor notes (user)
**** New selection modes
When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).
- Vertex Select
Select vertices as usual, fully compatible with how previous version work
- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.
- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.
While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.
The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:
**** Extrude
Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.
New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.
**** Other things to note
- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.
**** Todo
Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.
EditMesh refactor notes (coder)
**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.
**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT
- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.
- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect
- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);
- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices
**** Code hints for handling selection
If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.
However, by using the above calls, at least selections flush downward (to vertex level). You then can call:
void EM_selectmode_flush(void);
Which flushes selections back upward, based on the selectmode setting. This function does the following:
- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges
This works fine in nice controlled situations.
However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:
void EM_select_flush(void);
Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.
**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h
- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.
**** Unified undo for editmode
New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.
Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.
**** Going in/out editmode
As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.
ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.
2004-09-23 20:52:51 +00:00
|
|
|
|
2004-11-17 17:15:36 +00:00
|
|
|
// force sumo engine to be active
|
|
|
|
for (wo = main->world.first; wo; wo= wo->id.next) {
|
|
|
|
if(wo->physicsEngine==0) wo->physicsEngine = 2;
|
|
|
|
}
|
|
|
|
|
EditMesh refactory + undo recode
The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
EditMesh refactor notes (user)
**** New selection modes
When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).
- Vertex Select
Select vertices as usual, fully compatible with how previous version work
- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.
- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.
While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.
The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:
**** Extrude
Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.
New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.
**** Other things to note
- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.
**** Todo
Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.
EditMesh refactor notes (coder)
**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.
**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT
- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.
- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect
- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);
- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices
**** Code hints for handling selection
If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.
However, by using the above calls, at least selections flush downward (to vertex level). You then can call:
void EM_selectmode_flush(void);
Which flushes selections back upward, based on the selectmode setting. This function does the following:
- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges
This works fine in nice controlled situations.
However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:
void EM_select_flush(void);
Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.
**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h
- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.
**** Unified undo for editmode
New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.
Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.
**** Going in/out editmode
As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.
ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.
2004-09-23 20:52:51 +00:00
|
|
|
for (sce= main->scene.first; sce; sce= sce->id.next) {
|
2004-09-30 22:29:19 +00:00
|
|
|
if(sce->selectmode==0) {
|
|
|
|
sce->selectmode= SCE_SELECT_VERTEX;
|
|
|
|
set_zbuf_sel= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D *)sl;
|
|
|
|
if(set_zbuf_sel) v3d->flag |= V3D_ZBUF_SELECT;
|
|
|
|
}
|
2004-11-01 20:50:42 +00:00
|
|
|
else if(sl->spacetype==SPACE_TEXT) {
|
|
|
|
SpaceText *st= (SpaceText *)sl;
|
|
|
|
if(st->tabnumber==0) st->tabnumber= 2;
|
|
|
|
}
|
2004-09-30 22:29:19 +00:00
|
|
|
}
|
|
|
|
}
|
EditMesh refactory + undo recode
The changelog is very long... it's on the web too:
http://www.blender3d.org/cms/Mesh_editing_rewrite.425.0.html
EditMesh refactor notes (user)
**** New selection modes
When entering Edit Mode for a Mesh, you now have the choice for three selection modes. These are shown as icons in the 3D header (hotkey is being searched for!).
- Vertex Select
Select vertices as usual, fully compatible with how previous version work
- Edge Select
Vertices are not drawn anymore, and selections happen by default on the edges. It is a true edge select, meaning that you can select three out of four edges in a face, without automatic having the 4th edge selected.
- Face Select
Instead of vertices, now selection 'points' are drawn in the face centers. Selected faces also get a colored outline, like for edges. This also is true face select, for each face individual regardless selection status of its vertices or edges.
While holding SHIFT, and press a selection mode, you can also combine the above choices. Now selection becomes mixed, and will behave as expected.
For example; in Edge+Face select mode, selecting the 4 edges of a face will select the face too.
The selection modes and optional drawing modes (like transparant faces, normals, or solid drawing) all work together. All of Blender's mesh editing tools now react to the correct selection mode as well.
Most noticeable it's in:
**** Extrude
Extruding in Edge or Face Select mode allows much more precise control over what's extruded and what should be excluded. Try for example a checker pattern selection, and extrude it.
New is the fixed translation when faces are extruded. This always follows the (averaged) face normal(s) of the old face(s), enabling much easier working in 3D views . A single 'G' (Grab) or 'R' (Rotate) or 'S' (Scale) will change transform modus as usual.
**** Other things to note
- Hiding edges/faces will also behave different based on Select Mode.
- while editing, normals of faces are updated always now
- Border select (BKEY) has 2 different rules for edges; when one edge is fully inside of the border, it will only select edges that are fully inside. Otherwise it selects each edge intersecting with the border.
- in face mode, adding vertices, edges or a circle is invisible...
- "Add monkey" now works as a normal primitive (rotated and on 3d cursor)
- Mesh undo was fully recoded, hopefully solving issues now with Vertex Keys and Groups
- Going in and out of editmode was fully recoded. Especially on larger models you'll notice substantial speed gain.
**** Todo
Add 'FaceSelect mode' functionality in EditMode, including zbuffered selection, display and editing of UV texture.
EditMesh refactor notes (coder)
**** Usage of flags in general
The "->f" flags are reserved for the editmesh.c and editmesh_lib.c core functions. Actually only selection status is there now.
The "->f1" and "->f2" flags are free to use. They're available in vertex/edge/face structs. Since they're free, check carefully when calling other functions that use these flags... for example extrude() or subdivide() use them.
**** Selection flags
EditVert: eve->f & SELECT
EditEdge: eed->f & SELECT
EditFace: efa->f & SELECT
- Selection is only possible when not-hidden!
- Selection flags are always up-to-date, BUT:
if selection mode >= SELECT_EDGE vertex selection flags can be incorrect
if selection mode == SELECT_FACE vertex/edge selection flags can be incorrect
This because of shared vertices or edges.
- use for selecting vertices:
eve->f &= SELECT
- use for selecting edges always:
void EM_select_edge(eed, 1) // 1 = select, 0 = deselect
- use for selecting faces always:
void EM_select_face(efa, 1) // 1 = select, 0 = deselect
- To set the 'f' flags in all of the data:
void EM_set_flag_all(int flag);
void EM_clear_flag_all(int flag);
- the old faceselectedOR() and faceselectedAND() are still there, but only
to be used for evaluating its vertices
**** Code hints for handling selection
If the selectmode is 'face'; vertex or edge selections need to be flushed upward. Same is true for 'edge' selection mode. This means that you'll have to keep track of all selections while coding... selecting the four vertices in a face doesn't automatically select the face anymore.
However, by using the above calls, at least selections flush downward (to vertex level). You then can call:
void EM_selectmode_flush(void);
Which flushes selections back upward, based on the selectmode setting. This function does the following:
- if selectmode 'vertex': select edges/faces based on its selected vertices
- if selectmode 'edge': select faces based its selected edges
This works fine in nice controlled situations.
However, only changing the vertex selections then still doesn't select a face in face mode! If you really can't avoid only working with vertex selections, you can use this call:
void EM_select_flush(void);
Now selection is flushed upward regardless current selectmode. That can be destructive for special cases however, like checkerboard selected faces. So use this only when you know everything else was deselected (or deselect it). Example: adding primitives.
**** Hide flags
EditVert: eve->h
EditEdge: eed->h
EditFace: efa->h
- all hide flags are always up-to-date
- hidden vertices/edges/faces are always deselected. so when you operate on selection only, there's no need to check for hide flag.
**** Unified undo for editmode
New file: editmode_undo.h
A pretty nice function pointer handler style undo. Just code three functions, and your undo will fly! The c file has a good reference.
Also note that the old undo system has been replaced. It currently uses minimal dependencies on Meshes themselves (no abuse of going in/out editmode), and is restricted nicely to editmode functions.
**** Going in/out editmode
As speedup now all vertices/faces/edges are allocated in three big chunks. In vertices/faces/edges now tags are set to denote such data cannot be freed.
ALso the hashtable (lookup) for edges uses no mallocs at all anymore, but is part of the EditEdge itself.
2004-09-23 20:52:51 +00:00
|
|
|
}
|
|
|
|
}
|
More tweaks related to bump mapping quality;
While going over the code, I found out the "nabla", the size of offset
vectors for calculating derivatives of a texture, is a built in constant.
Even worse, the value was different for new noise types (musgrave etc).
So I've added a new slider for it in the procedural texture panels, which
by default is set to 0.025, the value of the old constant. Also made sure
it works with equal effect in all procedurals.
NOTE: a small Nabla will give sharper, detailed bump, but the effect also
becomes smaller, correct that in the Mapping Panel of materials.
For better & compliant control over the bumpmapping, I've also included
the Colorband output in derivatives calculus, so the bump output then
matches the color created. It's also a nice tool to finetune output of
textures for bumpmapping in general.
Bug fix; clicking on the rightmose 'item' in ColorBand didn't activate it.
Found out the ColorBand was slightly drawn off (2 pixels).
2004-12-07 14:46:48 +00:00
|
|
|
if(main->versionfile <= 235) {
|
|
|
|
Tex *tex= main->tex.first;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
Scene *sce= main->scene.first;
|
2005-01-07 18:07:13 +00:00
|
|
|
Sequence *seq;
|
|
|
|
Editing *ed;
|
More tweaks related to bump mapping quality;
While going over the code, I found out the "nabla", the size of offset
vectors for calculating derivatives of a texture, is a built in constant.
Even worse, the value was different for new noise types (musgrave etc).
So I've added a new slider for it in the procedural texture panels, which
by default is set to 0.025, the value of the old constant. Also made sure
it works with equal effect in all procedurals.
NOTE: a small Nabla will give sharper, detailed bump, but the effect also
becomes smaller, correct that in the Mapping Panel of materials.
For better & compliant control over the bumpmapping, I've also included
the Colorband output in derivatives calculus, so the bump output then
matches the color created. It's also a nice tool to finetune output of
textures for bumpmapping in general.
Bug fix; clicking on the rightmose 'item' in ColorBand didn't activate it.
Found out the ColorBand was slightly drawn off (2 pixels).
2004-12-07 14:46:48 +00:00
|
|
|
|
|
|
|
while(tex) {
|
2005-07-14 22:21:12 +00:00
|
|
|
if(tex->nabla==0.0) tex->nabla= 0.025f;
|
More tweaks related to bump mapping quality;
While going over the code, I found out the "nabla", the size of offset
vectors for calculating derivatives of a texture, is a built in constant.
Even worse, the value was different for new noise types (musgrave etc).
So I've added a new slider for it in the procedural texture panels, which
by default is set to 0.025, the value of the old constant. Also made sure
it works with equal effect in all procedurals.
NOTE: a small Nabla will give sharper, detailed bump, but the effect also
becomes smaller, correct that in the Mapping Panel of materials.
For better & compliant control over the bumpmapping, I've also included
the Colorband output in derivatives calculus, so the bump output then
matches the color created. It's also a nice tool to finetune output of
textures for bumpmapping in general.
Bug fix; clicking on the rightmose 'item' in ColorBand didn't activate it.
Found out the ColorBand was slightly drawn off (2 pixels).
2004-12-07 14:46:48 +00:00
|
|
|
tex= tex->id.next;
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
while(sce) {
|
|
|
|
sce->r.postsat= 1.0;
|
2005-01-07 18:07:13 +00:00
|
|
|
ed= sce->ed;
|
|
|
|
if(ed) {
|
|
|
|
WHILE_SEQ(&ed->seqbase) {
|
|
|
|
if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) seq->flag |= SEQ_MAKE_PREMUL;
|
|
|
|
}
|
|
|
|
END_SEQ
|
|
|
|
}
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(main->versionfile <= 236) {
|
2005-04-02 13:57:23 +00:00
|
|
|
Object *ob;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
Scene *sce= main->scene.first;
|
2005-01-30 11:25:27 +00:00
|
|
|
Camera *cam= main->camera.first;
|
2005-04-17 17:43:07 +00:00
|
|
|
Material *ma;
|
2005-03-19 12:17:06 +00:00
|
|
|
bScreen *sc;
|
3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html
Image Memory Grabage Collection
This adds memory handling to the image code. An image is tagged each time it is used.
During a collection cycle (frequency of cycles is user defined), if an image is older
than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.
Notes:
Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
Collecting is called in draw_object, most likely not the best place to do it.
Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)
Userpref DNA changes:
I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.
Info window changes:
I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.
Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
while(sce) {
|
2005-05-26 19:49:05 +00:00
|
|
|
sce->r.mode &= ~R_ZBLUR; // disabled for release
|
|
|
|
|
2005-07-14 22:21:12 +00:00
|
|
|
if(sce->r.postsat==0.0) sce->r.postsat= 1.0f;
|
2005-05-26 19:49:05 +00:00
|
|
|
|
The zblur plugin (aka as DoF) integrated in render. Compared to patch
submitted by Alexander, changes/improvements are:
- Moved to new Panel in Scene buttons "Post Effects". Together with other
postprocessing options, such as Edge render. It is also not called DoF,
this because that's a bit pretending too much then. It's a zblur still!
- Made it render Alpha as well
- Made it use and deliver float buffers
- Huge cleanup of zblur.c code, was very messy. It was alling things in render
code without need even (win matrices, transform faces, etc)
- Fixed errors in using Z values (zbuffer is signed int)
- Removed very weird gamma corrections for front/back half
- Tweaked gaussian table, allow variable 'Sigma' to be set for gauss curve
- Didn't copy 'auto focus' yet. Use of this is very limited, and gives
false expectations, nor works for rendering anims with deamons well.
Main issue remains: it's not a very advanced feature... I still doubt
very much if this deserves to be released. Spent 2 days on trying to get
the key issues solved, with not much results.
- gauss filter code has weird side effects on large blur size
- having unsharp (blurred) in front also blurs what's around in back.
only blurred in back with sharp in front works a little bit
- severe aliasing errors... also due the code splitting in 2 halves
- doesnt work with unified yet
- won't work for halos, spot halos or transparant faces
Anyhoo... It was promised to be committed, so now artists can play with it.
Who knows it's useful after all, or some fixes can be implemented. :)
2005-04-23 20:49:23 +00:00
|
|
|
if(sce->r.zgamma==0.0) {
|
2005-07-14 22:21:12 +00:00
|
|
|
sce->r.focus= 0.9f;
|
|
|
|
sce->r.zgamma= 1.0f;
|
|
|
|
sce->r.zsigma= 4.0f;
|
|
|
|
sce->r.zblur= 10.0f;
|
|
|
|
sce->r.zmin= 0.8f;
|
The zblur plugin (aka as DoF) integrated in render. Compared to patch
submitted by Alexander, changes/improvements are:
- Moved to new Panel in Scene buttons "Post Effects". Together with other
postprocessing options, such as Edge render. It is also not called DoF,
this because that's a bit pretending too much then. It's a zblur still!
- Made it render Alpha as well
- Made it use and deliver float buffers
- Huge cleanup of zblur.c code, was very messy. It was alling things in render
code without need even (win matrices, transform faces, etc)
- Fixed errors in using Z values (zbuffer is signed int)
- Removed very weird gamma corrections for front/back half
- Tweaked gaussian table, allow variable 'Sigma' to be set for gauss curve
- Didn't copy 'auto focus' yet. Use of this is very limited, and gives
false expectations, nor works for rendering anims with deamons well.
Main issue remains: it's not a very advanced feature... I still doubt
very much if this deserves to be released. Spent 2 days on trying to get
the key issues solved, with not much results.
- gauss filter code has weird side effects on large blur size
- having unsharp (blurred) in front also blurs what's around in back.
only blurred in back with sharp in front works a little bit
- severe aliasing errors... also due the code splitting in 2 halves
- doesnt work with unified yet
- won't work for halos, spot halos or transparant faces
Anyhoo... It was promised to be committed, so now artists can play with it.
Who knows it's useful after all, or some fixes can be implemented. :)
2005-04-23 20:49:23 +00:00
|
|
|
}
|
2005-07-14 22:21:12 +00:00
|
|
|
if(sce->editbutsize==0.0) sce->editbutsize= 0.1f;
|
2005-05-03 10:54:42 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2005-01-30 11:25:27 +00:00
|
|
|
while(cam) {
|
|
|
|
if(cam->ortho_scale==0.0) {
|
2005-07-14 22:21:12 +00:00
|
|
|
cam->ortho_scale= 256.0f/cam->lens;
|
2005-01-30 11:25:27 +00:00
|
|
|
if(cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
|
|
|
|
}
|
|
|
|
cam= cam->id.next;
|
|
|
|
}
|
2005-03-19 12:17:06 +00:00
|
|
|
/* set manipulator type */
|
2005-04-30 21:27:05 +00:00
|
|
|
/* force oops draw if depgraph was set*/
|
2005-05-11 20:01:42 +00:00
|
|
|
/* set time line var */
|
2005-03-19 12:17:06 +00:00
|
|
|
for (sc= main->screen.first; sc; sc= sc->id.next) {
|
|
|
|
ScrArea *sa;
|
|
|
|
for (sa= sc->areabase.first; sa; sa= sa->next) {
|
|
|
|
SpaceLink *sl;
|
|
|
|
for (sl= sa->spacedata.first; sl; sl= sl->next) {
|
|
|
|
if(sl->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d= (View3D *)sl;
|
2005-03-28 14:00:49 +00:00
|
|
|
if(v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
|
2005-03-19 12:17:06 +00:00
|
|
|
}
|
2005-04-30 21:27:05 +00:00
|
|
|
#ifndef SHOWDEPGRAPH
|
2005-12-18 13:46:01 +00:00
|
|
|
else if(sl->spacetype==SPACE_OOPS) {
|
2005-04-30 21:27:05 +00:00
|
|
|
if ( ((SpaceOops *)sl)->type==SO_DEPSGRAPH)
|
|
|
|
((SpaceOops *)sl)->type=SO_OOPS;
|
|
|
|
}
|
2005-05-11 20:01:42 +00:00
|
|
|
#endif
|
2005-12-18 13:46:01 +00:00
|
|
|
else if(sl->spacetype==SPACE_TIME) {
|
2005-05-11 20:01:42 +00:00
|
|
|
SpaceTime *stime= (SpaceTime *)sl;
|
2005-05-29 11:53:55 +00:00
|
|
|
if(stime->redraws==0)
|
|
|
|
stime->redraws= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
|
2005-05-11 20:01:42 +00:00
|
|
|
}
|
2005-03-19 12:17:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 17:43:07 +00:00
|
|
|
// init new shader vars
|
|
|
|
for (ma= main->mat.first; ma; ma= ma->id.next) {
|
2005-04-22 21:31:52 +00:00
|
|
|
if(ma->darkness==0.0) {
|
2005-07-14 22:21:12 +00:00
|
|
|
ma->rms=0.1f;
|
|
|
|
ma->darkness=1.0f;
|
2005-04-22 21:31:52 +00:00
|
|
|
}
|
2005-04-17 17:43:07 +00:00
|
|
|
}
|
|
|
|
|
2005-05-02 13:28:13 +00:00
|
|
|
/* softbody init new vars */
|
2005-04-02 13:57:23 +00:00
|
|
|
for(ob= main->object.first; ob; ob= ob->id.next) {
|
2005-04-20 16:55:04 +00:00
|
|
|
if(ob->soft) {
|
2005-07-14 22:21:12 +00:00
|
|
|
if(ob->soft->defgoal==0.0) ob->soft->defgoal= 0.7f;
|
|
|
|
if(ob->soft->physics_speed==0.0) ob->soft->physics_speed= 1.0f;
|
2005-05-02 13:28:13 +00:00
|
|
|
|
|
|
|
if(ob->soft->interval==0) {
|
|
|
|
ob->soft->interval= 2;
|
|
|
|
ob->soft->sfra= 1;
|
|
|
|
ob->soft->efra= 100;
|
|
|
|
}
|
2005-04-20 16:55:04 +00:00
|
|
|
}
|
2005-04-16 14:01:49 +00:00
|
|
|
if(ob->soft && ob->soft->vertgroup==0) {
|
|
|
|
bDeformGroup *locGroup = get_named_vertexgroup(ob, "SOFTGOAL");
|
|
|
|
if(locGroup){
|
|
|
|
/* retrieve index for that group */
|
|
|
|
ob->soft->vertgroup = 1 + get_defgroup_num(ob, locGroup);
|
|
|
|
}
|
|
|
|
}
|
2005-04-02 13:57:23 +00:00
|
|
|
}
|
More tweaks related to bump mapping quality;
While going over the code, I found out the "nabla", the size of offset
vectors for calculating derivatives of a texture, is a built in constant.
Even worse, the value was different for new noise types (musgrave etc).
So I've added a new slider for it in the procedural texture panels, which
by default is set to 0.025, the value of the old constant. Also made sure
it works with equal effect in all procedurals.
NOTE: a small Nabla will give sharper, detailed bump, but the effect also
becomes smaller, correct that in the Mapping Panel of materials.
For better & compliant control over the bumpmapping, I've also included
the Colorband output in derivatives calculus, so the bump output then
matches the color created. It's also a nice tool to finetune output of
textures for bumpmapping in general.
Bug fix; clicking on the rightmose 'item' in ColorBand didn't activate it.
Found out the ColorBand was slightly drawn off (2 pixels).
2004-12-07 14:46:48 +00:00
|
|
|
}
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
if(main->versionfile <= 237) {
|
|
|
|
bArmature *arm;
|
2005-07-13 13:30:51 +00:00
|
|
|
bConstraint *con;
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
Object *ob;
|
2005-07-26 18:46:28 +00:00
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
// armature recode checks
|
|
|
|
for(arm= main->armature.first; arm; arm= arm->id.next) {
|
|
|
|
where_is_armature(arm);
|
|
|
|
}
|
|
|
|
for(ob= main->object.first; ob; ob= ob->id.next) {
|
2005-08-14 16:03:22 +00:00
|
|
|
if(ob->parent) {
|
|
|
|
Object *parent= newlibadr(fd, lib, ob->parent);
|
|
|
|
if (parent && parent->type==OB_LATTICE)
|
|
|
|
ob->partype = PARSKEL;
|
2005-08-11 03:31:33 +00:00
|
|
|
}
|
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
// btw. armature_rebuild_pose is further only called on leave editmode
|
|
|
|
if(ob->type==OB_ARMATURE) {
|
2005-09-12 13:02:36 +00:00
|
|
|
if(ob->pose)
|
2005-07-13 13:30:51 +00:00
|
|
|
ob->pose->flag |= POSE_RECALC;
|
2005-09-12 13:02:36 +00:00
|
|
|
ob->recalc |= OB_RECALC; // cannot call stuff now (pointers!), done in setup_app_data
|
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
/* new generic xray option */
|
2005-07-26 18:46:28 +00:00
|
|
|
arm= newlibadr(fd, lib, ob->data);
|
2005-07-14 12:44:33 +00:00
|
|
|
if(arm->flag & ARM_DRAWXRAY) {
|
|
|
|
ob->dtx |= OB_DRAWXRAY;
|
|
|
|
}
|
2005-07-21 22:34:01 +00:00
|
|
|
} else if (ob->type==OB_MESH) {
|
2005-07-26 18:46:28 +00:00
|
|
|
Mesh *me = newlibadr(fd, lib, ob->data);
|
|
|
|
|
2005-07-21 22:34:01 +00:00
|
|
|
if ((me->flag&ME_SUBSURF)) {
|
|
|
|
SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
|
2005-07-26 18:46:28 +00:00
|
|
|
|
2005-07-22 15:09:54 +00:00
|
|
|
smd->levels = MAX2(1, me->subdiv);
|
|
|
|
smd->renderLevels = MAX2(1, me->subdivr);
|
2005-07-21 22:34:01 +00:00
|
|
|
smd->subdivType = me->subsurftype;
|
2005-07-26 18:46:28 +00:00
|
|
|
|
2005-07-22 15:09:54 +00:00
|
|
|
smd->modifier.mode = 0;
|
|
|
|
if (me->subdiv!=0)
|
|
|
|
smd->modifier.mode |= 1;
|
|
|
|
if (me->subdivr!=0)
|
|
|
|
smd->modifier.mode |= 2;
|
2005-08-13 05:05:18 +00:00
|
|
|
if (me->flag&ME_OPT_EDGES)
|
|
|
|
smd->flags |= eSubsurfModifierFlag_ControlEdges;
|
2005-07-21 22:34:01 +00:00
|
|
|
|
|
|
|
BLI_addtail(&ob->modifiers, smd);
|
|
|
|
}
|
2005-07-14 12:44:33 +00:00
|
|
|
}
|
2005-07-26 18:46:28 +00:00
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
// follow path constraint needs to set the 'path' option in curves...
|
|
|
|
for(con=ob->constraints.first; con; con= con->next) {
|
|
|
|
if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
|
|
|
|
bFollowPathConstraint *data = con->data;
|
2005-07-26 18:46:28 +00:00
|
|
|
Object *obc= newlibadr(fd, lib, data->tar);
|
|
|
|
|
2005-07-14 12:44:33 +00:00
|
|
|
if(obc && obc->type==OB_CURVE) {
|
2005-08-15 09:45:48 +00:00
|
|
|
Curve *cu= newlibadr(fd, lib, obc->data);
|
|
|
|
if(cu) cu->flag |= CU_PATH;
|
2005-07-13 13:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-07-14 12:44:33 +00:00
|
|
|
}
|
2005-08-15 10:30:53 +00:00
|
|
|
}
|
|
|
|
if(main->versionfile <= 238) {
|
|
|
|
Lattice *lt;
|
2005-08-16 22:58:31 +00:00
|
|
|
Object *ob;
|
Armature "Envelope" editing.
For defining the deformation distances of Bones, three values are being
used now. The bone tip and root radius define the bone-shape itself and the
"dist" defines the soft area around it. A full (user) doc is in CMS here;
http://www.blender3d.org/cms/Armature_Envelopes.647.0.html
Note: todo still is allowing both Vertex Deform Groups and these Envelopes
together (and or per Bone).
Also part of this commit is:
- New: Hiding bones in EditMode. This is a separate 'hide flag', so you can
keep the PoseMode hidden Bones separate from EditMode.
(In the future we should do some kind of bone-grouping or so)
- While transform(), the hotkeys G,R,S only switch mode when the previous
mode was compatible. Caused conflicts with Crease/BoneDist/etc.
- Deleting the last VertexGroup now also deletes the entire Mesh 'dvert'
data. Sounds logical, but remember that VertexGroups are partial on a
Mesh, partial on Object. Weird design decision though...
Anyhoo, at this moment the only way to have Bone Envelopes deform, is
by deleting all VertexGroups!
- In PoseMode, the hotkey ALT+S now does both B-Bone size or Envelope,
depending draw type.
- In EditMode, Extrude now also works when only Root points were selected.
- Weight editing is also symmetrical btw, with the "X-axis Mirror" option
set.
2005-08-19 12:35:15 +00:00
|
|
|
bArmature *arm;
|
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
|
|
|
Mesh *me;
|
2005-09-26 15:34:21 +00:00
|
|
|
Key *key;
|
2005-08-24 20:37:25 +00:00
|
|
|
Scene *sce= main->scene.first;
|
|
|
|
|
|
|
|
while(sce){
|
|
|
|
if(sce->toolsettings == NULL){
|
|
|
|
sce->toolsettings = MEM_mallocN(sizeof(struct ToolSettings),"Tool Settings Struct");
|
|
|
|
sce->toolsettings->cornertype=0;
|
|
|
|
sce->toolsettings->degr = 90;
|
|
|
|
sce->toolsettings->step = 9;
|
|
|
|
sce->toolsettings->turn = 1;
|
|
|
|
sce->toolsettings->extr_offs = 1;
|
2005-09-03 16:20:33 +00:00
|
|
|
sce->toolsettings->doublimit = 0.001f;
|
2005-08-24 20:37:25 +00:00
|
|
|
sce->toolsettings->segments = 32;
|
|
|
|
sce->toolsettings->rings = 32;
|
|
|
|
sce->toolsettings->vertices = 32;
|
|
|
|
sce->toolsettings->editbutflag =1;
|
|
|
|
}
|
|
|
|
sce= sce->id.next;
|
|
|
|
}
|
2005-08-15 10:30:53 +00:00
|
|
|
|
|
|
|
for (lt=main->latt.first; lt; lt=lt->id.next) {
|
|
|
|
if (lt->fu==0.0 && lt->fv==0.0 && lt->fw==0.0) {
|
|
|
|
calc_lat_fudu(lt->flag, lt->pntsu, <->fu, <->du);
|
|
|
|
calc_lat_fudu(lt->flag, lt->pntsv, <->fv, <->dv);
|
|
|
|
calc_lat_fudu(lt->flag, lt->pntsw, <->fw, <->dw);
|
|
|
|
}
|
|
|
|
}
|
2005-08-16 22:58:31 +00:00
|
|
|
|
|
|
|
for(ob=main->object.first; ob; ob= ob->id.next) {
|
2005-08-23 20:39:58 +00:00
|
|
|
ModifierData *md;
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
PartEff *paf;
|
2005-08-23 20:39:58 +00:00
|
|
|
|
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
if (md->type==eModifierType_Subsurf) {
|
|
|
|
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
|
|
|
|
|
|
|
smd->flags &= ~(eSubsurfModifierFlag_Incremental|eSubsurfModifierFlag_DebugIncr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-16 22:58:31 +00:00
|
|
|
if ((ob->softflag&OB_SB_ENABLE) && !modifiers_findByType(ob, eModifierType_Softbody)) {
|
|
|
|
if (ob->softflag&OB_SB_POSTDEF) {
|
2005-08-23 20:39:58 +00:00
|
|
|
md = ob->modifiers.first;
|
2005-08-16 22:58:31 +00:00
|
|
|
|
|
|
|
while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
|
|
|
|
md = md->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody));
|
|
|
|
} else {
|
|
|
|
BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody));
|
|
|
|
}
|
|
|
|
|
|
|
|
ob->softflag &= ~OB_SB_ENABLE;
|
|
|
|
}
|
2005-08-27 12:48:45 +00:00
|
|
|
if(ob->pose) {
|
2005-09-03 16:20:33 +00:00
|
|
|
bPoseChannel *pchan;
|
2005-08-27 12:48:45 +00:00
|
|
|
bConstraint *con;
|
|
|
|
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
2005-09-12 13:02:36 +00:00
|
|
|
// note, pchan->bone is also lib-link stuff
|
2005-08-27 14:27:05 +00:00
|
|
|
if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
|
2005-08-27 12:48:45 +00:00
|
|
|
pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
|
|
|
|
pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;
|
|
|
|
|
|
|
|
for(con= pchan->constraints.first; con; con= con->next) {
|
|
|
|
if(con->type == CONSTRAINT_TYPE_KINEMATIC) {
|
|
|
|
bKinematicConstraint *data = (bKinematicConstraint*)con->data;
|
|
|
|
data->weight = 1.0f;
|
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
|
|
|
data->orientweight = 1.0f;
|
2005-08-27 17:04:29 +00:00
|
|
|
data->flag &= ~CONSTRAINT_IK_ROT;
|
Integration of new IK lib features in Armature Poses.
Best is to forget yesterday's commit and old docs. New docs are underway...
Here's how IK works now;
- IK chains can go all the way to the furthest parent Bone. Disregarding
the old option "IK to Parent" and disgregarding whether a Bone has an
offset to its parent (offsets now work for IK, so you can also make
T-bones).
- The old "IK to Parent" option now only does what it should do: it denotes
whether a Bone is directly connected to a Parent Bone, or not.
In the UI and in code this option is now called "Connected".
- You can also define yourself which Bone will become the "Root" for an IK
chain. This can be any Parent of the IK tip (where the IK constraint is).
By default it goes all the way, unless you set a value for the new IK
Constraint Panel option "Chain Lenght".
- "Tree IK" now is detected automatic, when multiple IK Roots are on the
same Bone, and when there's a branched structure.
Multiple IK's on a single chain (no branches) is still executed as usual,
doing the IK's sequentially.
- Note: Branched structures, with _partial_ overlapping IK chains, that don't
share the same Root will possibly disconnect branches.
- When you select a Bone with IK, it now draws a yellow dashed line to its
Root.
- The IK options "Location Weight" and "Rotation Weight" are relative,
in case there's a Tree IK structure. These weights cannot be set to
zero. To animate or disable IK Targets, use the "Influence" slider.
- This new IK is backwards and upwards compatible for Blender files.
Of course, the new features won't show in older Blender binaries! :)
Other changes & notes;
- In PoseMode, the Constraint Panel now also draws in Editing Buttons, next
to the Bones Panel.
- IK Constraint Panel was redesigned... it's still a bit squished
- Buttons "No X DoF" is now called "Lock X". This to follow convention to
name options positive.
- Added Undo push for Make/Clear Parent in Editmode Armature
- Use CTRL+P "Make Parent" on a single selected Bone to make it become
connected (ALT+P had already "Disconnect").
On todo next; Visualizing & review of Bone DoF limits and stiffness
2005-08-28 12:23:06 +00:00
|
|
|
|
|
|
|
/* enforce conversion from old IK_TOPARENT to rootbone index */
|
|
|
|
data->rootbone= -1;
|
2005-09-24 14:19:37 +00:00
|
|
|
|
|
|
|
/* update_pose_etc handles rootbone==-1 */
|
|
|
|
ob->pose->flag |= POSE_RECALC;
|
2005-08-27 12:48:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
The long awaited Particle patch from Janne Karhu
http://www.blender3d.org/cms/New_Particle_options_a.721.0.html
There's no doubt this patch had a lot of good ideas for features, and I
want to compliment Janne again for getting it all to work even!
A more careful review of the features and code did show however quite some
flaws and bugs... partially because the current particle code was very much
polluted already, but also because of the implementation lacked quality.
However, the patch was too good to reject, so I've fixed and recoded the
parts that needed it most. :)
Here's a list of of most evident changes in the patch;
- Guides support recoded. It was implemented as a true 'force field',
checking all Curve path points for each particle to find the closest. Was
just far too slow, and didn't support looping or bends well.
The new implementation is fast (real time) and treats the paths as actual
trajectory for the particle.
- Guides didn't integrate in the physics/speed system either, was added as
exception. Now it's integrated and can be combined with other velocities
or forces
- Use of Fields was slow code in general, made it use a Cache instead.
- The "even" distribution didn't work for Jittered sample patterns.
- The "even" or "vertexgroup" code in the main loops were badly constructed,
giving too much cpu for a simple task. Instead of going over all faces
many times, it now only does it once.
Same part of the code used a lot of temporal unneeded mallocs.
- Use of DerivedMesh or Mesh was confused, didn't work for Subsurfs in all
cases
- Support for vertex groups was slow, evaluating vertexgroups too often
- When a vertexgroup failed to read, it was wrongly handled (set to zero).
VertexGroup support now is with a name.
- Split up the too huge build_particle() call in some parts (moving new code)
- The "texture re-timing" option failed for moving Objects. The old code used
the convention that particles were added with increasing time steps.
Solved by creating a object Matrix Cache.
Also: the texture coordinates had to be corrected to become "OrCo".
- The "Disp" option only was used to draw less particles. Changed it to
actually calculate fewer particles for 3D viewing, but render all still.
So now it can be used to keep editing realtime.
Removed;
The "speed threshold" and "Tight" features were not copied over. This
resembled too much to feature overkill. Needs re-evaluation.
Also the "Deform" option was not added, I prefer to first check if the
current particle system really works for the Modifier system.
And:
- Added integration for particle force fields in the dependency graph
- Added TAB completion for vertexgroup names!
- Made the 'wait cursor' only appear when particles take more than 0.5 sec
- The particle jitter table order now is randomized too, giving much
nicer emitting of particles in large faces.
- Vortex field didn't correctly use speed/forces, so it didn't work for
collisions.
- Triangle distribution was wrong
- Removed ancient bug that applied in a *very* weird way speed and forces.
(location changes got the half force, speed the full...???)
So much... might have forgotten some notes! :)
2005-11-10 16:01:56 +00:00
|
|
|
|
|
|
|
paf = give_parteff(ob);
|
|
|
|
if (paf) {
|
|
|
|
if(paf->disp == 0)
|
|
|
|
paf->disp = 100;
|
|
|
|
if(paf->speedtex == 0)
|
|
|
|
paf->speedtex = 8;
|
|
|
|
if(paf->omat == 0)
|
|
|
|
paf->omat = 1;
|
|
|
|
}
|
2005-08-16 22:58:31 +00:00
|
|
|
}
|
Armature "Envelope" editing.
For defining the deformation distances of Bones, three values are being
used now. The bone tip and root radius define the bone-shape itself and the
"dist" defines the soft area around it. A full (user) doc is in CMS here;
http://www.blender3d.org/cms/Armature_Envelopes.647.0.html
Note: todo still is allowing both Vertex Deform Groups and these Envelopes
together (and or per Bone).
Also part of this commit is:
- New: Hiding bones in EditMode. This is a separate 'hide flag', so you can
keep the PoseMode hidden Bones separate from EditMode.
(In the future we should do some kind of bone-grouping or so)
- While transform(), the hotkeys G,R,S only switch mode when the previous
mode was compatible. Caused conflicts with Crease/BoneDist/etc.
- Deleting the last VertexGroup now also deletes the entire Mesh 'dvert'
data. Sounds logical, but remember that VertexGroups are partial on a
Mesh, partial on Object. Weird design decision though...
Anyhoo, at this moment the only way to have Bone Envelopes deform, is
by deleting all VertexGroups!
- In PoseMode, the hotkey ALT+S now does both B-Bone size or Envelope,
depending draw type.
- In EditMode, Extrude now also works when only Root points were selected.
- Weight editing is also symmetrical btw, with the "X-axis Mirror" option
set.
2005-08-19 12:35:15 +00:00
|
|
|
|
|
|
|
for(arm=main->armature.first; arm; arm= arm->id.next) {
|
|
|
|
bone_version_238(&arm->bonebase);
|
2005-08-21 18:53:12 +00:00
|
|
|
arm->deformflag |= ARM_DEF_VGROUP;
|
Armature "Envelope" editing.
For defining the deformation distances of Bones, three values are being
used now. The bone tip and root radius define the bone-shape itself and the
"dist" defines the soft area around it. A full (user) doc is in CMS here;
http://www.blender3d.org/cms/Armature_Envelopes.647.0.html
Note: todo still is allowing both Vertex Deform Groups and these Envelopes
together (and or per Bone).
Also part of this commit is:
- New: Hiding bones in EditMode. This is a separate 'hide flag', so you can
keep the PoseMode hidden Bones separate from EditMode.
(In the future we should do some kind of bone-grouping or so)
- While transform(), the hotkeys G,R,S only switch mode when the previous
mode was compatible. Caused conflicts with Crease/BoneDist/etc.
- Deleting the last VertexGroup now also deletes the entire Mesh 'dvert'
data. Sounds logical, but remember that VertexGroups are partial on a
Mesh, partial on Object. Weird design decision though...
Anyhoo, at this moment the only way to have Bone Envelopes deform, is
by deleting all VertexGroups!
- In PoseMode, the hotkey ALT+S now does both B-Bone size or Envelope,
depending draw type.
- In EditMode, Extrude now also works when only Root points were selected.
- Weight editing is also symmetrical btw, with the "X-axis Mirror" option
set.
2005-08-19 12:35:15 +00:00
|
|
|
}
|
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
|
|
|
|
|
|
|
for(me=main->mesh.first; me; me= me->id.next) {
|
|
|
|
if (!me->medge) {
|
2005-09-22 17:52:41 +00:00
|
|
|
make_edges(me, 1); /* 1 = use mface->edcode */
|
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
2005-08-21 07:19:20 +00:00
|
|
|
} else {
|
|
|
|
mesh_strip_loose_faces(me);
|
|
|
|
}
|
|
|
|
}
|
2005-09-26 15:34:21 +00:00
|
|
|
|
|
|
|
for(key= main->key.first; key; key= key->id.next) {
|
|
|
|
KeyBlock *kb;
|
|
|
|
int index= 1;
|
|
|
|
|
|
|
|
/* trick to find out if we already introduced adrcode */
|
|
|
|
for(kb= key->block.first; kb; kb= kb->next)
|
|
|
|
if(kb->adrcode) break;
|
|
|
|
|
|
|
|
if(kb==NULL) {
|
|
|
|
for(kb= key->block.first; kb; kb= kb->next) {
|
|
|
|
if(kb==key->refkey) {
|
|
|
|
if(kb->name[0]==0)
|
|
|
|
strcpy(kb->name, "Basis");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(kb->name[0]==0)
|
|
|
|
sprintf(kb->name, "Key %d", index);
|
|
|
|
kb->adrcode= index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-15 10:30:53 +00:00
|
|
|
}
|
2005-10-20 16:31:46 +00:00
|
|
|
if(main->versionfile <= 239) {
|
2005-11-16 21:03:16 +00:00
|
|
|
bArmature *arm;
|
2005-10-20 16:31:46 +00:00
|
|
|
Object *ob;
|
2005-10-27 11:28:43 +00:00
|
|
|
Scene *sce= main->scene.first;
|
|
|
|
Camera *cam= main->camera.first;
|
2005-11-12 16:22:10 +00:00
|
|
|
Material *ma= main->mat.first;
|
2005-11-23 15:20:45 +00:00
|
|
|
int set_passepartout= 0;
|
2005-10-20 16:31:46 +00:00
|
|
|
|
|
|
|
/* deformflag is local in modifier now */
|
|
|
|
for(ob=main->object.first; ob; ob= ob->id.next) {
|
|
|
|
ModifierData *md;
|
|
|
|
|
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
if (md->type==eModifierType_Armature) {
|
|
|
|
ArmatureModifierData *amd = (ArmatureModifierData*) md;
|
|
|
|
if(amd->object && amd->deformflag==0) {
|
|
|
|
Object *oba= newlibadr(fd, lib, amd->object);
|
|
|
|
bArmature *arm= newlibadr(fd, lib, oba->data);
|
|
|
|
amd->deformflag= arm->deformflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-10-27 11:28:43 +00:00
|
|
|
}
|
|
|
|
|
2005-11-16 21:03:16 +00:00
|
|
|
/* updating stepsize for ghost drawing */
|
|
|
|
for(arm= main->armature.first; arm; arm= arm->id.next) {
|
|
|
|
if (arm->ghostsize==0) arm->ghostsize=1;
|
2005-12-07 12:36:26 +00:00
|
|
|
bone_version_239(&arm->bonebase);
|
|
|
|
if(arm->layer==0) arm->layer= 1;
|
2005-11-16 21:03:16 +00:00
|
|
|
}
|
|
|
|
|
2005-11-23 15:20:45 +00:00
|
|
|
for(;sce;sce= sce->id.next) {
|
2005-11-01 21:28:53 +00:00
|
|
|
/* make 'innervert' the default subdivide type, for backwards compat */
|
|
|
|
sce->toolsettings->cornertype=1;
|
|
|
|
|
2005-11-23 15:20:45 +00:00
|
|
|
if(sce->r.scemode & R_PASSEPARTOUT) {
|
|
|
|
set_passepartout= 1;
|
|
|
|
sce->r.scemode &= ~R_PASSEPARTOUT;
|
|
|
|
}
|
|
|
|
/* gauss is filter variable now */
|
|
|
|
if(sce->r.mode & R_GAUSS) {
|
|
|
|
sce->r.filtertype= R_FILTER_GAUSS;
|
|
|
|
sce->r.mode &= ~R_GAUSS;
|
2005-10-27 11:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
2005-11-23 15:20:45 +00:00
|
|
|
|
|
|
|
for(;cam; cam= cam->id.next) {
|
|
|
|
if(set_passepartout)
|
|
|
|
cam->flag |= CAM_SHOWPASSEPARTOUT;
|
|
|
|
|
|
|
|
/* make sure old cameras have title safe on */
|
|
|
|
|
|
|
|
/* *** to be uncommented before 2.40 release! *** */
|
|
|
|
/*
|
|
|
|
if (!(cam->flag & CAM_SHOWTITLESAFE))
|
|
|
|
cam->flag |= CAM_SHOWTITLESAFE;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* set an appropriate camera passepartout alpha */
|
|
|
|
if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f;
|
|
|
|
}
|
|
|
|
|
2005-11-12 16:22:10 +00:00
|
|
|
for(; ma; ma= ma->id.next) {
|
|
|
|
if(ma->strand_sta==0.0f) {
|
|
|
|
ma->strand_sta= ma->strand_end= 1.0f;
|
|
|
|
ma->mode |= MA_TANGENT_STR;
|
|
|
|
}
|
2005-11-27 12:19:12 +00:00
|
|
|
/* remove this test before 2.40 too! pad is set to denote check was done */
|
|
|
|
if(ma->pad==0) {
|
|
|
|
if(ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
|
|
|
|
ma->pad= 1;
|
|
|
|
}
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
/* orange stuff, so should be done for 2.40 too */
|
|
|
|
if(ma->layers.first==NULL) {
|
|
|
|
ma->ml_flag= ML_RENDER;
|
|
|
|
}
|
2005-11-12 16:22:10 +00:00
|
|
|
}
|
2005-10-20 16:31:46 +00:00
|
|
|
}
|
|
|
|
|
2005-07-26 18:46:28 +00:00
|
|
|
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
|
|
|
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
|
|
|
|
|
|
|
|
/* don't forget to set version number in blender.c! */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void lib_link_all(FileData *fd, Main *main)
|
|
|
|
{
|
2005-12-15 18:42:02 +00:00
|
|
|
oldnewmap_sort(fd);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib_link_screen(fd, main);
|
|
|
|
lib_link_scene(fd, main);
|
|
|
|
lib_link_object(fd, main);
|
|
|
|
lib_link_curve(fd, main);
|
|
|
|
lib_link_mball(fd, main);
|
|
|
|
lib_link_material(fd, main);
|
|
|
|
lib_link_texture(fd, main);
|
|
|
|
lib_link_image(fd, main);
|
|
|
|
lib_link_ipo(fd, main);
|
|
|
|
lib_link_key(fd, main);
|
|
|
|
lib_link_world(fd, main);
|
|
|
|
lib_link_lamp(fd, main);
|
|
|
|
lib_link_latt(fd, main);
|
|
|
|
lib_link_text(fd, main);
|
|
|
|
lib_link_camera(fd, main);
|
|
|
|
lib_link_sound(fd, main);
|
|
|
|
lib_link_group(fd, main);
|
|
|
|
lib_link_armature(fd, main);
|
|
|
|
lib_link_action(fd, main);
|
|
|
|
lib_link_vfont(fd, main);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
lib_link_mesh(fd, main); /* as last: tpage images with users at zero */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
lib_link_library(fd, main); /* only init users */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
|
|
|
|
{
|
|
|
|
Link *link;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-04-23 21:02:58 +00:00
|
|
|
bfd->user= read_struct(fd, bhead, "user def");
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
bfd->user->themes.first= bfd->user->themes.last= NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
/* read all attached data */
|
|
|
|
while(bhead && bhead->code==DATA) {
|
2004-04-23 21:02:58 +00:00
|
|
|
link= read_struct(fd, bhead, "user def data");
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
BLI_addtail(&bfd->user->themes, link);
|
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
return bhead;
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
BlendFileData *blo_read_file_internal(FileData *fd, BlendReadError *error_r)
|
|
|
|
{
|
|
|
|
BHead *bhead= blo_firstbhead(fd);
|
|
|
|
BlendFileData *bfd;
|
2002-12-20 02:08:46 +00:00
|
|
|
FileGlobal *fg = (FileGlobal *)NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-05-26 13:17:12 +00:00
|
|
|
bfd= MEM_callocN(sizeof(BlendFileData), "blendfiledata");
|
|
|
|
bfd->main= MEM_callocN(sizeof(Main), "main");
|
2002-10-12 11:37:38 +00:00
|
|
|
BLI_addtail(&fd->mainlist, bfd->main);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bfd->main->versionfile= fd->fileversion;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(bhead) {
|
|
|
|
switch(bhead->code) {
|
|
|
|
case GLOB:
|
|
|
|
case DATA:
|
|
|
|
case DNA1:
|
|
|
|
case TEST:
|
|
|
|
case REND:
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
if (bhead->code==GLOB) {
|
2004-04-23 21:02:58 +00:00
|
|
|
fg= read_struct(fd, bhead, "REND");
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
|
|
|
break;
|
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
|
|
|
case USER:
|
|
|
|
bhead= read_userdef(bfd, fd, bhead);
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
case ENDB:
|
|
|
|
bhead = NULL;
|
|
|
|
break;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
case ID_LI:
|
|
|
|
bhead = read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
|
|
|
|
break;
|
|
|
|
case ID_ID:
|
|
|
|
/* always adds to the most recently loaded
|
|
|
|
* ID_LI block, see direct_link_library.
|
|
|
|
* this is part of the file format definition.
|
|
|
|
*/
|
|
|
|
bhead = read_libblock(fd, fd->mainlist.last, bhead, LIB_READ+LIB_EXTERN, NULL);
|
|
|
|
break;
|
2005-12-15 18:37:47 +00:00
|
|
|
case ID_GR:
|
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
|
|
|
break;
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
default:
|
|
|
|
bhead = read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* before read_libraries */
|
2005-07-26 18:46:28 +00:00
|
|
|
do_versions(fd, NULL, bfd->main);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
read_libraries(fd, &fd->mainlist);
|
|
|
|
blo_join_main(&fd->mainlist);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
lib_link_all(fd, bfd->main);
|
2005-12-16 17:35:38 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
link_global(fd, bfd, fg); /* as last */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
/* removed here: check for existance of curscreen/scene, moved to kernel setup_app */
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(fg);
|
|
|
|
|
|
|
|
return bfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************* APPEND LIBRARY ************** */
|
|
|
|
|
|
|
|
static BHead *find_previous_lib(FileData *fd, BHead *bhead)
|
|
|
|
{
|
|
|
|
for (; bhead; bhead= blo_prevbhead(fd, bhead))
|
|
|
|
if (bhead->code==ID_LI)
|
|
|
|
break;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return bhead;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BHead *find_bhead(FileData *fd, void *old)
|
|
|
|
{
|
|
|
|
BHead *bhead;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (!old)
|
|
|
|
return NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead))
|
|
|
|
if (bhead->old==old)
|
|
|
|
return bhead;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ID *is_yet_read(Main *mainvar, BHead *bhead)
|
|
|
|
{
|
|
|
|
ListBase *lb;
|
|
|
|
ID *idtest, *id;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
// BHEAD+DATA dependancy
|
|
|
|
idtest= (ID *)(bhead +1);
|
|
|
|
lb= wich_libbase(mainvar, GS(idtest->name));
|
|
|
|
if(lb) {
|
|
|
|
id= lb->first;
|
|
|
|
while(id) {
|
|
|
|
if( strcmp(id->name, idtest->name)==0 ) return id;
|
|
|
|
id= id->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_doit(FileData *fd, Main *mainvar, void *old)
|
|
|
|
{
|
|
|
|
BHead *bhead;
|
|
|
|
ID *id;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
bhead= find_bhead(fd, old);
|
|
|
|
if(bhead) {
|
|
|
|
/* from another library? */
|
|
|
|
if(bhead->code==ID_ID) {
|
|
|
|
BHead *bheadlib= find_previous_lib(fd, bhead);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(bheadlib) {
|
|
|
|
// BHEAD+DATA dependancy
|
|
|
|
Library *lib= (Library *)(bheadlib+1);
|
2005-12-14 13:21:32 +00:00
|
|
|
/* we read the lib->name directly from the bhead, potential danger (64 bits?) */
|
2002-10-12 11:37:38 +00:00
|
|
|
mainvar= blo_find_main(&fd->mainlist, lib->name);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
id= is_yet_read(mainvar, bhead);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(id==0) {
|
|
|
|
read_libblock(fd, mainvar, bhead, LIB_READ+LIB_INDIRECT, NULL);
|
|
|
|
printf("expand: other lib %s\n", lib->name);
|
|
|
|
}
|
|
|
|
else {
|
2005-12-16 17:35:38 +00:00
|
|
|
//oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
|
|
|
|
|
|
|
change_idid_adr_fd(fd, bhead->old, id);
|
2002-10-12 11:37:38 +00:00
|
|
|
printf("expand: already linked: %s lib: %s\n", id->name, lib->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
id= is_yet_read(mainvar, bhead);
|
|
|
|
if(id==0) {
|
|
|
|
// BHEAD+DATA dependancy
|
|
|
|
id= (ID *)(bhead+1);
|
|
|
|
read_libblock(fd, mainvar, bhead, LIB_TESTIND, NULL);
|
|
|
|
}
|
|
|
|
else {
|
2005-12-14 23:00:01 +00:00
|
|
|
/* removed line below... I *really* dont know whatfor (Id is read, so...)
|
|
|
|
it caused a whole lot of extra and unneeded oldmap entries */
|
|
|
|
/* oldnewmap_insert(fd->libmap, bhead->old, id, 1); */
|
2003-04-26 18:01:01 +00:00
|
|
|
/* printf("expand: already read %s\n", id->name); */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
static void expand_group(FileData *fd, Main *mainvar, Group *group)
|
|
|
|
{
|
|
|
|
GroupObject *go;
|
|
|
|
|
|
|
|
for(go= group->gobject.first; go; go= go->next) {
|
|
|
|
expand_doit(fd, mainvar, go->ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void expand_key(FileData *fd, Main *mainvar, Key *key)
|
|
|
|
{
|
|
|
|
expand_doit(fd, mainvar, key->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
|
|
|
|
{
|
|
|
|
expand_doit(fd, mainvar, tex->ima);
|
2004-07-26 21:44:55 +00:00
|
|
|
expand_doit(fd, mainvar, tex->ipo);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_material(FileData *fd, Main *mainvar, Material *ma)
|
|
|
|
{
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
MaterialLayer *ml;
|
2002-10-12 11:37:38 +00:00
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(ma->mtex[a]) {
|
|
|
|
expand_doit(fd, mainvar, ma->mtex[a]->tex);
|
|
|
|
expand_doit(fd, mainvar, ma->mtex[a]->object);
|
|
|
|
}
|
|
|
|
}
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, ma->ipo);
|
Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!)
- New Panel "Layers" in Material buttons, allows to add unlimited amount
of materials on top of each other.
- Every Layer is actually just another Material, which gets rendered/shaded
(including texture), and then added on top of previous layer with an
operation like Mix, Add, Mult, etc.
- Layers render fully independent, so bumpmaps are not passed on to next
layers.
- Per Layer you can set if it influences Diffuse, Specular or Alpha
- If a Material returns alpha (like from texture), the alpha value is
used for adding the layers too.
- New texture "Map To" channel allows to have a texture work on a Layer
- Each layer, including basis Material, can be turned on/off individually
Notes:
- at this moment, the full shading pass happens for each layer, including
shadow, AO and raytraced mirror or transparency...
- I had to remove old hacks from preview render, which corrected reflected
normals for preview texturing.
- still needs loadsa testing!
2005-12-04 14:32:21 +00:00
|
|
|
|
|
|
|
for (ml=ma->layers.first; ml; ml=ml->next) {
|
|
|
|
if(ml->mat)
|
|
|
|
expand_doit(fd, mainvar, ml->mat);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
|
|
|
|
{
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(la->mtex[a]) {
|
|
|
|
expand_doit(fd, mainvar, la->mtex[a]->tex);
|
|
|
|
expand_doit(fd, mainvar, la->mtex[a]->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expand_doit(fd, mainvar, la->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt)
|
|
|
|
{
|
|
|
|
expand_doit(fd, mainvar, lt->ipo);
|
|
|
|
expand_doit(fd, mainvar, lt->key);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void expand_world(FileData *fd, Main *mainvar, World *wrld)
|
|
|
|
{
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2004-12-04 21:49:02 +00:00
|
|
|
for(a=0; a<MAX_MTEX; a++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if(wrld->mtex[a]) {
|
|
|
|
expand_doit(fd, mainvar, wrld->mtex[a]->tex);
|
|
|
|
expand_doit(fd, mainvar, wrld->mtex[a]->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expand_doit(fd, mainvar, wrld->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb)
|
|
|
|
{
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<mb->totcol; a++) {
|
|
|
|
expand_doit(fd, mainvar, mb->mat[a]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
|
|
|
|
{
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<cu->totcol; a++) {
|
|
|
|
expand_doit(fd, mainvar, cu->mat[a]);
|
|
|
|
}
|
|
|
|
expand_doit(fd, mainvar, cu->vfont);
|
2005-06-17 21:04:27 +00:00
|
|
|
expand_doit(fd, mainvar, cu->vfontb);
|
|
|
|
expand_doit(fd, mainvar, cu->vfonti);
|
|
|
|
expand_doit(fd, mainvar, cu->vfontbi);
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, cu->key);
|
|
|
|
expand_doit(fd, mainvar, cu->ipo);
|
|
|
|
expand_doit(fd, mainvar, cu->bevobj);
|
2004-08-29 09:21:52 +00:00
|
|
|
expand_doit(fd, mainvar, cu->taperobj);
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, cu->textoncurve);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
TFace *tface;
|
2005-05-26 13:17:12 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<me->totcol; a++) {
|
|
|
|
expand_doit(fd, mainvar, me->mat[a]);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, me->key);
|
|
|
|
expand_doit(fd, mainvar, me->texcomesh);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(me->tface) {
|
|
|
|
tface= me->tface;
|
|
|
|
a= me->totface;
|
|
|
|
while(a--) {
|
|
|
|
if(tface->tpage) expand_doit(fd, mainvar, tface->tpage);
|
|
|
|
tface++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb)
|
|
|
|
{
|
|
|
|
bConstraint *curcon;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (curcon=lb->first; curcon; curcon=curcon->next) {
|
|
|
|
switch (curcon->type) {
|
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
{
|
|
|
|
bActionConstraint *data = (bActionConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
expand_doit(fd, mainvar, data->act);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
|
|
|
{
|
|
|
|
bLocateLikeConstraint *data = (bLocateLikeConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
|
|
|
{
|
|
|
|
bRotateLikeConstraint *data = (bRotateLikeConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data = (bKinematicConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
{
|
|
|
|
bTrackToConstraint *data = (bTrackToConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
2005-09-07 00:11:39 +00:00
|
|
|
case CONSTRAINT_TYPE_MINMAX:
|
|
|
|
{
|
|
|
|
bMinMaxConstraint *data = (bMinMaxConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
2003-10-21 13:22:07 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
|
|
|
{
|
|
|
|
bLockTrackConstraint *data = (bLockTrackConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
{
|
|
|
|
bFollowPathConstraint *data = (bFollowPathConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
2004-03-25 18:17:40 +00:00
|
|
|
case CONSTRAINT_TYPE_DISTANCELIMIT:
|
|
|
|
{
|
|
|
|
bDistanceLimitConstraint *data = (bDistanceLimitConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
2004-09-05 20:21:16 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
{
|
|
|
|
bStretchToConstraint *data = (bStretchToConstraint*)curcon->data;
|
|
|
|
expand_doit(fd, mainvar, data->tar);
|
|
|
|
break;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
case CONSTRAINT_TYPE_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_bones(FileData *fd, Main *mainvar, Bone *bone)
|
|
|
|
{
|
|
|
|
Bone *curBone;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (curBone = bone->childbase.first; curBone; curBone=curBone->next) {
|
|
|
|
expand_bones(fd, mainvar, curBone);
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_pose(FileData *fd, Main *mainvar, bPose *pose)
|
|
|
|
{
|
|
|
|
bPoseChannel *chan;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (!pose)
|
|
|
|
return;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (chan = pose->chanbase.first; chan; chan=chan->next) {
|
|
|
|
expand_constraints(fd, mainvar, &chan->constraints);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm)
|
|
|
|
{
|
|
|
|
Bone *curBone;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (curBone = arm->bonebase.first; curBone; curBone=curBone->next) {
|
|
|
|
expand_bones(fd, mainvar, curBone);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_constraint_channels(FileData *fd, Main *mainvar, ListBase *chanbase)
|
|
|
|
{
|
|
|
|
bConstraintChannel *chan;
|
|
|
|
for (chan=chanbase->first; chan; chan=chan->next){
|
|
|
|
expand_doit(fd, mainvar, chan->ipo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_action(FileData *fd, Main *mainvar, bAction *act)
|
|
|
|
{
|
|
|
|
bActionChannel *chan;
|
|
|
|
for (chan=act->chanbase.first; chan; chan=chan->next) {
|
|
|
|
expand_doit(fd, mainvar, chan->ipo);
|
|
|
|
expand_constraint_channels(fd, mainvar, &chan->constraintChannels);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-20 18:04:50 +00:00
|
|
|
static void expand_modifier(FileData *fd, Main *mainvar, ModifierData *md)
|
|
|
|
{
|
|
|
|
if (md->type==eModifierType_Lattice) {
|
|
|
|
LatticeModifierData *lmd = (LatticeModifierData*) md;
|
|
|
|
|
|
|
|
expand_doit(fd, mainvar, lmd->object);
|
|
|
|
}
|
|
|
|
else if (md->type==eModifierType_Curve) {
|
|
|
|
CurveModifierData *cmd = (CurveModifierData*) md;
|
|
|
|
|
|
|
|
expand_doit(fd, mainvar, cmd->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void expand_object(FileData *fd, Main *mainvar, Object *ob)
|
|
|
|
{
|
2005-07-20 18:04:50 +00:00
|
|
|
ModifierData *md;
|
2002-10-12 11:37:38 +00:00
|
|
|
bSensor *sens;
|
|
|
|
bController *cont;
|
|
|
|
bActuator *act;
|
|
|
|
bActionStrip *strip;
|
|
|
|
int a;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, ob->data);
|
|
|
|
expand_doit(fd, mainvar, ob->ipo);
|
|
|
|
expand_doit(fd, mainvar, ob->action);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-07-20 18:04:50 +00:00
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
expand_modifier(fd, mainvar, md);
|
|
|
|
}
|
|
|
|
|
2004-06-23 18:22:51 +00:00
|
|
|
expand_pose(fd, mainvar, ob->pose);
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_constraints(fd, mainvar, &ob->constraints);
|
|
|
|
expand_constraint_channels(fd, mainvar, &ob->constraintChannels);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (strip=ob->nlastrips.first; strip; strip=strip->next){
|
Big commit with work on Groups & Libraries:
-> Any Group Duplicate now can get local timing and local NLA override. This
enables to control the entire animation system of the Group.
Two methods for this have been implemented.
1) The quick way: just give the duplicator a "Startframe" offset.
2) Advanced: in the NLA Editor you can add ActionStrips to the duplicator
to override NLA/action of any Grouped Object.
For "Group NLA" to work, an ActionStrip needs to know which Object in a
group it controls. On adding a strip, the code checks if an Action was
already used by an Object in the Group, and assigns it automatic to that
Object.
You can also set this in the Nkey "Properties" panel for the strip.
Change in NLA: the SHIFT+A "Add strip" command now always adds strips to
the active Object. (It used to check where mouse was). This allows to add
NLA strips to Objects that didn't have actions/nla yet.
Important note: In Blender, duplicates are fully procedural and generated
on the fly for each redraw. This means that redraw speed equals to stepping
through frames, when using animated Duplicated Groups.
-> Recoded entire duplicator system
The old method was antique and clumsy, using globals and full temporal
copies of Object. The new system is nicer in control, faster, and since it
doesn't use temporal object copies anymore, it works better with Derived
Mesh and DisplayList and rendering.
By centralizing the code for duplicating, more options can be easier added.
Features to note:
- Duplicates now draw selected/unselected based on its Duplicator setting.
- Same goes for the drawtype (wire, solid, selection outline, etc)
- Duplicated Groups can be normally selected too
Bonus goodie: SHIFT+A (Toolbox) now has entry "Add group" too, with a
listing of all groups, allowing to add Group instances immediate.
-> Library System
- SHIFT+F4 data browse now shows the entire path for linked data
- Outliner draws Library Icons to denote linked data
- Outliner operation added: "Make Local" for library data.
- Outliner now also draws Groups in regular view, allowing to unlink too.
-> Fixes
- depsgraph missed signal update for bone-parented Objects
- on reading file, the entire database was tagged to "recalc" fully,
causing unnecessary slowdown on reading.
Might have missed stuff... :)
2005-12-11 13:23:30 +00:00
|
|
|
expand_doit(fd, mainvar, strip->object);
|
2002-10-12 11:37:38 +00:00
|
|
|
expand_doit(fd, mainvar, strip->act);
|
|
|
|
expand_doit(fd, mainvar, strip->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(a=0; a<ob->totcol; a++) {
|
|
|
|
expand_doit(fd, mainvar, ob->mat[a]);
|
|
|
|
}
|
2004-10-13 17:59:44 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
sens= ob->sensors.first;
|
|
|
|
while(sens) {
|
2004-10-13 17:59:44 +00:00
|
|
|
for(a=0; a<sens->totlinks; a++) {
|
|
|
|
sens->links[a]= newglobadr(fd, sens->links[a]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
if(sens->type==SENS_TOUCH) {
|
|
|
|
bTouchSensor *ts= sens->data;
|
|
|
|
expand_doit(fd, mainvar, ts->ma);
|
|
|
|
}
|
|
|
|
else if(sens->type==SENS_MESSAGE) {
|
|
|
|
bMessageSensor *ms= sens->data;
|
|
|
|
expand_doit(fd, mainvar, ms->fromObject);
|
|
|
|
}
|
|
|
|
sens= sens->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
cont= ob->controllers.first;
|
|
|
|
while(cont) {
|
2004-10-13 17:59:44 +00:00
|
|
|
for(a=0; a<cont->totlinks; a++) {
|
|
|
|
cont->links[a]= newglobadr(fd, cont->links[a]);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
if(cont->type==CONT_PYTHON) {
|
|
|
|
bPythonCont *pc= cont->data;
|
|
|
|
expand_doit(fd, mainvar, pc->text);
|
|
|
|
}
|
|
|
|
cont= cont->next;
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
act= ob->actuators.first;
|
|
|
|
while(act) {
|
|
|
|
if(act->type==ACT_SOUND) {
|
|
|
|
bSoundActuator *sa= act->data;
|
|
|
|
expand_doit(fd, mainvar, sa->sound);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_CAMERA) {
|
|
|
|
bCameraActuator *ca= act->data;
|
|
|
|
expand_doit(fd, mainvar, ca->ob);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_EDIT_OBJECT) {
|
|
|
|
bEditObjectActuator *eoa= act->data;
|
|
|
|
if(eoa) {
|
|
|
|
expand_doit(fd, mainvar, eoa->ob);
|
|
|
|
expand_doit(fd, mainvar, eoa->me);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_SCENE) {
|
|
|
|
bSceneActuator *sa= act->data;
|
|
|
|
expand_doit(fd, mainvar, sa->camera);
|
|
|
|
expand_doit(fd, mainvar, sa->scene);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_ACTION) {
|
|
|
|
bActionActuator *aa= act->data;
|
|
|
|
expand_doit(fd, mainvar, aa->act);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_PROPERTY) {
|
|
|
|
bPropertyActuator *pa= act->data;
|
|
|
|
expand_doit(fd, mainvar, pa->ob);
|
|
|
|
}
|
|
|
|
else if(act->type==ACT_MESSAGE) {
|
|
|
|
bMessageActuator *ma= act->data;
|
|
|
|
expand_doit(fd, mainvar, ma->toObject);
|
|
|
|
}
|
|
|
|
act= act->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
|
|
|
|
{
|
|
|
|
Base *base;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
base= sce->base.first;
|
|
|
|
while(base) {
|
|
|
|
expand_doit(fd, mainvar, base->object);
|
|
|
|
base= base->next;
|
|
|
|
}
|
|
|
|
expand_doit(fd, mainvar, sce->camera);
|
|
|
|
expand_doit(fd, mainvar, sce->world);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
|
|
|
|
{
|
|
|
|
expand_doit(fd, mainvar, ca->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expand_sound(FileData *fd, Main *mainvar, bSound *snd)
|
|
|
|
{
|
|
|
|
expand_doit(fd, mainvar, snd->ipo);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void expand_main(FileData *fd, Main *mainvar)
|
|
|
|
{
|
|
|
|
ListBase *lbarray[30];
|
|
|
|
ID *id;
|
|
|
|
int a, doit= 1;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(fd==0) return;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(doit) {
|
|
|
|
doit= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
a= set_listbasepointers(mainvar, lbarray);
|
|
|
|
while(a--) {
|
|
|
|
id= lbarray[a]->first;
|
|
|
|
|
|
|
|
while(id) {
|
|
|
|
if(id->flag & LIB_TEST) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
switch(GS(id->name)) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
case ID_OB:
|
|
|
|
expand_object(fd, mainvar, (Object *)id);
|
|
|
|
break;
|
|
|
|
case ID_ME:
|
|
|
|
expand_mesh(fd, mainvar, (Mesh *)id);
|
|
|
|
break;
|
|
|
|
case ID_CU:
|
|
|
|
expand_curve(fd, mainvar, (Curve *)id);
|
|
|
|
break;
|
|
|
|
case ID_MB:
|
|
|
|
expand_mball(fd, mainvar, (MetaBall *)id);
|
|
|
|
break;
|
|
|
|
case ID_SCE:
|
|
|
|
expand_scene(fd, mainvar, (Scene *)id);
|
|
|
|
break;
|
|
|
|
case ID_MA:
|
|
|
|
expand_material(fd, mainvar, (Material *)id);
|
|
|
|
break;
|
|
|
|
case ID_TE:
|
|
|
|
expand_texture(fd, mainvar, (Tex *)id);
|
|
|
|
break;
|
|
|
|
case ID_WO:
|
|
|
|
expand_world(fd, mainvar, (World *)id);
|
|
|
|
break;
|
|
|
|
case ID_LT:
|
|
|
|
expand_lattice(fd, mainvar, (Lattice *)id);
|
|
|
|
break;
|
|
|
|
case ID_LA:
|
|
|
|
expand_lamp(fd, mainvar,(Lamp *)id);
|
|
|
|
break;
|
|
|
|
case ID_KE:
|
|
|
|
expand_key(fd, mainvar, (Key *)id);
|
|
|
|
break;
|
|
|
|
case ID_CA:
|
|
|
|
expand_camera(fd, mainvar, (Camera *)id);
|
|
|
|
break;
|
|
|
|
case ID_SO:
|
|
|
|
expand_sound(fd, mainvar, (bSound *)id);
|
|
|
|
break;
|
|
|
|
case ID_AR:
|
|
|
|
expand_armature(fd, mainvar, (bArmature *)id);
|
|
|
|
break;
|
|
|
|
case ID_AC:
|
|
|
|
expand_action(fd, mainvar, (bAction *)id);
|
|
|
|
break;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
case ID_GR:
|
|
|
|
expand_group(fd, mainvar, (Group *)id);
|
|
|
|
break;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doit= 1;
|
|
|
|
id->flag -= LIB_TEST;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
id= id->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-08 19:08:37 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void give_base_to_objects(Scene *sce, ListBase *lb)
|
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
Base *base;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* give all objects which are LIB_EXTERN and LIB_NEEDLINK a base */
|
2002-10-12 11:37:38 +00:00
|
|
|
ob= lb->first;
|
|
|
|
while(ob) {
|
|
|
|
|
|
|
|
if(ob->id.us==0) {
|
|
|
|
|
2004-12-08 19:08:37 +00:00
|
|
|
if( ob->id.flag & LIB_INDIRECT ) {
|
|
|
|
base= MEM_callocN( sizeof(Base), "add_ext_base");
|
|
|
|
BLI_addtail(&(sce->base), base);
|
|
|
|
base->lay= ob->lay;
|
|
|
|
base->object= ob;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
base->flag= ob->flag;
|
2004-12-08 19:08:37 +00:00
|
|
|
ob->id.us= 1;
|
Orange branch: Revived hidden treasure, the Groups!
Previous experiment (in 2000) didn't satisfy, it had even some primitive
NLA option in groups... so, cleaned up the old code (removed most) and
integrated it back in a more useful way.
Usage:
- CTRL+G gives menu to add group, add to existing group, or remove from
groups.
- In Object buttons, a new (should become first) Panel was added, showing
not only Object "ID button" and Parent, but also the Groups the Object
Belongs to. These buttons also allow rename, assigning or removing.
- To indicate Objects are grouped, they're drawn in a (not theme yet, so
temporal?) green wire color.
- Use ALT+SHIFT mouse-select to (de)select an entire group
But, the real power of groups is in the following features:
-> Particle Force field and Guide control
In the "Particle Motion" Panel, you can indicate a Group name, this then
limits force fields or guides to members of that Group. (Note that layers
still work on top of that... not sure about that).
-> Light Groups
In the Material "Shaders" Panel, you can indicate a Group name to limit
lighting for the Material to lamps in this group. The Lights in a Group do
need to be 'visible' for the Scene to be rendered (as usual).
-> Group Duplicator
In the Object "Anim" Panel, you can set any Object (use Empty!) to
duplicate an entire Group. It will make copies of all Objects in that Group.
Also works for animated Objects, but it will copy the current positions or
deforms. Control over 'local timing' (so we can do Massive anims!) will be
added later.
(Note; this commit won't render Group duplicators yet, a fix in bf-blender
will enable that, next commit will sync)
-> Library Appending
In the SHIFT-F1 or SHIFT+F4 browsers, you can also find the Groups listed.
By appending or linking the Group itself, and use the Group Duplicator, you
now can animate and position linked Objects. The nice thing is that the
local saved file itself will only store the Group name that was linked, so
on a next file read, the Group Objects will be re-read as stored (changed)
in the Library file.
(Note; current implementation also "gives a base" to linked Group Objects,
to show them as Objects in the current Scene. Need that now for testing
purposes, but probably will be removed later).
-> Outliner
Outliner now shows Groups as optio too, nice to organize your data a bit too!
In General, Groups have a very good potential... for example, it could
become default for MetaBall Objects too (jiri, I can help you later on how
this works). All current 'layer relationships' in Blender should be dropped
in time, I guess...
2005-12-06 10:55:30 +00:00
|
|
|
|
2004-12-08 19:08:37 +00:00
|
|
|
ob->id.flag -= LIB_INDIRECT;
|
|
|
|
ob->id.flag |= LIB_EXTERN;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ob= ob->id.next;
|
|
|
|
}
|
|
|
|
}
|
2004-12-08 19:08:37 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-08-16 06:46:41 +00:00
|
|
|
static void append_named_part(FileData *fd, Main *mainvar, Scene *scene, char *name, int idcode, short flag)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
Base *base;
|
|
|
|
BHead *bhead;
|
|
|
|
ID *id;
|
|
|
|
int afbreek=0;
|
|
|
|
|
|
|
|
bhead = blo_firstbhead(fd);
|
|
|
|
while(bhead && afbreek==0) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(bhead->code==ENDB) afbreek= 1;
|
|
|
|
else if(bhead->code==idcode) {
|
|
|
|
// BHEAD+DATA dependancy
|
|
|
|
id= (ID *)(bhead+1);
|
|
|
|
if(strcmp(id->name+2, name)==0) {
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
id= is_yet_read(mainvar, bhead);
|
|
|
|
if(id==0) {
|
|
|
|
read_libblock(fd, mainvar, bhead, LIB_TESTEXT, NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf("append: already linked\n");
|
2004-06-23 18:22:51 +00:00
|
|
|
oldnewmap_insert(fd->libmap, bhead->old, id, 1);
|
2002-10-12 11:37:38 +00:00
|
|
|
if(id->flag & LIB_INDIRECT) {
|
|
|
|
id->flag -= LIB_INDIRECT;
|
|
|
|
id->flag |= LIB_EXTERN;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
if(idcode==ID_OB) { /* loose object: give a base */
|
2002-10-12 11:37:38 +00:00
|
|
|
base= MEM_callocN( sizeof(Base), "app_nam_part");
|
|
|
|
BLI_addtail(&scene->base, base);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(id==0) ob= mainvar->object.last;
|
|
|
|
else ob= (Object *)id;
|
2005-01-30 15:40:42 +00:00
|
|
|
|
|
|
|
/* this is bad code... G.vd nor G.scene should be used on this level... */
|
|
|
|
if((flag & FILE_ACTIVELAY)) {
|
|
|
|
if(G.vd) ob->lay= G.vd->layact;
|
|
|
|
else ob->lay = G.scene->lay;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
base->lay= ob->lay;
|
|
|
|
base->object= ob;
|
|
|
|
ob->id.us++;
|
2004-08-16 06:46:41 +00:00
|
|
|
|
2004-11-21 13:25:54 +00:00
|
|
|
if(flag & FILE_AUTOSELECT) {
|
2004-08-16 06:46:41 +00:00
|
|
|
base->flag |= SELECT;
|
|
|
|
base->object->flag = base->flag;
|
2004-11-21 13:25:54 +00:00
|
|
|
/* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
|
2004-08-16 06:46:41 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
afbreek= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bhead = blo_nextbhead(fd, bhead);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
|
|
|
|
{
|
|
|
|
BHead *bhead;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
|
|
|
|
if (bhead->code == GS(id->name)) {
|
|
|
|
ID *idread= (ID *)(bhead+1); /* BHEAD+DATA dependancy */
|
|
|
|
|
|
|
|
if (BLI_streq(id->name, idread->name)) {
|
2005-05-26 13:17:12 +00:00
|
|
|
id->flag &= ~LIB_READ;
|
2002-10-12 11:37:38 +00:00
|
|
|
id->flag |= LIB_TEST;
|
2005-06-02 09:24:58 +00:00
|
|
|
// printf("read lib block %s\n", id->name);
|
2002-10-12 11:37:38 +00:00
|
|
|
read_libblock(fd, mainvar, bhead, id->flag, id_r);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (bhead->code==ENDB)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-24 20:04:37 +00:00
|
|
|
/* this is a version of BLO_library_append needed by the BPython API, so
|
|
|
|
* scripts can load data from .blend files -- see Blender.Library module.*/
|
|
|
|
|
|
|
|
/* append to G.scene */
|
|
|
|
void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcode)
|
|
|
|
{
|
|
|
|
ListBase mainlist;
|
|
|
|
Main *mainl;
|
|
|
|
FileData *fd = (FileData *)bh;
|
2005-10-04 14:53:55 +00:00
|
|
|
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
2004-04-24 20:04:37 +00:00
|
|
|
|
|
|
|
mainlist.first= mainlist.last= G.main;
|
|
|
|
G.main->next= NULL;
|
|
|
|
|
2005-10-04 14:53:55 +00:00
|
|
|
/* make copy of the 'last loaded filename', we need to restore it */
|
|
|
|
BLI_strncpy(filename, G.sce, sizeof(filename));
|
|
|
|
/* already opened file, to reconstruct relative paths */
|
|
|
|
BLI_strncpy(G.sce, fd->filename, sizeof(filename));
|
|
|
|
|
2004-04-24 20:04:37 +00:00
|
|
|
/* make mains */
|
|
|
|
blo_split_main(&mainlist);
|
|
|
|
|
|
|
|
/* which one do we need? */
|
|
|
|
mainl = blo_find_main(&mainlist, dir);
|
|
|
|
|
2004-08-16 06:46:41 +00:00
|
|
|
append_named_part(fd, mainl, G.scene, name, idcode, 0);
|
2004-04-24 20:04:37 +00:00
|
|
|
|
|
|
|
/* make main consistant */
|
|
|
|
expand_main(fd, mainl);
|
|
|
|
|
|
|
|
/* do this when expand found other libs */
|
|
|
|
read_libraries(fd, &mainlist);
|
|
|
|
|
|
|
|
blo_join_main(&mainlist);
|
|
|
|
G.main= mainlist.first;
|
|
|
|
|
|
|
|
lib_link_all(fd, G.main);
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
|
2005-10-04 14:53:55 +00:00
|
|
|
/* restore the 'last loaded filename' */
|
|
|
|
BLI_strncpy(G.sce, filename, sizeof(filename));
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
DAG_scene_sort(G.scene);
|
2004-04-24 20:04:37 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* append to G.scene */
|
2002-10-12 11:37:38 +00:00
|
|
|
void BLO_library_append(SpaceFile *sfile, char *dir, int idcode)
|
|
|
|
{
|
|
|
|
FileData *fd= (FileData*) sfile->libfiledata;
|
2002-12-20 02:08:46 +00:00
|
|
|
Main *mainl;
|
2004-09-13 06:57:24 +00:00
|
|
|
Base *centerbase;
|
|
|
|
Object *ob;
|
2005-06-02 17:38:42 +00:00
|
|
|
float *curs,centerloc[3],vec[3],min[3],max[3];
|
|
|
|
int a, totsel=0,count=0;
|
|
|
|
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
2004-09-13 06:57:24 +00:00
|
|
|
|
|
|
|
INIT_MINMAX(min, max);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* are there files selected? */
|
2002-10-12 11:37:38 +00:00
|
|
|
for(a=0; a<sfile->totfile; a++) {
|
|
|
|
if(sfile->filelist[a].flags & ACTIVE) {
|
|
|
|
totsel++;
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(totsel==0) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* is the indicated file in the filelist? */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(sfile->file[0]) {
|
|
|
|
for(a=0; a<sfile->totfile; a++) {
|
|
|
|
if( strcmp(sfile->filelist[a].relname, sfile->file)==0) break;
|
|
|
|
}
|
|
|
|
if(a==sfile->totfile) {
|
|
|
|
error("Wrong indicated name");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
error("Nothing indicated");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2003-04-26 18:01:01 +00:00
|
|
|
/* now we have or selected, or an indicated file */
|
2004-08-16 06:46:41 +00:00
|
|
|
|
2005-06-02 17:38:42 +00:00
|
|
|
/* make copy of the 'last loaded filename', we need to restore it */
|
|
|
|
BLI_strncpy(filename, G.sce, sizeof(filename));
|
2005-12-11 22:54:46 +00:00
|
|
|
|
2005-12-14 09:59:22 +00:00
|
|
|
BLI_strncpy(G.sce, G.main->name, sizeof(G.main->name)); // original file, to reconstruct relative paths for current append
|
2005-06-02 17:38:42 +00:00
|
|
|
|
2004-11-21 13:25:54 +00:00
|
|
|
if(sfile->flag & FILE_AUTOSELECT) scene_deselect_all(G.scene);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-05-26 13:17:12 +00:00
|
|
|
fd->mainlist.first= fd->mainlist.last= G.main;
|
2002-10-12 11:37:38 +00:00
|
|
|
G.main->next= NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* make mains */
|
2005-05-26 13:17:12 +00:00
|
|
|
blo_split_main(&fd->mainlist);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* which one do we need? */
|
2005-05-26 13:17:12 +00:00
|
|
|
mainl = blo_find_main(&fd->mainlist, dir);
|
2004-07-27 11:00:09 +00:00
|
|
|
mainl->versionfile= fd->fileversion; // needed for do_version
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(totsel==0) {
|
2004-08-16 06:46:41 +00:00
|
|
|
append_named_part(fd, mainl, G.scene, sfile->file, idcode, sfile->flag);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(a=0; a<sfile->totfile; a++) {
|
|
|
|
if(sfile->filelist[a].flags & ACTIVE) {
|
2004-08-16 06:46:41 +00:00
|
|
|
append_named_part(fd, mainl, G.scene, sfile->filelist[a].relname, idcode, sfile->flag);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* make main consistant */
|
2002-12-20 02:08:46 +00:00
|
|
|
expand_main(fd, mainl);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* do this when expand found other libs */
|
2005-05-26 13:17:12 +00:00
|
|
|
read_libraries(fd, &fd->mainlist);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-10-25 20:19:31 +00:00
|
|
|
if(sfile->flag & FILE_STRINGCODE) {
|
2005-12-11 22:54:46 +00:00
|
|
|
|
2005-10-25 20:19:31 +00:00
|
|
|
/* uses old .blend file (*filename) as reference */
|
|
|
|
BLI_makestringcode(filename, mainl->curlib->name);
|
|
|
|
/* the caller checks for appended library, so we make sure names match */
|
|
|
|
BLI_strncpy(dir, mainl->curlib->name, sizeof(mainl->curlib->name));
|
|
|
|
}
|
|
|
|
|
2005-05-26 13:17:12 +00:00
|
|
|
blo_join_main(&fd->mainlist);
|
|
|
|
G.main= fd->mainlist.first;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
lib_link_all(fd, G.main);
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* give a base to loose objects */
|
2004-12-08 19:08:37 +00:00
|
|
|
give_base_to_objects(G.scene, &(G.main->object));
|
2003-04-26 18:01:01 +00:00
|
|
|
/* has been removed... erm, why? (ton) */
|
2004-09-13 06:57:24 +00:00
|
|
|
/* 20040907: looks like they are give base already in append_named_part(); -Nathan L */
|
2004-12-08 19:08:37 +00:00
|
|
|
/* 20041208: put back. It only linked direct, not indirect objects (ton) */
|
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* patch to prevent switch_endian happens twice */
|
2002-10-12 11:37:38 +00:00
|
|
|
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
|
|
|
|
blo_freefiledata((FileData*) sfile->libfiledata);
|
|
|
|
sfile->libfiledata= 0;
|
2005-10-25 20:19:31 +00:00
|
|
|
}
|
2004-09-13 06:57:24 +00:00
|
|
|
|
|
|
|
if(sfile->flag & FILE_ATCURSOR) {
|
|
|
|
centerbase= (G.scene->base.first);
|
|
|
|
while(centerbase) {
|
|
|
|
if(((centerbase)->flag & SELECT)) {
|
|
|
|
VECCOPY(vec, centerbase->object->loc);
|
|
|
|
DO_MINMAX(vec, min, max);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
centerbase= centerbase->next;
|
|
|
|
}
|
|
|
|
if(count) {
|
|
|
|
centerloc[0]= (min[0]+max[0])/2;
|
|
|
|
centerloc[1]= (min[1]+max[1])/2;
|
|
|
|
centerloc[2]= (min[2]+max[2])/2;
|
|
|
|
curs = G.scene->cursor;
|
|
|
|
VECSUB(centerloc,curs,centerloc);
|
|
|
|
|
|
|
|
centerbase= (G.scene->base.first);
|
|
|
|
while(centerbase) {
|
|
|
|
if( ((centerbase)->flag & SELECT)) {
|
|
|
|
ob= centerbase->object;
|
|
|
|
ob->loc[0] += centerloc[0];
|
|
|
|
ob->loc[1] += centerloc[1];
|
|
|
|
ob->loc[2] += centerloc[2];
|
|
|
|
}
|
|
|
|
centerbase= centerbase->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-06-02 17:38:42 +00:00
|
|
|
|
|
|
|
/* restore the 'last loaded filename' */
|
|
|
|
BLI_strncpy(G.sce, filename, sizeof(filename));
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
DAG_scene_sort(G.scene);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ************* READ LIBRARY ************** */
|
|
|
|
|
|
|
|
static int mainvar_count_libread_blocks(Main *mainvar)
|
|
|
|
{
|
|
|
|
ListBase *lbarray[30];
|
|
|
|
int a, tot= 0;
|
|
|
|
|
|
|
|
a= set_listbasepointers(mainvar, lbarray);
|
|
|
|
while(a--) {
|
|
|
|
ID *id= lbarray[a]->first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
for (id= lbarray[a]->first; id; id= id->next)
|
|
|
|
if (id->flag & LIB_READ)
|
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
return tot;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void read_libraries(FileData *basefd, ListBase *mainlist)
|
|
|
|
{
|
2004-04-24 20:04:37 +00:00
|
|
|
Main *mainl= mainlist->first;
|
2002-10-12 11:37:38 +00:00
|
|
|
Main *mainptr;
|
|
|
|
ListBase *lbarray[30];
|
|
|
|
int a, doit= 1;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(doit) {
|
|
|
|
doit= 0;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2003-04-26 18:01:01 +00:00
|
|
|
/* test 1: read libdata */
|
2004-04-24 20:04:37 +00:00
|
|
|
mainptr= mainl->next;
|
2002-10-12 11:37:38 +00:00
|
|
|
while(mainptr) {
|
|
|
|
int tot= mainvar_count_libread_blocks(mainptr);
|
2005-06-02 09:24:58 +00:00
|
|
|
|
|
|
|
//printf("found LIB_READ %s\n", mainptr->curlib->name);
|
2002-10-12 11:37:38 +00:00
|
|
|
if(tot) {
|
|
|
|
FileData *fd= mainptr->curlib->filedata;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-06-02 09:24:58 +00:00
|
|
|
if(fd==NULL) {
|
2005-07-25 18:35:49 +00:00
|
|
|
BlendReadError err;
|
2002-10-12 11:37:38 +00:00
|
|
|
printf("read lib %s\n", mainptr->curlib->name);
|
2005-07-25 18:35:49 +00:00
|
|
|
fd= blo_openblenderfile(mainptr->curlib->name, &err);
|
2002-10-12 11:37:38 +00:00
|
|
|
if (fd) {
|
|
|
|
if (fd->libmap)
|
|
|
|
oldnewmap_free(fd->libmap);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
fd->libmap = oldnewmap_new();
|
2005-01-05 10:31:27 +00:00
|
|
|
|
|
|
|
mainptr->curlib->filedata= fd;
|
|
|
|
mainptr->versionfile= fd->fileversion;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2005-01-05 10:31:27 +00:00
|
|
|
else mainptr->curlib->filedata= NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2005-06-02 09:24:58 +00:00
|
|
|
if (fd==NULL)
|
2002-10-12 11:37:38 +00:00
|
|
|
printf("ERROR: can't find lib %s \n", mainptr->curlib->name);
|
|
|
|
}
|
|
|
|
if(fd) {
|
|
|
|
doit= 1;
|
|
|
|
a= set_listbasepointers(mainptr, lbarray);
|
|
|
|
while(a--) {
|
|
|
|
ID *id= lbarray[a]->first;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
while(id) {
|
|
|
|
ID *idn= id->next;
|
|
|
|
if(id->flag & LIB_READ) {
|
|
|
|
ID *realid= NULL;
|
|
|
|
BLI_remlink(lbarray[a], id);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
append_id_part(fd, mainptr, id, &realid);
|
|
|
|
if (!realid)
|
|
|
|
printf("LIB ERROR: can't find %s\n", id->name);
|
2005-12-16 17:35:38 +00:00
|
|
|
|
|
|
|
change_idid_adr(mainlist, basefd, id, realid);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(id);
|
|
|
|
}
|
|
|
|
id= idn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expand_main(fd, mainptr);
|
2005-06-02 09:24:58 +00:00
|
|
|
|
|
|
|
/* dang FileData... now new libraries need to be appended to original filedata, it is not a good replacement for the old global (ton) */
|
|
|
|
while( fd->mainlist.first ) {
|
|
|
|
Main *mp= fd->mainlist.first;
|
|
|
|
BLI_remlink(&fd->mainlist, mp);
|
|
|
|
BLI_addtail(&basefd->mainlist, mp);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
}
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
mainptr= mainptr->next;
|
|
|
|
}
|
|
|
|
}
|
2005-12-16 17:35:38 +00:00
|
|
|
|
|
|
|
/* test if there are unread libblocks */
|
|
|
|
for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
|
2002-10-12 11:37:38 +00:00
|
|
|
a= set_listbasepointers(mainptr, lbarray);
|
|
|
|
while(a--) {
|
|
|
|
ID *id= lbarray[a]->first;
|
|
|
|
while(id) {
|
|
|
|
ID *idn= id->next;
|
|
|
|
if(id->flag & LIB_READ) {
|
|
|
|
BLI_remlink(lbarray[a], id);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
printf("LIB ERROR: can't find %s\n", id->name);
|
2005-12-16 17:35:38 +00:00
|
|
|
change_idid_adr(mainlist, basefd, id, NULL);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
MEM_freeN(id);
|
|
|
|
}
|
|
|
|
id= idn;
|
|
|
|
}
|
|
|
|
}
|
2005-12-16 17:35:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* do versions, link, and free */
|
|
|
|
for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
|
2003-04-26 18:01:01 +00:00
|
|
|
/* some mains still have to be read, then
|
|
|
|
* versionfile is still zero! */
|
2005-07-14 22:04:57 +00:00
|
|
|
if(mainptr->versionfile) {
|
|
|
|
if(mainptr->curlib->filedata) // can be zero... with shift+f1 append
|
2005-07-26 18:46:28 +00:00
|
|
|
do_versions(mainptr->curlib->filedata, mainptr->curlib, mainptr);
|
2005-07-14 22:04:57 +00:00
|
|
|
else
|
2005-07-26 18:46:28 +00:00
|
|
|
do_versions(basefd, NULL, mainptr);
|
2005-07-14 22:04:57 +00:00
|
|
|
}
|
|
|
|
|
2005-12-16 17:35:38 +00:00
|
|
|
if(mainptr->curlib->filedata)
|
|
|
|
lib_link_all(mainptr->curlib->filedata, mainptr);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
mainptr->curlib->filedata= NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
/* reading runtime */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2004-09-05 13:43:51 +00:00
|
|
|
BlendFileData *blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r)
|
|
|
|
{
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
BlendFileData *bfd = NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
FileData *fd = filedata_new();
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
fd->filedes = file;
|
|
|
|
fd->buffersize = actualsize;
|
|
|
|
fd->read = fd_read_from_file;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-07-25 18:35:49 +00:00
|
|
|
fd = blo_decode_and_check(fd, error_r);
|
|
|
|
if (!fd)
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
return NULL;
|
2004-06-23 18:22:51 +00:00
|
|
|
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
bfd= blo_read_file_internal(fd, error_r);
|
2002-10-12 11:37:38 +00:00
|
|
|
blo_freefiledata(fd);
|
2004-06-23 18:22:51 +00:00
|
|
|
|
This commit removes the glue from Blender, and with it
the directories decrypt, deflate, encrypt, inflate, readstreamglue,
sign, writeblenfile and writestreamglue.
Sirdude was so kind to modify the makefiles, so SCons and
Make are ready to build with the new Blender.
Visual Studio workspaces, solutions and projectfiles still need
to be updated (I'll do the .vcprojs and .sln myself after this commit).
Runtimes created with the Blender Publisher are not anymore
recognised - if you want these available, you'll have to convert
them first to .blends with the Publisher.
2004-04-16 15:55:16 +00:00
|
|
|
return bfd;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|