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 ,
2010-02-12 13:34:04 +00:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2002-10-12 11:37:38 +00:00
*
* The Original Code is Copyright ( C ) 2001 - 2002 by NaN Holding BV .
* All rights reserved .
*
*
2007-12-24 18:53:37 +00:00
* Contributor ( s ) : Blender Foundation
2002-10-12 11:37:38 +00:00
*
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
*/
2005-07-27 21:31:44 +00:00
# include "zlib.h"
2008-09-22 15:59:50 +00:00
# include <limits.h>
2002-10-12 11:37:38 +00:00
# include <stdio.h> // for printf fopen fwrite fclose sprintf FILE
# include <stdlib.h> // for getenv atoi
2010-02-22 09:22:36 +00:00
# include <stddef.h> // for offsetof
2002-10-12 11:37:38 +00:00
# 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
2010-03-22 09:30:00 +00:00
# include <unistd.h> // for read close
2002-10-12 11:37:38 +00:00
# else
2010-03-22 09:30:00 +00:00
# include <io.h> // for open close read
2009-09-06 13:20:05 +00:00
# include "winsock2.h"
# include "BLI_winstuff.h"
2002-10-12 11:37:38 +00:00
# endif
2009-01-18 10:41:45 +00:00
# include "DNA_anim_types.h"
2005-05-02 13:28:13 +00:00
# include "DNA_armature_types.h"
2002-10-12 11:37:38 +00:00
# include "DNA_actuator_types.h"
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
# include "DNA_brush_types.h"
2005-05-02 13:28:13 +00:00
# include "DNA_camera_types.h"
2008-01-29 21:01:12 +00:00
# include "DNA_cloth_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_effect_types.h"
# include "DNA_fileglobal_types.h"
2008-10-31 23:50:02 +00:00
# include "DNA_genfile.h"
2005-05-02 13:28:13 +00:00
# include "DNA_group_types.h"
2008-07-22 09:53:25 +00:00
# include "DNA_gpencil_types.h"
2005-05-02 13:28:13 +00:00
# include "DNA_ipo_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-05-02 13:28:13 +00:00
# include "DNA_nla_types.h"
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
# include "DNA_node_types.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_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"
2009-07-30 15:00:26 +00:00
# include "DNA_smoke_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_vfont_types.h"
# include "DNA_world_types.h"
2002-10-12 11:37:38 +00:00
# include "MEM_guardedalloc.h"
2010-08-16 05:46:10 +00:00
2002-10-12 11:37:38 +00:00
# include "BLI_blenlib.h"
2009-11-10 20:43:45 +00:00
# include "BLI_math.h"
2002-10-12 11:37:38 +00:00
2010-01-01 19:10:31 +00:00
# include "BKE_anim.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_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"
2009-02-22 19:31:25 +00:00
# include "BKE_brush.h"
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
# include "BKE_colortools.h"
2002-10-12 11:37:38 +00:00
# include "BKE_constraint.h"
2009-09-12 19:54:39 +00:00
# include "BKE_context.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"
2008-04-27 18:26:20 +00:00
# include "BKE_effect.h" /* give_parteff */
2009-01-18 10:41:45 +00:00
# include "BKE_fcurve.h"
2002-10-12 11:37:38 +00:00
# include "BKE_global.h" // for G
2006-02-18 16:21:32 +00:00
# include "BKE_group.h"
2006-12-20 17:57:56 +00:00
# include "BKE_image.h"
2005-08-15 10:30:53 +00:00
# include "BKE_lattice.h"
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
# include "BKE_library.h" // for which_libbase
2010-08-10 15:14:19 +00:00
# include "BKE_idcode.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_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"
2009-01-06 18:59:03 +00:00
# include "BKE_multires.h"
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
# include "BKE_node.h" // for tree type defines
2004-09-13 06:57:24 +00:00
# include "BKE_object.h"
2009-08-28 21:47:11 +00:00
# include "BKE_paint.h"
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
# include "BKE_particle.h"
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
# include "BKE_pointcache.h"
2008-09-21 10:12:33 +00:00
# include "BKE_property.h" // for get_ob_property
2008-12-19 00:50:21 +00:00
# include "BKE_report.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"
2009-12-19 22:40:45 +00:00
# include "BKE_screen.h"
2009-12-13 14:56:45 +00:00
# include "BKE_sequencer.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_texture.h" // for open_plugin_tex
# include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
2009-08-09 21:16:39 +00:00
# include "BKE_sound.h"
2008-01-01 18:16:10 +00:00
//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
//XXX #include "BIF_filelist.h" // badlevel too, where to move this? - elubie
//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
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"
2009-06-08 20:08:19 +00:00
# include "PIL_time.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
/*
2010-07-20 10:41:08 +00:00
Remark : still a weak point is the newaddress ( ) function , that doesnt solve reading from
2003-04-26 18:01:01 +00:00
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
2010-07-15 11:51:43 +00:00
- read USER data , only when indicated ( file is ~ / X . XX / startup . blend )
2003-04-26 18:01:01 +00:00
- 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
2010-03-22 09:30:00 +00:00
- read recursive
- read associated direct data
- link direct data ( internal and to LibBlock )
- free file
2003-04-26 18:01:01 +00:00
- 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) { \
2010-03-22 09:30:00 +00:00
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 ; }
2002-10-12 11:37:38 +00:00
/***/
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 */
2006-11-26 21:17:15 +00:00
static void * read_struct ( FileData * fd , BHead * bh , char * blockname ) ;
2005-03-09 19:45:59 +00:00
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 ;
}
2006-11-25 13:07:28 +00:00
/* for libdata, nr has ID code, no increment */
2005-12-15 18:42:02 +00:00
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 )
{
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] , * fromarray [ MAX_LIBARRAY ] ;
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 )
{
2006-12-01 10:12:41 +00:00
Main * tojoin , * mainl ;
mainl = mainlist - > first ;
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 ) {
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
lbn = which_libbase ( mainvar , GS ( id - > name ) ) ;
2002-10-12 11:37:38 +00:00
BLI_remlink ( lb , id ) ;
BLI_addtail ( lbn , id ) ;
break ;
}
mainvar = mainvar - > next ;
}
if ( mainvar = = 0 ) printf ( " error split_libdata \n " ) ;
}
id = idnext ;
}
}
2006-11-25 13:07:28 +00:00
void blo_split_main ( ListBase * mainlist , Main * main )
2002-10-12 11:37:38 +00:00
{
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2002-10-12 11:37:38 +00:00
Library * lib ;
int i ;
2004-06-23 18:22:51 +00:00
2006-11-25 13:07:28 +00:00
mainlist - > first = mainlist - > last = main ;
main - > next = NULL ;
if ( main - > library . first = = NULL )
return ;
for ( lib = main - > 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
2006-11-25 13:07:28 +00:00
i = set_listbasepointers ( main , lbarray ) ;
2002-10-12 11:37:38 +00:00
while ( i - - )
2006-11-25 13:07:28 +00:00
split_libdata ( lbarray [ i ] , main - > next ) ;
2002-10-12 11:37:38 +00:00
}
2006-01-04 19:05:24 +00:00
/* removes things like /blah/blah/../../blah/ etc, then writes in *name the full path */
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 ) ;
}
2007-11-30 15:12:31 +00:00
static void read_file_version ( FileData * fd , Main * main )
{
BHead * bhead ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > code = = GLOB ) {
FileGlobal * fg = read_struct ( fd , bhead , " Global " ) ;
if ( fg ) {
main - > subversionfile = fg - > subversion ;
main - > minversionfile = fg - > minversion ;
main - > minsubversionfile = fg - > minsubversion ;
MEM_freeN ( fg ) ;
}
else if ( bhead - > code = = ENDB )
break ;
}
}
}
static Main * blo_find_main ( FileData * fd , ListBase * mainlist , const char * name , const char * relabase )
2002-10-12 11:37:38 +00:00
{
Main * m ;
Library * lib ;
2004-06-23 18:48:55 +00:00
char name1 [ FILE_MAXDIR + FILE_MAXFILE ] ;
2005-12-14 09:59:22 +00:00
2006-12-01 19:52:04 +00:00
strncpy ( name1 , name , sizeof ( name1 ) - 1 ) ;
2006-01-04 19:05:24 +00:00
cleanup_path ( relabase , name1 ) ;
// printf("blo_find_main: original in %s\n", name);
// printf("blo_find_main: converted to %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 ) {
2010-06-02 17:58:28 +00:00
char * libname = ( m - > curlib ) ? m - > curlib - > filepath : m - > name ;
2004-06-23 18:48:55 +00:00
2006-01-04 19:05:24 +00:00
if ( BLI_streq ( name1 , libname ) ) {
2006-11-30 15:54:21 +00:00
if ( G . f & G_DEBUG ) printf ( " blo_find_main: 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 " ) ;
2006-12-01 19:52:04 +00:00
strncpy ( lib - > name , name , sizeof ( lib - > name ) - 1 ) ;
2010-06-02 17:58:28 +00:00
BLI_strncpy ( lib - > filepath , name1 , sizeof ( lib - > filepath ) ) ;
2006-01-04 19:05:24 +00:00
2002-10-12 11:37:38 +00:00
m - > curlib = lib ;
2005-12-14 09:59:22 +00:00
2007-11-30 15:12:31 +00:00
read_file_version ( fd , m ) ;
2006-11-30 15:54:21 +00:00
if ( G . f & G_DEBUG ) printf ( " blo_find_main: 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
2010-03-01 19:18:56 +00:00
//perform a endian swap on 64bit pointers, otherwise the pointer might map to zero
//0x0000000000000000000012345678 would become 0x12345678000000000000000000000000
2002-10-12 11:37:38 +00:00
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
2007-04-28 16:15:00 +00:00
is necessary on any modern 64 bit architecture ) */
2002-10-12 11:37:38 +00:00
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 )
{
BHeadN * new_bhead = 0 ;
int readsize ;
2009-06-08 20:08:19 +00:00
2002-10-12 11:37:38 +00:00
if ( fd ) {
if ( ! fd - > eof ) {
2010-10-31 15:39:37 +00:00
/* initializing to zero isn't strictly needed but shuts valgrind up
2009-06-08 20:08:19 +00:00
* since uninitialized memory gets compared */
2010-10-31 15:39:37 +00:00
BHead8 bhead8 = { 0 } ;
BHead4 bhead4 = { 0 } ;
BHead bhead = { 0 } ;
2009-06-08 20:08:19 +00:00
2002-10-12 11:37:38 +00:00
// 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 ;
2006-12-01 19:52:04 +00:00
bhead . len = 0 ;
2002-10-12 11:37:38 +00:00
}
} 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 ;
2006-12-01 19:52:04 +00:00
bhead . len = 0 ;
2002-10-12 11:37:38 +00:00
}
}
2004-06-23 18:22:51 +00:00
2005-12-21 16:18:59 +00:00
/* make sure people are not trying to pass bad blend files */
if ( bhead . len < 0 ) fd - > eof = 1 ;
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 ) ;
2005-12-21 16:18:59 +00:00
new_bhead = 0 ;
2002-10-12 11:37:38 +00:00
}
} 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 ) ;
}
2010-10-16 02:40:31 +00:00
BHead * blo_prevbhead ( FileData * UNUSED ( fd ) , BHead * thisblock )
2002-10-12 11:37:38 +00:00
{
2008-04-29 08:24:33 +00:00
BHeadN * bheadn = ( BHeadN * ) ( ( ( char * ) thisblock ) - GET_INT_FROM_POINTER ( & ( ( BHeadN * ) 0 ) - > bhead ) ) ;
2002-10-12 11:37:38 +00:00
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 )
{
2008-01-30 18:18:33 +00:00
BHeadN * new_bhead = NULL ;
BHead * bhead = NULL ;
2002-10-12 11:37:38 +00:00
if ( thisblock ) {
// bhead is actually a sub part of BHeadN
// We calculate the BHeadN pointer from the BHead pointer below
2008-04-29 08:24:33 +00:00
new_bhead = ( BHeadN * ) ( ( ( char * ) thisblock ) - GET_INT_FROM_POINTER ( & ( ( BHeadN * ) 0 ) - > bhead ) ) ;
2002-10-12 11:37:38 +00:00
// 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
2008-10-31 23:50:02 +00:00
fd - > filesdna = DNA_sdna_from_data ( & bhead [ 1 ] , bhead - > len , do_endian_swap ) ;
2007-04-28 16:15:00 +00:00
if ( fd - > filesdna ) {
2008-10-31 23:50:02 +00:00
fd - > compflags = DNA_struct_get_compareflags ( fd - > filesdna , fd - > memsdna ) ;
2007-04-28 16:15:00 +00:00
/* used to retrieve ID names from (bhead+1) */
2008-10-31 23:50:02 +00:00
fd - > id_name_offs = DNA_elem_offset ( fd - > filesdna , " ID " , " char " , " name[] " ) ;
2007-04-28 16:15:00 +00:00
}
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 ;
}
2006-11-26 21:17:15 +00:00
2009-01-02 19:10:35 +00:00
static int fd_read_from_file ( FileData * filedata , void * buffer , unsigned int size )
2002-10-12 11:37:38 +00:00
{
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
}
2009-01-02 19:10:35 +00:00
static int fd_read_gzip_from_file ( FileData * filedata , void * buffer , unsigned int size )
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
{
int readsize = gzread ( filedata - > gzfiledes , buffer , size ) ;
if ( readsize < 0 ) {
readsize = EOF ;
} else {
filedata - > seek + = readsize ;
}
return ( readsize ) ;
}
2009-01-02 19:10:35 +00:00
static int fd_read_from_memory ( FileData * filedata , void * buffer , unsigned int size )
2002-10-12 11:37:38 +00:00
{
2010-10-19 22:17:34 +00:00
// don't read more bytes then there are available in the buffer
int readsize = ( int ) MIN2 ( size , ( unsigned int ) ( filedata - > buffersize - filedata - > seek ) ) ;
2002-10-12 11:37:38 +00:00
memcpy ( buffer , filedata - > buffer + filedata - > seek , readsize ) ;
filedata - > seek + = readsize ;
return ( readsize ) ;
}
2009-01-02 06:03:53 +00:00
static int fd_read_from_memfile ( FileData * filedata , void * buffer , unsigned int size )
2004-09-05 13:43:51 +00:00
{
static unsigned int seek = 1 < < 30 ; /* the current position */
static unsigned int offset = 0 ; /* size of previous chunks */
static MemFileChunk * chunk = NULL ;
2008-03-05 15:13:41 +00:00
unsigned int chunkoffset , readsize , totread ;
2004-09-05 13:43:51 +00:00
if ( size = = 0 ) return 0 ;
2006-04-03 20:31:10 +00:00
if ( seek ! = ( unsigned int ) filedata - > seek ) {
2004-09-05 13:43:51 +00:00
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 ) {
2008-03-05 15:13:41 +00:00
totread = 0 ;
do {
/* 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 ;
}
chunkoffset = seek - offset ;
readsize = size - totread ;
/* data can be spread over multiple chunks, so clamp size
* to within this chunk , and then it will read further in
* the next chunk */
if ( chunkoffset + readsize > chunk - > size )
readsize = chunk - > size - chunkoffset ;
2008-03-05 17:51:35 +00:00
memcpy ( ( char * ) buffer + totread , chunk - > buf + chunkoffset , readsize ) ;
2008-03-05 15:13:41 +00:00
totread + = readsize ;
filedata - > seek + = readsize ;
seek + = readsize ;
} while ( totread < size ) ;
2004-09-05 13:43:51 +00:00
2008-03-05 15:13:41 +00:00
return totread ;
2004-09-05 13:43:51 +00:00
}
2008-03-05 15:13:41 +00:00
2004-09-05 13:43:51 +00:00
return 0 ;
}
2002-10-12 11:37:38 +00:00
static FileData * filedata_new ( void )
{
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
*/
2008-10-31 23:50:02 +00:00
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 ;
}
2008-12-19 00:50:21 +00:00
static FileData * blo_decode_and_check ( FileData * fd , ReportList * reports )
2005-07-25 18:35:49 +00:00
{
decode_blender_header ( fd ) ;
if ( fd - > flags & FD_FLAGS_FILE_OK ) {
if ( ! read_file_dna ( fd ) ) {
2010-11-24 12:17:26 +00:00
BKE_reportf ( reports , RPT_ERROR , " Failed to read blend file: \" %s \" , incomplete " , fd - > relabase ) ;
2005-07-25 18:35:49 +00:00
blo_freefiledata ( fd ) ;
fd = NULL ;
}
2006-11-26 21:17:15 +00:00
}
else {
2010-11-24 12:17:26 +00:00
BKE_reportf ( reports , RPT_ERROR , " Failed to read blend file: \" %s \" , not a blend file " , fd - > relabase ) ;
2005-07-25 18:35:49 +00:00
blo_freefiledata ( fd ) ;
fd = NULL ;
}
return fd ;
}
2006-01-04 19:05:24 +00:00
/* cannot be called with relative paths anymore! */
/* on each new library added, it now checks for the current FileData and expands relativeness */
2010-11-17 09:45:45 +00:00
FileData * blo_openblenderfile ( const char * name , ReportList * reports )
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 ;
2010-07-04 23:26:55 +00:00
errno = 0 ;
2006-01-04 19:05:24 +00:00
gzfile = gzopen ( name , " rb " ) ;
2004-06-23 18:22:51 +00:00
2010-07-03 17:47:06 +00:00
if ( gzfile = = Z_NULL ) {
2010-07-04 23:26:55 +00:00
BKE_reportf ( reports , RPT_ERROR , " Unable to open \" %s \" : %s. " , name , errno ? strerror ( errno ) : " Unknown erro reading file " ) ;
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 ;
fd - > read = fd_read_gzip_from_file ;
2004-06-23 18:22:51 +00:00
2008-09-11 13:00:54 +00:00
/* needed for library_append and read_libraries */
2009-10-20 16:43:25 +00:00
BLI_strncpy ( fd - > relabase , name , sizeof ( fd - > relabase ) ) ;
2008-09-11 13:00:54 +00:00
2008-12-19 00:50:21 +00:00
return blo_decode_and_check ( fd , reports ) ;
2002-10-12 11:37:38 +00:00
}
}
2008-12-19 00:50:21 +00:00
FileData * blo_openblendermemory ( void * mem , int memsize , ReportList * reports )
2002-10-12 11:37:38 +00:00
{
if ( ! mem | | memsize < SIZEOFBLENDERHEADER ) {
2008-12-19 00:50:21 +00:00
BKE_report ( reports , RPT_ERROR , ( mem ) ? " Unable to read " : " 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
2008-12-19 00:50:21 +00:00
return blo_decode_and_check ( fd , reports ) ;
2002-10-12 11:37:38 +00:00
}
}
2008-12-19 00:50:21 +00:00
FileData * blo_openblendermemfile ( MemFile * memfile , ReportList * reports )
2004-09-05 13:43:51 +00:00
{
if ( ! memfile ) {
2010-07-04 23:26:55 +00:00
BKE_report ( reports , RPT_ERROR , " Unable to open blend <memory> " ) ;
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 ;
2008-12-19 00:50:21 +00:00
return blo_decode_and_check ( fd , reports ) ;
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 )
2008-10-31 23:50:02 +00:00
DNA_sdna_free ( fd - > memsdna ) ;
2002-10-12 11:37:38 +00:00
if ( fd - > filesdna )
2008-10-31 23:50:02 +00:00
DNA_sdna_free ( fd - > filesdna ) ;
2002-10-12 11:37:38 +00:00
if ( fd - > compflags )
MEM_freeN ( fd - > compflags ) ;
if ( fd - > datamap )
oldnewmap_free ( fd - > datamap ) ;
if ( fd - > globmap )
oldnewmap_free ( fd - > globmap ) ;
2006-11-10 10:17:04 +00:00
if ( fd - > imamap )
oldnewmap_free ( fd - > imamap ) ;
2002-10-12 11:37:38 +00:00
if ( fd - > libmap & & ! ( fd - > flags & FD_FLAGS_NOT_MY_LIBMAP ) )
oldnewmap_free ( fd - > libmap ) ;
2008-01-30 18:18:33 +00:00
if ( fd - > bheadmap )
MEM_freeN ( fd - > bheadmap ) ;
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
}
2010-03-20 16:56:52 +00:00
int BLO_is_a_library ( const char * path , char * dir , char * group )
2009-09-12 19:54:39 +00:00
{
/* return ok when a blenderfile, in dir is the filename,
* in group the type of libdata
*/
int len ;
char * fd ;
strcpy ( dir , path ) ;
len = strlen ( dir ) ;
if ( len < 7 ) return 0 ;
if ( dir [ len - 1 ] ! = ' / ' & & dir [ len - 1 ] ! = ' \\ ' ) return 0 ;
group [ 0 ] = 0 ;
dir [ len - 1 ] = 0 ;
/* Find the last slash */
2010-03-20 16:56:52 +00:00
fd = BLI_last_slash ( dir ) ;
2009-09-12 19:54:39 +00:00
if ( fd = = 0 ) return 0 ;
* fd = 0 ;
if ( BLO_has_bfile_extension ( fd + 1 ) ) {
/* the last part of the dir is a .blend file, no group follows */
* fd = ' / ' ; /* put back the removed slash separating the dir and the .blend file name */
}
else {
char * gp = fd + 1 ; // in case we have a .blend file, gp points to the group
/* Find the last slash */
2010-03-20 16:56:52 +00:00
fd = BLI_last_slash ( dir ) ;
2009-09-12 19:54:39 +00:00
if ( ! fd | | ! BLO_has_bfile_extension ( fd + 1 ) ) return 0 ;
/* now we know that we are in a blend file and it is safe to
assume that gp actually points to a group */
if ( BLI_streq ( " Screen " , gp ) = = 0 )
BLI_strncpy ( group , gp , GROUP_MAX ) ;
}
return 1 ;
}
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 ) ;
}
2006-11-10 10:17:04 +00:00
static void * newimaadr ( FileData * fd , void * adr ) /* used to restore image data after undo */
{
if ( fd - > imamap & & adr )
return oldnewmap_lookup_and_inc ( fd - > imamap , adr ) ;
return NULL ;
}
2002-10-12 11:37:38 +00:00
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 ) ;
2006-11-25 13:07:28 +00:00
if ( id )
2002-10-12 11:37:38 +00:00
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 )
{
2006-03-27 22:33:21 +00:00
Main * mainptr ;
2005-12-16 17:35:38 +00:00
2006-03-27 22:33:21 +00:00
for ( mainptr = mainlist - > first ; mainptr ; mainptr = mainptr - > next ) {
2005-12-16 17:35:38 +00:00
FileData * fd ;
2006-03-27 22:33:21 +00:00
if ( mainptr - > curlib ) fd = mainptr - > curlib - > filedata ;
2005-12-16 17:35:38 +00:00
else fd = basefd ;
if ( fd ) {
change_idid_adr_fd ( fd , old , new ) ;
}
}
}
2002-10-12 11:37:38 +00:00
2008-11-02 00:25:39 +00:00
/* lib linked proxy objects point to our local data, we need
* to clear that pointer before reading the undo memfile since
* the object might be removed , it is set again in reading
* if the local object still exists */
2010-10-16 02:40:31 +00:00
void blo_clear_proxy_pointers_from_lib ( Main * oldmain )
2008-11-02 00:25:39 +00:00
{
2008-12-19 16:36:15 +00:00
Object * ob = oldmain - > object . first ;
2008-11-02 00:25:39 +00:00
for ( ; ob ; ob = ob - > id . next )
if ( ob - > id . lib )
ob - > proxy_from = NULL ;
}
2008-12-19 16:36:15 +00:00
void blo_make_image_pointer_map ( FileData * fd , Main * oldmain )
2006-11-10 10:17:04 +00:00
{
2008-12-19 16:36:15 +00:00
Image * ima = oldmain - > image . first ;
Scene * sce = oldmain - > scene . first ;
2010-03-27 15:35:34 +00:00
int a ;
2006-11-10 10:17:04 +00:00
fd - > imamap = oldnewmap_new ( ) ;
for ( ; ima ; ima = ima - > id . next ) {
2006-12-20 17:57:56 +00:00
Link * ibuf = ima - > ibufs . first ;
for ( ; ibuf ; ibuf = ibuf - > next )
oldnewmap_insert ( fd - > imamap , ibuf , ibuf , 0 ) ;
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
if ( ima - > gputexture )
oldnewmap_insert ( fd - > imamap , ima - > gputexture , ima - > gputexture , 0 ) ;
2010-03-27 15:35:34 +00:00
for ( a = 0 ; a < IMA_MAX_RENDER_SLOT ; a + + )
if ( ima - > renders [ a ] )
oldnewmap_insert ( fd - > imamap , ima - > renders [ a ] , ima - > renders [ a ] , 0 ) ;
2006-11-10 10:17:04 +00:00
}
2006-11-18 13:25:42 +00:00
for ( ; sce ; sce = sce - > id . next ) {
if ( sce - > nodetree ) {
bNode * node ;
for ( node = sce - > nodetree - > nodes . first ; node ; node = node - > next )
oldnewmap_insert ( fd - > imamap , node - > preview , node - > preview , 0 ) ;
}
}
2006-11-10 10:17:04 +00:00
}
2008-12-19 16:36:15 +00:00
/* set old main image ibufs to zero if it has been restored */
/* this works because freeing old main only happens after this call */
void blo_end_image_pointer_map ( FileData * fd , Main * oldmain )
2006-11-10 10:17:04 +00:00
{
OldNew * entry = fd - > imamap - > entries ;
2008-12-19 16:36:15 +00:00
Image * ima = oldmain - > image . first ;
Scene * sce = oldmain - > scene . first ;
2010-03-27 15:35:34 +00:00
int i , a ;
2006-11-10 10:17:04 +00:00
/* used entries were restored, so we put them to zero */
for ( i = 0 ; i < fd - > imamap - > nentries ; i + + , entry + + ) {
2010-03-22 09:30:00 +00:00
if ( entry - > nr > 0 )
2006-11-10 10:17:04 +00:00
entry - > newp = NULL ;
}
for ( ; ima ; ima = ima - > id . next ) {
2006-12-20 17:57:56 +00:00
Link * ibuf , * next ;
/* this mirrors direct_link_image */
for ( ibuf = ima - > ibufs . first ; ibuf ; ibuf = next ) {
next = ibuf - > next ;
if ( NULL = = newimaadr ( fd , ibuf ) ) { /* so was restored */
BLI_remlink ( & ima - > ibufs , ibuf ) ;
2006-11-10 10:17:04 +00:00
ima - > bindcode = 0 ;
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
ima - > gputexture = NULL ;
2006-12-20 17:57:56 +00:00
}
2006-11-10 10:17:04 +00:00
}
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
ima - > gputexture = newimaadr ( fd , ima - > gputexture ) ;
2010-03-27 15:35:34 +00:00
for ( a = 0 ; a < IMA_MAX_RENDER_SLOT ; a + + )
ima - > renders [ a ] = newimaadr ( fd , ima - > renders [ a ] ) ;
2006-11-10 10:17:04 +00:00
}
2006-11-18 13:25:42 +00:00
for ( ; sce ; sce = sce - > id . next ) {
if ( sce - > nodetree ) {
bNode * node ;
for ( node = sce - > nodetree - > nodes . first ; node ; node = node - > next )
node - > preview = newimaadr ( fd , node - > preview ) ;
}
}
2006-11-10 10:17:04 +00:00
}
2006-11-25 13:07:28 +00:00
/* undo file support: add all library pointers in lookup */
void blo_add_library_pointer_map ( ListBase * mainlist , FileData * fd )
{
2007-03-16 05:39:30 +00:00
Main * ptr = mainlist - > first ;
2006-11-25 13:07:28 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2007-03-16 05:39:30 +00:00
for ( ptr = ptr - > next ; ptr ; ptr = ptr - > next ) {
int i = set_listbasepointers ( ptr , lbarray ) ;
2006-11-25 13:07:28 +00:00
while ( i - - ) {
ID * id ;
for ( id = lbarray [ i ] - > first ; id ; id = id - > next )
oldnewmap_insert ( fd - > libmap , id , id , GS ( id - > name ) ) ;
}
}
}
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
2007-04-28 16:15:00 +00:00
data = ( char * ) ( bhead + 1 ) ;
2002-10-12 11:37:38 +00:00
blocksize = filesdna - > typelens [ filesdna - > structs [ bhead - > SDNAnr ] [ 0 ] ] ;
nblocks = bhead - > nr ;
while ( nblocks - - ) {
2008-10-31 23:50:02 +00:00
DNA_struct_switch_endian ( 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 ) {
2007-04-28 16:15:00 +00:00
/* switch is based on file dna */
2002-10-12 11:37:38 +00:00
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 ) {
2008-10-31 23:50:02 +00:00
temp = DNA_struct_reconstruct ( fd - > memsdna , fd - > filesdna , fd - > compflags , bh - > SDNAnr , bh - > nr , ( bh + 1 ) ) ;
2002-10-12 11:37:38 +00:00
} else {
2004-04-23 21:02:58 +00:00
temp = MEM_mallocN ( bh - > len , blockname ) ;
2007-04-28 16:15:00 +00:00
memcpy ( temp , ( bh + 1 ) , bh - > len ) ;
2002-10-12 11:37:38 +00:00
}
}
}
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
2006-12-20 17:57:56 +00:00
if ( lb - > first = = NULL ) return ;
2002-10-12 11:37:38 +00:00
lb - > first = newdataadr ( fd , lb - > first ) ;
ln = lb - > first ;
2006-12-20 17:57:56 +00:00
prev = NULL ;
2002-10-12 11:37:38 +00:00
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
2010-04-29 21:46:25 +00:00
int * ipoin , * imat ;
size_t len ;
2002-10-12 11:37:38 +00:00
/* 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 ;
}
}
}
2006-11-17 04:46:48 +00:00
/* ************ READ ID Properties *************** */
2010-10-14 00:33:39 +00:00
static void IDP_DirectLinkProperty ( IDProperty * prop , int switch_endian , FileData * fd ) ;
static void IDP_LibLinkProperty ( IDProperty * prop , int switch_endian , FileData * fd ) ;
2006-11-17 04:46:48 +00:00
2008-12-31 13:16:37 +00:00
static void IDP_DirectLinkIDPArray ( IDProperty * prop , int switch_endian , FileData * fd )
{
2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.
Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.
Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.
With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.
Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.
Example code:
http://www.pasteall.org/7201/python
2009-08-18 01:29:25 +00:00
IDProperty * array ;
2008-12-31 13:16:37 +00:00
int i ;
/*since we didn't save the extra buffer, set totallen to len.*/
prop - > totallen = prop - > len ;
prop - > data . pointer = newdataadr ( fd , prop - > data . pointer ) ;
2009-08-28 20:51:30 +00:00
array = ( IDProperty * ) prop - > data . pointer ;
2010-09-20 05:46:07 +00:00
/* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared
* theres not really anything we can do to correct this , at least dont crash */
if ( array = = NULL ) {
prop - > len = 0 ;
prop - > totallen = 0 ;
}
2008-12-31 13:16:37 +00:00
2009-08-28 20:51:30 +00:00
for ( i = 0 ; i < prop - > len ; i + + )
IDP_DirectLinkProperty ( & array [ i ] , switch_endian , fd ) ;
2008-12-31 13:16:37 +00:00
}
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
static void IDP_DirectLinkArray ( IDProperty * prop , int switch_endian , FileData * fd )
2006-11-17 04:46:48 +00:00
{
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
IDProperty * * array ;
2006-11-18 02:18:40 +00:00
int i ;
/*since we didn't save the extra buffer, set totallen to len.*/
2006-11-17 04:46:48 +00:00
prop - > totallen = prop - > len ;
prop - > data . pointer = newdataadr ( fd , prop - > data . pointer ) ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
2009-08-28 20:51:30 +00:00
if ( prop - > subtype = = IDP_GROUP ) {
test_pointer_array ( fd , prop - > data . pointer ) ;
array = prop - > data . pointer ;
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
2009-08-28 20:51:30 +00:00
for ( i = 0 ; i < prop - > len ; i + + )
IDP_DirectLinkProperty ( array [ i ] , switch_endian , fd ) ;
}
else if ( prop - > subtype = = IDP_DOUBLE ) {
if ( switch_endian ) {
2008-07-24 19:22:17 +00:00
for ( i = 0 ; i < prop - > len ; i + + ) {
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
SWITCH_LONGINT ( ( ( double * ) prop - > data . pointer ) [ i ] ) ;
2008-07-24 19:22:17 +00:00
}
2009-08-28 20:51:30 +00:00
}
}
else {
if ( switch_endian ) {
2008-07-24 19:22:17 +00:00
for ( i = 0 ; i < prop - > len ; i + + ) {
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
SWITCH_INT ( ( ( int * ) prop - > data . pointer ) [ i ] ) ;
2008-07-24 19:22:17 +00:00
}
2006-11-18 02:18:40 +00:00
}
2006-11-17 04:46:48 +00:00
}
}
2010-10-16 02:40:31 +00:00
static void IDP_DirectLinkString ( IDProperty * prop , FileData * fd )
2006-11-17 04:46:48 +00:00
{
/*since we didn't save the extra string buffer, set totallen to len.*/
prop - > totallen = prop - > len ;
prop - > data . pointer = newdataadr ( fd , prop - > data . pointer ) ;
}
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
static void IDP_DirectLinkGroup ( IDProperty * prop , int switch_endian , FileData * fd )
2006-11-17 04:46:48 +00:00
{
ListBase * lb = & prop - > data . group ;
IDProperty * loop ;
link_list ( fd , lb ) ;
/*Link child id properties now*/
for ( loop = prop - > data . group . first ; loop ; loop = loop - > next ) {
IDP_DirectLinkProperty ( loop , switch_endian , fd ) ;
}
}
RNA:
* Added support for using pointers + collections as operator properties,
but with the restriction that they must point to other type derived from
ID property groups. The "add" function for these properties will allocate
a new ID property group and point to that.
* Added support for arrays with type IDP_GROUP in ID properties.
* Fix bug getting/setting float array values.
Example code for collections, note the "OperatorMousePath" type is defined
in rna_wm.c and has a float[2] property named "loc".
Defining the operator property:
prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
Adding values:
PointerRNA itemptr;
float loc[2] = {1, 1},
RNA_collection_add(op->ptr, "path", &itemptr);
RNA_float_set_array(&itemptr, "loc", loc);
Iterating:
RNA_BEGIN(op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
printf("Location: %f %f\n", loc[0], loc[1]);
}
RNA_END;
2008-12-26 20:38:52 +00:00
void IDP_DirectLinkProperty ( IDProperty * prop , int switch_endian , FileData * fd )
2006-11-17 04:46:48 +00:00
{
switch ( prop - > type ) {
case IDP_GROUP :
IDP_DirectLinkGroup ( prop , switch_endian , fd ) ;
break ;
case IDP_STRING :
2010-10-16 02:40:31 +00:00
IDP_DirectLinkString ( prop , fd ) ;
2006-11-17 04:46:48 +00:00
break ;
case IDP_ARRAY :
IDP_DirectLinkArray ( prop , switch_endian , fd ) ;
2008-07-24 19:22:17 +00:00
break ;
2008-12-31 13:16:37 +00:00
case IDP_IDPARRAY :
IDP_DirectLinkIDPArray ( prop , switch_endian , fd ) ;
break ;
2008-07-24 19:22:17 +00:00
case IDP_DOUBLE :
/*erg, stupid doubles. since I'm storing them
in the same field as int val ; val2 in the
IDPropertyData struct , they have to deal with
endianness specifically
in theory , val and val2 would ' ve already been swapped
if switch_endian is true , so we have to first unswap
them then reswap them as a single 64 - bit entity .
*/
if ( switch_endian ) {
SWITCH_INT ( prop - > data . val ) ;
SWITCH_INT ( prop - > data . val2 ) ;
SWITCH_LONGINT ( prop - > data . val ) ;
}
2006-11-17 04:46:48 +00:00
break ;
}
}
/*stub function*/
2010-10-16 02:40:31 +00:00
void IDP_LibLinkProperty ( IDProperty * UNUSED ( prop ) , int UNUSED ( switch_endian ) , FileData * UNUSED ( fd ) )
2006-11-17 04:46:48 +00:00
{
}
2009-01-07 04:38:30 +00:00
/* ************ READ CurveMapping *************** */
/* cuma itself has been read! */
static void direct_link_curvemapping ( FileData * fd , CurveMapping * cumap )
{
int a ;
/* flag seems to be able to hang? Maybe old files... not bad to clear anyway */
cumap - > flag & = ~ CUMA_PREMULLED ;
for ( a = 0 ; a < CM_TOT ; a + + ) {
cumap - > cm [ a ] . curve = newdataadr ( fd , cumap - > cm [ a ] . curve ) ;
cumap - > cm [ a ] . table = NULL ;
2010-03-23 16:16:32 +00:00
cumap - > cm [ a ] . premultable = NULL ;
2009-01-07 04:38:30 +00:00
}
}
2006-11-17 04:46:48 +00:00
/* ************ READ Brush *************** */
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
/* library brush linking after fileread */
static void lib_link_brush ( FileData * fd , Main * main )
{
Brush * brush ;
/* only link ID pointers */
for ( brush = main - > brush . first ; brush ; brush = brush - > id . next ) {
if ( brush - > id . flag & LIB_NEEDLINK ) {
brush - > id . flag - = LIB_NEEDLINK ;
2006-07-31 15:53:03 +00:00
2010-01-03 08:37:18 +00:00
brush - > mtex . tex = newlibadr_us ( fd , brush - > id . lib , brush - > mtex . tex ) ;
2009-01-15 04:22:23 +00:00
brush - > clone . image = newlibadr_us ( fd , brush - > id . lib , brush - > clone . image ) ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
}
}
}
static void direct_link_brush ( FileData * fd , Brush * brush )
{
2006-07-31 15:53:03 +00:00
/* brush itself has been read */
2009-01-07 04:38:30 +00:00
/* fallof curve */
brush - > curve = newdataadr ( fd , brush - > curve ) ;
if ( brush - > curve )
direct_link_curvemapping ( fd , brush - > curve ) ;
2009-02-22 19:31:25 +00:00
else
2010-01-04 17:28:37 +00:00
brush_curve_preset ( brush , CURVE_PRESET_SHARP ) ;
2010-07-20 13:42:27 +00:00
brush - > preview = NULL ;
brush - > icon_imbuf = NULL ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
}
2010-10-16 02:40:31 +00:00
static void direct_link_script ( FileData * UNUSED ( fd ) , Script * script )
2008-03-06 21:25:15 +00:00
{
script - > id . us = 1 ;
2008-03-07 03:24:23 +00:00
SCRIPT_SET_NULL ( script )
2008-03-06 21:25:15 +00:00
}
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
2002-10-12 11:37:38 +00:00
/* ************ 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 ;
}
2006-06-05 11:07:15 +00:00
/* ************ READ IMAGE PREVIEW *************** */
static PreviewImage * direct_link_preview_image ( FileData * fd , PreviewImage * old_prv )
{
PreviewImage * prv = newdataadr ( fd , old_prv ) ;
if ( prv ) {
2007-09-02 17:25:03 +00:00
int i ;
for ( i = 0 ; i < PREVIEW_MIPMAPS ; + + i ) {
if ( prv - > rect [ i ] ) {
prv - > rect [ i ] = newdataadr ( fd , prv - > rect [ i ] ) ;
}
}
2006-06-05 11:07:15 +00:00
}
return prv ;
}
2009-01-19 02:26:46 +00:00
/* ************ READ ANIMATION STUFF ***************** */
/* Legacy Data Support (for Version Patching) ----------------------------- */
// XXX depreceated - old animation system
static void lib_link_ipo ( FileData * fd , Main * main )
{
Ipo * ipo ;
ipo = main - > ipo . first ;
while ( ipo ) {
if ( ipo - > id . flag & LIB_NEEDLINK ) {
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 ) ;
}
ipo - > id . flag - = LIB_NEEDLINK ;
}
ipo = ipo - > id . next ;
}
}
// XXX depreceated - old animation system
static void direct_link_ipo ( FileData * fd , Ipo * ipo )
{
IpoCurve * icu ;
link_list ( fd , & ( ipo - > curve ) ) ;
icu = ipo - > curve . first ;
while ( icu ) {
icu - > bezt = newdataadr ( fd , icu - > bezt ) ;
icu - > bp = newdataadr ( fd , icu - > bp ) ;
icu - > driver = newdataadr ( fd , icu - > driver ) ;
icu = icu - > next ;
}
}
2002-10-12 11:37:38 +00:00
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
static void lib_link_nlastrips ( FileData * fd , ID * id , ListBase * striplist )
{
bActionStrip * strip ;
Two wonderful new NLA & Armature editing features!
- FORWARD CYCLING & MATCHING
Up to no now, adding multiple actions in NLA with walkcycles required to
animate them standing still, as if walking on a conveyor belt. The stride
option then makes the object itself move forward, trying to keep the foot
stuck on the floor (with poor results!).
This option now allows to make walk cycles moving forward. By
indicating a reference Offset Bone, the NLA system will use that bone to
detect the correct offset for the Armature Pose to make it seamlessly going
forward.
Best of all, this option works as for cyclic Action Strips as well as for
individual Action Strips. Note that for individual strips, you have to set
the strip on "Hold". (Might become automatic detected later).
Here's an example edit image for NLA:
http://www.blender.org/bf/nla_match-cycle.jpg
And the animation for it:
http://download.blender.org/demo/test/2.43/0001_0150_match.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_matching.blend
Using this kind of cycling works pretty straightforward, and is a lot
easier to setup than Stride Bones.
To be further tested:
- Blending cycles
- matching rotation for the bones as well.
- ACTION MODIFIERS (motion deformors)
The above option was actually required for this feature. Typically walk
cycles are constructed with certain Bones to be the handles, controlling
for example the torso or feet.
An Action Modifier allows you to use a Curve Path to deform the motion of
these controlling bones. This uses the existing Curve Deformation option.
Modifiers can be added per Action Strip, each controlling a channel (bone)
by choice, and even allows to layer multiple modifiers on top of each other
(several paths deforming motion). This option is using the dependency graph,
so editing the Curve will give realtime changes in the Armature.
The previous walkcycle, controlled by two curves:
http://download.blender.org/demo/test/2.43/0001_0150_deform.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend
Action Modifiers can be added in the NLA Properties Panel. Per Modifier you
have to indicate the channel and a Curve Object. You can copy modifiers from
one strip to another using CTRL+C (only copies to active Object strips).
Setting up a correct Curve Path has to be carefully done:
- Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated.
- make sure the center point of the Curve Object is at the center of the
Armature (or above)
- move the first point of the curve to the center point as well.
- check if the path starts from this first point, you can change it using
(in Curve EditMode) the option Wkey -> "Switch Direction"
- Make sure alignment uses the correct axis; if the Armature walks into
the negative Y direction, you have to set in Object Buttons, "Anim settings"
Panel, the correct Track option. (Note; option will probably move to the
Modifier later).
This is a good reason to make such paths automatic (on a command). Is on the
todo list.
Also note this:
- the Curve Path extends in beginning and ending, that's (for now) the default,
and allows to use multiple paths. Make sure paths begin and end horizontal.
- Moving the Curve in Object Mode will change the "mapping" (as if the landscape
a character walks over moves). Moving the Curve in Edit Mode will change the
actual position of the deformation.
- Speed (Ipos) on paths is not supported yet, will be done.
- The Curve "Stretch" deform option doesn't work.
- Modifiers are executed *after* all actions in NLA are evaluated, there's no
support yet for blending multiple strips with Modifiers.
- This doesn't work yet for time-mapping...
This commit is mostly for review by character animators... some details or
working methods might change.
This feature can also be used for other modifiers, such as noise (Perlin) or
the mythical "Oomph" (frequency control) and of course Python.
Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 15:51:57 +00:00
bActionModifier * amod ;
2002-10-12 11:37:38 +00:00
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 ) ;
Two wonderful new NLA & Armature editing features!
- FORWARD CYCLING & MATCHING
Up to no now, adding multiple actions in NLA with walkcycles required to
animate them standing still, as if walking on a conveyor belt. The stride
option then makes the object itself move forward, trying to keep the foot
stuck on the floor (with poor results!).
This option now allows to make walk cycles moving forward. By
indicating a reference Offset Bone, the NLA system will use that bone to
detect the correct offset for the Armature Pose to make it seamlessly going
forward.
Best of all, this option works as for cyclic Action Strips as well as for
individual Action Strips. Note that for individual strips, you have to set
the strip on "Hold". (Might become automatic detected later).
Here's an example edit image for NLA:
http://www.blender.org/bf/nla_match-cycle.jpg
And the animation for it:
http://download.blender.org/demo/test/2.43/0001_0150_match.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_matching.blend
Using this kind of cycling works pretty straightforward, and is a lot
easier to setup than Stride Bones.
To be further tested:
- Blending cycles
- matching rotation for the bones as well.
- ACTION MODIFIERS (motion deformors)
The above option was actually required for this feature. Typically walk
cycles are constructed with certain Bones to be the handles, controlling
for example the torso or feet.
An Action Modifier allows you to use a Curve Path to deform the motion of
these controlling bones. This uses the existing Curve Deformation option.
Modifiers can be added per Action Strip, each controlling a channel (bone)
by choice, and even allows to layer multiple modifiers on top of each other
(several paths deforming motion). This option is using the dependency graph,
so editing the Curve will give realtime changes in the Armature.
The previous walkcycle, controlled by two curves:
http://download.blender.org/demo/test/2.43/0001_0150_deform.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend
Action Modifiers can be added in the NLA Properties Panel. Per Modifier you
have to indicate the channel and a Curve Object. You can copy modifiers from
one strip to another using CTRL+C (only copies to active Object strips).
Setting up a correct Curve Path has to be carefully done:
- Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated.
- make sure the center point of the Curve Object is at the center of the
Armature (or above)
- move the first point of the curve to the center point as well.
- check if the path starts from this first point, you can change it using
(in Curve EditMode) the option Wkey -> "Switch Direction"
- Make sure alignment uses the correct axis; if the Armature walks into
the negative Y direction, you have to set in Object Buttons, "Anim settings"
Panel, the correct Track option. (Note; option will probably move to the
Modifier later).
This is a good reason to make such paths automatic (on a command). Is on the
todo list.
Also note this:
- the Curve Path extends in beginning and ending, that's (for now) the default,
and allows to use multiple paths. Make sure paths begin and end horizontal.
- Moving the Curve in Object Mode will change the "mapping" (as if the landscape
a character walks over moves). Moving the Curve in Edit Mode will change the
actual position of the deformation.
- Speed (Ipos) on paths is not supported yet, will be done.
- The Curve "Stretch" deform option doesn't work.
- Modifiers are executed *after* all actions in NLA are evaluated, there's no
support yet for blending multiple strips with Modifiers.
- This doesn't work yet for time-mapping...
This commit is mostly for review by character animators... some details or
working methods might change.
This feature can also be used for other modifiers, such as noise (Perlin) or
the mythical "Oomph" (frequency control) and of course Python.
Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 15:51:57 +00:00
for ( amod = strip - > modifiers . first ; amod ; amod = amod - > next )
amod - > ob = newlibadr ( fd , id - > lib , amod - > ob ) ;
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
}
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system
static void direct_link_nlastrips ( FileData * fd , ListBase * strips )
{
bActionStrip * strip ;
link_list ( fd , strips ) ;
for ( strip = strips - > first ; strip ; strip = strip - > next )
link_list ( fd , & strip - > modifiers ) ;
}
// XXX depreceated - old animation system
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 ) ;
}
}
2009-01-19 02:26:46 +00:00
/* Data Linking ----------------------------- */
2009-05-22 11:19:35 +00:00
static void lib_link_fmodifiers ( FileData * fd , ID * id , ListBase * list )
{
FModifier * fcm ;
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
/* data for specific modifiers */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_PYTHON :
{
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
data - > script = newlibadr ( fd , id - > lib , data - > script ) ;
}
break ;
}
}
}
2009-01-19 02:26:46 +00:00
static void lib_link_fcurves ( FileData * fd , ID * id , ListBase * list )
{
FCurve * fcu ;
2009-11-26 02:13:56 +00:00
if ( list = = NULL )
return ;
2009-01-19 02:26:46 +00:00
/* relink ID-block references... */
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
/* driver data */
if ( fcu - > driver ) {
ChannelDriver * driver = fcu - > driver ;
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
DriverVar * dvar ;
Animato - Drivers with Multiple Targets:
Drivers now support multiple targets which act as 'variables'. The targets have a short 'name' (see later), and reference some property (in much the same way as F-Curves do, using RNA-Paths) which acts as the 'value'.
These named variables can then be used in a Python Expression which relates them to each other for more fine-grained control over the result of the driver. By using only the names of these variables in the expressions, we are able to define expressions/relationships in a much more readable way, as data access is separated from data use. This makes the underlying relationships easier to understand.
By default, if no Python Expression is given, the variables are simply averaged together, so old files won't break. :)
For example, check the following diagram (thanks Cessen/Nathan V from Peach team):
http://download.blender.org/ftp/incoming/250_drivers_mockup_cessen.png
TODO List:
* Depsgraph building for new driver relationships doesn't work yet. This needs to be recoded again, but this new system makes this much easier, since the targets are clearly defined (i.e. no need to parse py expressions to get list of objects)
* Graph Editor interface for editing these needs to be rewritten
* Python function for evaluating these expressions is needed (Campbell?)
2009-04-16 07:37:06 +00:00
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
for ( dvar = driver - > variables . first ; dvar ; dvar = dvar - > next ) {
DRIVER_TARGETS_LOOPER ( dvar )
{
/* only relink if still used */
if ( tarIndex < dvar - > num_targets )
dtar - > id = newlibadr ( fd , id - > lib , dtar - > id ) ;
else
dtar - > id = NULL ;
}
DRIVER_TARGETS_LOOPER_END
}
2009-01-19 02:26:46 +00:00
}
/* modifiers */
2009-05-22 11:19:35 +00:00
lib_link_fmodifiers ( fd , id , & fcu - > modifiers ) ;
}
}
/* NOTE: this assumes that link_list has already been called on the list */
static void direct_link_fmodifiers ( FileData * fd , ListBase * list )
{
FModifier * fcm ;
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
/* relink general data */
fcm - > data = newdataadr ( fd , fcm - > data ) ;
fcm - > edata = NULL ;
/* do relinking of data for specific types */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_GENERATOR :
{
FMod_Generator * data = ( FMod_Generator * ) fcm - > data ;
data - > coefficients = newdataadr ( fd , data - > coefficients ) ;
2009-01-19 02:26:46 +00:00
}
2009-05-22 11:19:35 +00:00
break ;
case FMODIFIER_TYPE_ENVELOPE :
{
FMod_Envelope * data = ( FMod_Envelope * ) fcm - > data ;
data - > data = newdataadr ( fd , data - > data ) ;
}
break ;
case FMODIFIER_TYPE_PYTHON :
{
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
data - > prop = newdataadr ( fd , data - > prop ) ;
IDP_DirectLinkProperty ( data - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
}
break ;
2009-01-19 02:26:46 +00:00
}
}
}
2009-01-22 10:53:22 +00:00
/* NOTE: this assumes that link_list has already been called on the list */
2009-01-19 02:26:46 +00:00
static void direct_link_fcurves ( FileData * fd , ListBase * list )
{
FCurve * fcu ;
/* link F-Curve data to F-Curve again (non ID-libs) */
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
/* curve data */
fcu - > bezt = newdataadr ( fd , fcu - > bezt ) ;
fcu - > fpt = newdataadr ( fd , fcu - > fpt ) ;
/* rna path */
fcu - > rna_path = newdataadr ( fd , fcu - > rna_path ) ;
2009-01-20 11:07:42 +00:00
/* group */
fcu - > grp = newdataadr ( fd , fcu - > grp ) ;
2009-01-19 02:26:46 +00:00
/* driver */
fcu - > driver = newdataadr ( fd , fcu - > driver ) ;
if ( fcu - > driver ) {
ChannelDriver * driver = fcu - > driver ;
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
DriverVar * dvar ;
2010-01-20 18:27:19 +00:00
driver - > expr_comp = NULL ;
2009-01-19 02:26:46 +00:00
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
/* relink variables, targets and their paths */
link_list ( fd , & driver - > variables ) ;
for ( dvar = driver - > variables . first ; dvar ; dvar = dvar - > next ) {
DRIVER_TARGETS_LOOPER ( dvar )
{
/* only relink the targets being used */
if ( tarIndex < dvar - > num_targets )
dtar - > rna_path = newdataadr ( fd , dtar - > rna_path ) ;
else
dtar - > rna_path = NULL ;
}
DRIVER_TARGETS_LOOPER_END
}
2009-01-19 02:26:46 +00:00
}
/* modifiers */
link_list ( fd , & fcu - > modifiers ) ;
2009-05-22 11:19:35 +00:00
direct_link_fmodifiers ( fd , & fcu - > modifiers ) ;
2009-01-19 02:26:46 +00:00
}
}
static void lib_link_action ( FileData * fd , Main * main )
{
bAction * act ;
bActionChannel * chan ;
for ( act = main - > action . first ; act ; act = act - > id . next ) {
if ( act - > id . flag & LIB_NEEDLINK ) {
act - > id . flag - = LIB_NEEDLINK ;
// XXX depreceated - old animation system <<<
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 ) ;
}
// >>> XXX depreceated - old animation system
lib_link_fcurves ( fd , & act - > id , & act - > curves ) ;
}
}
}
static void direct_link_action ( FileData * fd , bAction * act )
{
bActionChannel * achan ; // XXX depreceated - old animation system
bActionGroup * agrp ;
2009-01-22 10:53:22 +00:00
link_list ( fd , & act - > curves ) ;
link_list ( fd , & act - > chanbase ) ; // XXX depreceated - old animation system
2009-01-19 02:26:46 +00:00
link_list ( fd , & act - > groups ) ;
link_list ( fd , & act - > markers ) ;
// XXX depreceated - old animation system <<<
for ( achan = act - > chanbase . first ; achan ; achan = achan - > next ) {
achan - > grp = newdataadr ( fd , achan - > grp ) ;
link_list ( fd , & achan - > constraintChannels ) ;
}
// >>> XXX depreceated - old animation system
direct_link_fcurves ( fd , & act - > curves ) ;
for ( agrp = act - > groups . first ; agrp ; agrp = agrp - > next ) {
2009-01-20 11:07:42 +00:00
agrp - > channels . first = newdataadr ( fd , agrp - > channels . first ) ;
agrp - > channels . last = newdataadr ( fd , agrp - > channels . last ) ;
2009-01-19 02:26:46 +00:00
}
}
2009-07-06 03:44:44 +00:00
static void lib_link_nladata_strips ( FileData * fd , ID * id , ListBase * list )
{
NlaStrip * strip ;
for ( strip = list - > first ; strip ; strip = strip - > next ) {
/* check strip's children */
lib_link_nladata_strips ( fd , id , & strip - > strips ) ;
2009-11-26 02:13:56 +00:00
/* check strip's F-Curves */
lib_link_fcurves ( fd , id , & strip - > fcurves ) ;
2009-07-06 03:44:44 +00:00
/* reassign the counted-reference to action */
strip - > act = newlibadr_us ( fd , id - > lib , strip - > act ) ;
}
}
2009-05-22 11:19:35 +00:00
2009-07-06 03:44:44 +00:00
static void lib_link_nladata ( FileData * fd , ID * id , ListBase * list )
2009-05-22 11:19:35 +00:00
{
NlaTrack * nlt ;
2009-07-06 03:44:44 +00:00
/* we only care about the NLA strips inside the tracks */
2009-05-22 11:19:35 +00:00
for ( nlt = list - > first ; nlt ; nlt = nlt - > next ) {
2009-07-06 03:44:44 +00:00
lib_link_nladata_strips ( fd , id , & nlt - > strips ) ;
}
}
/* This handles Animato NLA-Strips linking
* NOTE : this assumes that link_list has already been called on the list
*/
static void direct_link_nladata_strips ( FileData * fd , ListBase * list )
{
NlaStrip * strip ;
for ( strip = list - > first ; strip ; strip = strip - > next ) {
/* strip's child strips */
link_list ( fd , & strip - > strips ) ;
direct_link_nladata_strips ( fd , & strip - > strips ) ;
/* strip's F-Curves */
link_list ( fd , & strip - > fcurves ) ;
direct_link_fcurves ( fd , & strip - > fcurves ) ;
/* strip's F-Modifiers */
link_list ( fd , & strip - > modifiers ) ;
direct_link_fcurves ( fd , & strip - > modifiers ) ;
2009-05-22 11:19:35 +00:00
}
}
/* NOTE: this assumes that link_list has already been called on the list */
static void direct_link_nladata ( FileData * fd , ListBase * list )
{
NlaTrack * nlt ;
for ( nlt = list - > first ; nlt ; nlt = nlt - > next ) {
/* relink list of strips */
link_list ( fd , & nlt - > strips ) ;
/* relink strip data */
2009-07-06 03:44:44 +00:00
direct_link_nladata_strips ( fd , & nlt - > strips ) ;
2009-05-22 11:19:35 +00:00
}
}
2009-01-19 02:26:46 +00:00
/* ------- */
2009-02-11 12:19:42 +00:00
static void lib_link_keyingsets ( FileData * fd , ID * id , ListBase * list )
{
KeyingSet * ks ;
KS_Path * ksp ;
/* here, we're only interested in the ID pointer stored in some of the paths */
for ( ks = list - > first ; ks ; ks = ks - > next ) {
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
ksp - > id = newlibadr ( fd , id - > lib , ksp - > id ) ;
}
}
}
/* NOTE: this assumes that link_list has already been called on the list */
static void direct_link_keyingsets ( FileData * fd , ListBase * list )
{
KeyingSet * ks ;
KS_Path * ksp ;
/* link KeyingSet data to KeyingSet again (non ID-libs) */
for ( ks = list - > first ; ks ; ks = ks - > next ) {
/* paths */
link_list ( fd , & ks - > paths ) ;
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
/* rna path */
ksp - > rna_path = newdataadr ( fd , ksp - > rna_path ) ;
}
}
}
/* ------- */
2009-01-19 02:26:46 +00:00
static void lib_link_animdata ( FileData * fd , ID * id , AnimData * adt )
{
if ( adt = = NULL )
return ;
/* link action data */
adt - > action = newlibadr_us ( fd , id - > lib , adt - > action ) ;
2009-06-06 05:06:46 +00:00
adt - > tmpact = newlibadr_us ( fd , id - > lib , adt - > tmpact ) ;
2009-01-19 02:26:46 +00:00
/* link drivers */
lib_link_fcurves ( fd , id , & adt - > drivers ) ;
/* overrides don't have lib-link for now, so no need to do anything */
/* link NLA-data */
2009-05-22 11:19:35 +00:00
lib_link_nladata ( fd , id , & adt - > nla_tracks ) ;
2009-01-19 02:26:46 +00:00
}
static void direct_link_animdata ( FileData * fd , AnimData * adt )
{
/* NOTE: must have called newdataadr already before doing this... */
if ( adt = = NULL )
return ;
/* link drivers */
2009-01-22 10:53:22 +00:00
link_list ( fd , & adt - > drivers ) ;
2009-01-19 02:26:46 +00:00
direct_link_fcurves ( fd , & adt - > drivers ) ;
/* link overrides */
// TODO...
/* link NLA-data */
2009-05-22 11:19:35 +00:00
link_list ( fd , & adt - > nla_tracks ) ;
direct_link_nladata ( fd , & adt - > nla_tracks ) ;
2009-06-23 13:25:31 +00:00
2010-11-05 00:09:45 +00:00
/* relink active strip - even though strictly speaking this should only be used
* if we ' re in ' tweaking mode ' , we need to be able to have this loaded back for
* undo , but also since users may not exit tweakmode before saving ( # 24535 )
*/
// TODO: it's not really nice that anyone should be able to save the file in this
// state, but it's going to be too hard to enforce this single case...
adt - > actstrip = newdataadr ( fd , adt - > actstrip ) ;
2009-01-19 02:26:46 +00:00
}
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
/* ************ READ MOTION PATHS *************** */
/* direct data for cache */
static void direct_link_motionpath ( FileData * fd , bMotionPath * mpath )
{
/* sanity check */
if ( mpath = = NULL )
return ;
/* relink points cache */
mpath - > points = newdataadr ( fd , mpath - > points ) ;
}
2009-02-20 16:39:39 +00:00
/* ************ READ NODE TREE *************** */
/* singe node tree (also used for material/scene trees), ntree is not NULL */
static void lib_link_ntree ( FileData * fd , ID * id , bNodeTree * ntree )
{
bNode * node ;
if ( ntree - > adt ) lib_link_animdata ( fd , & ntree - > id , ntree - > adt ) ;
2009-11-11 08:12:54 +00:00
ntree - > gpd = newlibadr_us ( fd , id - > lib , ntree - > gpd ) ;
2009-02-20 16:39:39 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next )
node - > id = newlibadr_us ( fd , id - > lib , node - > id ) ;
}
/* library ntree linking after fileread */
static void lib_link_nodetree ( FileData * fd , Main * main )
{
bNodeTree * ntree ;
/* only link ID pointers */
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
if ( ntree - > id . flag & LIB_NEEDLINK ) {
ntree - > id . flag - = LIB_NEEDLINK ;
lib_link_ntree ( fd , & ntree - > id , ntree ) ;
}
}
}
/* verify types for nodes and groups, all data has to be read */
/* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic
* typedefs */
2010-10-16 02:40:31 +00:00
static void lib_verify_nodetree ( Main * main , int UNUSED ( open ) )
2009-02-20 16:39:39 +00:00
{
Scene * sce ;
Material * ma ;
Tex * tx ;
bNodeTree * ntree ;
/* this crashes blender on undo/redo
if ( open = = 1 ) {
reinit_nodesystem ( ) ;
} */
/* now create the own typeinfo structs an verify nodes */
/* here we still assume no groups in groups */
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
ntreeVerifyTypes ( ntree ) ; /* internal nodes, no groups! */
ntreeMakeOwnType ( ntree ) ; /* for group usage */
}
/* now verify all types in material trees, groups are set OK now */
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > nodetree )
ntreeVerifyTypes ( ma - > nodetree ) ;
}
/* and scene trees */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > nodetree )
ntreeVerifyTypes ( sce - > nodetree ) ;
}
/* and texture trees */
for ( tx = main - > tex . first ; tx ; tx = tx - > id . next ) {
if ( tx - > nodetree )
ntreeVerifyTypes ( tx - > nodetree ) ;
}
}
/* ntree itself has been read! */
static void direct_link_nodetree ( FileData * fd , bNodeTree * ntree )
{
/* note: writing and reading goes in sync, for speed */
bNode * node ;
bNodeSocket * sock ;
bNodeLink * link ;
ntree - > init = 0 ; /* to set callbacks and force setting types */
ntree - > owntype = NULL ;
2010-05-27 08:22:16 +00:00
ntree - > progress = NULL ;
2009-02-20 16:39:39 +00:00
ntree - > adt = newdataadr ( fd , ntree - > adt ) ;
direct_link_animdata ( fd , ntree - > adt ) ;
link_list ( fd , & ntree - > nodes ) ;
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > type = = NODE_DYNAMIC ) {
node - > custom1 = 0 ;
node - > custom1 = BSET ( node - > custom1 , NODE_DYNAMIC_LOADED ) ;
node - > typeinfo = NULL ;
}
node - > storage = newdataadr ( fd , node - > storage ) ;
if ( node - > storage ) {
/* could be handlerized at some point */
if ( ntree - > type = = NTREE_SHADER & & ( node - > type = = SH_NODE_CURVE_VEC | | node - > type = = SH_NODE_CURVE_RGB ) )
direct_link_curvemapping ( fd , node - > storage ) ;
else if ( ntree - > type = = NTREE_COMPOSIT ) {
2010-01-21 00:00:45 +00:00
if ( ELEM4 ( node - > type , CMP_NODE_TIME , CMP_NODE_CURVE_VEC , CMP_NODE_CURVE_RGB , CMP_NODE_HUECORRECT ) )
2009-02-20 16:39:39 +00:00
direct_link_curvemapping ( fd , node - > storage ) ;
else if ( ELEM3 ( node - > type , CMP_NODE_IMAGE , CMP_NODE_VIEWER , CMP_NODE_SPLITVIEWER ) )
( ( ImageUser * ) node - > storage ) - > ok = 1 ;
}
else if ( ntree - > type = = NTREE_TEXTURE & & ( node - > type = = TEX_NODE_CURVE_RGB | | node - > type = = TEX_NODE_CURVE_TIME ) ) {
direct_link_curvemapping ( fd , node - > storage ) ;
}
}
link_list ( fd , & node - > inputs ) ;
link_list ( fd , & node - > outputs ) ;
}
link_list ( fd , & ntree - > links ) ;
/* and we connect the rest */
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
node - > preview = newimaadr ( fd , node - > preview ) ;
node - > lasty = 0 ;
for ( sock = node - > inputs . first ; sock ; sock = sock - > next )
sock - > link = newdataadr ( fd , sock - > link ) ;
for ( sock = node - > outputs . first ; sock ; sock = sock - > next )
sock - > ns . data = NULL ;
}
for ( link = ntree - > links . first ; link ; link = link - > next ) {
link - > fromnode = newdataadr ( fd , link - > fromnode ) ;
link - > tonode = newdataadr ( fd , link - > tonode ) ;
link - > fromsock = newdataadr ( fd , link - > fromsock ) ;
link - > tosock = newdataadr ( fd , link - > tosock ) ;
}
2010-01-06 03:00:19 +00:00
2009-02-20 16:39:39 +00:00
/* type verification is in lib-link */
}
2009-01-19 02:26:46 +00:00
/* ************ READ ARMATURE ***************** */
2010-02-06 11:50:39 +00:00
/* temp struct used to transport needed info to lib_link_constraint_cb() */
typedef struct tConstraintLinkData {
FileData * fd ;
ID * id ;
} tConstraintLinkData ;
/* callback function used to relink constraint ID-links */
2010-10-16 02:40:31 +00:00
static void lib_link_constraint_cb ( bConstraint * UNUSED ( con ) , ID * * idpoin , void * userdata )
2010-02-06 11:50:39 +00:00
{
tConstraintLinkData * cld = ( tConstraintLinkData * ) userdata ;
* idpoin = newlibadr ( cld - > fd , cld - > id - > lib , * idpoin ) ;
}
2002-10-12 11:37:38 +00:00
static void lib_link_constraints ( FileData * fd , ID * id , ListBase * conlist )
{
2010-02-06 11:50:39 +00:00
tConstraintLinkData cld ;
2002-10-12 11:37:38 +00:00
bConstraint * con ;
2010-02-06 11:50:39 +00:00
/* legacy fixes */
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 ;
}
2007-11-28 12:11:06 +00:00
/* own ipo, all constraints have it */
2009-01-19 02:26:46 +00:00
con - > ipo = newlibadr_us ( fd , id - > lib , con - > ipo ) ; // XXX depreceated - old animation system
2010-02-06 11:50:39 +00:00
}
/* relink all ID-blocks used by the constraints */
cld . fd = fd ;
cld . id = id ;
id_loop_constraints ( conlist , lib_link_constraint_cb , & cld ) ;
}
static void direct_link_constraints ( FileData * fd , ListBase * lb )
{
bConstraint * con ;
link_list ( fd , lb ) ;
for ( con = lb - > first ; con ; con = con - > next ) {
con - > data = newdataadr ( fd , con - > data ) ;
2007-11-28 12:11:06 +00:00
2002-10-12 11:37:38 +00:00
switch ( con - > type ) {
2010-02-06 11:50:39 +00:00
case CONSTRAINT_TYPE_PYTHON :
2007-06-18 07:41:21 +00:00
{
2010-02-06 11:50:39 +00:00
bPythonConstraint * data = con - > data ;
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
2010-02-06 11:50:39 +00:00
link_list ( fd , & data - > targets ) ;
data - > prop = newdataadr ( fd , data - > prop ) ;
if ( data - > prop )
IDP_DirectLinkProperty ( data - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
}
2010-02-06 11:50:39 +00:00
break ;
case CONSTRAINT_TYPE_SPLINEIK :
2006-02-19 17:42:20 +00:00
{
2010-02-06 11:50:39 +00:00
bSplineIKConstraint * data = con - > data ;
data - > points = newdataadr ( fd , data - > points ) ;
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
}
2010-02-06 11:50:39 +00:00
break ;
case CONSTRAINT_TYPE_KINEMATIC :
2002-10-12 11:37:38 +00:00
{
2009-09-24 21:22:24 +00:00
con - > lin_error = 0.f ;
con - > rot_error = 0.f ;
2002-10-12 11:37:38 +00:00
}
2010-02-06 11:50:39 +00:00
break ;
2009-11-01 11:29:40 +00:00
}
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
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 ;
2006-11-11 16:45:17 +00:00
int rebuild ;
2006-03-07 21:50:26 +00:00
if ( ! pose | | ! arm )
2002-10-12 11:37:38 +00:00
return ;
2006-11-30 21:40:11 +00:00
2010-11-24 14:05:53 +00:00
2006-11-30 21:40:11 +00:00
/* always rebuild to match proxy or lib changes */
rebuild = ob - > proxy | | ( ob - > id . lib = = NULL & & arm - > id . lib ) ;
2002-10-12 11:37:38 +00:00
2010-11-24 14:05:53 +00:00
if ( ob - > proxy ) {
/* sync proxy layer */
if ( pose - > proxy_layer )
arm - > layer = pose - > proxy_layer ;
/* sync proxy active bone */
if ( pose - > proxy_act_bone [ 0 ] ) {
Bone * bone = get_named_bone ( arm , pose - > proxy_act_bone ) ;
if ( bone )
arm - > act_bone = bone ;
}
2010-05-04 12:31:24 +00:00
}
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 ) ;
2006-11-11 16:45:17 +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 ) ;
2006-11-11 16:45:17 +00:00
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 ;
2006-11-11 16:45:17 +00:00
else if ( ob - > id . lib = = NULL & & arm - > id . lib ) {
/* local pose selection copied to armature, bit hackish */
2009-11-09 21:03:54 +00:00
pchan - > bone - > flag & = ~ BONE_SELECTED ;
2006-11-11 16:45:17 +00:00
pchan - > bone - > flag | = pchan - > selectflag ;
}
2005-12-14 20:36:04 +00:00
}
2006-11-11 16:45:17 +00:00
2005-12-14 20:36:04 +00:00
if ( rebuild ) {
2010-07-05 03:55:28 +00:00
ob - > recalc = OB_RECALC_ALL ;
2005-12-14 20:36:04 +00:00
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 ) {
2009-09-21 06:43:20 +00:00
if ( arm - > adt ) lib_link_animdata ( fd , & arm - > id , arm - > adt ) ;
2002-10-12 11:37:38 +00:00
arm - > id . flag - = LIB_NEEDLINK ;
}
arm = arm - > id . next ;
}
}
static void direct_link_bones ( FileData * fd , Bone * bone )
{
Bone * child ;
bone - > parent = newdataadr ( fd , bone - > parent ) ;
2009-10-28 15:33:45 +00:00
bone - > prop = newdataadr ( fd , bone - > prop ) ;
if ( bone - > prop )
IDP_DirectLinkProperty ( bone - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2009-11-09 23:41:48 +00:00
bone - > flag & = ~ BONE_DRAW_ACTIVE ;
2002-10-12 11:37:38 +00:00
link_list ( fd , & bone - > childbase ) ;
2009-10-28 15:33:45 +00:00
for ( child = bone - > childbase . first ; child ; child = child - > next )
2002-10-12 11:37:38 +00:00
direct_link_bones ( fd , child ) ;
}
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 ) ;
2009-01-02 19:10:35 +00:00
arm - > edbo = NULL ;
2009-07-19 02:26:01 +00:00
arm - > sketch = NULL ;
2009-11-26 03:43:39 +00:00
2009-09-21 06:43:20 +00:00
arm - > adt = newdataadr ( fd , arm - > adt ) ;
2009-11-26 03:43:39 +00:00
direct_link_animdata ( fd , arm - > adt ) ;
2009-01-02 19:10:35 +00:00
2002-10-12 11:37:38 +00:00
bone = arm - > bonebase . first ;
while ( bone ) {
direct_link_bones ( fd , bone ) ;
bone = bone - > next ;
}
2009-11-09 21:03:54 +00:00
arm - > act_bone = newdataadr ( fd , arm - > act_bone ) ;
arm - > act_edbone = NULL ;
2002-10-12 11:37:38 +00:00
}
/* ************ 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 ) {
2009-01-19 02:26:46 +00:00
if ( ca - > adt ) lib_link_animdata ( fd , & ca - > id , ca - > adt ) ;
ca - > ipo = newlibadr_us ( fd , ca - > id . lib , ca - > ipo ) ; // XXX depreceated - old animation system
2007-09-23 18:27:01 +00:00
ca - > dof_ob = newlibadr_us ( fd , ca - > id . lib , ca - > dof_ob ) ;
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 )
{
2009-01-19 02:26:46 +00:00
ca - > adt = newdataadr ( fd , ca - > adt ) ;
direct_link_animdata ( fd , ca - > adt ) ;
2002-10-12 11:37:38 +00:00
}
2004-06-23 18:22:51 +00:00
2002-10-12 11:37:38 +00:00
/* ************ 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 ) {
2009-01-19 02:26:46 +00:00
if ( la - > adt ) lib_link_animdata ( fd , & la - > id , la - > adt ) ;
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 ) ;
}
}
2009-01-19 02:26:46 +00:00
la - > ipo = newlibadr_us ( fd , la - > id . lib , la - > ipo ) ; // XXX depreceated - old animation system
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 ;
2009-01-19 02:26:46 +00:00
la - > adt = newdataadr ( fd , la - > adt ) ;
direct_link_animdata ( fd , la - > adt ) ;
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 ] ) ;
}
* Extra lamp falloff options, including custom curve!
This adds some new lamp attenuation options to the Lamp panel, replacing the old 'Quad' button. Yes, the panel layout is still nasty here, but I've ignored it for now to address properly in the panels cleanup work.
* Constant
http://mke3.net/blender/devel/rendering/falloff-constant.jpg
Lamp doesn't decay with distance
* Inverse Linear
http://mke3.net/blender/devel/rendering/falloff-invlinear.jpg
Default, and same as in older Blender without 'Quad' on. Decays linearly, with 'Dist' value as the lamp's half-energy-distance
* Inverse Square
http://mke3.net/blender/devel/rendering/falloff-invsquare.jpg
A sharper, more realistic decay, good for most electric lights (i.e. not sunlight). This is similar to the old Quad option with slight changes.
* Lin/Quad weighted
Exactly the same as in older Blenders with the old 'Quad' button enabled. When this setting is chosen, two sliders are shown, 'Linear' and 'Quad' (previously Quad1 and Quad2), which controls the 'linearness' or 'quadraticness' of the falloff curve. Lamps in old files with the 'Quad' button on will be initialised to this setting.
But much better for precise control over the lamp falloff now is:
* Custom Curve
This shows an extra 'Falloff Curve' panel, where you can use the standard Blender curve UI control to precisely control how the light falls off. The Y axis is intensity, and the X axis is distance, stretched over the length of the 'Dist' value.
Some example curves and renders:
http://mke3.net/blender/devel/rendering/falloff-curve1-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve1.jpg
http://mke3.net/blender/devel/rendering/falloff-curve2-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve2.jpg
http://mke3.net/blender/devel/rendering/falloff-curve3-curve.png
http://mke3.net/blender/devel/rendering/falloff-curve3.jpg (whee)
2007-09-16 13:50:34 +00:00
la - > curfalloff = newdataadr ( fd , la - > curfalloff ) ;
if ( la - > curfalloff )
direct_link_curvemapping ( fd , la - > curfalloff ) ;
2007-09-02 17:25:03 +00:00
la - > preview = direct_link_preview_image ( fd , la - > preview ) ;
2002-10-12 11:37:38 +00:00
}
/* ************ 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 ) {
2009-02-20 16:39:39 +00:00
if ( key - > adt ) lib_link_animdata ( fd , & key - > id , key - > adt ) ;
2009-01-19 02:26:46 +00:00
key - > ipo = newlibadr_us ( fd , key - > id . lib , key - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
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
2009-01-19 02:26:46 +00:00
key - > adt = newdataadr ( fd , key - > adt ) ;
direct_link_animdata ( fd , key - > adt ) ;
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 ) {
2009-08-03 13:09:23 +00:00
if ( mb - > adt ) lib_link_animdata ( fd , & mb - > id , mb - > adt ) ;
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 ] ) ;
2009-01-19 02:26:46 +00:00
mb - > ipo = newlibadr_us ( fd , mb - > id . lib , mb - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
mb - > id . flag - = LIB_NEEDLINK ;
}
mb = mb - > id . next ;
}
}
static void direct_link_mball ( FileData * fd , MetaBall * mb )
{
2009-08-03 13:09:23 +00:00
mb - > adt = newdataadr ( fd , mb - > adt ) ;
direct_link_animdata ( fd , mb - > adt ) ;
2002-10-12 11:37:38 +00:00
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
2009-01-02 19:10:35 +00:00
mb - > disp . first = mb - > disp . last = NULL ;
mb - > editelems = NULL ;
mb - > bb = NULL ;
2009-07-29 12:35:09 +00:00
/* mb->edit_elems.first= mb->edit_elems.last= NULL;*/
mb - > lastelem = NULL ;
2002-10-12 11:37:38 +00:00
}
/* ************ 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 ) {
2009-01-19 02:26:46 +00:00
if ( wrld - > adt ) lib_link_animdata ( fd , & wrld - > id , wrld - > adt ) ;
wrld - > ipo = newlibadr_us ( fd , wrld - > id . lib , wrld - > ipo ) ; // XXX depreceated - old animation system
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 ) ;
}
}
2009-01-19 02:26:46 +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 ;
2009-01-19 02:26:46 +00:00
wrld - > adt = newdataadr ( fd , wrld - > adt ) ;
direct_link_animdata ( fd , wrld - > adt ) ;
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 ] ) ;
}
2007-09-02 17:25:03 +00:00
wrld - > preview = direct_link_preview_image ( fd , wrld - > preview ) ;
2002-10-12 11:37:38 +00:00
}
/* ************ READ VFONT ***************** */
2010-10-16 02:40:31 +00:00
static void lib_link_vfont ( FileData * UNUSED ( fd ) , Main * main )
2002-10-12 11:37:38 +00:00
{
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 ****************** */
2010-10-16 02:40:31 +00:00
static void lib_link_text ( FileData * UNUSED ( fd ) , Main * main )
2002-10-12 11:37:38 +00:00
{
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 ) ;
2008-08-04 23:01:47 +00:00
link_list ( fd , & text - > markers ) ;
2003-03-25 15:54:46 +00:00
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
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
text - > flags = ( text - > flags ) & ~ TXT_ISEXT ;
2003-03-25 15:54:46 +00:00
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 ) {
2006-11-17 06:14:15 +00:00
if ( ima - > id . properties ) IDP_LibLinkProperty ( ima - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
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 ;
}
}
2006-12-20 17:57:56 +00:00
static void link_ibuf_list ( FileData * fd , ListBase * lb )
{
Link * ln , * prev ;
if ( lb - > first = = NULL ) return ;
lb - > first = newimaadr ( fd , lb - > first ) ;
ln = lb - > first ;
prev = NULL ;
while ( ln ) {
ln - > next = newimaadr ( fd , ln - > next ) ;
ln - > prev = prev ;
prev = ln ;
ln = ln - > next ;
}
lb - > last = prev ;
}
2002-10-12 11:37:38 +00:00
static void direct_link_image ( FileData * fd , Image * ima )
{
2006-11-10 10:17:04 +00:00
/* for undo system, pointers could be restored */
2006-12-20 17:57:56 +00:00
if ( fd - > imamap )
link_ibuf_list ( fd , & ima - > ibufs ) ;
else
ima - > ibufs . first = ima - > ibufs . last = NULL ;
/* if not restored, we keep the binded opengl index */
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
if ( ima - > ibufs . first = = NULL ) {
2006-11-10 10:17:04 +00:00
ima - > bindcode = 0 ;
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
ima - > gputexture = NULL ;
}
2006-11-10 10:17:04 +00:00
ima - > anim = NULL ;
2006-12-20 17:57:56 +00:00
ima - > rr = NULL ;
2006-11-10 10:17:04 +00:00
ima - > repbind = NULL ;
2010-03-27 15:35:34 +00:00
memset ( ima - > renders , 0 , sizeof ( ima - > renders ) ) ;
ima - > last_render_slot = ima - > render_slot ;
2006-11-10 10:17:04 +00:00
2002-10-12 11:37:38 +00:00
ima - > packedfile = direct_link_packedfile ( fd , ima - > packedfile ) ;
2006-06-05 11:07:15 +00:00
ima - > preview = direct_link_preview_image ( fd , ima - > preview ) ;
2002-10-12 11:37:38 +00:00
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 ) {
2009-02-20 16:39:39 +00:00
if ( cu - > adt ) lib_link_animdata ( fd , & cu - > id , cu - > adt ) ;
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
2009-01-19 02:26:46 +00:00
cu - > ipo = newlibadr_us ( fd , cu - > id . lib , cu - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
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 ;
2009-01-19 02:26:46 +00:00
cu - > adt = newdataadr ( fd , cu - > adt ) ;
direct_link_animdata ( fd , cu - > adt ) ;
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
2010-09-29 12:46:26 +00:00
if ( cu - > vfont = = NULL ) link_list ( fd , & ( cu - > nurb ) ) ;
2002-10-12 11:37:38 +00:00
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
2008-12-31 17:11:42 +00:00
cu - > bev . first = cu - > bev . last = NULL ;
cu - > disp . first = cu - > disp . last = NULL ;
2009-01-02 19:10:35 +00:00
cu - > editnurb = NULL ;
2010-04-30 04:48:40 +00:00
cu - > lastsel = NULL ;
2008-12-31 17:11:42 +00:00
cu - > path = NULL ;
2009-01-23 14:43:25 +00:00
cu - > editfont = NULL ;
2009-01-02 19:10:35 +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 ) ;
2010-09-29 12:46:26 +00:00
if ( cu - > vfont = = NULL ) 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 ) {
2009-02-20 16:39:39 +00:00
if ( tex - > adt ) lib_link_animdata ( fd , & tex - > id , tex - > adt ) ;
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 ) ;
2009-11-04 08:44:42 +00:00
if ( tex - > pd )
2009-08-17 22:09:36 +00:00
tex - > pd - > object = newlibadr ( fd , tex - > id . lib , tex - > pd - > object ) ;
2009-08-13 05:21:25 +00:00
if ( tex - > vd ) tex - > vd - > object = newlibadr ( fd , tex - > id . lib , tex - > vd - > object ) ;
2004-06-23 18:22:51 +00:00
2008-11-12 22:03:11 +00:00
if ( tex - > nodetree )
lib_link_ntree ( fd , & tex - > id , tex - > nodetree ) ;
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 )
{
2009-01-19 02:26:46 +00:00
tex - > adt = newdataadr ( fd , tex - > adt ) ;
direct_link_animdata ( fd , tex - > adt ) ;
2002-10-12 11:37:38 +00:00
tex - > plugin = newdataadr ( fd , tex - > plugin ) ;
if ( tex - > plugin ) {
tex - > plugin - > handle = 0 ;
open_plugin_tex ( tex - > plugin ) ;
2006-11-22 15:53:46 +00:00
/* initialize data for this instance, if an initialization
* function exists .
*/
if ( tex - > plugin - > instance_init )
tex - > plugin - > instance_init ( ( void * ) tex - > plugin - > data ) ;
2002-10-12 11:37:38 +00:00
}
tex - > coba = newdataadr ( fd , tex - > coba ) ;
tex - > env = newdataadr ( fd , tex - > env ) ;
if ( tex - > env ) {
2006-12-20 17:57:56 +00:00
tex - > env - > ima = NULL ;
2002-10-12 11:37:38 +00:00
memset ( tex - > env - > cube , 0 , 6 * sizeof ( void * ) ) ;
tex - > env - > ok = 0 ;
}
* Volumetrics
Removed all the old particle rendering code and options I had in there
before, in order to make way for...
A new procedural texture: 'Point Density'
Point Density is a 3d texture that find the density of a group of 'points'
in space and returns that in the texture as an intensity value. Right now,
its at an early stage and it's only enabled for particles, but it would be
cool to extend it later for things like object vertices, or point cache
files from disk - i.e. to import point cloud data into Blender for
rendering volumetrically.
Currently there are just options for an Object and its particle system
number, this is the particle system that will get cached before rendering,
and then used for the texture's density estimation.
It works totally consistent with as any other procedural texture, so
previously where I've mapped a clouds texture to volume density to make
some of those test renders, now I just map a point density texture to
volume density.
Here's a version of the same particle smoke test file from before, updated
to use the point density texture instead:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test02.blend
There are a few cool things about implementing this as a texture:
- The one texture (and cache) can be instanced across many different
materials:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_instanced.png
This means you can calculate and bake one particle system, but render it
multiple times across the scene, with different material settings, at no
extra memory cost.
Right now, the particles are cached in world space, so you have to map it
globally, and if you want it offset, you have to do it in the material (as
in the file above). I plan to add an option to bake in local space, so you
can just map the texture to local and it just works.
- It also works for solid surfaces too, it just gets the density at that
particular point on the surface, eg:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_solid.mov
- You can map it to whatever you want, not only density but the various
emissions and colours as well. I'd like to investigate using the other
outputs in the texture too (like the RGB or normal outputs), perhaps with
options to colour by particle age, generating normals for making particle
'dents' in a surface, whatever!
2008-09-28 08:00:22 +00:00
tex - > pd = newdataadr ( fd , tex - > pd ) ;
if ( tex - > pd ) {
tex - > pd - > point_tree = NULL ;
2008-11-09 01:16:12 +00:00
tex - > pd - > coba = newdataadr ( fd , tex - > pd - > coba ) ;
* Volumetrics
Removed all the old particle rendering code and options I had in there
before, in order to make way for...
A new procedural texture: 'Point Density'
Point Density is a 3d texture that find the density of a group of 'points'
in space and returns that in the texture as an intensity value. Right now,
its at an early stage and it's only enabled for particles, but it would be
cool to extend it later for things like object vertices, or point cache
files from disk - i.e. to import point cloud data into Blender for
rendering volumetrically.
Currently there are just options for an Object and its particle system
number, this is the particle system that will get cached before rendering,
and then used for the texture's density estimation.
It works totally consistent with as any other procedural texture, so
previously where I've mapped a clouds texture to volume density to make
some of those test renders, now I just map a point density texture to
volume density.
Here's a version of the same particle smoke test file from before, updated
to use the point density texture instead:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test02.blend
There are a few cool things about implementing this as a texture:
- The one texture (and cache) can be instanced across many different
materials:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_instanced.png
This means you can calculate and bake one particle system, but render it
multiple times across the scene, with different material settings, at no
extra memory cost.
Right now, the particles are cached in world space, so you have to map it
globally, and if you want it offset, you have to do it in the material (as
in the file above). I plan to add an option to bake in local space, so you
can just map the texture to local and it just works.
- It also works for solid surfaces too, it just gets the density at that
particular point on the surface, eg:
http://mke3.net/blender/devel/rendering/volumetrics/pointdensity_solid.mov
- You can map it to whatever you want, not only density but the various
emissions and colours as well. I'd like to investigate using the other
outputs in the texture too (like the RGB or normal outputs), perhaps with
options to colour by particle age, generating normals for making particle
'dents' in a surface, whatever!
2008-09-28 08:00:22 +00:00
}
2008-11-12 19:03:50 +00:00
* Volume Rendering: Voxel data
This commit introduces a new texture ('Voxel Data'), used to load up saved voxel
data sets for rendering, contributed by Raúl 'farsthary' Fernández Hernández
with some additional tweaks. Thanks, Raúl!
The texture works similar to the existing point density texture, currently it
only provides intensity information, which can then be mapped (for example) to
density in a volume material. This is an early version, intended to read the
voxel format saved by Raúl's command line simulators, in future revisions
there's potential for making a more full-featured 'Blender voxel file format',
and also for supporting other formats too.
Note: Due to some subtleties in Raúl's existing released simulators, in order
to load them correctly the voxel data texture, you'll need to raise the
'resolution' value by 2. So if you baked out the simulation at resolution 50,
enter 52 for the resolution in the texture panel. This can possibly be fixed in
the simulator later on.
Right now, the way the texture is mapped is just in the space 0,0,0 <-> 1,1,1
and it can appear rotated 90 degrees incorrectly. This will be tackled, for now,
probably the easiest way to map it is with and empty, using Map Input -> Object.
Smoke test: http://www.vimeo.com/2449270
One more note, trilinear interpolation seems a bit slow at the moment, we'll
look into this.
For curiosity, while testing/debugging this, I made a script that exports a mesh
to voxel data. Here's a test of grogan (www.kajimba.com) converted to voxels,
rendered as a volume: http://www.vimeo.com/2512028
The script is available here: http://mke3.net/projects/bpython/export_object_voxeldata.py
* Another smaller thing, brought back early ray termination (was disabled
previously for debugging) and made it user configurable. It now appears as a new
value in the volume material: 'Depth Cutoff'. For some background info on what
this does, check:
http://farsthary.wordpress.com/2008/12/11/cutting-down-render-times/
* Also some disabled work-in-progess code for light cache
2008-12-13 05:41:34 +00:00
tex - > vd = newdataadr ( fd , tex - > vd ) ;
if ( tex - > vd ) {
tex - > vd - > dataset = NULL ;
2010-06-01 06:07:22 +00:00
tex - > vd - > ok = 0 ;
* Volume Rendering: Voxel data
This commit introduces a new texture ('Voxel Data'), used to load up saved voxel
data sets for rendering, contributed by Raúl 'farsthary' Fernández Hernández
with some additional tweaks. Thanks, Raúl!
The texture works similar to the existing point density texture, currently it
only provides intensity information, which can then be mapped (for example) to
density in a volume material. This is an early version, intended to read the
voxel format saved by Raúl's command line simulators, in future revisions
there's potential for making a more full-featured 'Blender voxel file format',
and also for supporting other formats too.
Note: Due to some subtleties in Raúl's existing released simulators, in order
to load them correctly the voxel data texture, you'll need to raise the
'resolution' value by 2. So if you baked out the simulation at resolution 50,
enter 52 for the resolution in the texture panel. This can possibly be fixed in
the simulator later on.
Right now, the way the texture is mapped is just in the space 0,0,0 <-> 1,1,1
and it can appear rotated 90 degrees incorrectly. This will be tackled, for now,
probably the easiest way to map it is with and empty, using Map Input -> Object.
Smoke test: http://www.vimeo.com/2449270
One more note, trilinear interpolation seems a bit slow at the moment, we'll
look into this.
For curiosity, while testing/debugging this, I made a script that exports a mesh
to voxel data. Here's a test of grogan (www.kajimba.com) converted to voxels,
rendered as a volume: http://www.vimeo.com/2512028
The script is available here: http://mke3.net/projects/bpython/export_object_voxeldata.py
* Another smaller thing, brought back early ray termination (was disabled
previously for debugging) and made it user configurable. It now appears as a new
value in the volume material: 'Depth Cutoff'. For some background info on what
this does, check:
http://farsthary.wordpress.com/2008/12/11/cutting-down-render-times/
* Also some disabled work-in-progess code for light cache
2008-12-13 05:41:34 +00:00
}
2008-11-12 22:03:11 +00:00
tex - > nodetree = newdataadr ( fd , tex - > nodetree ) ;
if ( tex - > nodetree )
direct_link_nodetree ( fd , tex - > nodetree ) ;
2007-09-02 17:25:03 +00:00
tex - > preview = direct_link_preview_image ( fd , tex - > preview ) ;
2006-12-20 17:57:56 +00:00
tex - > iuser . ok = 1 ;
2002-10-12 11:37:38 +00:00
}
/* ************ READ MATERIAL ***************** */
static void lib_link_material ( FileData * fd , Main * main )
{
Material * ma ;
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 ) {
2009-02-20 16:39:39 +00:00
if ( ma - > adt ) lib_link_animdata ( fd , & ma - > id , ma - > adt ) ;
2006-11-17 04:46:48 +00:00
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
of library blocks that implement this . */
if ( ma - > id . properties ) IDP_LibLinkProperty ( ma - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
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 ) ;
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
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 ) ;
}
}
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
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
if ( ma - > nodetree )
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
lib_link_ntree ( fd , & ma - > id , ma - > nodetree ) ;
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
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
2009-01-19 02:26:46 +00:00
ma - > adt = newdataadr ( fd , ma - > adt ) ;
direct_link_animdata ( fd , ma - > adt ) ;
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: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
ma - > nodetree = newdataadr ( fd , ma - > nodetree ) ;
if ( ma - > nodetree )
direct_link_nodetree ( fd , ma - > nodetree ) ;
2007-09-02 17:25:03 +00:00
ma - > preview = direct_link_preview_image ( fd , ma - > preview ) ;
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
ma - > gpumaterial . first = ma - > gpumaterial . last = NULL ;
2002-10-12 11:37:38 +00:00
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
/* ************ READ PARTICLE SETTINGS ***************** */
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
static void direct_link_pointcache ( FileData * fd , PointCache * cache )
{
2009-06-21 10:16:52 +00:00
if ( ( cache - > flag & PTCACHE_DISK_CACHE ) = = 0 ) {
PTCacheMem * pm ;
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
int i ;
2009-06-21 10:16:52 +00:00
link_list ( fd , & cache - > mem_cache ) ;
pm = cache - > mem_cache . first ;
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
for ( ; pm ; pm = pm - > next ) {
if ( pm - > index_array )
pm - > index_array = newdataadr ( fd , pm - > index_array ) ;
for ( i = 0 ; i < BPHYS_TOT_DATA ; i + + ) {
if ( pm - > data [ i ] & & pm - > data_types & ( 1 < < i ) )
pm - > data [ i ] = newdataadr ( fd , pm - > data [ i ] ) ;
}
}
2009-06-21 10:16:52 +00:00
}
2009-07-12 23:38:47 +00:00
else
cache - > mem_cache . first = cache - > mem_cache . last = NULL ;
2009-08-29 15:20:36 +00:00
cache - > flag & = ~ PTCACHE_SIMULATION_VALID ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
cache - > simframe = 0 ;
2009-08-29 15:20:36 +00:00
cache - > edit = NULL ;
cache - > free_edit = NULL ;
2010-09-27 09:58:37 +00:00
cache - > cached_frames = NULL ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
}
2010-11-30 21:31:18 +00:00
static void direct_link_pointcache_list ( FileData * fd , ListBase * ptcaches , PointCache * * ocache , int force_disk )
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
{
PointCache * cache ;
if ( ptcaches - > first ) {
link_list ( fd , ptcaches ) ;
2010-11-30 21:31:18 +00:00
for ( cache = ptcaches - > first ; cache ; cache = cache - > next ) {
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
direct_link_pointcache ( fd , cache ) ;
2010-11-30 21:31:18 +00:00
if ( force_disk ) {
cache - > flag | = PTCACHE_DISK_CACHE ;
cache - > step = 1 ;
}
}
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
* ocache = newdataadr ( fd , * ocache ) ;
}
else if ( * ocache ) {
2009-08-12 17:39:11 +00:00
/* old "single" caches need to be linked too */
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
* ocache = newdataadr ( fd , * ocache ) ;
direct_link_pointcache ( fd , * ocache ) ;
2010-11-30 21:31:18 +00:00
if ( force_disk ) {
( * ocache ) - > flag | = PTCACHE_DISK_CACHE ;
cache - > step = 1 ;
}
2009-08-12 17:39:11 +00:00
ptcaches - > first = ptcaches - > last = * ocache ;
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
}
}
2009-12-18 13:08:11 +00:00
void lib_link_partdeflect ( FileData * fd , ID * id , PartDeflect * pd )
{
if ( pd & & pd - > tex )
pd - > tex = newlibadr_us ( fd , id - > lib , pd - > tex ) ;
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
static void lib_link_particlesettings ( FileData * fd , Main * main )
{
ParticleSettings * part ;
2009-10-05 13:25:56 +00:00
ParticleDupliWeight * dw ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part = main - > particle . first ;
while ( part ) {
if ( part - > id . flag & LIB_NEEDLINK ) {
2009-06-24 02:11:36 +00:00
if ( part - > adt ) lib_link_animdata ( fd , & part - > id , part - > adt ) ;
2009-01-19 02:26:46 +00:00
part - > ipo = newlibadr_us ( fd , part - > id . lib , part - > ipo ) ; // XXX depreceated - old animation system
2009-06-24 02:11:36 +00:00
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > dup_ob = newlibadr ( fd , part - > id . lib , part - > dup_ob ) ;
part - > dup_group = newlibadr ( fd , part - > id . lib , part - > dup_group ) ;
part - > eff_group = newlibadr ( fd , part - > id . lib , part - > eff_group ) ;
part - > bb_ob = newlibadr ( fd , part - > id . lib , part - > bb_ob ) ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
2009-12-18 13:08:11 +00:00
lib_link_partdeflect ( fd , & part - > id , part - > pd ) ;
lib_link_partdeflect ( fd , & part - > id , part - > pd2 ) ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
if ( part - > effector_weights )
part - > effector_weights - > group = newlibadr ( fd , part - > id . lib , part - > effector_weights - > group ) ;
2009-10-05 13:25:56 +00:00
dw = part - > dupliweights . first ;
for ( ; dw ; dw = dw - > next )
dw - > ob = newlibadr ( fd , part - > id . lib , dw - > ob ) ;
2009-07-20 23:52:53 +00:00
if ( part - > boids ) {
BoidState * state = part - > boids - > states . first ;
BoidRule * rule ;
for ( ; state ; state = state - > next ) {
rule = state - > rules . first ;
for ( ; rule ; rule = rule - > next )
switch ( rule - > type ) {
case eBoidRuleType_Goal :
case eBoidRuleType_Avoid :
{
BoidRuleGoalAvoid * brga = ( BoidRuleGoalAvoid * ) rule ;
brga - > ob = newlibadr ( fd , part - > id . lib , brga - > ob ) ;
break ;
}
case eBoidRuleType_FollowLeader :
{
BoidRuleFollowLeader * brfl = ( BoidRuleFollowLeader * ) rule ;
brfl - > ob = newlibadr ( fd , part - > id . lib , brfl - > ob ) ;
break ;
}
}
}
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > id . flag - = LIB_NEEDLINK ;
}
part = part - > id . next ;
}
}
2009-12-18 13:08:11 +00:00
static void direct_link_partdeflect ( PartDeflect * pd )
{
if ( pd ) pd - > rng = NULL ;
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
static void direct_link_particlesettings ( FileData * fd , ParticleSettings * part )
{
2009-06-24 02:11:36 +00:00
part - > adt = newdataadr ( fd , part - > adt ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > pd = newdataadr ( fd , part - > pd ) ;
2008-08-30 14:32:16 +00:00
part - > pd2 = newdataadr ( fd , part - > pd2 ) ;
2009-07-20 23:52:53 +00:00
2010-03-14 20:18:15 +00:00
direct_link_animdata ( fd , part - > adt ) ;
2009-12-18 13:08:11 +00:00
direct_link_partdeflect ( part - > pd ) ;
direct_link_partdeflect ( part - > pd2 ) ;
2009-12-14 19:17:27 +00:00
part - > effector_weights = newdataadr ( fd , part - > effector_weights ) ;
if ( ! part - > effector_weights )
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
part - > effector_weights = BKE_add_effector_weights ( part - > eff_group ) ;
2009-10-05 13:25:56 +00:00
link_list ( fd , & part - > dupliweights ) ;
2009-07-20 23:52:53 +00:00
part - > boids = newdataadr ( fd , part - > boids ) ;
2010-04-04 12:29:06 +00:00
part - > fluid = newdataadr ( fd , part - > fluid ) ;
2009-07-20 23:52:53 +00:00
if ( part - > boids ) {
BoidState * state ;
link_list ( fd , & part - > boids - > states ) ;
for ( state = part - > boids - > states . first ; state ; state = state - > next ) {
link_list ( fd , & state - > rules ) ;
link_list ( fd , & state - > conditions ) ;
link_list ( fd , & state - > actions ) ;
}
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
}
2008-09-16 18:40:54 +00:00
static void lib_link_particlesystems ( FileData * fd , Object * ob , ID * id , ListBase * particles )
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
{
2008-09-16 16:20:51 +00:00
ParticleSystem * psys , * psysnext ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2008-09-16 16:20:51 +00:00
for ( psys = particles - > first ; psys ; psys = psysnext ) {
psysnext = psys - > next ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
psys - > part = newlibadr_us ( fd , id - > lib , psys - > part ) ;
2008-09-16 16:20:51 +00:00
if ( psys - > part ) {
2009-07-20 23:52:53 +00:00
ParticleTarget * pt = psys - > targets . first ;
2009-07-12 23:38:47 +00:00
2009-07-20 23:52:53 +00:00
for ( ; pt ; pt = pt - > next )
pt - > ob = newlibadr ( fd , id - > lib , pt - > ob ) ;
2009-07-12 23:38:47 +00:00
2010-06-09 02:42:20 +00:00
psys - > parent = newlibadr_us ( fd , id - > lib , psys - > parent ) ;
2008-09-16 16:20:51 +00:00
psys - > target_ob = newlibadr ( fd , id - > lib , psys - > target_ob ) ;
2010-02-04 16:54:25 +00:00
if ( psys - > clmd ) {
/* XXX - from reading existing code this seems correct but intended usage of
* pointcache should / w cloth should be added in ' ParticleSystem ' - campbell */
psys - > clmd - > point_cache = psys - > pointcache ;
psys - > clmd - > ptcaches . first = psys - > clmd - > ptcaches . last = NULL ;
2010-03-26 10:52:55 +00:00
psys - > clmd - > coll_parms - > group = newlibadr ( fd , id - > lib , psys - > clmd - > coll_parms - > group ) ;
2010-02-04 16:54:25 +00:00
}
2008-09-16 16:20:51 +00:00
}
else {
2008-09-16 18:40:54 +00:00
/* particle modifier must be removed before particle system */
ParticleSystemModifierData * psmd = psys_get_modifier ( ob , psys ) ;
BLI_remlink ( & ob - > modifiers , psmd ) ;
modifier_free ( ( ModifierData * ) psmd ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2008-09-16 16:20:51 +00:00
BLI_remlink ( particles , psys ) ;
MEM_freeN ( psys ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
}
}
}
static void direct_link_particlesystems ( FileData * fd , ListBase * particles )
{
ParticleSystem * psys ;
2009-07-20 23:52:53 +00:00
ParticleData * pa ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
int a ;
for ( psys = particles - > first ; psys ; psys = psys - > next ) {
psys - > particles = newdataadr ( fd , psys - > particles ) ;
2009-07-20 23:52:53 +00:00
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( psys - > particles & & psys - > particles - > hair ) {
2009-07-20 23:52:53 +00:00
for ( a = 0 , pa = psys - > particles ; a < psys - > totpart ; a + + , pa + + )
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
pa - > hair = newdataadr ( fd , pa - > hair ) ;
}
2009-07-20 23:52:53 +00:00
2008-01-17 00:28:14 +00:00
if ( psys - > particles & & psys - > particles - > keys ) {
2009-07-20 23:52:53 +00:00
for ( a = 0 , pa = psys - > particles ; a < psys - > totpart ; a + + , pa + + ) {
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
pa - > keys = NULL ;
pa - > totkey = 0 ;
}
psys - > flag & = ~ PSYS_KEYED ;
2008-01-17 00:28:14 +00:00
}
2009-07-20 23:52:53 +00:00
2009-08-22 17:11:36 +00:00
if ( psys - > particles & & psys - > particles - > boid ) {
2009-07-20 23:52:53 +00:00
pa = psys - > particles ;
pa - > boid = newdataadr ( fd , pa - > boid ) ;
for ( a = 1 , pa + + ; a < psys - > totpart ; a + + , pa + + )
pa - > boid = ( pa - 1 ) - > boid + 1 ;
}
else {
for ( a = 0 , pa = psys - > particles ; a < psys - > totpart ; a + + , pa + + )
pa - > boid = NULL ;
}
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
psys - > child = newdataadr ( fd , psys - > child ) ;
psys - > effectors = NULL ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2009-07-20 23:52:53 +00:00
link_list ( fd , & psys - > targets ) ;
2009-07-12 23:38:47 +00:00
2009-08-29 15:20:36 +00:00
psys - > edit = NULL ;
2009-02-25 19:29:58 +00:00
psys - > free_edit = NULL ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
psys - > pathcache = NULL ;
psys - > childcache = NULL ;
psys - > pathcachebufs . first = psys - > pathcachebufs . last = NULL ;
psys - > childcachebufs . first = psys - > childcachebufs . last = NULL ;
2009-09-17 22:00:49 +00:00
psys - > frand = NULL ;
psys - > pdd = NULL ;
2010-10-19 17:45:19 +00:00
psys - > renderdata = NULL ;
2010-06-09 02:42:20 +00:00
2010-11-30 21:31:18 +00:00
direct_link_pointcache_list ( fd , & psys - > ptcaches , & psys - > pointcache , 0 ) ;
2009-07-20 23:52:53 +00:00
2009-09-10 22:32:33 +00:00
if ( psys - > clmd ) {
psys - > clmd = newdataadr ( fd , psys - > clmd ) ;
psys - > clmd - > clothObject = NULL ;
psys - > clmd - > sim_parms = newdataadr ( fd , psys - > clmd - > sim_parms ) ;
2010-09-10 08:36:14 +00:00
psys - > clmd - > sim_parms - > effector_weights = NULL ;
2009-09-10 22:32:33 +00:00
psys - > clmd - > coll_parms = newdataadr ( fd , psys - > clmd - > coll_parms ) ;
if ( psys - > clmd - > sim_parms ) {
if ( psys - > clmd - > sim_parms - > presets > 10 )
psys - > clmd - > sim_parms - > presets = 0 ;
}
psys - > hair_in_dm = psys - > hair_out_dm = NULL ;
psys - > clmd - > point_cache = psys - > pointcache ;
}
2009-07-20 23:52:53 +00:00
psys - > tree = NULL ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
}
return ;
2002-10-12 11:37:38 +00:00
}
/* ************ READ MESH ***************** */
2006-11-21 16:54:00 +00:00
static void lib_link_mtface ( FileData * fd , Mesh * me , MTFace * mtface , int totface )
{
MTFace * tf = mtface ;
int i ;
for ( i = 0 ; i < totface ; i + + , tf + + ) {
tf - > tpage = newlibadr ( fd , me - > id . lib , tf - > tpage ) ;
if ( tf - > tpage & & tf - > tpage - > id . us = = 0 )
tf - > tpage - > id . us = 1 ;
}
}
2007-04-02 00:52:38 +00:00
static void lib_link_customdata_mtface ( FileData * fd , Mesh * me , CustomData * fdata , int totface )
{
int i ;
for ( i = 0 ; i < fdata - > totlayer ; i + + ) {
CustomDataLayer * layer = & fdata - > layers [ i ] ;
if ( layer - > type = = CD_MTFACE )
lib_link_mtface ( fd , me , layer - > data , totface ) ;
}
}
2002-10-12 11:37:38 +00:00
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 ;
2006-11-17 06:14:15 +00:00
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
of library blocks that implement this . */
if ( me - > id . properties ) IDP_LibLinkProperty ( me - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2010-02-02 18:24:10 +00:00
if ( me - > adt ) lib_link_animdata ( fd , & me - > id , me - > adt ) ;
2006-11-17 06:14:15 +00:00
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
2007-04-02 00:52:38 +00:00
lib_link_customdata_mtface ( fd , me , & me - > fdata , me - > totface ) ;
if ( me - > mr & & me - > mr - > levels . first )
lib_link_customdata_mtface ( fd , me , & me - > mr - > fdata ,
( ( MultiresLevel * ) me - > mr - > levels . first ) - > totface ) ;
2004-06-23 18:22:51 +00:00
2002-10-12 11:37:38 +00:00
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 ;
}
}
2009-11-25 14:27:50 +00:00
static void direct_link_mdisps ( FileData * fd , int count , MDisps * mdisps , int external )
2009-01-06 18:59:03 +00:00
{
if ( mdisps ) {
int i ;
for ( i = 0 ; i < count ; + + i ) {
mdisps [ i ] . disps = newdataadr ( fd , mdisps [ i ] . disps ) ;
2010-10-19 22:17:34 +00:00
if ( ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) & & ( mdisps [ i ] . disps ) ) {
/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
/* this does swap for data written at write_mdisps() - readfile.c */
int x ;
float * tmpdisps = * mdisps [ i ] . disps ;
for ( x = 0 ; x < mdisps [ i ] . totdisp * 3 ; x + + ) {
SWITCH_INT ( * tmpdisps ) ;
tmpdisps + + ;
}
}
2009-11-25 14:27:50 +00:00
if ( ! external & & ! mdisps [ i ] . disps )
2009-01-06 18:59:03 +00:00
mdisps [ i ] . totdisp = 0 ;
}
2010-10-19 22:17:34 +00:00
}
2009-01-06 18:59:03 +00:00
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
static void direct_link_customdata ( FileData * fd , CustomData * data , int count )
{
2006-12-04 23:27:53 +00:00
int i = 0 ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
data - > layers = newdataadr ( fd , data - > layers ) ;
2009-11-25 14:27:50 +00:00
data - > external = newdataadr ( fd , data - > external ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
while ( i < data - > totlayer ) {
CustomDataLayer * layer = & data - > layers [ i ] ;
2009-11-25 14:27:50 +00:00
if ( layer - > flag & CD_FLAG_EXTERNAL )
layer - > flag & = ~ CD_FLAG_IN_MEMORY ;
2007-01-06 20:16:06 +00:00
if ( CustomData_verify_versions ( data , i ) ) {
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
layer - > data = newdataadr ( fd , layer - > data ) ;
2009-01-06 18:59:03 +00:00
if ( layer - > type = = CD_MDISPS )
2009-11-25 14:27:50 +00:00
direct_link_mdisps ( fd , count , layer - > data , layer - > flag & CD_FLAG_EXTERNAL ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
i + + ;
}
}
}
2002-10-12 11:37:38 +00:00
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 ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
mesh - > mtface = newdataadr ( fd , mesh - > mtface ) ;
2002-10-12 11:37:38 +00:00
mesh - > mcol = newdataadr ( fd , mesh - > mcol ) ;
mesh - > msticky = newdataadr ( fd , mesh - > msticky ) ;
2004-07-08 20:38:27 +00:00
mesh - > dvert = newdataadr ( fd , mesh - > dvert ) ;
2007-01-16 06:49:57 +00:00
2010-07-27 06:06:36 +00:00
/* animdata */
2010-02-02 18:24:10 +00:00
mesh - > adt = newdataadr ( fd , mesh - > adt ) ;
direct_link_animdata ( fd , mesh - > adt ) ;
2007-01-16 06:49:57 +00:00
/* Partial-mesh visibility (do this before using totvert, totface, or totedge!) */
mesh - > pv = newdataadr ( fd , mesh - > pv ) ;
if ( mesh - > pv ) {
mesh - > pv - > vert_map = newdataadr ( fd , mesh - > pv - > vert_map ) ;
mesh - > pv - > edge_map = newdataadr ( fd , mesh - > pv - > edge_map ) ;
mesh - > pv - > old_faces = newdataadr ( fd , mesh - > pv - > old_faces ) ;
mesh - > pv - > old_edges = newdataadr ( fd , mesh - > pv - > old_edges ) ;
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
/* normally direct_link_dverts should be called in direct_link_customdata,
but for backwards compat in do_versions to work we do it here */
2007-01-16 06:49:57 +00:00
direct_link_dverts ( fd , mesh - > pv ? mesh - > pv - > totvert : mesh - > totvert , mesh - > dvert ) ;
2004-07-08 20:38:27 +00:00
2007-01-16 06:49:57 +00:00
direct_link_customdata ( fd , & mesh - > vdata , mesh - > pv ? mesh - > pv - > totvert : mesh - > totvert ) ;
direct_link_customdata ( fd , & mesh - > edata , mesh - > pv ? mesh - > pv - > totedge : mesh - > totedge ) ;
direct_link_customdata ( fd , & mesh - > fdata , mesh - > pv ? mesh - > pv - > totface : mesh - > totface ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
2007-08-11 20:45:27 +00:00
mesh - > bb = NULL ;
mesh - > mselect = NULL ;
2008-12-31 17:11:42 +00:00
mesh - > edit_mesh = NULL ;
2006-11-06 01:08:26 +00:00
/* Multires data */
mesh - > mr = newdataadr ( fd , mesh - > mr ) ;
if ( mesh - > mr ) {
MultiresLevel * lvl ;
2007-01-02 19:23:55 +00:00
2006-11-06 01:08:26 +00:00
link_list ( fd , & mesh - > mr - > levels ) ;
2006-12-03 22:15:50 +00:00
lvl = mesh - > mr - > levels . first ;
2007-01-02 19:23:55 +00:00
2006-12-03 22:15:50 +00:00
direct_link_customdata ( fd , & mesh - > mr - > vdata , lvl - > totvert ) ;
2007-01-02 19:23:55 +00:00
direct_link_dverts ( fd , lvl - > totvert , CustomData_get ( & mesh - > mr - > vdata , 0 , CD_MDEFORMVERT ) ) ;
2007-01-10 06:09:10 +00:00
direct_link_customdata ( fd , & mesh - > mr - > fdata , lvl - > totface ) ;
2007-01-02 19:23:55 +00:00
2009-06-21 02:51:42 +00:00
mesh - > mr - > edge_flags = newdataadr ( fd , mesh - > mr - > edge_flags ) ;
mesh - > mr - > edge_creases = newdataadr ( fd , mesh - > mr - > edge_creases ) ;
2007-06-01 02:21:11 +00:00
mesh - > mr - > verts = newdataadr ( fd , mesh - > mr - > verts ) ;
2007-01-02 19:28:54 +00:00
2006-12-03 22:15:50 +00:00
for ( ; lvl ; lvl = lvl - > next ) {
2006-11-06 01:08:26 +00:00
lvl - > verts = newdataadr ( fd , lvl - > verts ) ;
lvl - > faces = newdataadr ( fd , lvl - > faces ) ;
lvl - > edges = newdataadr ( fd , lvl - > edges ) ;
2007-01-10 06:09:10 +00:00
lvl - > colfaces = newdataadr ( fd , lvl - > colfaces ) ;
2006-11-06 01:08:26 +00:00
}
}
2009-06-08 20:08:19 +00:00
/* Gracefully handle corrupted mesh */
if ( mesh - > mr & & ! mesh - > mr - > verts ) {
/* If totals match, simply load the current mesh verts into multires */
if ( mesh - > totvert = = ( ( MultiresLevel * ) mesh - > mr - > levels . last ) - > totvert )
mesh - > mr - > verts = MEM_dupallocN ( mesh - > mvert ) ;
else {
/* Otherwise, we can't recover the data, silently remove multires */
multires_free ( mesh - > mr ) ;
mesh - > mr = NULL ;
2006-11-06 01:08:26 +00:00
}
}
2005-07-26 02:44:59 +00:00
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
if ( ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) & & mesh - > tface ) {
TFace * tf = mesh - > tface ;
2009-01-02 06:03:53 +00:00
unsigned int i ;
2004-06-23 18:22:51 +00:00
2007-01-16 06:49:57 +00:00
for ( i = 0 ; i < ( mesh - > pv ? mesh - > pv - > totface : mesh - > totface ) ; i + + , tf + + ) {
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
SWITCH_INT ( tf - > col [ 0 ] ) ;
SWITCH_INT ( tf - > col [ 1 ] ) ;
SWITCH_INT ( tf - > col [ 2 ] ) ;
SWITCH_INT ( tf - > col [ 3 ] ) ;
2002-10-12 11:37:38 +00:00
}
}
}
2006-09-03 12:16:14 +00:00
/* ************ READ LATTICE ***************** */
static void lib_link_latt ( FileData * fd , Main * main )
{
Lattice * lt ;
lt = main - > latt . first ;
while ( lt ) {
if ( lt - > id . flag & LIB_NEEDLINK ) {
2009-01-19 02:26:46 +00:00
lt - > ipo = newlibadr_us ( fd , lt - > id . lib , lt - > ipo ) ; // XXX depreceated - old animation system
2006-09-03 12:16:14 +00:00
lt - > key = newlibadr_us ( fd , lt - > id . lib , lt - > key ) ;
lt - > id . flag - = LIB_NEEDLINK ;
}
lt = lt - > id . next ;
}
}
static void direct_link_latt ( FileData * fd , Lattice * lt )
{
lt - > def = newdataadr ( fd , lt - > def ) ;
lt - > dvert = newdataadr ( fd , lt - > dvert ) ;
direct_link_dverts ( fd , lt - > pntsu * lt - > pntsv * lt - > pntsw , lt - > dvert ) ;
2009-01-02 19:10:35 +00:00
lt - > editlatt = NULL ;
2006-09-03 12:16:14 +00:00
}
2002-10-12 11:37:38 +00:00
/* ************ READ OBJECT ***************** */
2006-08-28 01:12:36 +00:00
static void lib_link_modifiers__linkModifiers ( void * userData , Object * ob ,
2010-03-22 09:30:00 +00:00
ID * * idpoin )
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
2006-08-28 01:12:36 +00:00
* idpoin = newlibadr ( fd , ob - > id . lib , * idpoin ) ;
2007-01-18 10:59:23 +00:00
/* hardcoded bad exception; non-object modifier data gets user count (texture, displace) */
if ( * idpoin & & GS ( ( * idpoin ) - > name ) ! = ID_OB )
( * idpoin ) - > us + + ;
- 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 ( FileData * fd , Object * ob )
{
2006-08-28 01:12:36 +00:00
modifiers_foreachIDLink ( 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 ) {
2006-11-17 04:46:48 +00:00
if ( ob - > id . properties ) IDP_LibLinkProperty ( ob - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2009-01-19 02:26:46 +00:00
if ( ob - > adt ) lib_link_animdata ( fd , & ob - > id , ob - > adt ) ;
// XXX depreceated - old animation system <<<
ob - > ipo = newlibadr_us ( fd , ob - > id . lib , ob - > ipo ) ;
ob - > action = newlibadr_us ( fd , ob - > id . lib , ob - > action ) ;
// >>> XXX depreceated - old animation system
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 ) ;
== PoseLib - Overhauled Implementation ==
Based on feedback from Ton, I've recoded the way "PoseLibs" are implemented/exposed. Therefore, quite a bit of code has been changed to fit this in better.
Now, ANY ACTION can be a "PoseLib". A set of Markers which belong to the Action (it's taken a year, but they're finally back), are used to tag "poses" in the Action. These markers are shown using diamond-shaped blue icons (designed by Matt Ebb) in three shades - unselected/normal, selected, active.
Notes:
* Each Armature Object has an Action which acts as a PoseLib.
* Improved UI presented in buttons panel for this
-- added proper buttons for action assigning
-- renamed "Validate PoseLib" to "Auto-Sync PoseLib" (this option auto-tags poses based on keyframes found)
Like in the 3d-view, use the hotkeys:
* Shift-L to add a local marker
* Ctrl-Shift-L to rename a local marker
* Alt-L to delete selected local markers
Note: transforms, etc. are not currently available with these markers
== PoseLib Preview ==
Added a few features here:
* Left/Right-Arrow keys now change the poses too (previous and next respectively)
* Up/Down-Arrow keys also change the poses, but "jump" to a pose 5 steps away in their respective directions
2007-12-30 12:08:28 +00:00
ob - > poselib = newlibadr_us ( fd , ob - > id . lib , ob - > poselib ) ;
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 ) ;
2006-11-30 15:54:21 +00:00
ob - > proxy = newlibadr_us ( fd , ob - > id . lib , ob - > proxy ) ;
if ( ob - > proxy ) {
/* paranoia check, actually a proxy_from pointer should never be written... */
if ( ob - > proxy - > id . lib = = NULL ) {
ob - > proxy - > proxy_from = NULL ;
ob - > proxy = NULL ;
2010-04-05 07:20:34 +00:00
if ( ob - > id . lib )
printf ( " Proxy lost from object %s lib %s \n " , ob - > id . name + 2 , ob - > id . lib - > name ) ;
else
printf ( " Proxy lost from object %s lib <NONE> \n " , ob - > id . name + 2 ) ;
2006-11-30 15:54:21 +00:00
}
else {
2006-11-14 15:27:43 +00:00
/* this triggers object_update to always use a copy */
2006-11-30 15:54:21 +00:00
ob - > proxy - > proxy_from = ob ;
2006-11-11 16:45:17 +00:00
/* force proxy updates after load/undo, a bit weak */
2010-07-05 03:55:28 +00:00
ob - > recalc = ob - > proxy - > recalc = OB_RECALC_ALL ;
2006-11-11 16:45:17 +00:00
}
2006-11-30 15:54:21 +00:00
}
ob - > proxy_group = newlibadr ( fd , ob - > id . lib , ob - > proxy_group ) ;
2009-01-19 02:26:46 +00:00
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 ) {
2010-02-19 13:13:21 +00:00
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. \n " , ob - > id . name + 2 ) ;
2002-10-12 11:37:38 +00:00
ob - > type = OB_EMPTY ;
warn = 1 ;
2010-02-19 13:13:21 +00:00
2006-11-30 16:44:34 +00:00
if ( ob - > pose ) {
== Bone Groups ==
I'm committing some work-in-progress code for "bone groups" now, as I there have been are some major bugs caused by the timeoffset stuff (some of my test files were not loading, and other files were showing all sorts of weird problems).
Anyway, in this commit, the following things for "bone groups" have been done:
* Bone groups are stored per armature (internally, this is per bPose block)
* Added controls for editing bone-groups per armature - "add", "remove", "rename". These can be found in the "Links and Materials" panel in PoseMode, beside the settings for PoseLib.
* Reorganised buttons for editing selected bones in PoseMode. I've replaced the "dist" and "weight" buttons (they existed in EditMode anyway) with a menu to choose the bone-group and the custom-shape-ob field. In the place of the old custom-shape-ob field, I've restored the "Hide" button. This might break muscle-memory a bit, but there isn't a lot of space to play with there.
Some stuff I'd been originally planning to do before committing:
* When adding keyframes for bones, an action-group with the same name as the bone's group will be added to the action, and the action-channel will be made a member of that.
* New action/bone groups have unique names (renaming/adding new should check if name exists before assigning it)
* There's a setting under Bone-Groups stuff which sets which custom-colour set is used to colour that group's bones. Currently, this is non-functional, as the necessary drawing code for armatures is not in place yet.
2008-01-20 02:55:35 +00:00
free_pose ( ob - > pose ) ;
2006-11-30 16:44:34 +00:00
ob - > pose = NULL ;
2009-08-16 03:24:23 +00:00
ob - > mode & = ~ OB_MODE_POSE ;
2006-11-30 16:44:34 +00:00
}
2002-10-12 11:37:38 +00:00
}
for ( a = 0 ; a < ob - > totcol ; a + + ) ob - > mat [ a ] = newlibadr_us ( fd , ob - > id . lib , ob - > mat [ a ] ) ;
2009-01-19 02:26:46 +00:00
2009-08-28 12:41:45 +00:00
ob - > gpd = newlibadr_us ( fd , ob - > id . lib , ob - > gpd ) ;
2010-03-23 14:47:40 +00:00
ob - > duplilist = NULL ;
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 */
2009-01-19 02:26:46 +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 ) ;
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system <<<
2002-10-12 11:37:38 +00:00
lib_link_constraint_channels ( fd , & ob - > id , & ob - > constraintChannels ) ;
2009-01-19 02:26:46 +00:00
lib_link_nlastrips ( fd , & ob - > id , & ob - > nlastrips ) ;
// >>> XXX depreceated - old animation system
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 ) {
2008-08-30 14:32:16 +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 ;
ts - > ma = newlibadr ( fd , ob - > id . lib , ts - > ma ) ;
}
else if ( sens - > type = = SENS_MESSAGE ) {
bMessageSensor * ms = sens - > data ;
ms - > fromObject =
2010-03-22 09:30:00 +00:00
newlibadr ( fd , ob - > id . lib , ms - > fromObject ) ;
2002-10-12 11:37:38 +00:00
}
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 ) {
2008-08-30 14:32:16 +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 ;
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_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 ) ;
}
2009-06-08 20:08:19 +00:00
else if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * oa = act - > data ;
oa - > reference = newlibadr ( fd , ob - > id . lib , oa - > reference ) ;
}
2002-10-12 11:37:38 +00:00
else if ( act - > type = = ACT_EDIT_OBJECT ) {
bEditObjectActuator * eoa = act - > data ;
if ( eoa = = NULL ) {
init_actuator ( act ) ;
}
2006-12-01 19:52:04 +00:00
else {
eoa - > ob = newlibadr ( fd , ob - > id . lib , eoa - > ob ) ;
eoa - > me = newlibadr ( fd , ob - > id . lib , eoa - > me ) ;
}
2002-10-12 11:37:38 +00:00
}
2009-06-08 20:08:19 +00:00
else if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * oa = act - > data ;
if ( oa = = NULL ) {
init_actuator ( act ) ;
}
else {
oa - > reference = newlibadr ( fd , ob - > id . lib , oa - > reference ) ;
}
}
2002-10-12 11:37:38 +00:00
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 ) ;
}
2008-06-18 06:46:49 +00:00
else if ( act - > type = = ACT_SHAPEACTION ) {
bActionActuator * aa = act - > data ;
aa - > act = newlibadr ( fd , ob - > id . lib , aa - > act ) ;
}
2002-10-12 11:37:38 +00:00
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 ) ;
}
2007-10-22 20:24:26 +00:00
else if ( act - > type = = ACT_2DFILTER ) {
2007-11-06 12:16:12 +00:00
bTwoDFilterActuator * _2dfa = act - > data ;
_2dfa - > text = newlibadr ( fd , ob - > id . lib , _2dfa - > text ) ;
2007-10-22 20:24:26 +00:00
}
2008-04-06 18:30:52 +00:00
else if ( act - > type = = ACT_PARENT ) {
bParentActuator * parenta = act - > data ;
parenta - > ob = newlibadr ( fd , ob - > id . lib , parenta - > ob ) ;
}
BGE patch: add state engine support in the logic bricks.
This patch introduces a simple state engine system with the logic bricks. This system features full
backward compatibility, multiple active states, multiple state transitions, automatic disabling of
sensor and actuators, full GUI support and selective display of sensors and actuators.
Note: Python API is available but not documented yet. It will be added asap.
State internals
===============
The state system is object based. The current state mask is stored in the object as a 32 bit value;
each bit set in the mask is an active state. The controllers have a state mask too but only one bit
can be set: a controller belongs to a single state. The game engine will only execute controllers
that belong to active states. Sensors and actuators don't have a state mask but are effectively
attached to states via their links to the controllers. Sensors and actuators can be connected to more
than one state. When a controller becomes inactive because of a state change, its links to sensors
and actuators are temporarily broken (until the state becomes active again). If an actuator gets isolated,
i.e all the links to controllers are broken, it is automatically disabled. If a sensor gets isolated,
the game engine will stop calling it to save CPU. It will also reset the sensor internal state so that
it can react as if the game just started when it gets reconnected to an active controller. For example,
an Always sensor in no pulse mode that is connected to a single state (i.e connected to one or more
controllers of a single state) will generate a pulse each time the state becomes active. This feature is
not available on all sensors, see the notes below.
GUI
===
This system system is fully configurable through the GUI: the object state mask is visible under the
object bar in the controller's colum as an array of buttons just like the 3D view layer mask.
Click on a state bit to only display the controllers of that state. You can select more than one state
with SHIFT-click. The All button sets all the bits so that you can see all the controllers of the object.
The Ini button sets the state mask back to the object default state. You can change the default state
of object by first selecting the desired state mask and storing using the menu under the State button.
If you define a default state mask, it will be loaded into the object state make when you load the blend
file or when you run the game under the blenderplayer. However, when you run the game under Blender,
the current selected state mask will be used as the startup state for the object. This allows you to test
specific state during the game design.
The controller display the state they belong to with a new button in the controller header. When you add
a new controller, it is added by default in the lowest enabled state. You can change the controller state
by clicking on the button and selecting another state. If more than one state is enabled in the object
state mask, controllers are grouped by state for more readibility.
The new Sta button in the sensor and actuator column header allows you to display only the sensors and
actuators that are linked to visible controllers.
A new state actuator is available to modify the state during the game. It defines a bit mask and
the operation to apply on the current object state mask:
Cpy: the bit mask is copied to the object state mask.
Add: the bits that set in the bit mask will be turned on in the object state mask.
Sub: the bits that set in the bit mask will be turned off in the object state mask.
Inv: the bits that set in the bit mask will be inverted in the objecyy state mask.
Notes
=====
- Although states have no name, a simply convention consists in using the name of the first controller
of the state as the state name. The GUI will support that convention by displaying as a hint the name
of the first controller of the state when you move the mouse over a state bit of the object state mask
or of the state actuator bit mask.
- Each object has a state mask and each object can have a state engine but if several objects are
part of a logical group, it is recommended to put the state engine only in the main object and to
link the controllers of that object to the sensors and actuators of the different objects.
- When loading an old blend file, the state mask of all objects and controllers are initialized to 1
so that all the controllers belong to this single state. This ensures backward compatibility with
existing game.
- When the state actuator is activated at the same time as other actuators, these actuators are
guaranteed to execute before being eventually disabled due to the state change. This is useful for
example to send a message or update a property at the time of changing the state.
- Sensors that depend on underlying resource won't reset fully when they are isolated. By the time they
are acticated again, they will behave as follow:
* keyboard sensor: keys already pressed won't be detected. The keyboard sensor is only sensitive
to new key press.
* collision sensor: objects already colliding won't be detected. Only new collisions are
detected.
* near and radar sensor: same as collision sensor.
2008-06-22 14:23:57 +00:00
else if ( act - > type = = ACT_STATE ) {
/* bStateActuator *statea = act->data; */
}
2009-09-24 21:22:24 +00:00
else if ( act - > type = = ACT_ARMATURE ) {
bArmatureActuator * arma = act - > data ;
arma - > target = newlibadr ( fd , ob - > id . lib , arma - > target ) ;
arma - > subtarget = newlibadr ( fd , ob - > id . lib , arma - > subtarget ) ;
}
2002-10-12 11:37:38 +00:00
act = act - > next ;
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2008-08-14 09:19:41 +00:00
{
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) modifiers_findByType ( ob , eModifierType_Fluidsim ) ;
if ( fluidmd & & fluidmd - > fss )
fluidmd - > fss - > ipo = newlibadr_us ( fd , ob - > id . lib , fluidmd - > fss - > ipo ) ;
Sorry for the big commit, but I've been fixing many of these
issues in parallel... So this commit contains: an update of
the solver (e.g. moving objects), integration of blender IPOs,
improved rendering (motion blur, smoothed normals) and a first particle
test. In more detail:
Solver update:
- Moving objects using a relatively simple model, and not yet fully optimized - ok
for box falling into water, water in a moving glass might cause trouble. Simulation
times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot
might also cause slowdowns.
- Additional obstacle settings: noslip (as before), free slip (move along wall freely)
and part slip (mix of both).
- Obstacle settings also added for domain boundaries now, the six walls of the domain are
obstacles after all as well
- Got rid of templates, should make compiling for e.g. macs more convenient,
for linux there's not much difference. Finally got rid of parser (and some other code
parts), the simulation now uses the internal API to transfer data.
- Some unnecessary file were removed, the GUI now needs 3 settings buttons...
This should still be changed (maybe by adding a new panel for domain objects).
IPOs:
- Animated params: viscosity, time and gravity for domains. In contrast
to normal time IPO for Blender objects, the fluidsim one scales the time
step size - so a constant 1 has no effect, values towards 0 slow it down,
larger ones speed the simulation up (-> longer time steps, more compuations).
The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect).
- For objects that are enabled for fluidsim, a new IPO type shows up. Inflow
objects can use the velocity channels to animate the inflow. Obstacles, in/outflow
objects can be switched on (Active IPO>0) and off (<0) during the simulation.
- Movement, rotation and scaling of those 3 types is exported from the normal
Blender channels (Loc,dLoc,etc.).
Particles:
- This is still experimental, so it might be deactivated for a
release... It should at some point be used to model smaller splashes,
depending on the the realworld size and the particle generation
settings particles are generated during simulation (stored in _particles_X.gz
files).
- These are loaded by enabling the particle field for an arbitrary object,
which should be given a halo material. For each frame, similar to the mesh
loading, the particle system them loads the simulated particle positions.
- For rendering, I "abused" the part->rt field - I couldnt find any use
for it in the code and it seems to work fine. The fluidsim particles
store their size there.
Rendering:
- The fluidims particles use scaled sizes and alpha values to give a more varied
appearance. In convertblender.c fluidsim particle systems use the p->rt field
to scale up the size and down the alpha of "smaller particles". Setting the
influence fields in the fluidims settings to 0 gives equally sized particles
with same alpha everywhere. Higher values cause larger differences.
- Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals
computed by the solver are used. This is basically done by switching off the
normal recalculation in convertblender.c (the function calc_fluidsimnormals
handles other mesh inits instead of calc_vertexnormals).
This could also be used to e.g. modify mesh normals in a modifier...
- Another change is that fluidsim meshes load the velocities computed
during the simulation for image based motion blur. This is inited in
load_fluidsimspeedvectors for the vector pass (they're loaded during the
normal load in DerivedMesh readBobjgz). Generation and loading can be switched
off in the settings. Vector pass currently loads the fluidism meshes 3 times,
so this should still be optimized.
Examples:
- smoothed normals versus normals from subdividing once:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png
- fluidsim particles, size/alpha influence 0:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png
size influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png
size & alpha influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png
- the standard drop with motion blur and particles:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg
(here's how it looks without
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg)
- another inflow animation (moving, switched on/off) with a moving obstacle
(and strong mblur :)
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg
Things still to fix:
- rotating & scaling domains causes wrong speed vectors
- get rid of SDL code for threading, use pthreads as well?
- update wiki documentation
- cool effects for rendering would be photon maps for caustics,
and motion blur for particles :)
2006-02-27 11:45:42 +00:00
}
2009-07-30 15:00:26 +00:00
{
SmokeModifierData * smd = ( SmokeModifierData * ) modifiers_findByType ( ob , eModifierType_Smoke ) ;
if ( smd & & smd - > type = = MOD_SMOKE_TYPE_DOMAIN & & smd - > domain )
{
smd - > domain - > coll_group = newlibadr_us ( fd , ob - > id . lib , smd - > domain - > coll_group ) ;
smd - > domain - > eff_group = newlibadr_us ( fd , ob - > id . lib , smd - > domain - > eff_group ) ;
smd - > domain - > fluid_group = newlibadr_us ( fd , ob - > id . lib , smd - > domain - > fluid_group ) ;
2009-10-08 10:18:14 +00:00
smd - > domain - > effector_weights - > group = newlibadr ( fd , ob - > id . lib , smd - > domain - > effector_weights - > group ) ;
2010-11-23 14:04:05 +00:00
smd - > domain - > flags | = MOD_SMOKE_FILE_LOAD ; /* flag for refreshing the simulation after loading */
2009-07-30 15:00:26 +00:00
}
}
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
{
ClothModifierData * clmd = ( ClothModifierData * ) modifiers_findByType ( ob , eModifierType_Cloth ) ;
if ( clmd )
{
clmd - > sim_parms - > effector_weights - > group = newlibadr ( fd , ob - > id . lib , clmd - > sim_parms - > effector_weights - > group ) ;
2010-03-26 10:52:55 +00:00
clmd - > coll_parms - > group = newlibadr ( fd , ob - > id . lib , clmd - > coll_parms - > group ) ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
}
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
/* texture field */
if ( ob - > pd )
2009-12-18 13:08:11 +00:00
lib_link_partdeflect ( fd , & ob - > id , ob - > pd ) ;
Sorry for the big commit, but I've been fixing many of these
issues in parallel... So this commit contains: an update of
the solver (e.g. moving objects), integration of blender IPOs,
improved rendering (motion blur, smoothed normals) and a first particle
test. In more detail:
Solver update:
- Moving objects using a relatively simple model, and not yet fully optimized - ok
for box falling into water, water in a moving glass might cause trouble. Simulation
times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot
might also cause slowdowns.
- Additional obstacle settings: noslip (as before), free slip (move along wall freely)
and part slip (mix of both).
- Obstacle settings also added for domain boundaries now, the six walls of the domain are
obstacles after all as well
- Got rid of templates, should make compiling for e.g. macs more convenient,
for linux there's not much difference. Finally got rid of parser (and some other code
parts), the simulation now uses the internal API to transfer data.
- Some unnecessary file were removed, the GUI now needs 3 settings buttons...
This should still be changed (maybe by adding a new panel for domain objects).
IPOs:
- Animated params: viscosity, time and gravity for domains. In contrast
to normal time IPO for Blender objects, the fluidsim one scales the time
step size - so a constant 1 has no effect, values towards 0 slow it down,
larger ones speed the simulation up (-> longer time steps, more compuations).
The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect).
- For objects that are enabled for fluidsim, a new IPO type shows up. Inflow
objects can use the velocity channels to animate the inflow. Obstacles, in/outflow
objects can be switched on (Active IPO>0) and off (<0) during the simulation.
- Movement, rotation and scaling of those 3 types is exported from the normal
Blender channels (Loc,dLoc,etc.).
Particles:
- This is still experimental, so it might be deactivated for a
release... It should at some point be used to model smaller splashes,
depending on the the realworld size and the particle generation
settings particles are generated during simulation (stored in _particles_X.gz
files).
- These are loaded by enabling the particle field for an arbitrary object,
which should be given a halo material. For each frame, similar to the mesh
loading, the particle system them loads the simulated particle positions.
- For rendering, I "abused" the part->rt field - I couldnt find any use
for it in the code and it seems to work fine. The fluidsim particles
store their size there.
Rendering:
- The fluidims particles use scaled sizes and alpha values to give a more varied
appearance. In convertblender.c fluidsim particle systems use the p->rt field
to scale up the size and down the alpha of "smaller particles". Setting the
influence fields in the fluidims settings to 0 gives equally sized particles
with same alpha everywhere. Higher values cause larger differences.
- Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals
computed by the solver are used. This is basically done by switching off the
normal recalculation in convertblender.c (the function calc_fluidsimnormals
handles other mesh inits instead of calc_vertexnormals).
This could also be used to e.g. modify mesh normals in a modifier...
- Another change is that fluidsim meshes load the velocities computed
during the simulation for image based motion blur. This is inited in
load_fluidsimspeedvectors for the vector pass (they're loaded during the
normal load in DerivedMesh readBobjgz). Generation and loading can be switched
off in the settings. Vector pass currently loads the fluidism meshes 3 times,
so this should still be optimized.
Examples:
- smoothed normals versus normals from subdividing once:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png
- fluidsim particles, size/alpha influence 0:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png
size influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png
size & alpha influence 1:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png
- the standard drop with motion blur and particles:
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg
(here's how it looks without
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg)
- another inflow animation (moving, switched on/off) with a moving obstacle
(and strong mblur :)
http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg
Things still to fix:
- rotating & scaling domains causes wrong speed vectors
- get rid of SDL code for threading, use pthreads as well?
- update wiki documentation
- cool effects for rendering would be photon maps for caustics,
and motion blur for particles :)
2006-02-27 11:45:42 +00:00
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
if ( ob - > soft )
ob - > soft - > effector_weights - > group = newlibadr ( fd , ob - > id . lib , ob - > soft - > effector_weights - > group ) ;
2008-09-16 18:40:54 +00:00
lib_link_particlesystems ( fd , ob , & ob - > id , & ob - > particlesystem ) ;
- 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
2008-12-29 13:38:08 +00:00
if ( warn )
2008-12-19 00:50:21 +00:00
BKE_report ( fd - > reports , RPT_WARNING , " Warning in console " ) ;
2002-10-12 11:37:38 +00:00
}
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
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 ) ;
== Bone Groups ==
I'm committing some work-in-progress code for "bone groups" now, as I there have been are some major bugs caused by the timeoffset stuff (some of my test files were not loading, and other files were showing all sorts of weird problems).
Anyway, in this commit, the following things for "bone groups" have been done:
* Bone groups are stored per armature (internally, this is per bPose block)
* Added controls for editing bone-groups per armature - "add", "remove", "rename". These can be found in the "Links and Materials" panel in PoseMode, beside the settings for PoseLib.
* Reorganised buttons for editing selected bones in PoseMode. I've replaced the "dist" and "weight" buttons (they existed in EditMode anyway) with a menu to choose the bone-group and the custom-shape-ob field. In the place of the old custom-shape-ob field, I've restored the "Hide" button. This might break muscle-memory a bit, but there isn't a lot of space to play with there.
Some stuff I'd been originally planning to do before committing:
* When adding keyframes for bones, an action-group with the same name as the bone's group will be added to the action, and the action-channel will be made a member of that.
* New action/bone groups have unique names (renaming/adding new should check if name exists before assigning it)
* There's a setting under Bone-Groups stuff which sets which custom-colour set is used to colour that group's bones. Currently, this is non-functional, as the necessary drawing code for armatures is not in place yet.
2008-01-20 02:55:35 +00:00
link_list ( fd , & pose - > agroups ) ;
2002-10-12 11:37:38 +00:00
2010-03-26 10:33:53 +00:00
pose - > chanhash = NULL ;
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 ) ;
2010-01-05 11:47:43 +00:00
pchan - > custom_tx = newdataadr ( fd , pchan - > custom_tx ) ;
2009-05-18 02:25:33 +00:00
2005-10-23 10:08:19 +00:00
direct_link_constraints ( fd , & pchan - > constraints ) ;
2009-05-18 02:25:33 +00:00
pchan - > prop = newdataadr ( fd , pchan - > prop ) ;
if ( pchan - > prop )
IDP_DirectLinkProperty ( pchan - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
pchan - > mpath = newdataadr ( fd , pchan - > mpath ) ;
if ( pchan - > mpath )
direct_link_motionpath ( fd , pchan - > mpath ) ;
2005-10-23 10:08:19 +00:00
pchan - > iktree . first = pchan - > iktree . last = NULL ;
pchan - > path = NULL ;
2010-11-16 01:19:37 +00:00
/* incase this value changes in future, clamp else we get undefined behavior */
CLAMP ( pchan - > rotmode , ROT_MODE_MIN , ROT_MODE_MAX ) ;
2002-10-12 11:37:38 +00:00
}
2009-09-24 21:22:24 +00:00
pose - > ikdata = NULL ;
if ( pose - > ikparam ! = NULL ) {
pose - > ikparam = newdataadr ( fd , pose - > ikparam ) ;
}
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 ;
2009-01-04 14:14:06 +00:00
md - > scene = NULL ;
2006-06-14 13:25:01 +00:00
/* if modifiers disappear, or for upward compatibility */
if ( NULL = = modifierType_getInfo ( md - > type ) )
md - > type = eModifierType_None ;
- 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 ;
2008-01-29 21:01:12 +00:00
}
2009-06-08 20:08:19 +00:00
else if ( md - > type = = eModifierType_Armature ) {
ArmatureModifierData * amd = ( ArmatureModifierData * ) md ;
amd - > prevCos = NULL ;
}
2008-01-29 21:01:12 +00:00
else if ( md - > type = = eModifierType_Cloth ) {
ClothModifierData * clmd = ( ClothModifierData * ) md ;
clmd - > clothObject = NULL ;
clmd - > sim_parms = newdataadr ( fd , clmd - > sim_parms ) ;
clmd - > coll_parms = newdataadr ( fd , clmd - > coll_parms ) ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
2010-11-30 21:31:18 +00:00
direct_link_pointcache_list ( fd , & clmd - > ptcaches , & clmd - > point_cache , 0 ) ;
2008-01-29 21:01:12 +00:00
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
if ( clmd - > sim_parms ) {
2008-03-20 18:28:40 +00:00
if ( clmd - > sim_parms - > presets > 10 )
clmd - > sim_parms - > presets = 0 ;
2009-11-18 13:33:52 +00:00
clmd - > sim_parms - > reset = 0 ;
2008-03-20 18:28:40 +00:00
}
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
2009-12-14 19:17:27 +00:00
clmd - > sim_parms - > effector_weights = newdataadr ( fd , clmd - > sim_parms - > effector_weights ) ;
if ( ! clmd - > sim_parms - > effector_weights )
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
clmd - > sim_parms - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2008-02-28 00:01:19 +00:00
2008-01-29 21:01:12 +00:00
}
2008-07-25 18:57:16 +00:00
else if ( md - > type = = eModifierType_Fluidsim ) {
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) md ;
fluidmd - > fss = newdataadr ( fd , fluidmd - > fss ) ;
2010-03-25 00:10:41 +00:00
fluidmd - > fss - > fmd = fluidmd ;
2009-01-26 08:34:40 +00:00
fluidmd - > fss - > meshSurfNormals = 0 ;
2008-07-25 18:57:16 +00:00
}
2009-07-30 15:00:26 +00:00
else if ( md - > type = = eModifierType_Smoke ) {
SmokeModifierData * smd = ( SmokeModifierData * ) md ;
if ( smd - > type = = MOD_SMOKE_TYPE_DOMAIN )
{
smd - > flow = NULL ;
smd - > coll = NULL ;
2009-07-30 22:11:28 +00:00
smd - > domain = newdataadr ( fd , smd - > domain ) ;
smd - > domain - > smd = smd ;
2009-07-30 15:00:26 +00:00
smd - > domain - > fluid = NULL ;
2009-09-10 10:35:51 +00:00
smd - > domain - > wt = NULL ;
smd - > domain - > shadow = NULL ;
smd - > domain - > tex = NULL ;
smd - > domain - > tex_shadow = NULL ;
smd - > domain - > tex_wt = NULL ;
2009-08-20 00:33:59 +00:00
2009-12-14 19:17:27 +00:00
smd - > domain - > effector_weights = newdataadr ( fd , smd - > domain - > effector_weights ) ;
if ( ! smd - > domain - > effector_weights )
2009-10-08 10:18:14 +00:00
smd - > domain - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2010-11-30 21:31:18 +00:00
direct_link_pointcache_list ( fd , & ( smd - > domain - > ptcaches [ 0 ] ) , & ( smd - > domain - > point_cache [ 0 ] ) , 1 ) ;
/* Smoke uses only one cache from now on, so store pointer convert */
if ( smd - > domain - > ptcaches [ 1 ] . first | | smd - > domain - > point_cache [ 1 ] ) {
printf ( " High resolution smoke cache not available due to pointcache update. Please reset the simulation. \n " ) ;
smd - > domain - > ptcaches [ 1 ] . first = smd - > domain - > ptcaches [ 1 ] . first = NULL ;
smd - > domain - > point_cache [ 1 ] = NULL ;
}
2009-07-30 15:00:26 +00:00
}
else if ( smd - > type = = MOD_SMOKE_TYPE_FLOW )
{
smd - > domain = NULL ;
smd - > coll = NULL ;
smd - > flow = newdataadr ( fd , smd - > flow ) ;
2009-07-30 22:11:28 +00:00
smd - > flow - > smd = smd ;
2009-07-30 15:00:26 +00:00
smd - > flow - > psys = newdataadr ( fd , smd - > flow - > psys ) ;
}
else if ( smd - > type = = MOD_SMOKE_TYPE_COLL )
{
smd - > flow = NULL ;
smd - > domain = NULL ;
smd - > coll = newdataadr ( fd , smd - > coll ) ;
2009-10-02 14:40:51 +00:00
if ( smd - > coll )
{
smd - > coll - > points = NULL ;
smd - > coll - > numpoints = 0 ;
}
else
smd - > type = 0 ;
2009-07-30 15:00:26 +00:00
}
}
2008-01-29 21:01:12 +00:00
else if ( md - > type = = eModifierType_Collision ) {
CollisionModifierData * collmd = ( CollisionModifierData * ) md ;
/*
// TODO: CollisionModifier should use pointcache
// + have proper reset events before enabling this
collmd - > x = newdataadr ( fd , collmd - > x ) ;
collmd - > xnew = newdataadr ( fd , collmd - > xnew ) ;
collmd - > mfaces = newdataadr ( fd , collmd - > mfaces ) ;
collmd - > current_x = MEM_callocN ( sizeof ( MVert ) * collmd - > numverts , " current_x " ) ;
collmd - > current_xnew = MEM_callocN ( sizeof ( MVert ) * collmd - > numverts , " current_xnew " ) ;
collmd - > current_v = MEM_callocN ( sizeof ( MVert ) * collmd - > numverts , " current_v " ) ;
*/
collmd - > x = NULL ;
collmd - > xnew = NULL ;
collmd - > current_x = NULL ;
collmd - > current_xnew = NULL ;
collmd - > current_v = NULL ;
2009-11-18 13:33:52 +00:00
collmd - > time = - 1000 ;
2008-01-29 21:01:12 +00:00
collmd - > numverts = 0 ;
2008-05-07 20:42:16 +00:00
collmd - > bvhtree = NULL ;
2008-01-29 21:01:12 +00:00
collmd - > mfaces = NULL ;
}
2009-04-20 15:06:46 +00:00
else if ( md - > type = = eModifierType_Surface ) {
SurfaceModifierData * surmd = ( SurfaceModifierData * ) md ;
surmd - > dm = NULL ;
surmd - > bvhtree = NULL ;
2009-07-20 23:52:53 +00:00
surmd - > x = NULL ;
surmd - > v = NULL ;
surmd - > numverts = 0 ;
2009-04-20 15:06:46 +00:00
}
2008-01-29 21:01:12 +00:00
else if ( md - > type = = eModifierType_Hook ) {
- 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
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 ] ) ;
}
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
} else if ( md - > type = = eModifierType_ParticleSystem ) {
ParticleSystemModifierData * psmd = ( ParticleSystemModifierData * ) md ;
psmd - > dm = 0 ;
psmd - > psys = newdataadr ( fd , psmd - > psys ) ;
2007-11-27 16:16:47 +00:00
psmd - > flag & = ~ eParticleSystemFlag_psys_updated ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
} else if ( md - > type = = eModifierType_Explode ) {
ExplodeModifierData * psmd = ( ExplodeModifierData * ) md ;
psmd - > facepa = 0 ;
- 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
}
2007-11-04 22:00:24 +00:00
else if ( md - > type = = eModifierType_MeshDeform ) {
MeshDeformModifierData * mmd = ( MeshDeformModifierData * ) md ;
2010-04-23 11:19:06 +00:00
mmd - > bindinfluences = newdataadr ( fd , mmd - > bindinfluences ) ;
mmd - > bindoffsets = newdataadr ( fd , mmd - > bindoffsets ) ;
mmd - > bindcagecos = newdataadr ( fd , mmd - > bindcagecos ) ;
2007-11-11 22:54:14 +00:00
mmd - > dyngrid = newdataadr ( fd , mmd - > dyngrid ) ;
mmd - > dyninfluences = newdataadr ( fd , mmd - > dyninfluences ) ;
mmd - > dynverts = newdataadr ( fd , mmd - > dynverts ) ;
2007-11-04 22:00:24 +00:00
2010-04-23 11:19:06 +00:00
mmd - > bindweights = newdataadr ( fd , mmd - > bindweights ) ;
mmd - > bindcos = newdataadr ( fd , mmd - > bindcos ) ;
2007-11-04 22:00:24 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
int a ;
2010-04-23 11:19:06 +00:00
if ( mmd - > bindoffsets )
for ( a = 0 ; a < mmd - > totvert + 1 ; a + + )
SWITCH_INT ( mmd - > bindoffsets [ a ] )
if ( mmd - > bindcagecos )
for ( a = 0 ; a < mmd - > totcagevert * 3 ; a + + )
SWITCH_INT ( mmd - > bindcagecos [ a ] )
if ( mmd - > dynverts )
for ( a = 0 ; a < mmd - > totvert ; a + + )
SWITCH_INT ( mmd - > dynverts [ a ] )
2007-11-14 16:20:19 +00:00
if ( mmd - > bindweights )
for ( a = 0 ; a < mmd - > totcagevert * mmd - > totvert ; a + + )
SWITCH_INT ( mmd - > bindweights [ a ] )
if ( mmd - > bindcos )
for ( a = 0 ; a < mmd - > totcagevert * 3 ; a + + )
SWITCH_INT ( mmd - > bindcos [ a ] )
2007-11-04 22:00:24 +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
}
}
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
2006-06-02 20:48:22 +00:00
/* weak weak... this was only meant as draw flag, now is used in give_base too */
ob - > flag & = ~ OB_FROMGROUP ;
2010-04-26 10:12:03 +00:00
/* loading saved files with editmode enabled works, but for undo we like
to stay in object mode during undo presses so keep editmode disabled */
if ( fd - > memfile )
ob - > mode & = ~ ( OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT ) ;
2009-10-03 11:23:31 +00:00
2005-05-02 13:28:13 +00:00
ob - > disp . first = ob - > disp . last = NULL ;
2009-01-19 02:26:46 +00:00
ob - > adt = newdataadr ( fd , ob - > adt ) ;
direct_link_animdata ( fd , ob - > adt ) ;
2002-10-12 11:37:38 +00:00
ob - > pose = newdataadr ( fd , ob - > pose ) ;
direct_link_pose ( fd , ob - > pose ) ;
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
ob - > mpath = newdataadr ( fd , ob - > mpath ) ;
if ( ob - > mpath )
direct_link_motionpath ( fd , ob - > mpath ) ;
2004-06-23 18:22:51 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ob - > defbase ) ;
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system <<<
Two wonderful new NLA & Armature editing features!
- FORWARD CYCLING & MATCHING
Up to no now, adding multiple actions in NLA with walkcycles required to
animate them standing still, as if walking on a conveyor belt. The stride
option then makes the object itself move forward, trying to keep the foot
stuck on the floor (with poor results!).
This option now allows to make walk cycles moving forward. By
indicating a reference Offset Bone, the NLA system will use that bone to
detect the correct offset for the Armature Pose to make it seamlessly going
forward.
Best of all, this option works as for cyclic Action Strips as well as for
individual Action Strips. Note that for individual strips, you have to set
the strip on "Hold". (Might become automatic detected later).
Here's an example edit image for NLA:
http://www.blender.org/bf/nla_match-cycle.jpg
And the animation for it:
http://download.blender.org/demo/test/2.43/0001_0150_match.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_matching.blend
Using this kind of cycling works pretty straightforward, and is a lot
easier to setup than Stride Bones.
To be further tested:
- Blending cycles
- matching rotation for the bones as well.
- ACTION MODIFIERS (motion deformors)
The above option was actually required for this feature. Typically walk
cycles are constructed with certain Bones to be the handles, controlling
for example the torso or feet.
An Action Modifier allows you to use a Curve Path to deform the motion of
these controlling bones. This uses the existing Curve Deformation option.
Modifiers can be added per Action Strip, each controlling a channel (bone)
by choice, and even allows to layer multiple modifiers on top of each other
(several paths deforming motion). This option is using the dependency graph,
so editing the Curve will give realtime changes in the Armature.
The previous walkcycle, controlled by two curves:
http://download.blender.org/demo/test/2.43/0001_0150_deform.avi
Blender file:
http://download.blender.org/demo/test/2.43/mancandy_actiondeform.blend
Action Modifiers can be added in the NLA Properties Panel. Per Modifier you
have to indicate the channel and a Curve Object. You can copy modifiers from
one strip to another using CTRL+C (only copies to active Object strips).
Setting up a correct Curve Path has to be carefully done:
- Use SHIFT+A "Curve Path" in top view, or ensure the path is not rotated.
- make sure the center point of the Curve Object is at the center of the
Armature (or above)
- move the first point of the curve to the center point as well.
- check if the path starts from this first point, you can change it using
(in Curve EditMode) the option Wkey -> "Switch Direction"
- Make sure alignment uses the correct axis; if the Armature walks into
the negative Y direction, you have to set in Object Buttons, "Anim settings"
Panel, the correct Track option. (Note; option will probably move to the
Modifier later).
This is a good reason to make such paths automatic (on a command). Is on the
todo list.
Also note this:
- the Curve Path extends in beginning and ending, that's (for now) the default,
and allows to use multiple paths. Make sure paths begin and end horizontal.
- Moving the Curve in Object Mode will change the "mapping" (as if the landscape
a character walks over moves). Moving the Curve in Edit Mode will change the
actual position of the deformation.
- Speed (Ipos) on paths is not supported yet, will be done.
- The Curve "Stretch" deform option doesn't work.
- Modifiers are executed *after* all actions in NLA are evaluated, there's no
support yet for blending multiple strips with Modifiers.
- This doesn't work yet for time-mapping...
This commit is mostly for review by character animators... some details or
working methods might change.
This feature can also be used for other modifiers, such as noise (Perlin) or
the mythical "Oomph" (frequency control) and of course Python.
Special thanks to Bassam & Matt for research & design help. Have fun!
2006-10-31 15:51:57 +00:00
direct_link_nlastrips ( fd , & ob - > nlastrips ) ;
2002-10-12 11:37:38 +00:00
link_list ( fd , & ob - > constraintChannels ) ;
2009-01-19 02:26:46 +00:00
// >>> XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
ob - > mat = newdataadr ( fd , ob - > mat ) ;
test_pointer_array ( fd , ( void * * ) & ob - > mat ) ;
2009-07-13 00:40:20 +00:00
ob - > matbits = newdataadr ( fd , ob - > matbits ) ;
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 ) ;
2009-12-18 13:08:11 +00:00
direct_link_partdeflect ( 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 ;
2006-11-10 23:09:16 +00:00
sb - > scratch = NULL ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
/* although not used anymore */
/* still have to be loaded to be compatible with old files */
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 ] ) ;
}
}
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
2009-12-14 19:17:27 +00:00
sb - > effector_weights = newdataadr ( fd , sb - > effector_weights ) ;
if ( ! sb - > effector_weights )
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
sb - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2010-11-30 21:31:18 +00:00
direct_link_pointcache_list ( fd , & sb - > ptcaches , & sb - > pointcache , 0 ) ;
2005-04-02 13:57:23 +00:00
}
2008-09-27 21:52:20 +00:00
ob - > bsoft = newdataadr ( fd , ob - > bsoft ) ;
2005-09-18 13:27:12 +00:00
ob - > fluidsimSettings = newdataadr ( fd , ob - > fluidsimSettings ) ; /* NT */
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
link_list ( fd , & ob - > particlesystem ) ;
direct_link_particlesystems ( fd , & ob - > particlesystem ) ;
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 ) ;
BGE patch: add state engine support in the logic bricks.
This patch introduces a simple state engine system with the logic bricks. This system features full
backward compatibility, multiple active states, multiple state transitions, automatic disabling of
sensor and actuators, full GUI support and selective display of sensors and actuators.
Note: Python API is available but not documented yet. It will be added asap.
State internals
===============
The state system is object based. The current state mask is stored in the object as a 32 bit value;
each bit set in the mask is an active state. The controllers have a state mask too but only one bit
can be set: a controller belongs to a single state. The game engine will only execute controllers
that belong to active states. Sensors and actuators don't have a state mask but are effectively
attached to states via their links to the controllers. Sensors and actuators can be connected to more
than one state. When a controller becomes inactive because of a state change, its links to sensors
and actuators are temporarily broken (until the state becomes active again). If an actuator gets isolated,
i.e all the links to controllers are broken, it is automatically disabled. If a sensor gets isolated,
the game engine will stop calling it to save CPU. It will also reset the sensor internal state so that
it can react as if the game just started when it gets reconnected to an active controller. For example,
an Always sensor in no pulse mode that is connected to a single state (i.e connected to one or more
controllers of a single state) will generate a pulse each time the state becomes active. This feature is
not available on all sensors, see the notes below.
GUI
===
This system system is fully configurable through the GUI: the object state mask is visible under the
object bar in the controller's colum as an array of buttons just like the 3D view layer mask.
Click on a state bit to only display the controllers of that state. You can select more than one state
with SHIFT-click. The All button sets all the bits so that you can see all the controllers of the object.
The Ini button sets the state mask back to the object default state. You can change the default state
of object by first selecting the desired state mask and storing using the menu under the State button.
If you define a default state mask, it will be loaded into the object state make when you load the blend
file or when you run the game under the blenderplayer. However, when you run the game under Blender,
the current selected state mask will be used as the startup state for the object. This allows you to test
specific state during the game design.
The controller display the state they belong to with a new button in the controller header. When you add
a new controller, it is added by default in the lowest enabled state. You can change the controller state
by clicking on the button and selecting another state. If more than one state is enabled in the object
state mask, controllers are grouped by state for more readibility.
The new Sta button in the sensor and actuator column header allows you to display only the sensors and
actuators that are linked to visible controllers.
A new state actuator is available to modify the state during the game. It defines a bit mask and
the operation to apply on the current object state mask:
Cpy: the bit mask is copied to the object state mask.
Add: the bits that set in the bit mask will be turned on in the object state mask.
Sub: the bits that set in the bit mask will be turned off in the object state mask.
Inv: the bits that set in the bit mask will be inverted in the objecyy state mask.
Notes
=====
- Although states have no name, a simply convention consists in using the name of the first controller
of the state as the state name. The GUI will support that convention by displaying as a hint the name
of the first controller of the state when you move the mouse over a state bit of the object state mask
or of the state actuator bit mask.
- Each object has a state mask and each object can have a state engine but if several objects are
part of a logical group, it is recommended to put the state engine only in the main object and to
link the controllers of that object to the sensors and actuators of the different objects.
- When loading an old blend file, the state mask of all objects and controllers are initialized to 1
so that all the controllers belong to this single state. This ensures backward compatibility with
existing game.
- When the state actuator is activated at the same time as other actuators, these actuators are
guaranteed to execute before being eventually disabled due to the state change. This is useful for
example to send a message or update a property at the time of changing the state.
- Sensors that depend on underlying resource won't reset fully when they are isolated. By the time they
are acticated again, they will behave as follow:
* keyboard sensor: keys already pressed won't be detected. The keyboard sensor is only sensitive
to new key press.
* collision sensor: objects already colliding won't be detected. Only new collisions are
detected.
* near and radar sensor: same as collision sensor.
2008-06-22 14:23:57 +00:00
if ( ob - > init_state ) {
/* if a known first state is specified, set it so that the game will start ok */
ob - > state = ob - > init_state ;
} else if ( ! ob - > state ) {
ob - > state = 1 ;
}
2002-10-12 11:37:38 +00:00
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 ) ;
BGE patch: add state engine support in the logic bricks.
This patch introduces a simple state engine system with the logic bricks. This system features full
backward compatibility, multiple active states, multiple state transitions, automatic disabling of
sensor and actuators, full GUI support and selective display of sensors and actuators.
Note: Python API is available but not documented yet. It will be added asap.
State internals
===============
The state system is object based. The current state mask is stored in the object as a 32 bit value;
each bit set in the mask is an active state. The controllers have a state mask too but only one bit
can be set: a controller belongs to a single state. The game engine will only execute controllers
that belong to active states. Sensors and actuators don't have a state mask but are effectively
attached to states via their links to the controllers. Sensors and actuators can be connected to more
than one state. When a controller becomes inactive because of a state change, its links to sensors
and actuators are temporarily broken (until the state becomes active again). If an actuator gets isolated,
i.e all the links to controllers are broken, it is automatically disabled. If a sensor gets isolated,
the game engine will stop calling it to save CPU. It will also reset the sensor internal state so that
it can react as if the game just started when it gets reconnected to an active controller. For example,
an Always sensor in no pulse mode that is connected to a single state (i.e connected to one or more
controllers of a single state) will generate a pulse each time the state becomes active. This feature is
not available on all sensors, see the notes below.
GUI
===
This system system is fully configurable through the GUI: the object state mask is visible under the
object bar in the controller's colum as an array of buttons just like the 3D view layer mask.
Click on a state bit to only display the controllers of that state. You can select more than one state
with SHIFT-click. The All button sets all the bits so that you can see all the controllers of the object.
The Ini button sets the state mask back to the object default state. You can change the default state
of object by first selecting the desired state mask and storing using the menu under the State button.
If you define a default state mask, it will be loaded into the object state make when you load the blend
file or when you run the game under the blenderplayer. However, when you run the game under Blender,
the current selected state mask will be used as the startup state for the object. This allows you to test
specific state during the game design.
The controller display the state they belong to with a new button in the controller header. When you add
a new controller, it is added by default in the lowest enabled state. You can change the controller state
by clicking on the button and selecting another state. If more than one state is enabled in the object
state mask, controllers are grouped by state for more readibility.
The new Sta button in the sensor and actuator column header allows you to display only the sensors and
actuators that are linked to visible controllers.
A new state actuator is available to modify the state during the game. It defines a bit mask and
the operation to apply on the current object state mask:
Cpy: the bit mask is copied to the object state mask.
Add: the bits that set in the bit mask will be turned on in the object state mask.
Sub: the bits that set in the bit mask will be turned off in the object state mask.
Inv: the bits that set in the bit mask will be inverted in the objecyy state mask.
Notes
=====
- Although states have no name, a simply convention consists in using the name of the first controller
of the state as the state name. The GUI will support that convention by displaying as a hint the name
of the first controller of the state when you move the mouse over a state bit of the object state mask
or of the state actuator bit mask.
- Each object has a state mask and each object can have a state engine but if several objects are
part of a logical group, it is recommended to put the state engine only in the main object and to
link the controllers of that object to the sensors and actuators of the different objects.
- When loading an old blend file, the state mask of all objects and controllers are initialized to 1
so that all the controllers belong to this single state. This ensures backward compatibility with
existing game.
- When the state actuator is activated at the same time as other actuators, these actuators are
guaranteed to execute before being eventually disabled due to the state change. This is useful for
example to send a message or update a property at the time of changing the state.
- Sensors that depend on underlying resource won't reset fully when they are isolated. By the time they
are acticated again, they will behave as follow:
* keyboard sensor: keys already pressed won't be detected. The keyboard sensor is only sensitive
to new key press.
* collision sensor: objects already colliding won't be detected. Only new collisions are
detected.
* near and radar sensor: same as collision sensor.
2008-06-22 14:23:57 +00:00
if ( cont - > state_mask = = 0 )
cont - > state_mask = 1 ;
2002-10-12 11:37:38 +00:00
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 ) ;
2009-10-09 09:48:04 +00:00
2009-10-09 12:16:58 +00:00
modifier_unique_name ( & ob - > modifiers , ( ModifierData * ) hmd ) ;
2005-08-11 02:23:52 +00:00
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 ;
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
ob - > gpulamp . first = ob - > gpulamp . last = NULL ;
2009-08-25 18:41:36 +00:00
link_list ( fd , & ob - > pc_ids ) ;
2009-08-15 18:58:01 +00:00
2010-11-16 01:19:37 +00:00
/* incase this value changes in future, clamp else we get undefined behavior */
CLAMP ( ob - > rotmode , ROT_MODE_MIN , ROT_MODE_MAX ) ;
2010-10-02 11:39:11 +00:00
if ( ob - > sculpt ) {
2009-08-15 18:58:01 +00:00
ob - > sculpt = MEM_callocN ( sizeof ( SculptSession ) , " reload sculpt session " ) ;
2010-10-02 11:39:11 +00:00
ob - > sculpt - > ob = ob ;
}
2002-10-12 11:37:38 +00:00
}
/* ************ READ SCENE ***************** */
2009-02-04 17:40:50 +00:00
/* patch for missing scene IDs, can't be in do-versions */
static void composite_patch ( bNodeTree * ntree , Scene * scene )
{
bNode * node ;
for ( node = ntree - > nodes . first ; node ; node = node - > next )
2010-01-03 02:53:01 +00:00
if ( node - > id = = NULL & & ELEM4 ( node - > type , CMP_NODE_R_LAYERS , CMP_NODE_COMPOSITE , CMP_NODE_DEFOCUS , CMP_NODE_OUTPUT_FILE ) )
2009-02-04 17:40:50 +00:00
node - > id = & scene - > id ;
}
2009-08-17 00:39:00 +00:00
static void link_paint ( FileData * fd , Scene * sce , Paint * p )
{
2010-08-12 11:09:19 +00:00
if ( p ) {
2010-08-04 12:18:07 +00:00
p - > brush = newlibadr_us ( fd , sce - > id . lib , p - > brush ) ;
2010-08-12 11:09:19 +00:00
p - > paint_cursor = NULL ;
2009-08-17 00:39:00 +00:00
}
}
2009-02-04 17:40:50 +00:00
2002-10-12 11:37:38 +00:00
static void lib_link_scene ( FileData * fd , Main * main )
{
Scene * sce ;
Base * base , * next ;
Sequence * seq ;
2006-12-07 14:17:38 +00:00
SceneRenderLayer * srl ;
2009-12-16 19:49:33 +00:00
TimeMarker * marker ;
2006-11-06 01:08:26 +00:00
2002-10-12 11:37:38 +00:00
sce = main - > scene . first ;
while ( sce ) {
if ( sce - > id . flag & LIB_NEEDLINK ) {
2006-11-17 06:14:15 +00:00
/*Link ID Properties -- and copy this comment EXACTLY for easy finding
of library blocks that implement this . */
if ( sce - > id . properties ) IDP_LibLinkProperty ( sce - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2009-01-19 02:26:46 +00:00
if ( sce - > adt ) lib_link_animdata ( fd , & sce - > id , sce - > adt ) ;
2009-02-11 12:19:42 +00:00
lib_link_keyingsets ( fd , & sce - > id , & sce - > keyingsets ) ;
2002-10-12 11:37:38 +00:00
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 ) ;
2009-08-26 12:01:15 +00:00
sce - > gpd = newlibadr_us ( fd , sce - > id . lib , sce - > gpd ) ;
2009-06-10 15:09:44 +00:00
2009-08-17 00:39:00 +00:00
link_paint ( fd , sce , & sce - > toolsettings - > sculpt - > paint ) ;
2009-08-17 02:49:31 +00:00
link_paint ( fd , sce , & sce - > toolsettings - > vpaint - > paint ) ;
link_paint ( fd , sce , & sce - > toolsettings - > wpaint - > paint ) ;
2009-08-17 04:40:59 +00:00
link_paint ( fd , sce , & sce - > toolsettings - > imapaint . paint ) ;
2009-08-17 00:39:00 +00:00
2008-11-13 18:57:10 +00:00
sce - > toolsettings - > skgen_template = newlibadr ( fd , sce - > id . lib , sce - > toolsettings - > skgen_template ) ;
2008-11-06 03:31:25 +00:00
2006-12-07 14:17:38 +00:00
for ( base = sce - > base . first ; base ; base = next ) {
2002-10-12 11:37:38 +00:00
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
2005-12-16 17:35:38 +00:00
if ( base - > object = = NULL ) {
2010-01-11 12:24:08 +00:00
BKE_reportf ( fd - > reports , RPT_ERROR , " LIB ERROR: Object lost from scene:'%s \' \n " , sce - > id . name + 2 ) ;
2010-05-18 16:58:28 +00:00
if ( G . background = = 0 ) printf ( " LIB ERROR: base removed from scene:'%s \' \n " , sce - > id . name + 2 ) ;
2002-10-12 11:37:38 +00:00
BLI_remlink ( & sce - > base , base ) ;
if ( base = = sce - > basact ) sce - > basact = 0 ;
MEM_freeN ( base ) ;
}
}
2004-06-23 18:22:51 +00:00
2008-12-15 05:21:44 +00:00
SEQ_BEGIN ( sce - > ed , seq ) {
if ( seq - > ipo ) seq - > ipo = newlibadr_us ( fd , sce - > id . lib , seq - > ipo ) ;
2010-03-20 11:15:16 +00:00
if ( seq - > scene ) {
seq - > scene = newlibadr ( fd , sce - > id . lib , seq - > scene ) ;
2010-05-30 19:33:26 +00:00
seq - > scene_sound = sound_scene_add_scene_sound ( sce , seq , seq - > startdisp , seq - > enddisp , seq - > startofs + seq - > anim_startofs ) ;
2010-03-20 11:15:16 +00:00
}
2010-03-09 13:52:52 +00:00
if ( seq - > scene_camera ) seq - > scene_camera = newlibadr ( fd , sce - > id . lib , seq - > scene_camera ) ;
2008-12-15 05:21:44 +00:00
if ( seq - > sound ) {
2010-02-07 23:41:17 +00:00
seq - > scene_sound = NULL ;
2009-08-09 21:16:39 +00:00
if ( seq - > type = = SEQ_HD_SOUND )
seq - > type = SEQ_SOUND ;
else
seq - > sound = newlibadr ( fd , sce - > id . lib , seq - > sound ) ;
2008-12-15 05:21:44 +00:00
if ( seq - > sound ) {
seq - > sound - > id . us + + ;
2010-05-30 19:33:26 +00:00
seq - > scene_sound = sound_add_scene_sound ( sce , seq , seq - > startdisp , seq - > enddisp , seq - > startofs + seq - > anim_startofs ) ;
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
}
2002-10-12 11:37:38 +00:00
}
2008-12-15 05:21:44 +00:00
seq - > anim = 0 ;
2002-10-12 11:37:38 +00:00
}
2008-12-15 05:21:44 +00:00
SEQ_END
2009-12-08 13:57:51 +00:00
2009-12-16 19:49:33 +00:00
# ifdef DURIAN_CAMERA_SWITCH
for ( marker = sce - > markers . first ; marker ; marker = marker - > next ) {
if ( marker - > camera ) {
marker - > camera = newlibadr ( fd , sce - > id . lib , marker - > camera ) ;
}
}
# endif
2009-12-08 13:57:51 +00:00
if ( sce - > ed )
2010-02-07 23:41:17 +00:00
seq_update_muting ( sce , sce - > ed ) ;
2004-11-21 11:44:50 +00:00
2009-02-04 17:40:50 +00:00
if ( sce - > nodetree ) {
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
lib_link_ntree ( fd , & sce - > id , sce - > nodetree ) ;
2009-02-04 17:40:50 +00:00
composite_patch ( sce - > nodetree , sce ) ;
}
2006-12-07 14:17:38 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
srl - > mat_override = newlibadr_us ( fd , sce - > id . lib , srl - > mat_override ) ;
srl - > light_override = newlibadr_us ( fd , sce - > id . lib , srl - > light_override ) ;
}
2009-04-20 15:06:46 +00:00
/*Game Settings: Dome Warp Text*/
2010-05-27 07:37:09 +00:00
sce - > gm . dome . warptext = newlibadr ( fd , sce - > id . lib , sce - > gm . dome . warptext ) ;
2009-04-20 15:06:46 +00:00
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 ) ;
2008-12-15 05:21:44 +00:00
for ( seq = lb - > first ; seq ; seq = seq - > next )
if ( seq - > seqbase . first )
link_recurs_seq ( fd , & seq - > seqbase ) ;
2002-10-12 11:37:38 +00:00
}
2009-08-17 00:39:00 +00:00
static void direct_link_paint ( FileData * fd , Paint * * paint )
{
2009-12-14 17:08:02 +00:00
Paint * p ;
2010-08-04 12:18:07 +00:00
/* TODO. is this needed */
2009-12-14 17:08:02 +00:00
p = ( * paint ) = newdataadr ( fd , ( * paint ) ) ;
2009-08-17 00:39:00 +00:00
}
2002-10-12 11:37:38 +00:00
static void direct_link_scene ( FileData * fd , Scene * sce )
{
Editing * ed ;
Sequence * seq ;
2004-11-13 12:55:59 +00:00
MetaStack * ms ;
2004-06-23 18:22:51 +00:00
2005-05-29 19:41:03 +00:00
sce - > theDag = NULL ;
sce - > dagisvalid = 0 ;
2009-04-30 11:33:07 +00:00
sce - > obedit = NULL ;
2009-08-19 12:35:40 +00:00
sce - > stats = 0 ;
2010-02-12 00:44:26 +00:00
sce - > fps_info = NULL ;
2009-08-09 21:16:39 +00:00
2010-02-07 23:41:17 +00:00
sound_create_scene ( sce ) ;
2009-08-09 21:16:39 +00:00
2006-03-20 20:52:04 +00:00
/* set users to one by default, not in lib-link, this will increase it for compo nodes */
sce - > id . us = 1 ;
2006-11-17 06:14:15 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( sce - > base ) ) ;
2009-01-19 02:26:46 +00:00
sce - > adt = newdataadr ( fd , sce - > adt ) ;
direct_link_animdata ( fd , sce - > adt ) ;
2009-02-11 12:19:42 +00:00
link_list ( fd , & sce - > keyingsets ) ;
direct_link_keyingsets ( fd , & sce - > keyingsets ) ;
2002-10-12 11:37:38 +00:00
sce - > basact = newdataadr ( fd , sce - > basact ) ;
2005-08-24 20:37:25 +00:00
sce - > toolsettings = newdataadr ( fd , sce - > toolsettings ) ;
2009-01-10 14:19:14 +00:00
if ( sce - > toolsettings ) {
2009-08-17 00:39:00 +00:00
direct_link_paint ( fd , ( Paint * * ) & sce - > toolsettings - > sculpt ) ;
2009-08-17 02:49:31 +00:00
direct_link_paint ( fd , ( Paint * * ) & sce - > toolsettings - > vpaint ) ;
direct_link_paint ( fd , ( Paint * * ) & sce - > toolsettings - > wpaint ) ;
2009-08-17 00:39:00 +00:00
2009-02-25 19:29:58 +00:00
sce - > toolsettings - > imapaint . paintcursor = NULL ;
sce - > toolsettings - > particle . paintcursor = NULL ;
2009-01-10 14:19:14 +00:00
}
2006-11-06 01:08:26 +00:00
2002-10-12 11:37:38 +00:00
if ( sce - > ed ) {
2006-11-22 19:59:17 +00:00
ListBase * old_seqbasep = & ( ( Editing * ) sce - > ed ) - > seqbase ;
2002-10-12 11:37:38 +00:00
ed = sce - > ed = newdataadr ( fd , sce - > ed ) ;
2009-11-14 15:31:52 +00:00
ed - > act_seq = newdataadr ( fd , ed - > act_seq ) ;
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
2008-12-15 05:21:44 +00:00
SEQ_BEGIN ( ed , seq ) {
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 - > plugin = newdataadr ( fd , seq - > plugin ) ;
2004-06-23 18:22:51 +00:00
seq - > effectdata = newdataadr ( fd , seq - > effectdata ) ;
2006-03-07 20:01:12 +00:00
2010-04-19 13:27:54 +00:00
if ( seq - > type & SEQ_EFFECT )
2006-03-07 20:01:12 +00:00
seq - > flag | = SEQ_EFFECT_NOT_LOADED ;
2010-04-19 13:27:54 +00:00
if ( seq - > type = = SEQ_SPEED ) {
SpeedControlVars * s = seq - > effectdata ;
s - > frameMap = NULL ;
2006-03-07 20:01:12 +00:00
}
2004-06-23 18:22:51 +00:00
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 ;
2007-11-18 17:39:30 +00:00
if ( seq - > type = = SEQ_IMAGE | |
seq - > type = = SEQ_MOVIE | |
seq - > type = = SEQ_RAM_SOUND | |
seq - > type = = SEQ_HD_SOUND ) {
seq - > strip - > stripdata = newdataadr (
fd , seq - > strip - > stripdata ) ;
} else {
seq - > strip - > stripdata = 0 ;
2004-06-23 18:22:51 +00:00
}
2007-12-25 15:31:36 +00:00
if ( seq - > flag & SEQ_USE_CROP ) {
seq - > strip - > crop = newdataadr (
fd , seq - > strip - > crop ) ;
} else {
seq - > strip - > crop = 0 ;
}
if ( seq - > flag & SEQ_USE_TRANSFORM ) {
seq - > strip - > transform = newdataadr (
fd , seq - > strip - > transform ) ;
} else {
seq - > strip - > transform = 0 ;
}
if ( seq - > flag & SEQ_USE_PROXY ) {
seq - > strip - > proxy = newdataadr (
fd , seq - > strip - > proxy ) ;
2009-06-08 20:08:19 +00:00
seq - > strip - > proxy - > anim = 0 ;
2007-12-25 15:31:36 +00:00
} else {
seq - > strip - > proxy = 0 ;
}
2008-02-02 23:28:50 +00:00
if ( seq - > flag & SEQ_USE_COLOR_BALANCE ) {
seq - > strip - > color_balance = newdataadr (
fd , seq - > strip - > color_balance ) ;
} else {
seq - > strip - > color_balance = 0 ;
}
2009-06-16 21:16:22 +00:00
if ( seq - > strip - > color_balance ) {
2009-07-25 20:59:09 +00:00
// seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
2009-06-16 21:16:22 +00:00
}
2002-10-12 11:37:38 +00:00
}
}
2008-12-15 05:21:44 +00:00
SEQ_END
2006-06-05 19:04:19 +00:00
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 ;
2008-08-30 14:32:16 +00:00
intptr_t offset ;
2004-11-13 12:55:59 +00:00
2008-08-30 14:32:16 +00:00
offset = ( ( intptr_t ) & ( temp . seqbase ) ) - ( ( intptr_t ) & temp ) ;
2004-11-13 12:55:59 +00:00
2006-11-22 19:59:17 +00:00
/* root pointer */
if ( ed - > seqbasep = = old_seqbasep ) {
ed - > seqbasep = & ed - > seqbase ;
}
else {
poin = ( char * ) ed - > seqbasep ;
poin - = offset ;
poin = newdataadr ( fd , poin ) ;
if ( poin ) ed - > seqbasep = ( ListBase * ) ( poin + offset ) ;
else ed - > seqbasep = & ed - > seqbase ;
}
2004-11-13 12:55:59 +00:00
/* stack */
link_list ( fd , & ( ed - > metastack ) ) ;
for ( ms = ed - > metastack . first ; ms ; ms = ms - > next ) {
ms - > parseq = newdataadr ( fd , ms - > parseq ) ;
2006-11-22 19:59:17 +00:00
if ( ms - > oldbasep = = old_seqbasep )
ms - > oldbasep = & ed - > seqbase ;
else {
poin = ( char * ) ms - > oldbasep ;
poin - = offset ;
poin = newdataadr ( fd , poin ) ;
if ( poin ) ms - > oldbasep = ( ListBase * ) ( poin + offset ) ;
else ms - > oldbasep = & ed - > seqbase ;
}
2004-11-13 12:55:59 +00:00
}
}
2002-10-12 11:37:38 +00:00
}
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 ) ;
}
2008-05-11 20:40:55 +00:00
if ( sce - > r . ffcodecdata . properties ) {
sce - > r . ffcodecdata . properties = newdataadr (
fd , sce - > r . ffcodecdata . properties ) ;
if ( sce - > r . ffcodecdata . properties ) {
IDP_DirectLinkProperty (
sce - > r . ffcodecdata . properties ,
( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
}
}
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
link_list ( fd , & ( sce - > markers ) ) ;
=== Custom Transform Orientation ===
Custom Orientations can be added with Ctrl-Shift-C (hotkey suggestions are welcomed), this adds and select the new alignment. Custom Orientations can also be added, deleted, selected from the Transform Orientations panel (View -> Transform Orientations). Standard orientations (global, local, normal, view) can also be selected from this panel.
If you plan on using only a single custom orientation and don't really need a list, I suggest you use the hotkey as it adds and selects at the same time.
Custom Orientations are save in the scene and are selected per 3D view (like normal orientation).
Adding from an object, the orientation is a normalized version of the object's orientation.
Adding from mesh data, a single element (vertex, edge, face) must be selected in its respective selection mode. Vertex orientation Z-axis is based on the normal, edge Z-axis on the edge itself (X-axis is on the XoY plane when possible, Y-axis is perpendicular to the rest). Face orientation Z-axis is the face normal, X-axis is perpendicular to the first edge, Y-axis is perpendicular to the rest.
(More logical orientations can be suggested).
I plan to add: 2 vertice (connected or not) => edge orientation , 3 vertice = face orientation
Differences from the patch:
- orientations no longer link back to the object they came from, everything is copy on creation.
- orientations are overwritten based on name (if you add an orientation with the same name as one that already exists, it overwrites the old one)
2008-01-13 18:24:09 +00:00
link_list ( fd , & ( sce - > transform_spaces ) ) ;
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
link_list ( fd , & ( sce - > r . layers ) ) ;
2009-12-16 19:49:33 +00:00
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
sce - > nodetree = newdataadr ( fd , sce - > nodetree ) ;
if ( sce - > nodetree )
direct_link_nodetree ( fd , sce - > nodetree ) ;
2002-10-12 11:37:38 +00:00
}
2007-12-24 18:53:37 +00:00
/* ************ READ WM ***************** */
static void direct_link_windowmanager ( FileData * fd , wmWindowManager * wm )
{
wmWindow * win ;
wm - > id . us = 1 ;
link_list ( fd , & ( wm - > windows ) ) ;
for ( win = wm - > windows . first ; win ; win = win - > next ) {
win - > ghostwin = NULL ;
win - > eventstate = NULL ;
2008-01-01 15:53:38 +00:00
win - > curswin = NULL ;
2.5
Sanitized the 'tweak' event.
Original idea was to have WM event system generating it
automatically. However, I first tested it via a handler
and operator, to check what kind of configurations would
be useful. It appeared to not work nice, also because
that inserting a tweak operator in a keymap is confusing.
Now 'tweaks' are generated automatically, and can be
catched by keymaps as any event. The current definition
of tweak is:
- if Left/Middle/Rightmouse pressed
if event wasn't handled by window queue (modal handlers)
start checking mousepositions
- while mousepositions are checked
- escape on any event other than mouse
- on mouse events:
- add tweak event if mousemove > 10 pixels
- stop checking for tweak if mousebutton released
- Tweak events have a define indicating mousebutton used
EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R
- In keymap definitions you can use _S or _A to map to
action or select mouse userdef.
- Event value in keymap should be KM_ANY for all tweaks,
or use one of the eight directions:
EVT_GESTURE_E, _SE, _S, _SW, _W, _NW, _N, _NE
- And of course you can add modifier checks in keymaps for it.
- Because tweaks are a result of mouse events, the handlers get
both to evaluate. That means that RMB-select + tweak will work
correctly.
In case you don't want both to be handled, for example the
CTRL+LMB 'extrude' and CTRL+LMB-tweak 'lasso select', you will
need to set the first acting on a EVT_RELEASE, this event only
gets passed on when tweak fails.
The current system allows all options, configurable, we had in 2.48,
and many more! A diagram of what's possible is on the todo. :)
Also in this commit: lasso select editmesh failed with 'zbuffer
occluded select'. Also circle-select failed.
2009-02-02 14:13:14 +00:00
win - > tweak = NULL ;
2007-12-24 18:53:37 +00:00
win - > queue . first = win - > queue . last = NULL ;
win - > handlers . first = win - > handlers . last = NULL ;
2009-09-18 12:43:36 +00:00
win - > modalhandlers . first = win - > modalhandlers . last = NULL ;
2008-01-01 15:53:38 +00:00
win - > subwindows . first = win - > subwindows . last = NULL ;
2.5
Sanitized the 'tweak' event.
Original idea was to have WM event system generating it
automatically. However, I first tested it via a handler
and operator, to check what kind of configurations would
be useful. It appeared to not work nice, also because
that inserting a tweak operator in a keymap is confusing.
Now 'tweaks' are generated automatically, and can be
catched by keymaps as any event. The current definition
of tweak is:
- if Left/Middle/Rightmouse pressed
if event wasn't handled by window queue (modal handlers)
start checking mousepositions
- while mousepositions are checked
- escape on any event other than mouse
- on mouse events:
- add tweak event if mousemove > 10 pixels
- stop checking for tweak if mousebutton released
- Tweak events have a define indicating mousebutton used
EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R
- In keymap definitions you can use _S or _A to map to
action or select mouse userdef.
- Event value in keymap should be KM_ANY for all tweaks,
or use one of the eight directions:
EVT_GESTURE_E, _SE, _S, _SW, _W, _NW, _N, _NE
- And of course you can add modifier checks in keymaps for it.
- Because tweaks are a result of mouse events, the handlers get
both to evaluate. That means that RMB-select + tweak will work
correctly.
In case you don't want both to be handled, for example the
CTRL+LMB 'extrude' and CTRL+LMB-tweak 'lasso select', you will
need to set the first acting on a EVT_RELEASE, this event only
gets passed on when tweak fails.
The current system allows all options, configurable, we had in 2.48,
and many more! A diagram of what's possible is on the todo. :)
Also in this commit: lasso select editmesh failed with 'zbuffer
occluded select'. Also circle-select failed.
2009-02-02 14:13:14 +00:00
win - > gesture . first = win - > gesture . last = NULL ;
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
win - > drawdata = NULL ;
win - > drawmethod = - 1 ;
win - > drawfail = 0 ;
2007-12-24 18:53:37 +00:00
}
2009-10-20 13:58:53 +00:00
wm - > timers . first = wm - > timers . last = NULL ;
2007-12-24 18:53:37 +00:00
wm - > operators . first = wm - > operators . last = NULL ;
2.5
Vertex Paint back!
Added WM level "paint cursor" system, which manages a custom painting
cursor for tools or modes.
- Activate it with WM_paint_cursor_activate(). That function wants two
callbacks, a poll(C) to check whether there's a cursor in given context
and ARegion, and a draw(C, x, y) which gets called when appropriate.
- While paintcursor is active, the WM handles necessary redrawing events
for all regions, also to nicely clear the cursor on region exit.
- WM_paint_cursor_activate returns a handle, which you have to use to
end the paint cursor. This handle also means you can register as many
custom cursors as you want.
At the moment, vertex paint mode registers only a mousemove handler,
all other events are still normally handled. This is stuff for the
future todo.
2009-01-09 13:55:45 +00:00
wm - > paintcursors . first = wm - > paintcursors . last = NULL ;
2008-01-10 18:56:24 +00:00
wm - > queue . first = wm - > queue . last = NULL ;
2009-07-16 22:47:27 +00:00
BKE_reports_init ( & wm - > reports , RPT_STORE ) ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
wm - > keyconfigs . first = wm - > keyconfigs . last = NULL ;
wm - > defaultconf = NULL ;
2009-07-13 00:40:20 +00:00
wm - > jobs . first = wm - > jobs . last = NULL ;
Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
There are calls to define drag-able images, ID blocks, RNA paths,
file paths, and so on. By default you drag an icon, exceptionally
an ImBuf
- Drag items are registered centrally in the WM, it allows more drag
items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts
the mouse event to an EVT_DROP type. This event then gets the full
drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps
you can make a "drop map" this way, which become 'drop map handlers'
in the queues.
- next to that the UI kit handles some common button types (like
accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
- poll() = check if the event drag data is relevant for this box
- copy() = fill in custom properties in the dropbox to initialize
an operator
- The dropbox handler then calls its standard Operator with its
dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit
on mouse-over. In case the icon is a button or UI element too (most
cases), the drag-able feature will make the item react to
mouse-release instead of mouse-press.
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works
too. I've added code that passes on mousemoves and clicks to other
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an
Image ID... keep this in mind. Sequencer for example wants paths to
be dropped, textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're
part of the UI and editor design (= how we want an editor to work), and
not default offered configurable like keymaps.
- At the moment only one item can be dragged at a time. This is for
several reasons.... For one, Blender doesn't have a well defined
uniform way to define "what is selected" (files, outliner items, etc).
Secondly there's potential conflicts on what todo when you drop mixed
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip,
should be represented in filewindow as a single sequence anyway.
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it
could show the operator as a sort of menu, allowing arrow or scrollwheel
to choose. For time being I'd prefer to try to design a singular drop
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that
detects an object (type) under cursor, so a drag item's option can be
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled,
while WM event code tried same. Added new OPERATOR_HANDLED flag for this.
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
(for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review...
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS
into Blender window. I've noticed this code is unfinished for Macs, but
seems to be complete for Windows. Needs test... currently, an external
drop event will print in console when succesfully delivered to Blender's WM.
2010-01-26 18:18:21 +00:00
wm - > drags . first = wm - > drags . last = NULL ;
2008-01-10 18:56:24 +00:00
2008-01-10 18:13:34 +00:00
wm - > windrawable = NULL ;
2007-12-24 18:53:37 +00:00
wm - > initialized = 0 ;
2010-01-29 13:06:50 +00:00
wm - > op_undo_depth = 0 ;
2007-12-24 18:53:37 +00:00
}
static void lib_link_windowmanager ( FileData * fd , Main * main )
{
wmWindowManager * wm ;
2009-09-03 18:38:52 +00:00
wmWindow * win ;
2007-12-24 18:53:37 +00:00
for ( wm = main - > wm . first ; wm ; wm = wm - > id . next ) {
2009-09-03 18:38:52 +00:00
if ( wm - > id . flag & LIB_NEEDLINK ) {
for ( win = wm - > windows . first ; win ; win = win - > next )
win - > screen = newlibadr ( fd , NULL , win - > screen ) ;
wm - > id . flag - = LIB_NEEDLINK ;
2007-12-24 18:53:37 +00:00
}
}
}
2008-12-29 13:38:08 +00:00
/* ****************** READ GREASE PENCIL ***************** */
2002-10-12 11:37:38 +00:00
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
/* relinks grease-pencil data - used for direct_link and old file linkage */
static void direct_link_gpencil ( FileData * fd , bGPdata * gpd )
2008-07-22 09:53:25 +00:00
{
bGPDlayer * gpl ;
bGPDframe * gpf ;
bGPDstroke * gps ;
2009-05-04 10:24:53 +00:00
/* we must firstly have some grease-pencil data to link! */
if ( gpd = = NULL )
return ;
2008-07-22 09:53:25 +00:00
/* relink layers */
link_list ( fd , & gpd - > layers ) ;
for ( gpl = gpd - > layers . first ; gpl ; gpl = gpl - > next ) {
/* relink frames */
link_list ( fd , & gpl - > frames ) ;
gpl - > actframe = newdataadr ( fd , gpl - > actframe ) ;
for ( gpf = gpl - > frames . first ; gpf ; gpf = gpf - > next ) {
/* relink strokes (and their points) */
link_list ( fd , & gpf - > strokes ) ;
for ( gps = gpf - > strokes . first ; gps ; gps = gps - > next ) {
gps - > points = newdataadr ( fd , gps - > points ) ;
}
}
}
}
2008-12-29 13:38:08 +00:00
/* ****************** READ SCREEN ***************** */
static void butspace_version_132 ( SpaceButs * buts )
{
buts - > v2d . tot . xmin = 0.0f ;
buts - > v2d . tot . ymin = 0.0f ;
buts - > v2d . tot . xmax = 1279.0f ;
buts - > v2d . tot . ymax = 228.0f ;
buts - > v2d . min [ 0 ] = 256.0f ;
buts - > v2d . min [ 1 ] = 42.0f ;
buts - > v2d . max [ 0 ] = 2048.0f ;
buts - > v2d . max [ 1 ] = 450.0f ;
buts - > v2d . minzoom = 0.5f ;
buts - > v2d . maxzoom = 1.21f ;
buts - > v2d . scroll = 0 ;
buts - > v2d . keepzoom = 1 ;
buts - > v2d . keeptot = 1 ;
}
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
2006-12-20 17:57:56 +00:00
for ( sc = main - > screen . first ; sc ; sc = sc - > id . next ) {
2002-10-12 11:37:38 +00:00
if ( sc - > id . flag & LIB_NEEDLINK ) {
sc - > id . us = 1 ;
sc - > scene = newlibadr ( fd , sc - > id . lib , sc - > scene ) ;
2010-06-28 18:40:17 +00:00
sc - > animtimer = NULL ; /* saved in rare cases */
2008-07-22 09:53:25 +00:00
2002-10-12 11:37:38 +00:00
sa = sc - > areabase . first ;
while ( sa ) {
SpaceLink * sl ;
2008-07-22 09:53:25 +00:00
2002-10-12 11:37:38 +00:00
sa - > full = newlibadr ( fd , sc - > id . lib , sa - > full ) ;
2008-07-22 09:53:25 +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 ;
2010-01-25 11:06:55 +00:00
BGpic * bgpic = NULL ;
2008-07-22 09:53:25 +00:00
2002-10-12 11:37:38 +00:00
v3d - > camera = newlibadr ( fd , sc - > id . lib , v3d - > camera ) ;
2006-11-07 15:47:10 +00:00
v3d - > ob_centre = newlibadr ( fd , sc - > id . lib , v3d - > ob_centre ) ;
2008-07-22 09:53:25 +00:00
2010-01-19 22:44:43 +00:00
/* should be do_versions but not easy adding into the listbase */
2002-10-12 11:37:38 +00:00
if ( v3d - > bgpic ) {
2010-01-19 22:44:43 +00:00
v3d - > bgpic = newlibadr ( fd , sc - > id . lib , v3d - > bgpic ) ;
BLI_addtail ( & v3d - > bgpicbase , bgpic ) ;
v3d - > bgpic = NULL ;
}
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next ) {
bgpic - > ima = newlibadr_us ( fd , sc - > id . lib , bgpic - > ima ) ;
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 ;
2010-01-23 03:57:11 +00:00
bDopeSheet * ads = sipo - > ads ;
2004-11-13 12:55:59 +00:00
2010-01-23 03:57:11 +00:00
if ( ads ) {
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
}
2002-10-12 11:37:38 +00:00
}
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
2005-12-21 22:21:43 +00:00
sbuts - > ri = NULL ;
2009-06-03 23:33:56 +00:00
sbuts - > pinid = newlibadr ( fd , sc - > id . lib , sbuts - > pinid ) ;
2009-07-24 16:41:12 +00:00
sbuts - > mainbo = sbuts - > mainb ;
sbuts - > mainbuser = sbuts - > mainb ;
2008-12-29 13:38:08 +00:00
if ( main - > versionfile < 132 )
butspace_version_132 ( sbuts ) ;
2002-10-12 11:37:38 +00:00
}
else if ( sl - > spacetype = = SPACE_FILE ) {
SpaceFile * sfile = ( SpaceFile * ) sl ;
2009-01-06 22:48:58 +00:00
sfile - > files = NULL ;
2009-01-06 14:42:54 +00:00
sfile - > params = NULL ;
sfile - > op = NULL ;
2009-04-06 15:07:01 +00:00
sfile - > layout = NULL ;
2009-07-21 14:28:41 +00:00
sfile - > folders_prev = NULL ;
sfile - > folders_next = NULL ;
2002-10-12 11:37:38 +00:00
}
else if ( sl - > spacetype = = SPACE_IMASEL ) {
2007-09-02 17:25:03 +00:00
SpaceImaSel * simasel = ( SpaceImaSel * ) sl ;
simasel - > files = NULL ;
simasel - > returnfunc = NULL ;
simasel - > menup = NULL ;
simasel - > pupmenu = NULL ;
simasel - > img = NULL ;
2002-10-12 11:37:38 +00:00
}
else if ( sl - > spacetype = = SPACE_ACTION ) {
SpaceAction * saction = ( SpaceAction * ) sl ;
2010-01-23 03:57:11 +00:00
bDopeSheet * ads = & saction - > ads ;
if ( ads ) {
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
}
2002-10-12 11:37:38 +00:00
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 ) ;
2010-04-05 06:52:27 +00:00
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
* so fingers crossed this works fine !
*/
sima - > gpd = newlibadr_us ( fd , sc - > id . lib , sima - > gpd ) ;
2002-10-12 11:37:38 +00:00
}
else if ( sl - > spacetype = = SPACE_NLA ) {
2010-01-23 03:57:11 +00:00
SpaceNla * snla = ( SpaceNla * ) sl ;
bDopeSheet * ads = snla - > ads ;
if ( ads ) {
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
}
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 ) ;
2010-10-13 06:06:39 +00:00
st - > drawcache = NULL ;
2003-12-14 01:18:09 +00:00
}
else if ( sl - > spacetype = = SPACE_SCRIPT ) {
2008-03-06 21:25:15 +00:00
SpaceScript * scpt = ( SpaceScript * ) sl ;
2008-03-07 22:39:45 +00:00
/*scpt->script = NULL; - 2.45 set to null, better re-run the script */
2008-03-06 21:25:15 +00:00
if ( scpt - > script ) {
2008-03-07 22:39:45 +00:00
scpt - > script = newlibadr ( fd , sc - > id . lib , scpt - > script ) ;
if ( scpt - > script ) {
SCRIPT_SET_NULL ( scpt - > script )
}
2008-03-06 21:25:15 +00:00
}
2002-10-12 11:37:38 +00:00
}
2009-03-26 14:05:33 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
2002-10-12 11:37:38 +00:00
SpaceOops * so = ( 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
TreeStoreElem * tselem ;
int a ;
2004-06-23 18:22:51 +00:00
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 - > tree . first = so - > tree . last = NULL ;
Patch #4980, by Joshua Leung (aligorith)
This enables finding data in the Outliner.
Usage: Fkey (partial strings), CTRL+Fkey (partial strings, case sensitive).
SHIFT+Fkey to repeat a search, this cycles around.
Extra changes:
- button popups to enter strings now starts activated.
- outliner either shows for Armature the Bones, or Posechannels or
Editbones, depending the mode. Was needed to make searches meaningful.
Although Joshua did very good work on the key functions, there were a couple
of issues in his code, and problems in Outliner code, that didn't make it
all work nicely. So, this is quite a revised patch. :)
Full review log can be found in the patch tracker.
2006-11-07 14:25:58 +00:00
so - > search_tse . id = newlibadr ( fd , NULL , so - > search_tse . id ) ;
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 ) {
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 ) ;
}
2009-01-27 17:12:40 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
snode - > id = newlibadr ( fd , sc - > id . lib , snode - > id ) ;
/* internal data, a bit patchy */
if ( snode - > id ) {
if ( GS ( snode - > id - > name ) = = ID_MA )
snode - > nodetree = ( ( Material * ) snode - > id ) - > nodetree ;
else if ( GS ( snode - > id - > name ) = = ID_SCE )
snode - > nodetree = ( ( Scene * ) snode - > id ) - > nodetree ;
else if ( GS ( snode - > id - > name ) = = ID_TE )
snode - > nodetree = ( ( Tex * ) snode - > id ) - > nodetree ;
}
}
2002-10-12 11:37:38 +00:00
}
sa = sa - > next ;
}
sc - > id . flag - = LIB_NEEDLINK ;
}
}
}
2006-11-29 08:57:32 +00:00
/* Only for undo files, or to restore a screen after reading without UI... */
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
{
if ( id ) {
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
ListBase * lb = which_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)
2006-11-29 08:57:32 +00:00
ID * idn = lb - > first ;
char * name = id - > name + 2 ;
2004-12-08 18:36:48 +00:00
while ( idn ) {
2006-11-29 08:57:32 +00:00
if ( idn - > name [ 2 ] = = name [ 0 ] & & strcmp ( idn - > name + 2 , name ) = = 0 ) {
if ( idn - > lib = = id - > lib ) {
if ( user & & idn - > us = = 0 ) idn - > us + + ;
break ;
}
2004-12-08 18:36:48 +00:00
}
idn = idn - > next ;
2004-09-05 13:43:51 +00:00
}
2006-11-29 08:57:32 +00:00
return idn ;
2004-09-05 13:43:51 +00:00
}
}
2006-11-29 08:57:32 +00:00
return NULL ;
2004-09-05 13:43:51 +00:00
}
/* called from kernel/blender.c */
2005-07-28 11:05:21 +00:00
/* used to link a file (without UI) to the current UI */
2006-07-02 12:03:07 +00:00
/* note that it assumes the old pointers in UI are still valid, so old Main is not freed */
2008-12-31 18:52:15 +00:00
void lib_link_screen_restore ( Main * newmain , bScreen * curscreen , Scene * curscene )
2004-09-05 13:43:51 +00:00
{
2008-12-31 18:52:15 +00:00
wmWindow * win ;
wmWindowManager * wm ;
2004-09-05 13:43:51 +00:00
bScreen * sc ;
ScrArea * sa ;
2008-12-31 18:52:15 +00:00
/* first windowmanager */
for ( wm = newmain - > wm . first ; wm ; wm = wm - > id . next ) {
for ( win = wm - > windows . first ; win ; win = win - > next ) {
win - > screen = restore_pointer_by_name ( newmain , ( ID * ) win - > screen , 1 ) ;
if ( win - > screen = = NULL )
win - > screen = curscreen ;
win - > screen - > winid = win - > winid ;
}
}
2006-12-20 17:57:56 +00:00
for ( sc = newmain - > screen . first ; sc ; sc = sc - > id . next ) {
2010-01-27 15:30:20 +00:00
Scene * oldscene = sc - > scene ;
2008-04-14 13:09:08 +00:00
sc - > scene = restore_pointer_by_name ( newmain , ( ID * ) sc - > scene , 1 ) ;
if ( sc - > scene = = NULL )
sc - > scene = curscene ;
2004-09-05 13:43:51 +00:00
2010-01-27 15:30:20 +00:00
/* keep cursor location through undo */
copy_v3_v3 ( sc - > scene - > cursor , oldscene - > cursor ) ;
2004-09-05 13:43:51 +00:00
sa = sc - > areabase . first ;
while ( sa ) {
SpaceLink * sl ;
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
2010-01-19 22:44:43 +00:00
BGpic * bgpic ;
2004-11-14 12:56:56 +00:00
2010-04-06 01:18:52 +00:00
if ( v3d - > scenelock )
v3d - > camera = NULL ; /* always get from scene */
else
v3d - > camera = restore_pointer_by_name ( newmain , ( ID * ) v3d - > camera , 1 ) ;
2006-07-02 12:03:07 +00:00
if ( v3d - > camera = = NULL )
v3d - > camera = sc - > scene - > camera ;
2006-11-07 15:47:10 +00:00
v3d - > ob_centre = restore_pointer_by_name ( newmain , ( ID * ) v3d - > ob_centre , 1 ) ;
2004-09-05 13:43:51 +00:00
2010-01-19 22:44:43 +00:00
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next ) {
bgpic - > ima = restore_pointer_by_name ( newmain , ( ID * ) bgpic - > ima , 1 ) ;
2004-09-05 13:43:51 +00:00
}
if ( v3d - > localvd ) {
2009-03-13 13:38:41 +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 */
2009-02-14 10:03:24 +00:00
/* XXX regionlocalview ?
2004-11-14 12:56:56 +00:00
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 ;
2009-02-14 10:03:24 +00:00
MEM_freeN ( v3d - > localvd ) ;
2004-11-14 16:06:24 +00:00
v3d - > localvd = NULL ;
}
2009-02-14 10:03:24 +00:00
*/
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 ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
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 ;
2010-01-25 17:24:04 +00:00
bDopeSheet * ads = sipo - > ads ;
2004-11-13 12:55:59 +00:00
2010-01-27 23:20:32 +00:00
if ( ads ) {
ads - > source = restore_pointer_by_name ( newmain , ( ID * ) ads - > source , 1 ) ;
if ( ads - > filter_grp )
2010-01-27 00:01:59 +00:00
ads - > filter_grp = restore_pointer_by_name ( newmain , ( ID * ) ads - > filter_grp , 0 ) ;
2010-01-25 17:24:04 +00:00
}
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
2009-06-03 23:33:56 +00:00
sbuts - > pinid = restore_pointer_by_name ( newmain , sbuts - > pinid , 0 ) ;
2008-01-01 18:16:10 +00:00
//XXX if (sbuts->ri) sbuts->ri->curtile = 0;
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_FILE ) {
2009-01-06 14:42:54 +00:00
2004-09-05 13:43:51 +00:00
SpaceFile * sfile = ( SpaceFile * ) sl ;
2009-01-06 22:48:58 +00:00
sfile - > files = NULL ;
2009-07-07 07:25:44 +00:00
sfile - > folders_prev = NULL ;
sfile - > folders_next = NULL ;
2009-01-06 22:48:58 +00:00
sfile - > params = NULL ;
sfile - > op = NULL ;
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_IMASEL ) {
2010-03-22 09:30:00 +00:00
SpaceImaSel * simasel = ( SpaceImaSel * ) sl ;
2007-09-02 17:25:03 +00:00
if ( simasel - > files ) {
2008-01-01 18:16:10 +00:00
//XXX BIF_filelist_freelib(simasel->files);
2007-09-02 17:25:03 +00:00
}
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_ACTION ) {
SpaceAction * saction = ( SpaceAction * ) sl ;
2010-01-27 23:20:32 +00:00
2004-11-05 17:18:17 +00:00
saction - > action = restore_pointer_by_name ( newmain , ( ID * ) saction - > action , 1 ) ;
2008-12-19 11:45:46 +00:00
saction - > ads . source = restore_pointer_by_name ( newmain , ( ID * ) saction - > ads . source , 1 ) ;
2010-01-25 17:24:04 +00:00
2010-01-27 23:20:32 +00:00
if ( saction - > ads . filter_grp )
2010-01-25 17:24:04 +00:00
saction - > ads . filter_grp = restore_pointer_by_name ( newmain , ( ID * ) saction - > ads . filter_grp , 0 ) ;
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 ) ;
2010-04-06 02:05:54 +00:00
2010-04-07 10:12:24 +00:00
sima - > scopes . waveform_1 = NULL ;
sima - > scopes . waveform_2 = NULL ;
sima - > scopes . waveform_3 = NULL ;
2010-04-09 00:44:35 +00:00
sima - > scopes . vecscope = NULL ;
2010-04-06 02:05:54 +00:00
sima - > scopes . ok = 0 ;
2010-04-05 06:52:27 +00:00
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
* so assume that here we ' re doing for undo only . . .
*/
sima - > gpd = restore_pointer_by_name ( newmain , ( ID * ) sima - > gpd , 1 ) ;
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_NLA ) {
2010-01-25 17:24:04 +00:00
SpaceNla * snla = ( SpaceNla * ) sl ;
bDopeSheet * ads = snla - > ads ;
2010-01-27 23:20:32 +00:00
if ( ads ) {
ads - > source = restore_pointer_by_name ( newmain , ( ID * ) ads - > source , 1 ) ;
if ( ads - > filter_grp )
ads - > filter_grp = restore_pointer_by_name ( newmain , ( ID * ) ads - > filter_grp , 0 ) ;
2010-01-25 17:24:04 +00:00
}
2004-09-05 13:43:51 +00:00
}
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 ;
2010-10-13 06:06:39 +00:00
st - > drawcache = NULL ;
2004-09-05 13:43:51 +00:00
}
else if ( sl - > spacetype = = SPACE_SCRIPT ) {
2008-03-06 21:25:15 +00:00
SpaceScript * scpt = ( SpaceScript * ) sl ;
scpt - > script = restore_pointer_by_name ( newmain , ( ID * ) scpt - > script , 1 ) ;
/*sc->script = NULL; - 2.45 set to null, better re-run the script */
if ( scpt - > script ) {
2008-03-07 03:24:23 +00:00
SCRIPT_SET_NULL ( scpt - > script )
2008-03-06 21:25:15 +00:00
}
2004-09-05 13:43:51 +00:00
}
2009-03-26 14:05:33 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
2004-09-05 13:43:51 +00:00
SpaceOops * so = ( 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
int a ;
Patch #4980, by Joshua Leung (aligorith)
This enables finding data in the Outliner.
Usage: Fkey (partial strings), CTRL+Fkey (partial strings, case sensitive).
SHIFT+Fkey to repeat a search, this cycles around.
Extra changes:
- button popups to enter strings now starts activated.
- outliner either shows for Armature the Bones, or Posechannels or
Editbones, depending the mode. Was needed to make searches meaningful.
Although Joshua did very good work on the key functions, there were a couple
of issues in his code, and problems in Outliner code, that didn't make it
all work nicely. So, this is quite a revised patch. :)
Full review log can be found in the patch tracker.
2006-11-07 14:25:58 +00:00
so - > search_tse . id = restore_pointer_by_name ( newmain , so - > search_tse . 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
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
}
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
2009-01-27 17:12:40 +00:00
snode - > id = restore_pointer_by_name ( newmain , snode - > id , 1 ) ;
snode - > edittree = NULL ;
if ( snode - > id = = NULL )
snode - > nodetree = NULL ;
else {
if ( GS ( snode - > id - > name ) = = ID_MA )
snode - > nodetree = ( ( Material * ) snode - > id ) - > nodetree ;
else if ( GS ( snode - > id - > name ) = = ID_SCE )
snode - > nodetree = ( ( Scene * ) snode - > id ) - > nodetree ;
else if ( GS ( snode - > id - > name ) = = ID_TE )
snode - > nodetree = ( ( Tex * ) snode - > id ) - > nodetree ;
}
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
}
2004-09-05 13:43:51 +00:00
}
sa = sa - > next ;
}
}
}
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
static void direct_link_region ( FileData * fd , ARegion * ar , int spacetype )
2008-12-19 00:18:16 +00:00
{
2008-12-26 13:11:04 +00:00
Panel * pa ;
link_list ( fd , & ( ar - > panels ) ) ;
for ( pa = ar - > panels . first ; pa ; pa = pa - > next ) {
pa - > paneltab = newdataadr ( fd , pa - > paneltab ) ;
2009-04-16 21:39:45 +00:00
pa - > runtime_flag = 0 ;
2008-12-26 13:11:04 +00:00
pa - > activedata = NULL ;
2009-04-11 02:18:24 +00:00
pa - > type = NULL ;
2008-12-26 13:11:04 +00:00
}
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
ar - > regiondata = newdataadr ( fd , ar - > regiondata ) ;
if ( ar - > regiondata ) {
if ( spacetype = = SPACE_VIEW3D ) {
RegionView3D * rv3d = ar - > regiondata ;
rv3d - > localvd = newdataadr ( fd , rv3d - > localvd ) ;
rv3d - > clipbb = newdataadr ( fd , rv3d - > clipbb ) ;
rv3d - > depths = NULL ;
rv3d - > retopo_view_data = NULL ;
rv3d - > ri = NULL ;
rv3d - > sms = NULL ;
rv3d - > smooth_timer = NULL ;
}
}
2009-07-29 22:57:53 +00:00
ar - > v2d . tab_offset = NULL ;
ar - > v2d . tab_num = 0 ;
ar - > v2d . tab_cur = 0 ;
2008-12-19 00:18:16 +00:00
ar - > handlers . first = ar - > handlers . last = NULL ;
ar - > uiblocks . first = ar - > uiblocks . last = NULL ;
2008-12-21 17:18:36 +00:00
ar - > headerstr = NULL ;
2008-12-19 00:18:16 +00:00
ar - > swinid = 0 ;
ar - > type = NULL ;
2.5: WIP commit for WM compositing.
* Drawing code from wm_event_system.c split into separate wm_draw.c file.
Now there's 3 different draw methods implemented, not sure what survives
or will be added but is useful for debugging.
* Draw All: redraws everything each time, for reference.
* Draw Overlap All: what the code did before this commit, only draw
regions marked for redraw, and anything that overlaps them.
* Triple Buffer: copies/retores all area regions into a texture, and
blits that before drawing. Menus, brushes, gestures, etc are redrawn
always on top of that.
Currently "Draw Overlap All" is set hardcoded to be used still. Triple
Buffer code is not complete, it doesn't handle window resize yet. Cards
that don't support non power of two textures can need quite large
textures as well, this could be split into multiple smaller ones.
2009-01-20 21:55:48 +00:00
ar - > swap = 0 ;
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
ar - > do_draw = 0 ;
memset ( & ar - > drawrct , 0 , sizeof ( ar - > drawrct ) ) ;
2008-12-19 00:18:16 +00:00
}
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
/* for the saved 2.50 files without regiondata */
/* and as patch for 2.48 and older */
static void view3d_split_250 ( View3D * v3d , ListBase * regions )
{
ARegion * ar ;
for ( ar = regions - > first ; ar ; ar = ar - > next ) {
if ( ar - > regiontype = = RGN_TYPE_WINDOW & & ar - > regiondata = = NULL ) {
RegionView3D * rv3d ;
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
rv3d = ar - > regiondata = MEM_callocN ( sizeof ( RegionView3D ) , " region v3d patch " ) ;
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
rv3d - > persp = v3d - > persp ;
rv3d - > view = v3d - > view ;
rv3d - > dist = v3d - > dist ;
VECCOPY ( rv3d - > ofs , v3d - > ofs ) ;
QUATCOPY ( rv3d - > viewquat , v3d - > viewquat ) ;
}
}
2009-09-14 19:12:29 +00:00
/* this was not initialized correct always */
if ( v3d - > twtype = = 0 )
v3d - > twtype = V3D_MANIP_TRANSLATE ;
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
}
2002-10-12 11:37:38 +00:00
static void direct_link_screen ( FileData * fd , bScreen * sc )
{
ScrArea * sa ;
ScrVert * sv ;
ScrEdge * se ;
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 ) ) ;
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
sc - > regionbase . first = sc - > regionbase . last = NULL ;
2008-12-29 13:38:08 +00:00
sc - > context = NULL ;
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to
create one timer per window, this replaces that with a way to let operators
or other handlers add/remove their own timers as needed. This is currently
delivered as an event with the timer handle, perhaps this should be a notifier
instead? Also includes some fixes in ghost for timer events that were not
delivered in time, due to passing negative timeout.
* Added a Message event, which is a generic event that can be added by any
operator. This is used in the UI code to communicate the results of opened
blocks. Again, this may be better as a notifier.
* These two events should not be blocked as they are intended for a specific
operator or handler, so there were exceptions added for this, which is one
of the reasons they might work better as notifiers, but currently these
things can't listen to notifier yet.
* Added an option to events to indicate if the customdata should be freed or
not.
* Added a free() callback for area regions, and added a free function for
area regions in blenkernel since it was already there for screens and areas.
* Added ED_screen/area/region_exit functions to clean up things like operators
and handlers when they are closed.
* Added screen level regions, these will draw over areas boundaries, with the
last created region on top. These are useful for tooltips, menus, etc, and
are not saved to file. It's using the same ARegion struct as areas to avoid
code duplication, but perhaps that should be renamed then. Note that redraws
currently go correct, because only full window redraws are used, for partial
redraws without any frontbuffer drawing, the window manager needs to get
support for compositing subwindows.
* Minor changes in the subwindow code to retrieve the matrix, and moved
setlinestyle to glutil.c.
* Reversed argument order in WM_event_add/remove_keymap_handler to be consistent
with modal_handler.
* Operators can now block events but not necessarily cancel/finish.
* Modal operators are now stored in a list in the window/area/region they were
created in. This means for example that when a transform operator is invoked
from a region but registers a handler at the window level (since mouse motion
across areas should work), it will still get removed when the region is closed
while the operator is running.
2008-11-11 15:18:21 +00:00
2008-01-07 18:03:41 +00:00
sc - > mainwin = sc - > subwinactive = 0 ; /* indices */
2.5: WM Compositing
* Triple Buffer is now more complete:
- Proper handling of window resize, duplicate, etc.
- It now uses 3x3 textures (or less) if the power of two sizes
do not match well. That still has a worst case wast of 23.4%,
but better than 300%.
- It can also use the ARB/NV/EXT_texture_rectangle extension
now, which may be supported on hardware that does not support
ARB_texture_non_power_of_two.
- Gesture, menu and brushe redraws now require no redraws at all
from the area regions. So even on a high poly scene just moving
the paint cursor or opening a menu should be fast.
* Testing can be done by setting the "Window Draw Method" in the
User Preferences in the outliner. "Overlap" is still default,
since "Triple Buffer" has not been tested on computers other than
mine, would like to avoid crashing Blender on startup in case
there is a common bug, but it's ready for testing now.
- For reference "Full" draws the full window each time.
- "Triple Buffer" should work for both swap copy and swap exchange
systems, the latter still need the -E command line option for
"Overlap".
- Resizing and going fullscreen still gives flicker here but no
more than "Full" drawing.
* Partial Redraw was added. ED_region_tag_redraw_partial takes a
rect in window coordinates to define a subarea of the region.
On region draw it will then set glScissor to a smaller area, and
ar->drawrct will always be set to either the partial or full
window rect. The latter can then be used for clipping in the 3D
view or clipping interface drawing. Neither is implemented yet.
2009-01-23 03:52:52 +00:00
sc - > swap = 0 ;
2007-12-24 18:53:37 +00:00
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 */
2008-01-01 15:53:38 +00:00
for ( se = sc - > edgebase . first ; se ; se = se - > next ) {
2002-10-12 11:37:38 +00:00
se - > v1 = newdataadr ( fd , se - > v1 ) ;
se - > v2 = newdataadr ( fd , se - > v2 ) ;
2008-08-30 14:32:16 +00:00
if ( ( intptr_t ) se - > v1 > ( intptr_t ) se - > v2 ) {
2002-10-12 11:37:38 +00:00
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 ;
}
}
/* areas */
2008-01-01 15:53:38 +00:00
for ( sa = sc - > areabase . first ; sa ; sa = sa - > next ) {
2002-10-12 11:37:38 +00:00
SpaceLink * sl ;
2008-01-01 15:53:38 +00:00
ARegion * ar ;
2004-06-23 18:22:51 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( sa - > spacedata ) ) ;
2008-01-01 15:53:38 +00:00
link_list ( fd , & ( sa - > regionbase ) ) ;
2004-06-23 18:22:51 +00:00
2007-12-24 18:53:37 +00:00
sa - > handlers . first = sa - > handlers . last = NULL ;
2008-01-07 18:03:41 +00:00
sa - > type = NULL ; /* spacetype callbacks */
2007-12-24 18:53:37 +00:00
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
for ( ar = sa - > regionbase . first ; ar ; ar = ar - > next )
direct_link_region ( fd , ar , sa - > spacetype ) ;
2006-12-12 11:13:43 +00:00
/* accident can happen when read/save new file with older version */
2008-12-14 10:52:48 +00:00
/* 2.50: we now always add spacedata for info */
if ( sa - > spacedata . first = = NULL ) {
SpaceInfo * sinfo = MEM_callocN ( sizeof ( SpaceInfo ) , " spaceinfo " ) ;
2009-02-07 19:37:29 +00:00
sa - > spacetype = sinfo - > spacetype = SPACE_INFO ;
2008-12-14 10:52:48 +00:00
BLI_addtail ( & sa - > spacedata , sinfo ) ;
}
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
/* add local view3d too */
else if ( sa - > spacetype = = SPACE_VIEW3D )
view3d_split_250 ( sa - > spacedata . first , & sa - > regionbase ) ;
2006-12-12 11:13:43 +00:00
2002-10-12 11:37:38 +00:00
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
2008-12-19 00:18:16 +00:00
link_list ( fd , & ( sl - > regionbase ) ) ;
for ( ar = sl - > regionbase . first ; ar ; ar = ar - > next )
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
direct_link_region ( fd , ar , sl - > spacetype ) ;
2008-12-19 00:18:16 +00:00
2002-10-12 11:37:38 +00:00
if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
2010-01-19 22:44:43 +00:00
BGpic * bgpic ;
2009-12-17 14:38:30 +00:00
v3d - > flag | = V3D_INVALID_BACKBUF ;
2010-01-19 22:44:43 +00:00
link_list ( fd , & ( v3d - > bgpicbase ) ) ;
/* should be do_versions except this doesnt fit well there */
if ( v3d - > bgpic ) {
bgpic = newdataadr ( fd , v3d - > bgpic ) ;
BLI_addtail ( & v3d - > bgpicbase , bgpic ) ;
v3d - > bgpic = NULL ;
}
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next )
bgpic - > iuser . ok = 1 ;
2008-07-22 09:53:25 +00:00
if ( v3d - > gpd ) {
v3d - > gpd = newdataadr ( fd , v3d - > gpd ) ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
direct_link_gpencil ( fd , v3d - > gpd ) ;
2008-07-22 09:53:25 +00:00
}
2002-10-12 11:37:38 +00:00
v3d - > localvd = newdataadr ( fd , v3d - > localvd ) ;
2010-08-25 14:23:02 +00:00
v3d - > afterdraw_transp . first = v3d - > afterdraw_transp . last = NULL ;
v3d - > afterdraw_xray . first = v3d - > afterdraw_xray . last = NULL ;
v3d - > afterdraw_xraytransp . first = v3d - > afterdraw_xraytransp . last = NULL ;
2006-11-27 15:23:21 +00:00
v3d - > properties_storage = NULL ;
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
view3d_split_250 ( v3d , & sl - > regionbase ) ;
2002-10-12 11:37:38 +00:00
}
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
else if ( sl - > spacetype = = SPACE_IPO ) {
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
sipo - > ads = newdataadr ( fd , sipo - > ads ) ;
2009-04-08 01:07:46 +00:00
sipo - > ghostCurves . first = sipo - > ghostCurves . last = NULL ;
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
}
2009-05-25 13:07:54 +00:00
else if ( sl - > spacetype = = SPACE_NLA ) {
SpaceNla * snla = ( SpaceNla * ) sl ;
snla - > ads = newdataadr ( fd , snla - > ads ) ;
}
2009-03-26 14:05:33 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
2002-10-12 11:37:38 +00:00
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
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
}
2006-01-09 23:52:51 +00:00
else if ( sl - > spacetype = = SPACE_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
sima - > cumap = newdataadr ( fd , sima - > cumap ) ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
if ( sima - > cumap )
direct_link_curvemapping ( fd , sima - > cumap ) ;
2010-04-05 06:52:27 +00:00
2009-05-29 00:20:41 +00:00
sima - > iuser . scene = NULL ;
2006-12-20 17:57:56 +00:00
sima - > iuser . ok = 1 ;
2010-04-07 10:12:24 +00:00
sima - > scopes . waveform_1 = NULL ;
sima - > scopes . waveform_2 = NULL ;
sima - > scopes . waveform_3 = NULL ;
2010-04-09 00:44:35 +00:00
sima - > scopes . vecscope = NULL ;
2010-04-06 02:05:54 +00:00
sima - > scopes . ok = 0 ;
2010-04-05 06:52:27 +00:00
/* WARNING: gpencil data is no longer stored directly in sima after 2.5
* so sacrifice a few old files for now to avoid crashes with new files !
*/
//sima->gpd= newdataadr(fd, sima->gpd);
//if (sima->gpd)
// direct_link_gpencil(fd, sima->gpd);
2006-01-09 23:52:51 +00:00
}
2005-12-18 13:46:01 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
2008-07-22 09:53:25 +00:00
if ( snode - > gpd ) {
snode - > gpd = newdataadr ( fd , snode - > gpd ) ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
direct_link_gpencil ( fd , snode - > gpd ) ;
2008-07-22 09:53:25 +00:00
}
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
snode - > nodetree = snode - > edittree = NULL ;
2005-12-18 13:46:01 +00:00
}
2010-06-22 14:10:45 +00:00
else if ( sl - > spacetype = = SPACE_TIME ) {
SpaceTime * stime = ( SpaceTime * ) sl ;
stime - > caches . first = stime - > caches . last = NULL ;
}
2009-06-16 13:09:36 +00:00
else if ( sl - > spacetype = = SPACE_LOGIC ) {
SpaceLogic * slogic = ( SpaceLogic * ) sl ;
2009-07-30 15:00:26 +00:00
2009-06-16 13:09:36 +00:00
if ( slogic - > gpd ) {
slogic - > gpd = newdataadr ( fd , slogic - > gpd ) ;
direct_link_gpencil ( fd , slogic - > gpd ) ;
}
}
2008-07-22 09:53:25 +00:00
else if ( sl - > spacetype = = SPACE_SEQ ) {
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
if ( sseq - > gpd ) {
sseq - > gpd = newdataadr ( fd , sseq - > gpd ) ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
direct_link_gpencil ( fd , sseq - > gpd ) ;
2008-07-22 09:53:25 +00:00
}
}
2009-06-03 23:33:56 +00:00
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
sbuts - > path = NULL ;
}
2009-07-16 00:50:27 +00:00
else if ( sl - > spacetype = = SPACE_CONSOLE ) {
SpaceConsole * sconsole = ( SpaceConsole * ) sl ;
2010-04-24 21:14:05 +00:00
ConsoleLine * cl , * cl_next ;
2009-07-16 00:50:27 +00:00
link_list ( fd , & sconsole - > scrollback ) ;
link_list ( fd , & sconsole - > history ) ;
//for(cl= sconsole->scrollback.first; cl; cl= cl->next)
// cl->line= newdataadr(fd, cl->line);
2010-04-23 09:24:22 +00:00
/*comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression,
from left to right . the right - most expression sets the result of the comma
expression as a whole */
2010-04-24 21:14:05 +00:00
for ( cl = sconsole - > history . first ; cl ; cl = cl_next ) {
cl_next = cl - > next ;
2010-04-23 09:24:22 +00:00
cl - > line = newdataadr ( fd , cl - > line ) ;
2010-04-24 21:14:05 +00:00
if ( cl - > line = = NULL ) {
2010-04-23 09:24:22 +00:00
BLI_remlink ( & sconsole - > history , cl ) ;
MEM_freeN ( cl ) ;
}
}
2009-07-16 00:50:27 +00:00
}
2010-03-01 06:23:59 +00:00
else if ( sl - > spacetype = = SPACE_FILE ) {
SpaceFile * sfile = ( SpaceFile * ) sl ;
/* this sort of info is probably irrelevant for reloading...
* plus , it isn ' t saved to files yet !
*/
sfile - > folders_prev = sfile - > folders_next = NULL ;
sfile - > files = NULL ;
sfile - > layout = NULL ;
sfile - > op = NULL ;
sfile - > params = NULL ;
}
2002-10-12 11:37:38 +00:00
}
2008-01-01 15:53:38 +00:00
2008-01-17 08:21:21 +00:00
sa - > actionzones . first = sa - > actionzones . last = NULL ;
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
/* ********** 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
for ( newmain = fd - > mainlist . first ; newmain ; newmain = newmain - > next ) {
if ( newmain - > curlib ) {
2010-06-02 17:58:28 +00:00
if ( strcmp ( newmain - > curlib - > filepath , lib - > filepath ) = = 0 ) {
printf ( " Fixed error in file; multiple instances of lib: \n %s \n " , lib - > filepath ) ;
2010-11-24 12:17:26 +00:00
BKE_reportf ( fd - > reports , RPT_WARNING , " Library '%s', '%s' had multiple instances, save and reload! " , lib - > name , lib - > filepath ) ;
2005-12-19 16:13:39 +00:00
change_idid_adr ( & fd - > mainlist , fd , lib , newmain - > curlib ) ;
// change_idid_adr_fd(fd, lib, newmain->curlib);
2005-12-14 09:59:22 +00:00
BLI_remlink ( & main - > library , lib ) ;
MEM_freeN ( lib ) ;
2010-11-24 12:17:26 +00:00
2008-12-19 00:50:21 +00:00
2005-12-14 09:59:22 +00:00
return ;
}
}
}
2006-01-04 19:05:24 +00:00
/* make sure we have full path in lib->filename */
2010-06-02 17:58:28 +00:00
BLI_strncpy ( lib - > filepath , lib - > name , sizeof ( lib - > name ) ) ;
cleanup_path ( fd - > relabase , lib - > filepath ) ;
2006-01-04 19:05:24 +00:00
// printf("direct_link_library: name %s\n", lib->name);
// printf("direct_link_library: filename %s\n", lib->filename);
2005-12-14 09:59:22 +00:00
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 ;
2006-12-01 10:12:41 +00:00
lib - > parent = NULL ;
2002-10-12 11:37:38 +00:00
}
2010-10-16 02:40:31 +00:00
static void lib_link_library ( FileData * UNUSED ( fd ) , Main * main )
2002-10-12 11:37:38 +00:00
{
Library * lib ;
2008-01-31 21:19:40 +00:00
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
2002-10-12 11:37:38 +00:00
lib - > id . us = 1 ;
2008-02-02 11:19:34 +00:00
}
}
/* Always call this once you havbe loaded new library data to set the relative paths correctly in relation to the blend file */
static void fix_relpaths_library ( const char * basepath , Main * main )
{
Library * lib ;
/* BLO_read_from_memory uses a blank filename */
if ( basepath = = NULL | | basepath [ 0 ] = = ' \0 ' )
return ;
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
2008-01-31 21:19:40 +00:00
/* Libraries store both relative and abs paths, recreate relative paths,
* relative to the blend file since indirectly linked libs will be relative to their direct linked library */
if ( strncmp ( lib - > name , " // " , 2 ) = = 0 ) { /* if this is relative to begin with? */
2010-06-02 17:58:28 +00:00
strncpy ( lib - > name , lib - > filepath , sizeof ( lib - > name ) ) ;
2010-03-09 17:36:23 +00:00
BLI_path_rel ( lib - > name , basepath ) ;
2008-01-31 21:19:40 +00:00
}
2002-10-12 11:37:38 +00:00
}
}
/* ************** READ SOUND ******************* */
static void direct_link_sound ( FileData * fd , bSound * sound )
{
2009-08-26 14:19:29 +00:00
sound - > handle = NULL ;
2010-02-07 23:41:17 +00:00
sound - > playback_handle = NULL ;
2002-10-12 11:37:38 +00:00
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 ;
2009-01-19 02:26:46 +00:00
sound - > ipo = newlibadr_us ( fd , sound - > id . lib , sound - > ipo ) ; // XXX depreceated - old animation system
2009-08-26 14:19:29 +00:00
2010-10-17 09:01:37 +00:00
sound_load ( main , sound ) ;
2009-08-29 23:13:27 +00:00
if ( sound - > cache )
sound_cache ( sound , 1 ) ;
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 ) {
2006-06-02 20:48:22 +00:00
go - > ob - > flag | = OB_FROMGROUP ;
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 + + ;
2009-11-11 16:28:53 +00:00
rem_from_group ( group , NULL , NULL , 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
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
static char * dataname ( short id_code )
{
switch ( id_code ) {
case ID_OB : return " Data from OB " ;
case ID_ME : return " Data from ME " ;
case ID_IP : return " Data from IP " ;
case ID_SCE : return " Data from SCE " ;
case ID_MA : return " Data from MA " ;
case ID_TE : return " Data from TE " ;
case ID_CU : return " Data from CU " ;
case ID_GR : return " Data from GR " ;
case ID_AR : return " Data from AR " ;
case ID_AC : return " Data from AC " ;
case ID_LI : return " Data from LI " ;
case ID_MB : return " Data from MB " ;
case ID_IM : return " Data from IM " ;
case ID_LT : return " Data from LT " ;
case ID_LA : return " Data from LA " ;
case ID_CA : return " Data from CA " ;
case ID_KE : return " Data from KE " ;
case ID_WO : return " Data from WO " ;
case ID_SCR : return " Data from SCR " ;
case ID_VF : return " Data from VF " ;
case ID_TXT : return " Data from TXT " ;
case ID_SO : return " Data from SO " ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
case ID_NT : return " Data from NT " ;
case ID_BR : return " Data from BR " ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
case ID_PA : return " Data from PA " ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
case ID_GD : return " Data from GD " ;
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
}
return " Data from Lib Block " ;
}
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
static BHead * read_data_into_oldnewmap ( FileData * fd , BHead * bhead , char * allocname )
{
bhead = blo_nextbhead ( fd , bhead ) ;
while ( bhead & & bhead - > code = = DATA ) {
void * data ;
2010-02-13 13:38:10 +00:00
#if 0
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
short * sp = fd - > filesdna - > structs [ bhead - > SDNAnr ] ;
char * allocname = fd - > filesdna - > types [ sp [ 0 ] ] ;
char * tmp = malloc ( 100 ) ;
strcpy ( tmp , allocname ) ;
data = read_struct ( fd , bhead , tmp ) ;
2010-02-13 13:38:10 +00:00
# else
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
data = read_struct ( fd , bhead , allocname ) ;
2010-02-13 13:38:10 +00:00
# endif
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
if ( data ) {
oldnewmap_insert ( fd - > datamap , bhead - > old , data , 0 ) ;
}
bhead = blo_nextbhead ( fd , bhead ) ;
}
return bhead ;
}
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 ;
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
char * allocname ;
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 */
2007-04-28 16:15:00 +00:00
/* do after read_struct, for dna reconstruct */
if ( bhead - > code = = ID_ID ) {
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
lb = which_libbase ( main , GS ( id - > name ) ) ;
2007-04-28 16:15:00 +00:00
}
else {
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
lb = which_libbase ( main , bhead - > code ) ;
2007-04-28 16:15:00 +00:00
}
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 ;
2005-12-21 22:21:43 +00:00
id - > icon_id = 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
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
/* need a name for the mallocN, just for debugging and sane prints on leaks */
allocname = dataname ( GS ( id - > name ) ) ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap ( fd , bhead , allocname ) ;
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 ) ) {
2007-12-24 18:53:37 +00:00
case ID_WM :
direct_link_windowmanager ( fd , ( wmWindowManager * ) id ) ;
break ;
2002-10-12 11:37:38 +00:00
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 ;
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
case ID_NT :
direct_link_nodetree ( fd , ( bNodeTree * ) id ) ;
break ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
case ID_BR :
direct_link_brush ( fd , ( Brush * ) id ) ;
break ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
case ID_PA :
direct_link_particlesettings ( fd , ( ParticleSettings * ) id ) ;
break ;
2008-03-06 21:25:15 +00:00
case ID_SCRIPT :
direct_link_script ( fd , ( Script * ) id ) ;
break ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
case ID_GD :
direct_link_gpencil ( fd , ( bGPdata * ) id ) ;
break ;
2002-10-12 11:37:38 +00:00
}
2006-11-17 06:14:15 +00:00
/*link direct data of ID properties*/
if ( id - > properties ) {
id - > properties = newdataadr ( fd , id - > properties ) ;
2008-03-12 10:20:45 +00:00
if ( id - > properties ) { /* this case means the data was written incorrectly, it should not happen */
IDP_DirectLinkProperty ( id - > properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
}
2006-11-17 06:14:15 +00:00
}
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 ) ;
}
2007-12-24 18:53:37 +00:00
/* note, this has to be kept for reading older files... */
/* also version info is written here */
static BHead * read_global ( BlendFileData * bfd , FileData * fd , BHead * bhead )
2002-10-12 11:37:38 +00:00
{
2007-12-24 18:53:37 +00:00
FileGlobal * fg = read_struct ( fd , bhead , " Global " ) ;
/* copy to bfd handle */
bfd - > main - > subversionfile = fg - > subversion ;
bfd - > main - > minversionfile = fg - > minversion ;
bfd - > main - > minsubversionfile = fg - > minsubversion ;
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 ;
2009-10-20 13:58:53 +00:00
BLI_strncpy ( bfd - > filename , fg - > filename , sizeof ( bfd - > filename ) ) ;
2009-10-20 16:43:25 +00:00
if ( G . fileflags & G_FILE_RECOVER )
BLI_strncpy ( fd - > relabase , fg - > filename , sizeof ( fd - > relabase ) ) ;
2006-11-26 21:17:15 +00:00
2007-12-24 18:53:37 +00:00
bfd - > curscreen = fg - > curscreen ;
bfd - > curscene = fg - > curscene ;
MEM_freeN ( fg ) ;
2009-08-18 15:27:48 +00:00
fd - > globalf = bfd - > globalf ;
fd - > fileflags = bfd - > fileflags ;
2007-12-24 18:53:37 +00:00
return blo_nextbhead ( fd , bhead ) ;
}
/* note, this has to be kept for reading older files... */
static void link_global ( FileData * fd , BlendFileData * bfd )
{
bfd - > curscreen = newlibadr ( fd , 0 , bfd - > curscreen ) ;
bfd - > curscene = newlibadr ( fd , 0 , bfd - > curscene ) ;
2004-09-05 13:43:51 +00:00
// 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 ) {
2008-12-26 13:11:04 +00:00
case 312 : return 311 ; /* F12KEY */
case 159 : return 161 ; /* PADSLASHKEY */
case 161 : return 150 ; /* PAD0 */
case 154 : return 151 ; /* PAD1 */
case 150 : return 152 ; /* PAD2 */
case 155 : return 153 ; /* PAD3 */
case 151 : return 154 ; /* PAD4 */
case 156 : return 155 ; /* PAD5 */
case 152 : return 156 ; /* PAD6 */
case 157 : return 157 ; /* PAD7 */
case 153 : return 158 ; /* PAD8 */
case 158 : return 159 ; /* PAD9 */
default : return code ;
2002-10-12 11:37:38 +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
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 ) ;
}
}
2006-02-03 20:39:36 +00:00
static void ntree_version_241 ( bNodeTree * ntree )
{
bNode * node ;
if ( ntree - > type = = NTREE_COMPOSIT ) {
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > type = = CMP_NODE_BLUR ) {
if ( node - > storage = = NULL ) {
NodeBlurData * nbd = MEM_callocN ( sizeof ( NodeBlurData ) , " node blur patch " ) ;
nbd - > sizex = node - > custom1 ;
nbd - > sizey = node - > custom2 ;
nbd - > filtertype = R_FILTER_QUAD ;
node - > storage = nbd ;
}
}
2006-02-07 11:39:26 +00:00
else if ( node - > type = = CMP_NODE_VECBLUR ) {
if ( node - > storage = = NULL ) {
NodeBlurData * nbd = MEM_callocN ( sizeof ( NodeBlurData ) , " node blur patch " ) ;
nbd - > samples = node - > custom1 ;
nbd - > maxspeed = node - > custom2 ;
nbd - > fac = 1.0f ;
node - > storage = nbd ;
}
}
2006-02-03 20:39:36 +00:00
}
}
}
2007-01-07 14:18:03 +00:00
static void ntree_version_242 ( bNodeTree * ntree )
{
bNode * node ;
if ( ntree - > type = = NTREE_COMPOSIT ) {
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > type = = CMP_NODE_HUE_SAT ) {
if ( node - > storage ) {
NodeHueSat * nhs = node - > storage ;
if ( nhs - > val = = 0.0f ) nhs - > val = 1.0f ;
}
}
}
}
2007-01-13 10:52:39 +00:00
else if ( ntree - > type = = NTREE_SHADER ) {
for ( node = ntree - > nodes . first ; node ; node = node - > next )
if ( node - > type = = SH_NODE_GEOMETRY & & node - > storage = = NULL )
node - > storage = MEM_callocN ( sizeof ( NodeGeometry ) , " NodeGeometry " ) ;
}
2007-01-07 14:18:03 +00:00
}
2006-11-03 12:23:04 +00:00
/* somehow, probably importing via python, keyblock adrcodes are not in order */
static void sort_shape_fix ( Main * main )
{
Key * key ;
KeyBlock * kb ;
int sorted = 0 ;
while ( sorted = = 0 ) {
sorted = 1 ;
for ( key = main - > key . first ; key ; key = key - > id . next ) {
for ( kb = key - > block . first ; kb ; kb = kb - > next ) {
if ( kb - > next & & kb - > adrcode > kb - > next - > adrcode ) {
KeyBlock * next = kb - > next ;
BLI_remlink ( & key - > block , kb ) ;
BLI_insertlink ( & key - > block , next , kb ) ;
kb = next ;
sorted = 0 ;
}
}
}
if ( sorted = = 0 ) printf ( " warning, shape keys were sorted incorrect, fixed it! \n " ) ;
}
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
static void customdata_version_242 ( Mesh * me )
{
2006-12-21 13:47:27 +00:00
CustomDataLayer * layer ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
MTFace * mtf ;
MCol * mcol ;
TFace * tf ;
2006-12-21 13:47:27 +00:00
int a , mtfacen , mcoln ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
if ( ! me - > vdata . totlayer ) {
2006-12-12 21:29:09 +00:00
CustomData_add_layer ( & me - > vdata , CD_MVERT , CD_ASSIGN , me - > mvert , me - > totvert ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
if ( me - > msticky )
2006-12-12 21:29:09 +00:00
CustomData_add_layer ( & me - > vdata , CD_MSTICKY , CD_ASSIGN , me - > msticky , me - > totvert ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
if ( me - > dvert )
2006-12-12 21:29:09 +00:00
CustomData_add_layer ( & me - > vdata , CD_MDEFORMVERT , CD_ASSIGN , me - > dvert , me - > totvert ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
}
if ( ! me - > edata . totlayer )
2006-12-12 21:29:09 +00:00
CustomData_add_layer ( & me - > edata , CD_MEDGE , CD_ASSIGN , me - > medge , me - > totedge ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
if ( ! me - > fdata . totlayer ) {
2006-12-12 21:29:09 +00:00
CustomData_add_layer ( & me - > fdata , CD_MFACE , CD_ASSIGN , me - > mface , me - > totface ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
2007-01-14 12:35:45 +00:00
if ( me - > tface ) {
if ( me - > mcol )
MEM_freeN ( me - > mcol ) ;
2006-12-12 21:29:09 +00:00
me - > mcol = CustomData_add_layer ( & me - > fdata , CD_MCOL , CD_CALLOC , NULL , me - > totface ) ;
me - > mtface = CustomData_add_layer ( & me - > fdata , CD_MTFACE , CD_CALLOC , NULL , me - > totface ) ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
mtf = me - > mtface ;
mcol = me - > mcol ;
tf = me - > tface ;
for ( a = 0 ; a < me - > totface ; a + + , mtf + + , tf + + , mcol + = 4 ) {
memcpy ( mcol , tf - > col , sizeof ( tf - > col ) ) ;
memcpy ( mtf - > uv , tf - > uv , sizeof ( tf - > uv ) ) ;
mtf - > flag = tf - > flag ;
mtf - > unwrap = tf - > unwrap ;
mtf - > mode = tf - > mode ;
mtf - > tile = tf - > tile ;
mtf - > tpage = tf - > tpage ;
mtf - > transp = tf - > transp ;
}
MEM_freeN ( me - > tface ) ;
me - > tface = NULL ;
}
2007-01-14 12:35:45 +00:00
else if ( me - > mcol ) {
me - > mcol = CustomData_add_layer ( & me - > fdata , CD_MCOL , CD_ASSIGN , me - > mcol , me - > totface ) ;
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
}
2006-11-21 14:46:17 +00:00
if ( me - > tface ) {
MEM_freeN ( me - > tface ) ;
me - > tface = NULL ;
}
2006-12-21 13:47:27 +00:00
for ( a = 0 , mtfacen = 0 , mcoln = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
if ( layer - > type = = CD_MTFACE ) {
if ( layer - > name [ 0 ] = = 0 ) {
if ( mtfacen = = 0 ) strcpy ( layer - > name , " UVTex " ) ;
else sprintf ( layer - > name , " UVTex.%.3d " , mtfacen ) ;
}
mtfacen + + ;
}
else if ( layer - > type = = CD_MCOL ) {
if ( layer - > name [ 0 ] = = 0 ) {
if ( mcoln = = 0 ) strcpy ( layer - > name , " Col " ) ;
else sprintf ( layer - > name , " Col.%.3d " , mcoln ) ;
}
mcoln + + ;
}
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
mesh_update_customdata_pointers ( me ) ;
}
2006-11-03 12:23:04 +00:00
2007-05-02 00:01:23 +00:00
/*only copy render texface layer from active*/
static void customdata_version_243 ( Mesh * me )
{
CustomDataLayer * layer ;
int a ;
for ( a = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
layer - > active_rnd = layer - > active ;
}
}
2006-12-20 17:57:56 +00:00
/* struct NodeImageAnim moved to ImageUser, and we make it default available */
static void do_version_ntree_242_2 ( bNodeTree * ntree )
{
bNode * node ;
if ( ntree - > type = = NTREE_COMPOSIT ) {
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( ELEM3 ( node - > type , CMP_NODE_IMAGE , CMP_NODE_VIEWER , CMP_NODE_SPLITVIEWER ) ) {
/* only image had storage */
if ( node - > storage ) {
NodeImageAnim * nia = node - > storage ;
ImageUser * iuser = MEM_callocN ( sizeof ( ImageUser ) , " ima user node " ) ;
iuser - > frames = nia - > frames ;
iuser - > sfra = nia - > sfra ;
iuser - > offset = nia - > nr - 1 ;
iuser - > cycl = nia - > cyclic ;
iuser - > fie_ima = 2 ;
iuser - > ok = 1 ;
node - > storage = iuser ;
MEM_freeN ( nia ) ;
}
else {
ImageUser * iuser = node - > storage = MEM_callocN ( sizeof ( ImageUser ) , " node image user " ) ;
iuser - > sfra = 1 ;
iuser - > fie_ima = 2 ;
iuser - > ok = 1 ;
}
}
}
}
}
2008-02-26 11:38:32 +00:00
static void ntree_version_245 ( FileData * fd , Library * lib , bNodeTree * ntree )
2008-02-04 21:17:15 +00:00
{
bNode * node ;
NodeTwoFloats * ntf ;
2008-02-26 11:38:32 +00:00
ID * nodeid ;
Image * image ;
ImageUser * iuser ;
2008-02-04 21:17:15 +00:00
if ( ntree - > type = = NTREE_COMPOSIT ) {
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > type = = CMP_NODE_ALPHAOVER ) {
if ( ! node - > storage ) {
ntf = MEM_callocN ( sizeof ( NodeTwoFloats ) , " NodeTwoFloats " ) ;
node - > storage = ntf ;
if ( node - > custom1 )
ntf - > x = 1.0f ;
}
}
2008-02-26 11:38:32 +00:00
/* fix for temporary flag changes during 245 cycle */
nodeid = newlibadr ( fd , lib , node - > id ) ;
if ( node - > storage & & nodeid & & GS ( nodeid - > name ) = = ID_IM ) {
image = ( Image * ) nodeid ;
iuser = node - > storage ;
if ( iuser - > flag & IMA_OLD_PREMUL ) {
iuser - > flag & = ~ IMA_OLD_PREMUL ;
iuser - > flag | = IMA_DO_PREMUL ;
}
if ( iuser - > flag & IMA_DO_PREMUL ) {
image - > flag & = ~ IMA_OLD_PREMUL ;
image - > flag | = IMA_DO_PREMUL ;
}
}
2008-02-04 21:17:15 +00:00
}
}
}
2008-09-29 17:08:11 +00:00
static void idproperties_fix_groups_lengths_recurse ( IDProperty * prop )
2008-02-23 02:12:50 +00:00
{
IDProperty * loop ;
int i ;
for ( loop = prop - > data . group . first , i = 0 ; loop ; loop = loop - > next , i + + ) {
if ( loop - > type = = IDP_GROUP ) idproperties_fix_groups_lengths_recurse ( loop ) ;
}
if ( prop - > len ! = i ) {
printf ( " Found and fixed bad id property group length. \n " ) ;
prop - > len = i ;
}
}
2008-09-29 17:08:11 +00:00
static void idproperties_fix_group_lengths ( ListBase idlist )
2008-02-23 02:12:50 +00:00
{
ID * id ;
for ( id = idlist . first ; id ; id = id - > next ) {
if ( id - > properties ) {
idproperties_fix_groups_lengths_recurse ( id - > properties ) ;
}
}
}
2008-02-04 21:17:15 +00:00
2008-09-29 17:08:11 +00:00
static void alphasort_version_246 ( FileData * fd , Library * lib , Mesh * me )
2008-07-29 15:48:31 +00:00
{
Material * ma ;
MFace * mf ;
MTFace * tf ;
int a , b , texalpha ;
/* verify we have a tface layer */
for ( b = 0 ; b < me - > fdata . totlayer ; b + + )
if ( me - > fdata . layers [ b ] . type = = CD_MTFACE )
break ;
if ( b = = me - > fdata . totlayer )
return ;
/* if we do, set alpha sort if the game engine did it before */
for ( a = 0 , mf = me - > mface ; a < me - > totface ; a + + , mf + + ) {
if ( mf - > mat_nr < me - > totcol ) {
2008-12-15 05:21:44 +00:00
ma = newlibadr ( fd , lib , me - > mat [ ( int ) mf - > mat_nr ] ) ;
2008-07-29 15:48:31 +00:00
texalpha = 0 ;
2008-10-27 15:22:55 +00:00
/* we can't read from this if it comes from a library,
* because direct_link might not have happened on it ,
* so ma - > mtex is not pointing to valid memory yet */
if ( ma & & ma - > id . lib )
ma = NULL ;
2008-07-29 15:48:31 +00:00
for ( b = 0 ; ma & & b < MAX_MTEX ; b + + )
if ( ma - > mtex & & ma - > mtex [ b ] & & ma - > mtex [ b ] - > mapto & MAP_ALPHA )
texalpha = 1 ;
}
else {
ma = NULL ;
texalpha = 0 ;
}
for ( b = 0 ; b < me - > fdata . totlayer ; b + + ) {
if ( me - > fdata . layers [ b ] . type = = CD_MTFACE ) {
tf = ( ( MTFace * ) me - > fdata . layers [ b ] . data ) + a ;
tf - > mode & = ~ TF_ALPHASORT ;
2009-08-15 19:35:03 +00:00
if ( ma & & ( ma - > mode & MA_ZTRANSP ) )
2008-07-29 15:48:31 +00:00
if ( ELEM ( tf - > transp , TF_ALPHA , TF_ADD ) | | ( texalpha & & ( tf - > transp ! = TF_CLIP ) ) )
tf - > mode | = TF_ALPHASORT ;
}
}
}
}
2008-12-11 19:35:27 +00:00
/* 2.50 patch */
static void area_add_header_region ( ScrArea * sa , ListBase * lb )
2008-01-07 18:03:41 +00:00
{
2008-12-11 19:35:27 +00:00
ARegion * ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
2008-01-07 18:03:41 +00:00
2008-12-11 19:35:27 +00:00
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_HEADER ;
if ( sa - > headertype = = 1 )
ar - > alignment = RGN_ALIGN_BOTTOM ;
else
ar - > alignment = RGN_ALIGN_TOP ;
/* initialise view2d data for header region, to allow panning */
2008-12-12 16:29:33 +00:00
/* is copy from ui_view2d.c */
2009-07-29 22:57:53 +00:00
ar - > v2d . keepzoom = ( V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT ) ;
2008-12-11 19:35:27 +00:00
ar - > v2d . keepofs = V2D_LOCKOFS_Y ;
2008-12-16 11:24:24 +00:00
ar - > v2d . keeptot = V2D_KEEPTOT_STRICT ;
2008-12-15 13:23:55 +00:00
ar - > v2d . align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y ;
2008-12-21 03:14:01 +00:00
ar - > v2d . flag = ( V2D_PIXELOFS_X | V2D_PIXELOFS_Y ) ;
2008-12-11 19:35:27 +00:00
}
2010-02-07 19:07:56 +00:00
static void sequencer_init_preview_region ( ARegion * ar )
{
// XXX a bit ugly still, copied from space_sequencer
/* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
ar - > regiontype = RGN_TYPE_PREVIEW ;
ar - > alignment = RGN_ALIGN_TOP ;
ar - > flag | = RGN_FLAG_HIDDEN ;
ar - > v2d . keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM ;
ar - > v2d . minzoom = 0.00001f ;
ar - > v2d . maxzoom = 100000.0f ;
ar - > v2d . tot . xmin = - 960.0f ; /* 1920 width centered */
ar - > v2d . tot . ymin = - 540.0f ; /* 1080 height centered */
ar - > v2d . tot . xmax = 960.0f ;
ar - > v2d . tot . ymax = 540.0f ;
ar - > v2d . min [ 0 ] = 0.0f ;
ar - > v2d . min [ 1 ] = 0.0f ;
ar - > v2d . max [ 0 ] = 12000.0f ;
ar - > v2d . max [ 1 ] = 12000.0f ;
ar - > v2d . cur = ar - > v2d . tot ;
ar - > v2d . align = V2D_ALIGN_FREE ; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
ar - > v2d . keeptot = V2D_KEEPTOT_FREE ;
}
2008-12-11 19:35:27 +00:00
/* 2.50 patch */
static void area_add_window_regions ( ScrArea * sa , SpaceLink * sl , ListBase * lb )
{
2008-12-12 18:47:12 +00:00
ARegion * ar ;
2009-12-14 22:59:41 +00:00
ARegion * ar_main ;
2008-12-12 18:47:12 +00:00
if ( sl ) {
/* first channels for ipo action nla... */
switch ( sl - > spacetype ) {
case SPACE_IPO :
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_CHANNELS ;
2008-12-15 11:58:57 +00:00
ar - > alignment = RGN_ALIGN_LEFT ;
2008-12-18 09:20:29 +00:00
ar - > v2d . scroll = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM ) ;
2009-08-02 22:56:42 +00:00
// for some reason, this doesn't seem to go auto like for NLA...
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_UI ;
ar - > alignment = RGN_ALIGN_RIGHT ;
ar - > v2d . scroll = V2D_SCROLL_RIGHT ;
ar - > v2d . flag = RGN_FLAG_HIDDEN ;
2008-12-12 18:47:12 +00:00
break ;
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
2008-12-12 18:47:12 +00:00
case SPACE_ACTION :
2008-12-14 14:43:08 +00:00
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_CHANNELS ;
ar - > alignment = RGN_ALIGN_LEFT ;
2008-12-18 23:23:09 +00:00
ar - > v2d . scroll = V2D_SCROLL_BOTTOM ;
2008-12-21 11:56:42 +00:00
ar - > v2d . flag = V2D_VIEWSYNC_AREA_VERTICAL ;
2008-12-12 18:47:12 +00:00
break ;
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
2008-12-12 18:47:12 +00:00
case SPACE_NLA :
2008-12-14 14:43:08 +00:00
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_CHANNELS ;
ar - > alignment = RGN_ALIGN_LEFT ;
2008-12-18 23:23:09 +00:00
ar - > v2d . scroll = V2D_SCROLL_BOTTOM ;
2008-12-28 11:08:56 +00:00
ar - > v2d . flag = V2D_VIEWSYNC_AREA_VERTICAL ;
2010-01-30 21:11:46 +00:00
// for some reason, some files still don't get this auto
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_UI ;
ar - > alignment = RGN_ALIGN_RIGHT ;
ar - > v2d . scroll = V2D_SCROLL_RIGHT ;
ar - > v2d . flag = RGN_FLAG_HIDDEN ;
2008-12-12 18:47:12 +00:00
break ;
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
2009-01-13 19:28:18 +00:00
case SPACE_NODE :
ar = MEM_callocN ( sizeof ( ARegion ) , " nodetree area for node " ) ;
BLI_addtail ( lb , ar ) ;
2010-11-20 16:00:36 +00:00
ar - > regiontype = RGN_TYPE_UI ;
2009-01-13 19:28:18 +00:00
ar - > alignment = RGN_ALIGN_LEFT ;
ar - > v2d . scroll = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM ) ;
ar - > v2d . flag = V2D_VIEWSYNC_AREA_VERTICAL ;
2.5
Added WM Jobs manager
- WM can manage threaded jobs for you; just provide a couple
of components to get it work:
- customdata, free callback for it
- timer step, notifier code
- start callback, update callback
- Once started, each job runs an own timer, and will for
every time step check necessary updates, or close the
job when ready.
- No drawing happens in jobs, that's for notifiers!
- Every job stores an owner pointer, and based on this owner
it will prevent multiple jobs to enter the stack.
Instead it will re-use a running job, signal it to stop
and allow caller to re-initialize it even.
- Check new wm_jobs.c for more explanation. Jobs API is still
under construction.
Fun: BLI_addtail(&wm->jobs, steve); :)
Put Node shader previews back using wmJobs
- Preview calculating is now fully threaded (1 thread still)
- Thanks to new event system + notifiers, you can see
previews update even while dragging sliders!
- Currently it only starts when you change a node setting.
Warning: the thread render shares Node data, so don't delete
nodes while it renders! This topic is on the todo to make safe.
Also:
- bug in region initialize (do_versions) showed channel list in
node editor wrong.
- flagged the channel list 'hidden' now, it was really in the
way! This is for later to work on anyway.
- recoded Render API callbacks so it gets handlers passed on,
no globals to use anymore, remember?
- previewrender code gets now so much nicer! Will remove a lot
of stuff from code soon.
2009-01-22 14:59:49 +00:00
/* temporarily hide it */
ar - > flag = RGN_FLAG_HIDDEN ;
break ;
2009-07-12 08:12:22 +00:00
case SPACE_FILE :
ar = MEM_callocN ( sizeof ( ARegion ) , " nodetree area for node " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_CHANNELS ;
ar - > alignment = RGN_ALIGN_LEFT ;
ar = MEM_callocN ( sizeof ( ARegion ) , " ui area for file " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_UI ;
ar - > alignment = RGN_ALIGN_TOP ;
break ;
2009-12-14 21:42:25 +00:00
case SPACE_SEQ :
2009-12-14 22:59:41 +00:00
ar_main = ( ARegion * ) lb - > first ;
for ( ; ar_main ; ar_main = ar_main - > next ) {
if ( ar_main - > regiontype = = RGN_TYPE_WINDOW )
break ;
}
2009-12-14 21:42:25 +00:00
ar = MEM_callocN ( sizeof ( ARegion ) , " preview area for sequencer " ) ;
2009-12-14 22:59:41 +00:00
BLI_insertlinkbefore ( lb , ar_main , ar ) ;
2010-02-07 19:07:56 +00:00
sequencer_init_preview_region ( ar ) ;
2009-12-14 21:42:25 +00:00
break ;
2009-11-11 10:59:58 +00:00
case SPACE_VIEW3D :
/* toolbar */
ar = MEM_callocN ( sizeof ( ARegion ) , " toolbar for view3d " ) ;
BLI_addtail ( lb , ar ) ;
2009-12-10 02:43:55 +00:00
ar - > regiontype = RGN_TYPE_TOOLS ;
2009-11-11 10:59:58 +00:00
ar - > alignment = RGN_ALIGN_LEFT ;
ar - > flag = RGN_FLAG_HIDDEN ;
/* tool properties */
ar = MEM_callocN ( sizeof ( ARegion ) , " tool properties for view3d " ) ;
BLI_addtail ( lb , ar ) ;
2009-12-10 02:43:55 +00:00
ar - > regiontype = RGN_TYPE_TOOL_PROPS ;
2009-11-11 10:59:58 +00:00
ar - > alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV ;
ar - > flag = RGN_FLAG_HIDDEN ;
/* buttons/list view */
ar = MEM_callocN ( sizeof ( ARegion ) , " buttons for view3d " ) ;
BLI_addtail ( lb , ar ) ;
ar - > regiontype = RGN_TYPE_UI ;
ar - > alignment = RGN_ALIGN_RIGHT ;
ar - > flag = RGN_FLAG_HIDDEN ;
2009-06-07 13:36:12 +00:00
#if 0
case SPACE_BUTS :
/* context UI region */
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
BLI_addtail ( lb , ar ) ;
2009-11-11 10:59:58 +00:00
ar - > regiontype = RGN_TYPE_UI ;
ar - > alignment = RGN_ALIGN_RIGHT ;
2009-06-07 13:36:12 +00:00
break ;
# endif
2008-12-12 18:47:12 +00:00
}
}
2009-01-15 04:22:23 +00:00
2008-12-12 18:47:12 +00:00
/* main region */
ar = MEM_callocN ( sizeof ( ARegion ) , " area region from do_versions " ) ;
2008-12-11 19:35:27 +00:00
BLI_addtail ( lb , ar ) ;
ar - > winrct = sa - > totrct ;
2008-12-12 18:47:12 +00:00
2008-12-11 19:35:27 +00:00
ar - > regiontype = RGN_TYPE_WINDOW ;
if ( sl ) {
2008-11-30 06:15:33 +00:00
/* if active spacetype has view2d data, copy that over to main region */
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
/* and we split view3d */
2008-12-11 19:35:27 +00:00
switch ( sl - > spacetype ) {
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
case SPACE_VIEW3D :
view3d_split_250 ( ( View3D * ) sl , lb ) ;
break ;
2009-03-26 14:05:33 +00:00
case SPACE_OUTLINER :
2008-12-01 11:37:05 +00:00
{
2008-12-11 19:35:27 +00:00
SpaceOops * soops = ( SpaceOops * ) sl ;
2008-12-01 11:37:05 +00:00
memcpy ( & ar - > v2d , & soops - > v2d , sizeof ( View2D ) ) ;
2008-12-06 09:25:42 +00:00
2008-12-04 20:28:59 +00:00
ar - > v2d . scroll & = ~ V2D_SCROLL_LEFT ;
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM_O ) ;
2008-12-05 02:03:37 +00:00
ar - > v2d . align = ( V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y ) ;
2008-12-14 08:32:21 +00:00
ar - > v2d . keepzoom | = ( V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_KEEPASPECT ) ;
2008-12-16 11:24:24 +00:00
ar - > v2d . keeptot = V2D_KEEPTOT_STRICT ;
2009-01-05 00:38:17 +00:00
ar - > v2d . minzoom = ar - > v2d . maxzoom = 1.0f ;
2008-12-18 09:20:29 +00:00
//ar->v2d.flag |= V2D_IS_INITIALISED;
2008-12-01 11:37:05 +00:00
}
2008-11-30 06:15:33 +00:00
break ;
case SPACE_TIME :
2008-12-01 11:37:05 +00:00
{
2008-12-11 19:35:27 +00:00
SpaceTime * stime = ( SpaceTime * ) sl ;
2008-12-01 11:37:05 +00:00
memcpy ( & ar - > v2d , & stime - > v2d , sizeof ( View2D ) ) ;
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
2008-12-05 02:03:37 +00:00
ar - > v2d . align | = V2D_ALIGN_NO_NEG_Y ;
2008-12-01 11:37:05 +00:00
ar - > v2d . keepofs | = V2D_LOCKOFS_Y ;
2008-12-13 09:25:47 +00:00
ar - > v2d . keepzoom | = V2D_LOCKZOOM_Y ;
2008-12-14 08:32:21 +00:00
ar - > v2d . tot . ymin = ar - > v2d . cur . ymin = - 10.0 ;
ar - > v2d . min [ 1 ] = ar - > v2d . max [ 1 ] = 20.0 ;
2008-12-01 11:37:05 +00:00
}
2008-11-30 06:15:33 +00:00
break ;
2008-12-12 18:47:12 +00:00
case SPACE_IPO :
{
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
memcpy ( & ar - > v2d , & sipo - > v2d , sizeof ( View2D ) ) ;
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor')
This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.
Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.
It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.
Notes:
* Fixed a few bugs in RNA User-Preferences wrapping
* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?
* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.
* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.
2009-01-26 11:33:16 +00:00
/* init mainarea view2d */
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
ar - > v2d . scroll | = ( V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL ) ;
2010-01-25 11:06:55 +00:00
ar - > v2d . min [ 0 ] = FLT_MIN ;
ar - > v2d . min [ 1 ] = FLT_MIN ;
ar - > v2d . max [ 0 ] = MAXFRAMEF ;
ar - > v2d . max [ 1 ] = FLT_MAX ;
2008-12-18 09:20:29 +00:00
//ar->v2d.flag |= V2D_IS_INITIALISED;
2008-12-13 19:00:54 +00:00
break ;
}
2008-12-14 14:43:08 +00:00
case SPACE_SOUND :
{
SpaceSound * ssound = ( SpaceSound * ) sl ;
memcpy ( & ar - > v2d , & ssound - > v2d , sizeof ( View2D ) ) ;
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
2008-12-14 14:43:08 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_LEFT ) ;
2008-12-18 09:20:29 +00:00
//ar->v2d.flag |= V2D_IS_INITIALISED;
2008-12-14 14:43:08 +00:00
break ;
}
case SPACE_NLA :
{
SpaceNla * snla = ( SpaceNla * ) sl ;
memcpy ( & ar - > v2d , & snla - > v2d , sizeof ( View2D ) ) ;
2010-01-27 11:43:34 +00:00
ar - > v2d . tot . ymin = ( float ) ( - sa - > winy ) / 3.0f ;
ar - > v2d . tot . ymax = 0.0f ;
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
2008-12-14 14:43:08 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_RIGHT ) ;
2008-12-18 23:23:09 +00:00
ar - > v2d . align = V2D_ALIGN_NO_POS_Y ;
2008-12-21 11:56:42 +00:00
ar - > v2d . flag | = V2D_VIEWSYNC_AREA_VERTICAL ;
2008-12-14 14:43:08 +00:00
break ;
}
case SPACE_ACTION :
{
2009-01-02 00:56:48 +00:00
/* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
ar - > v2d . tot . xmin = - 20.0f ;
2010-01-27 11:43:34 +00:00
ar - > v2d . tot . ymin = ( float ) ( - sa - > winy ) / 3.0f ;
2009-02-09 10:04:11 +00:00
ar - > v2d . tot . xmax = ( float ) ( ( sa - > winx > 120 ) ? ( sa - > winx ) : 120 ) ;
2009-01-01 08:08:55 +00:00
ar - > v2d . tot . ymax = 0.0f ;
ar - > v2d . cur = ar - > v2d . tot ;
ar - > v2d . min [ 0 ] = 0.0f ;
2010-03-22 09:30:00 +00:00
ar - > v2d . min [ 1 ] = 0.0f ;
2009-01-01 08:08:55 +00:00
ar - > v2d . max [ 0 ] = MAXFRAMEF ;
2010-03-22 09:30:00 +00:00
ar - > v2d . max [ 1 ] = FLT_MAX ;
2009-01-01 08:08:55 +00:00
ar - > v2d . minzoom = 0.01f ;
ar - > v2d . maxzoom = 50 ;
ar - > v2d . scroll = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
2008-12-14 14:43:08 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_RIGHT ) ;
2009-01-01 08:08:55 +00:00
ar - > v2d . keepzoom = V2D_LOCKZOOM_Y ;
2009-06-19 11:56:53 +00:00
ar - > v2d . align = V2D_ALIGN_NO_POS_Y ;
2009-01-01 08:08:55 +00:00
ar - > v2d . flag = V2D_VIEWSYNC_AREA_VERTICAL ;
2008-12-14 14:43:08 +00:00
break ;
}
case SPACE_SEQ :
{
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
memcpy ( & ar - > v2d , & sseq - > v2d , sizeof ( View2D ) ) ;
2008-12-15 11:58:57 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL ) ;
ar - > v2d . scroll | = ( V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL ) ;
2009-01-12 22:54:30 +00:00
ar - > v2d . align = V2D_ALIGN_NO_NEG_Y ;
2008-12-16 11:24:24 +00:00
ar - > v2d . flag | = V2D_IS_INITIALISED ;
2008-12-14 14:43:08 +00:00
break ;
}
2008-12-13 19:00:54 +00:00
case SPACE_NODE :
{
SpaceNode * snode = ( SpaceNode * ) sl ;
memcpy ( & ar - > v2d , & snode - > v2d , sizeof ( View2D ) ) ;
2008-12-29 00:03:05 +00:00
ar - > v2d . scroll = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM ) ;
2009-07-29 22:57:53 +00:00
ar - > v2d . keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT ;
2008-12-13 19:00:54 +00:00
break ;
}
case SPACE_BUTS :
{
SpaceButs * sbuts = ( SpaceButs * ) sl ;
memcpy ( & ar - > v2d , & sbuts - > v2d , sizeof ( View2D ) ) ;
2009-07-14 10:59:21 +00:00
ar - > v2d . scroll | = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM ) ;
2008-12-13 19:00:54 +00:00
break ;
2009-01-06 14:42:54 +00:00
}
case SPACE_FILE :
2010-03-22 09:30:00 +00:00
{
2009-01-17 00:51:42 +00:00
// SpaceFile *sfile= (SpaceFile *)sl;
2009-01-06 14:42:54 +00:00
ar - > v2d . tot . xmin = ar - > v2d . tot . ymin = 0 ;
ar - > v2d . tot . xmax = ar - > winx ;
ar - > v2d . tot . ymax = ar - > winy ;
ar - > v2d . cur = ar - > v2d . tot ;
ar - > regiontype = RGN_TYPE_WINDOW ;
ar - > v2d . scroll = ( V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM_O ) ;
ar - > v2d . align = ( V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y ) ;
2009-07-29 22:57:53 +00:00
ar - > v2d . keepzoom = ( V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT ) ;
2009-01-06 14:42:54 +00:00
break ;
2.5: Text Editor back.
There was very little structure in this code, using many globals
and duplicated code. Now it should be better structured. Most
things should work, the main parts that are not back yet are the
python plugins and markers. Notes:
* Blenfont is used for drawing the text, nicely anti-aliased.
* A monospace truetype font was added, since that is needed for
the text editor. It's Bitstream Vera Sans Mono. This is the
default gnome terminal font, but it doesn't fit entirely well
with the other font I think, can be changed easily of course.
* Clipboard copy/cut/paste now always uses the system clipboard,
the code for the own cut buffer was removed.
* The interface buttons should support copy/cut/paste again now
as well.
* WM_clipboard_text_get/WM_clipboard_text_set were added to the
windowmanager code.
* Find panel is now a kind of second header, instead of a panel.
This needs especially a way to start editing the text field
immediately on open still.
* Operators are independent of the actual space when possible,
was a bit of puzzling but got it solved nice with notifiers,
and some lazy init for syntax highlight in the drawing code.
* RNA was created for the text editor space and used for buttons.
* Operators:
* New, Open, Reload, Save, Save As, Make Internal
* Run Script, Refresh Pyconstraints
* Copy, Cut, Paste
* Convert Whitespace, Uncomment, Comment, Indent, Unindent
* Line Break, Insert
* Next Marker, Previous Marker, Clear All Markers, Mark All
* Select Line, Select All
* Jump, Move, Move Select, Delete, Toggle Overwrite
* Scroll, Scroll Bar, Set Cursor, Line Number
* Find and Replace, Find, Replace, Find Set Selected,
Replace Set Selected
* To 3D Object
* Resolve Conflict
2009-02-28 23:33:35 +00:00
}
case SPACE_TEXT :
{
SpaceText * st = ( SpaceText * ) sl ;
st - > flags | = ST_FIND_WRAP ;
2008-12-12 18:47:12 +00:00
}
2008-12-13 19:00:54 +00:00
//case SPACE_XXX: // FIXME... add other ones
2008-12-11 19:35:27 +00:00
// memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
// break;
}
}
}
static void do_versions_windowmanager_2_50 ( bScreen * screen )
{
ScrArea * sa ;
SpaceLink * sl ;
/* add regions */
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
/* we keep headertype variable to convert old files only */
if ( sa - > headertype )
area_add_header_region ( sa , & sa - > regionbase ) ;
area_add_window_regions ( sa , sa - > spacedata . first , & sa - > regionbase ) ;
2008-12-15 19:29:53 +00:00
/* space imageselect is depricated */
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_IMASEL )
sl - > spacetype = SPACE_INFO ; /* spacedata then matches */
}
2010-11-20 16:00:36 +00:00
/* it seems to be possible in 2.5 to have this saved, filewindow probably */
sa - > butspacetype = sa - > spacetype ;
2008-12-11 19:35:27 +00:00
/* pushed back spaces also need regions! */
if ( sa - > spacedata . first ) {
sl = sa - > spacedata . first ;
for ( sl = sl - > next ; sl ; sl = sl - > next ) {
if ( sa - > headertype )
area_add_header_region ( sa , & sl - > regionbase ) ;
area_add_window_regions ( sa , sl , & sl - > regionbase ) ;
}
2008-11-30 06:15:33 +00:00
}
2008-01-07 18:03:41 +00:00
}
}
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
static void versions_gpencil_add_main ( ListBase * lb , ID * id , char * name )
{
BLI_addtail ( lb , id ) ;
id - > us = 1 ;
id - > flag = LIB_FAKEUSER ;
* ( ( short * ) id - > name ) = ID_GD ;
new_id ( lb , id , name ) ;
/* alphabetic insterion: is in new_id */
if ( G . f & G_DEBUG )
printf ( " Converted GPencil to ID: %s \n " , id - > name + 2 ) ;
}
static void do_versions_gpencil_2_50 ( Main * main , bScreen * screen )
{
ScrArea * sa ;
SpaceLink * sl ;
/* add regions */
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
2009-04-20 15:06:46 +00:00
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
if ( v3d - > gpd ) {
versions_gpencil_add_main ( & main - > gpencil , ( ID * ) v3d - > gpd , " GPencil View3D " ) ;
v3d - > gpd = NULL ;
}
}
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
if ( snode - > gpd ) {
versions_gpencil_add_main ( & main - > gpencil , ( ID * ) snode - > gpd , " GPencil Node " ) ;
snode - > gpd = NULL ;
}
}
else if ( sl - > spacetype = = SPACE_SEQ ) {
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
if ( sseq - > gpd ) {
versions_gpencil_add_main ( & main - > gpencil , ( ID * ) sseq - > gpd , " GPencil Node " ) ;
sseq - > gpd = NULL ;
}
}
else if ( sl - > spacetype = = SPACE_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
if ( sima - > gpd ) {
versions_gpencil_add_main ( & main - > gpencil , ( ID * ) sima - > gpd , " GPencil Image " ) ;
sima - > gpd = NULL ;
}
}
}
}
}
2009-10-01 17:15:23 +00:00
static void do_version_mtex_factor_2_50 ( MTex * * mtex_array , short idtype )
{
MTex * mtex ;
float varfac , colfac ;
int a , neg ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
2009-10-01 17:15:23 +00:00
if ( ! mtex_array )
return ;
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
if ( mtex_array [ a ] ) {
mtex = mtex_array [ a ] ;
neg = mtex - > maptoneg ;
varfac = mtex - > varfac ;
colfac = mtex - > colfac ;
if ( neg & MAP_DISP ) mtex - > dispfac = - mtex - > dispfac ;
if ( neg & MAP_NORM ) mtex - > norfac = - mtex - > norfac ;
if ( neg & MAP_WARP ) mtex - > warpfac = - mtex - > warpfac ;
mtex - > colspecfac = ( neg & MAP_COLSPEC ) ? - colfac : colfac ;
mtex - > mirrfac = ( neg & MAP_COLMIR ) ? - colfac : colfac ;
mtex - > alphafac = ( neg & MAP_ALPHA ) ? - varfac : varfac ;
mtex - > difffac = ( neg & MAP_REF ) ? - varfac : varfac ;
mtex - > specfac = ( neg & MAP_SPEC ) ? - varfac : varfac ;
mtex - > emitfac = ( neg & MAP_EMIT ) ? - varfac : varfac ;
mtex - > hardfac = ( neg & MAP_HAR ) ? - varfac : varfac ;
mtex - > raymirrfac = ( neg & MAP_RAYMIRR ) ? - varfac : varfac ;
mtex - > translfac = ( neg & MAP_TRANSLU ) ? - varfac : varfac ;
mtex - > ambfac = ( neg & MAP_AMB ) ? - varfac : varfac ;
mtex - > colemitfac = ( neg & MAP_EMISSION_COL ) ? - colfac : colfac ;
mtex - > colreflfac = ( neg & MAP_REFLECTION_COL ) ? - colfac : colfac ;
mtex - > coltransfac = ( neg & MAP_TRANSMISSION_COL ) ? - colfac : colfac ;
mtex - > densfac = ( neg & MAP_DENSITY ) ? - varfac : varfac ;
mtex - > scatterfac = ( neg & MAP_SCATTERING ) ? - varfac : varfac ;
mtex - > reflfac = ( neg & MAP_REFLECTION ) ? - varfac : varfac ;
mtex - > timefac = ( neg & MAP_PA_TIME ) ? - varfac : varfac ;
mtex - > lengthfac = ( neg & MAP_PA_LENGTH ) ? - varfac : varfac ;
mtex - > clumpfac = ( neg & MAP_PA_CLUMP ) ? - varfac : varfac ;
mtex - > kinkfac = ( neg & MAP_PA_KINK ) ? - varfac : varfac ;
mtex - > roughfac = ( neg & MAP_PA_ROUGH ) ? - varfac : varfac ;
mtex - > padensfac = ( neg & MAP_PA_DENS ) ? - varfac : varfac ;
mtex - > lifefac = ( neg & MAP_PA_LIFE ) ? - varfac : varfac ;
mtex - > sizefac = ( neg & MAP_PA_SIZE ) ? - varfac : varfac ;
mtex - > ivelfac = ( neg & MAP_PA_IVEL ) ? - varfac : varfac ;
mtex - > pvelfac = ( neg & MAP_PA_PVEL ) ? - varfac : varfac ;
mtex - > shadowfac = ( neg & LAMAP_SHAD ) ? - colfac : colfac ;
mtex - > zenupfac = ( neg & WOMAP_ZENUP ) ? - colfac : colfac ;
mtex - > zendownfac = ( neg & WOMAP_ZENDOWN ) ? - colfac : colfac ;
mtex - > blendfac = ( neg & WOMAP_BLEND ) ? - varfac : varfac ;
if ( idtype = = ID_MA )
mtex - > colfac = ( neg & MAP_COL ) ? - colfac : colfac ;
else if ( idtype = = ID_LA )
mtex - > colfac = ( neg & LAMAP_COL ) ? - colfac : colfac ;
else if ( idtype = = ID_WO )
mtex - > colfac = ( neg & WOMAP_HORIZ ) ? - colfac : colfac ;
}
}
}
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
2010-10-16 02:40:31 +00:00
static void do_version_mdef_250 ( Main * main )
2010-04-23 11:19:06 +00:00
{
Object * ob ;
ModifierData * md ;
MeshDeformModifierData * mmd ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
if ( md - > type = = eModifierType_MeshDeform ) {
mmd = ( MeshDeformModifierData * ) md ;
if ( mmd - > bindcos ) {
/* make bindcos NULL in order to trick older versions
into thinking that the mesh was not bound yet */
mmd - > bindcagecos = mmd - > bindcos ;
mmd - > bindcos = NULL ;
modifier_mdef_compact_influences ( md ) ;
}
}
}
}
}
2010-01-25 18:38:09 +00:00
static void do_version_constraints_radians_degrees_250 ( ListBase * lb )
{
bConstraint * con ;
for ( con = lb - > first ; con ; con = con - > next ) {
if ( con - > type = = CONSTRAINT_TYPE_RIGIDBODYJOINT ) {
bRigidBodyJointConstraint * data = con - > data ;
2010-10-19 22:17:34 +00:00
data - > axX * = ( float ) ( M_PI / 180.0 ) ;
data - > axY * = ( float ) ( M_PI / 180.0 ) ;
data - > axZ * = ( float ) ( M_PI / 180.0 ) ;
2010-01-25 18:38:09 +00:00
}
else if ( con - > type = = CONSTRAINT_TYPE_KINEMATIC ) {
bKinematicConstraint * data = con - > data ;
2010-10-19 22:17:34 +00:00
data - > poleangle * = ( float ) ( M_PI / 180.0 ) ;
2010-01-25 18:38:09 +00:00
}
else if ( con - > type = = CONSTRAINT_TYPE_ROTLIMIT ) {
bRotLimitConstraint * data = con - > data ;
2010-10-19 22:17:34 +00:00
data - > xmin * = ( float ) ( M_PI / 180.0 ) ;
data - > xmax * = ( float ) ( M_PI / 180.0 ) ;
data - > ymin * = ( float ) ( M_PI / 180.0 ) ;
data - > ymax * = ( float ) ( M_PI / 180.0 ) ;
data - > zmin * = ( float ) ( M_PI / 180.0 ) ;
data - > zmax * = ( float ) ( M_PI / 180.0 ) ;
2010-01-25 18:38:09 +00:00
}
}
}
2010-01-25 06:24:05 +00:00
2010-03-26 02:57:49 +00:00
/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
static void do_version_old_trackto_to_constraints ( Object * ob )
{
/* create new trackto constraint from the relationship */
if ( ob - > track )
{
bConstraint * con = add_ob_constraint ( ob , " AutoTrack " , CONSTRAINT_TYPE_TRACKTO ) ;
bTrackToConstraint * data = con - > data ;
/* copy tracking settings from the object */
data - > tar = ob - > track ;
data - > reserved1 = ob - > trackflag ;
data - > reserved2 = ob - > upflag ;
}
/* clear old track setting */
ob - > track = NULL ;
}
2010-05-01 12:39:06 +00:00
static void do_versions_seq_unique_name_all_strips (
Scene * sce , ListBase * seqbasep )
{
Sequence * seq = seqbasep - > first ;
while ( seq ) {
seqbase_unique_name_recursive ( & sce - > ed - > seqbase , seq ) ;
if ( seq - > seqbase . first ) {
do_versions_seq_unique_name_all_strips (
sce , & seq - > seqbase ) ;
}
seq = seq - > next ;
}
}
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
2007-01-28 11:44:32 +00:00
if ( G . f & G_DEBUG )
2009-10-20 16:43:25 +00:00
printf ( " read file %s \n Version %d sub %d \n " , fd - > relabase , main - > versionfile , main - > subversionfile ) ;
2007-01-28 11:44:32 +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
}
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 ) & &
2010-03-22 09:30:00 +00:00
( tex - > gfac = = 0.0 ) & &
( tex - > bfac = = 0.0 ) ) {
2002-10-12 11:37:38 +00:00
tex - > rfac = 1.0 ;
tex - > gfac = 1.0 ;
tex - > bfac = 1.0 ;
tex - > filtersize = 1.0 ;
}
tex = tex - > id . next ;
}
}
if ( main - > versionfile < = 140 ) {
2009-10-16 10:00:45 +00:00
/* r-g-b-fac in texture */
2002-10-12 11:37:38 +00:00
Tex * tex = main - > tex . first ;
while ( tex ) {
if ( ( tex - > rfac = = 0.0 ) & &
2010-03-22 09:30:00 +00:00
( tex - > gfac = = 0.0 ) & &
( tex - > bfac = = 0.0 ) ) {
2002-10-12 11:37:38 +00:00
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 ;
2009-03-13 13:38:41 +00:00
st - > lheight = 12 ;
2002-10-12 11:37:38 +00:00
}
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 ) {
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 ;
2008-04-27 18:26:20 +00:00
/*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
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 < = 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 ) ;
2010-03-22 09:30:00 +00:00
/* 64 is do_fh */
2002-10-12 11:37:38 +00:00
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 ;
2008-09-21 10:12:33 +00:00
prop = get_ob_property ( ob , ia - > name ) ;
2002-10-12 11:37:38 +00:00
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 ) {
2010-03-22 09:30:00 +00:00
/* Set anisotropic friction off for old objects,
* values to 1.0 . */
2002-10-12 11:37:38 +00:00
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 < = 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 ;
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 ) {
2008-12-23 19:47:33 +00:00
if ( prop - > type = = GPROP_TIME ) {
// convert old GPROP_TIME values from int to float
2002-10-12 11:37:38 +00:00
* ( ( 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 ) {
2010-10-24 07:02:19 +00:00
if ( strcmp ( vf - > name + strlen ( vf - > name ) - 6 , " .Bfont " ) = = 0 ) {
strcpy ( vf - > name , FO_BUILTIN_NAME ) ;
2002-10-12 11:37:38 +00:00
}
}
/* 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 ;
2006-11-25 13:07:28 +00:00
for ( sound = main - > sound . first ; sound ; sound = sound - > id . next ) {
2002-10-12 11:37:38 +00:00
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
}
2006-05-11 00:13:42 +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 ;
}
}
2006-05-11 00:13:42 +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 ( 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
2010-03-22 09:30:00 +00:00
to the new full constraint Track is painless for everyone . - theeth
2004-03-25 18:17:40 +00:00
*/
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 ;
}
}
}
2010-03-22 09:30:00 +00:00
}
2004-03-25 18:17:40 +00:00
}
/* Change Ob->Track in real TrackTo constraint */
2010-03-26 02:57:49 +00:00
do_version_old_trackto_to_constraints ( ob ) ;
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
2004-03-25 18:17:40 +00:00
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
2010-03-22 09:30:00 +00:00
to the new full constraint Track is painless for everyone . */
2003-10-21 13:22:07 +00:00
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 ;
}
}
}
2010-03-22 09:30:00 +00:00
}
2003-10-21 13:22:07 +00:00
}
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
2008-12-26 14:19:25 +00:00
sbuts - > v2d . maxzoom = 1.2f ;
sbuts - > align = 1 ; /* horizontal default */
if ( sbuts - > mainb = = BUTS_LAMP ) {
sbuts - > mainb = CONTEXT_SHADING ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
2008-12-26 14:19:25 +00:00
}
else if ( sbuts - > mainb = = BUTS_MAT ) {
sbuts - > mainb = CONTEXT_SHADING ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
2008-12-26 14:19:25 +00:00
}
else if ( sbuts - > mainb = = BUTS_TEX ) {
sbuts - > mainb = CONTEXT_SHADING ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
2008-12-26 14:19:25 +00:00
}
else if ( sbuts - > mainb = = BUTS_ANIM ) {
sbuts - > mainb = CONTEXT_OBJECT ;
}
else if ( sbuts - > mainb = = BUTS_WORLD ) {
sbuts - > mainb = CONTEXT_SCENE ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
2008-12-26 14:19:25 +00:00
}
else if ( sbuts - > mainb = = BUTS_RENDER ) {
sbuts - > mainb = CONTEXT_SCENE ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
2008-12-26 14:19:25 +00:00
}
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 ;
2009-06-03 23:33:56 +00:00
//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
2008-12-26 14:19:25 +00:00
}
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-04 20:35:50 +00:00
}
}
}
}
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
2006-12-08 09:40:44 +00:00
/* introduction of raytrace */
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 ;
2006-12-08 09:40:44 +00:00
ma - > ang = 1.0 ;
ma - > ray_depth = 2 ;
ma - > ray_depth_tra = 2 ;
ma - > fresnel_tra = 0.0 ;
ma - > fresnel_mir = 0.0 ;
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
}
2006-05-11 00:13:42 +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 ) {
2004-11-17 17:15:36 +00:00
World * wo ;
2004-09-30 22:29:19 +00:00
bScreen * sc ;
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 ;
}
2004-09-30 22:29:19 +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 ;
2009-06-23 00:41:55 +00:00
v3d - > flag | = V3D_ZBUF_SELECT ;
2004-09-30 22:29:19 +00:00
}
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 ) {
2005-01-07 18:07:13 +00:00
ed = sce - > ed ;
if ( ed ) {
2008-12-15 05:21:44 +00:00
SEQ_BEGIN ( sce - > ed , seq ) {
if ( seq - > type = = SEQ_IMAGE | | seq - > type = = SEQ_MOVIE )
seq - > flag | = SEQ_MAKE_PREMUL ;
2005-01-07 18:07:13 +00:00
}
2008-12-15 05:21:44 +00:00
SEQ_END
2005-01-07 18:07:13 +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 ;
}
}
if ( main - > versionfile < = 236 ) {
2005-04-02 13:57:23 +00:00
Object * ob ;
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
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-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 ) {
2010-01-26 13:50:17 +00:00
bDeformGroup * locGroup = defgroup_find_name ( ob , " SOFTGOAL " ) ;
2005-04-16 14:01:49 +00:00
if ( locGroup ) {
/* retrieve index for that group */
2010-01-26 13:50:17 +00:00
ob - > soft - > vertgroup = 1 + defgroup_find_index ( ob , locGroup ) ;
2005-04-16 14:01:49 +00:00
}
}
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 ;
2010-07-05 03:55:28 +00:00
ob - > recalc | = OB_RECALC_ALL ; // cannot call stuff now (pointers!), done in setup_app_data
2005-09-12 13:02:36 +00:00
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 ) ;
2009-10-09 09:48:04 +00:00
2009-10-09 12:16:58 +00:00
modifier_unique_name ( & ob - > modifiers , ( ModifierData * ) smd ) ;
2005-07-21 22:34:01 +00:00
}
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 ) {
2006-07-13 11:36:26 +00:00
sce - > toolsettings = MEM_callocN ( sizeof ( struct ToolSettings ) , " Tool Settings Struct " ) ;
2005-08-24 20:37:25 +00:00
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 , & lt - > fu , & lt - > du ) ;
calc_lat_fudu ( lt - > flag , lt - > pntsv , & lt - > fv , & lt - > dv ) ;
calc_lat_fudu ( lt - > flag , lt - > pntsw , & lt - > fw , & lt - > 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 */
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 ;
}
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
if ( ma - > mode & MA_TRACEBLE ) ma - > mode | = MA_SHADBUF ;
2005-11-12 16:22:10 +00:00
}
2005-10-20 16:31:46 +00:00
}
2006-01-29 12:53:57 +00:00
if ( main - > versionfile < = 241 ) {
2006-04-02 12:39:11 +00:00
Object * ob ;
2006-03-19 17:50:53 +00:00
Tex * tex ;
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
Scene * sce ;
2006-05-15 09:52:59 +00:00
World * wo ;
2006-02-12 20:17:12 +00:00
Lamp * la ;
2006-06-16 15:31:32 +00:00
Material * ma ;
2006-01-04 19:11:27 +00:00
bArmature * arm ;
2006-02-03 20:39:36 +00:00
bNodeTree * ntree ;
2006-01-04 19:11:27 +00:00
2006-07-06 21:18:06 +00:00
for ( wo = main - > world . first ; wo ; wo = wo - > id . next ) {
/* Migrate to Bullet for games, except for the NaN versions */
/* People can still explicitely choose for Sumo (after 2.42 is out) */
if ( main - > versionfile > 225 )
2006-05-15 09:52:59 +00:00
wo - > physicsEngine = WOPHY_BULLET ;
2006-07-06 21:18:06 +00:00
if ( WO_AODIST = = wo - > aomode )
wo - > aocolor = WO_AOPLAIN ;
2006-05-15 09:52:59 +00:00
}
2006-01-04 19:11:27 +00:00
/* updating layers still */
for ( arm = main - > armature . first ; arm ; arm = arm - > id . next ) {
bone_version_239 ( & arm - > bonebase ) ;
if ( arm - > layer = = 0 ) arm - > layer = 1 ;
}
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2006-06-11 09:06:07 +00:00
if ( sce - > audio . mixrate = = 0 ) sce - > audio . mixrate = 44100 ;
2006-02-05 14:12:45 +00:00
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
if ( sce - > r . xparts < 2 ) sce - > r . xparts = 4 ;
if ( sce - > r . yparts < 2 ) sce - > r . yparts = 4 ;
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
/* adds default layer */
if ( sce - > r . layers . first = = NULL )
scene_add_render_layer ( sce ) ;
2006-06-17 10:25:07 +00:00
else {
SceneRenderLayer * srl ;
/* new layer flag for sky, was default for solid */
2006-06-27 08:53:39 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
2006-06-17 10:25:07 +00:00
if ( srl - > layflag & SCE_LAY_SOLID )
srl - > layflag | = SCE_LAY_SKY ;
2006-06-27 08:53:39 +00:00
srl - > passflag & = ( SCE_PASS_COMBINED | SCE_PASS_Z | SCE_PASS_NORMAL | SCE_PASS_VECTOR ) ;
}
2006-06-17 10:25:07 +00:00
}
2006-02-03 20:39:36 +00:00
/* node version changes */
if ( sce - > nodetree )
ntree_version_241 ( sce - > nodetree ) ;
2006-02-05 14:12:45 +00:00
/* uv calculation options moved to toolsettings */
2006-06-24 14:16:36 +00:00
if ( sce - > toolsettings - > uvcalc_radius = = 0.0 ) {
sce - > toolsettings - > uvcalc_radius = 1.0f ;
sce - > toolsettings - > uvcalc_cubesize = 1.0f ;
sce - > toolsettings - > uvcalc_mapdir = 1 ;
sce - > toolsettings - > uvcalc_mapalign = 1 ;
2008-03-26 14:50:29 +00:00
sce - > toolsettings - > uvcalc_flag = UVCALC_FILLHOLES ;
2006-06-24 14:16:36 +00:00
sce - > toolsettings - > unwrapper = 1 ;
}
2006-02-05 14:12:45 +00:00
Recoded Panorama rendering.
The old implementation was added quite hackish (talking about 10 yr ago).
You also had to make a small image slice, which was extended Xparts in
size. That also required to adjust the camera angle. Very clumsy.
Now; when enabling the Panorama option, it will automatically apply the
panorama effect on the vertically aligned tiles. You can just enable or
disable the "Pano" button, to get a subtle lens effect like this:
(without pano)
http://www.blender.org/bf/rt.jpg
(with pano)
http://www.blender.org/bf/rt1.jpg
For Panorama render, the minimum slice size has been hardcoded to be 8
pixels. The XParts button goes up to 512 to allow that. In practice,
rendering 64 slices will already give very good images for a wide angle
lens of 90 degrees, the curvature of straight lines then is equal to
a circle of 256 points.
Rendering a full 360 degree panorama you do by creating an extreme wide
angle camera. The theory says camera-lens 5 should do 360 degrees, but
for some reason my tests reveil it's 5.1... there's a rounding error
somewhere, maybe related to the clipping plane start? Will look at that
later. :)
Also note that for each Xpart slice, the entire database needs to be
rotated around camera to correct for panorama, on huge scenes that might
give some overhead.
Threaded render goes fine for Panorama too, but it can only render the
vertically aligned parts in parallel. For the next panorama slice it has
to wait for all threads of the current slice to be ready.
On reading old files, I convert the settings to match as closely as
possible the new situation.
Since I cannot bump up the version #, the code detects for old panorama
by checking for the image size. If image width is smaller than height, it
assumes it's an old file (only if Panoroma option was set).
2006-02-27 12:39:36 +00:00
if ( sce - > r . mode & R_PANORAMA ) {
2010-11-03 22:44:39 +00:00
/* all these checks to ensure saved files with svn version keep working... */
Recoded Panorama rendering.
The old implementation was added quite hackish (talking about 10 yr ago).
You also had to make a small image slice, which was extended Xparts in
size. That also required to adjust the camera angle. Very clumsy.
Now; when enabling the Panorama option, it will automatically apply the
panorama effect on the vertically aligned tiles. You can just enable or
disable the "Pano" button, to get a subtle lens effect like this:
(without pano)
http://www.blender.org/bf/rt.jpg
(with pano)
http://www.blender.org/bf/rt1.jpg
For Panorama render, the minimum slice size has been hardcoded to be 8
pixels. The XParts button goes up to 512 to allow that. In practice,
rendering 64 slices will already give very good images for a wide angle
lens of 90 degrees, the curvature of straight lines then is equal to
a circle of 256 points.
Rendering a full 360 degree panorama you do by creating an extreme wide
angle camera. The theory says camera-lens 5 should do 360 degrees, but
for some reason my tests reveil it's 5.1... there's a rounding error
somewhere, maybe related to the clipping plane start? Will look at that
later. :)
Also note that for each Xpart slice, the entire database needs to be
rotated around camera to correct for panorama, on huge scenes that might
give some overhead.
Threaded render goes fine for Panorama too, but it can only render the
vertically aligned parts in parallel. For the next panorama slice it has
to wait for all threads of the current slice to be ready.
On reading old files, I convert the settings to match as closely as
possible the new situation.
Since I cannot bump up the version #, the code detects for old panorama
by checking for the image size. If image width is smaller than height, it
assumes it's an old file (only if Panoroma option was set).
2006-02-27 12:39:36 +00:00
if ( sce - > r . xsch < sce - > r . ysch ) {
Object * obc = newlibadr ( fd , lib , sce - > camera ) ;
if ( obc & & obc - > type = = OB_CAMERA ) {
Camera * cam = newlibadr ( fd , lib , obc - > data ) ;
if ( cam - > lens > = 10.0f ) {
sce - > r . xsch * = sce - > r . xparts ;
cam - > lens * = ( float ) sce - > r . ysch / ( float ) sce - > r . xsch ;
}
}
}
}
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
}
2006-02-03 20:39:36 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next )
ntree_version_241 ( ntree ) ;
2006-02-12 20:17:12 +00:00
for ( la = main - > lamp . first ; la ; la = la - > id . next )
if ( la - > buffers = = 0 )
la - > buffers = 1 ;
2006-03-19 17:50:53 +00:00
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
if ( tex - > env & & tex - > env - > viewscale = = 0.0f )
tex - > env - > viewscale = 1.0f ;
2006-02-10 18:57:52 +00:00
// tex->imaflag |= TEX_GAUSS_MIP;
2006-03-19 17:50:53 +00:00
}
2006-01-13 15:50:32 +00:00
/* for empty drawsize and drawtype */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2006-04-02 12:39:11 +00:00
if ( ob - > empty_drawsize = = 0.0f ) {
ob - > empty_drawtype = OB_ARROWS ;
ob - > empty_drawsize = 1.0 ;
}
2006-01-13 15:50:32 +00:00
}
2006-04-02 12:39:11 +00:00
2006-06-16 15:31:32 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
2006-06-25 15:46:03 +00:00
/* stucci returns intensity from now on */
2006-06-16 15:31:32 +00:00
int a ;
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
if ( ma - > mtex [ a ] & & ma - > mtex [ a ] - > tex ) {
Tex * tex = newlibadr ( fd , lib , ma - > mtex [ a ] - > tex ) ;
2006-06-17 10:34:05 +00:00
if ( tex & & tex - > type = = TEX_STUCCI )
2006-06-16 15:31:32 +00:00
ma - > mtex [ a ] - > mapto & = ~ ( MAP_COL | MAP_SPEC | MAP_REF ) ;
}
}
2006-06-25 15:46:03 +00:00
/* transmissivity defaults */
if ( ma - > tx_falloff = = 0.0 ) ma - > tx_falloff = 1.0 ;
2006-06-16 15:31:32 +00:00
}
2006-06-19 08:45:11 +00:00
/* during 2.41 images with this name were used for viewer node output, lets fix that */
if ( main - > versionfile = = 241 ) {
Image * ima ;
for ( ima = main - > image . first ; ima ; ima = ima - > id . next )
if ( strcmp ( ima - > name , " Compositor " ) = = 0 ) {
strcpy ( ima - > id . name + 2 , " Viewer Node " ) ;
strcpy ( ima - > name , " Viewer Node " ) ;
}
}
2006-01-13 15:50:32 +00:00
}
2006-08-13 11:11:22 +00:00
if ( main - > versionfile < = 242 ) {
Scene * sce ;
2006-10-25 23:34:24 +00:00
bScreen * sc ;
2006-09-22 16:42:39 +00:00
Object * ob ;
2006-09-25 03:22:54 +00:00
Curve * cu ;
2006-10-14 10:21:19 +00:00
Material * ma ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
Mesh * me ;
2006-11-14 17:16:15 +00:00
Group * group ;
2006-09-25 03:22:54 +00:00
Nurb * nu ;
BezTriple * bezt ;
BPoint * bp ;
2007-01-07 14:18:03 +00:00
bNodeTree * ntree ;
2006-09-25 03:22:54 +00:00
int a ;
2006-12-05 16:44:57 +00:00
2006-11-29 17:01:09 +00:00
for ( sc = main - > screen . first ; sc ; sc = sc - > id . next ) {
2006-10-25 23:34:24 +00:00
ScrArea * sa ;
sa = sc - > areabase . first ;
while ( sa ) {
SpaceLink * sl ;
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
if ( v3d - > gridsubdiv = = 0 )
v3d - > gridsubdiv = 10 ;
}
}
sa = sa - > next ;
}
}
2006-08-13 11:11:22 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > toolsettings - > select_thresh = = 0.0f )
sce - > toolsettings - > select_thresh = 0.01f ;
2007-01-10 08:51:24 +00:00
if ( sce - > toolsettings - > clean_thresh = = 0.0f )
sce - > toolsettings - > clean_thresh = 0.1f ;
2006-11-29 17:01:09 +00:00
if ( sce - > r . threads = = 0 ) {
if ( sce - > r . mode & R_THREADS )
sce - > r . threads = 2 ;
else
sce - > r . threads = 1 ;
}
2007-01-07 14:18:03 +00:00
if ( sce - > nodetree )
ntree_version_242 ( sce - > nodetree ) ;
2006-08-13 11:11:22 +00:00
}
2006-09-22 16:42:39 +00:00
2007-01-07 14:18:03 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next )
ntree_version_242 ( ntree ) ;
2006-09-25 03:22:54 +00:00
/* add default radius values to old curve points */
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
for ( nu = cu - > nurb . first ; nu ; nu = nu - > next ) {
if ( nu ) {
if ( nu - > bezt ) {
for ( bezt = nu - > bezt , a = 0 ; a < nu - > pntsu ; a + + , bezt + + ) {
2006-10-03 00:16:22 +00:00
if ( ! bezt - > radius ) bezt - > radius = 1.0 ;
2006-09-25 03:22:54 +00:00
}
}
else if ( nu - > bp ) {
for ( bp = nu - > bp , a = 0 ; a < nu - > pntsu * nu - > pntsv ; a + + , bp + + ) {
2006-10-03 00:16:22 +00:00
if ( ! bp - > radius ) bp - > radius = 1.0 ;
2006-09-25 03:22:54 +00:00
}
}
}
}
}
2006-10-14 10:21:19 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2006-10-28 16:48:56 +00:00
ModifierData * md ;
2006-09-22 16:42:39 +00:00
ListBase * list ;
list = & ob - > constraints ;
/* check for already existing MinMax (floor) constraint
and update the sticky flagging */
if ( list ) {
bConstraint * curcon ;
for ( curcon = list - > first ; curcon ; curcon = curcon - > next ) {
2006-12-27 05:00:43 +00:00
switch ( curcon - > type ) {
case CONSTRAINT_TYPE_MINMAX :
{
bMinMaxConstraint * data = curcon - > data ;
if ( data - > sticky = = 1 )
data - > flag | = MINMAX_STICKY ;
else
data - > flag & = ~ MINMAX_STICKY ;
2006-09-22 16:42:39 +00:00
}
2006-12-27 05:00:43 +00:00
break ;
case CONSTRAINT_TYPE_ROTLIKE :
{
bRotateLikeConstraint * data = curcon - > data ;
/* version patch from buttons_object.c */
if ( data - > flag = = 0 )
data - > flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z ;
}
break ;
2006-09-22 16:42:39 +00:00
}
}
}
if ( ob - > type = = OB_ARMATURE ) {
if ( ob - > pose ) {
bConstraint * curcon ;
bPoseChannel * pchan ;
2006-12-27 05:00:43 +00:00
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
for ( curcon = pchan - > constraints . first ; curcon ; curcon = curcon - > next ) {
switch ( curcon - > type ) {
case CONSTRAINT_TYPE_MINMAX :
{
bMinMaxConstraint * data = curcon - > data ;
if ( data - > sticky = = 1 )
data - > flag | = MINMAX_STICKY ;
else
data - > flag & = ~ MINMAX_STICKY ;
2006-09-22 16:42:39 +00:00
}
2006-12-27 05:00:43 +00:00
break ;
case CONSTRAINT_TYPE_KINEMATIC :
{
bKinematicConstraint * data = curcon - > data ;
if ( ! ( data - > flag & CONSTRAINT_IK_POS ) ) {
data - > flag | = CONSTRAINT_IK_POS ;
data - > flag | = CONSTRAINT_IK_STRETCH ;
}
}
break ;
case CONSTRAINT_TYPE_ROTLIKE :
{
bRotateLikeConstraint * data = curcon - > data ;
/* version patch from buttons_object.c */
if ( data - > flag = = 0 )
data - > flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z ;
2006-11-06 23:51:37 +00:00
}
2006-12-27 05:00:43 +00:00
break ;
2006-11-06 23:51:37 +00:00
}
2006-09-22 16:42:39 +00:00
}
}
2006-09-25 03:22:54 +00:00
}
2006-09-22 16:42:39 +00:00
}
2006-10-28 16:48:56 +00:00
/* copy old object level track settings to curve modifers */
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
if ( md - > type = = eModifierType_Curve ) {
CurveModifierData * cmd = ( CurveModifierData * ) md ;
if ( cmd - > defaxis = = 0 ) cmd - > defaxis = ob - > trackflag + 1 ;
}
}
2006-10-14 10:21:19 +00:00
}
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > shad_alpha = = 0.0f )
ma - > shad_alpha = 1.0f ;
2007-01-13 10:52:39 +00:00
if ( ma - > nodetree )
ntree_version_242 ( ma - > nodetree ) ;
2006-09-22 16:42:39 +00:00
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
for ( me = main - > mesh . first ; me ; me = me - > id . next )
customdata_version_242 ( me ) ;
2006-10-28 16:48:56 +00:00
2006-11-14 17:16:15 +00:00
for ( group = main - > group . first ; group ; group = group - > id . next )
if ( group - > layer = = 0 )
group - > layer = ( 1 < < 20 ) - 1 ;
2006-11-03 12:23:04 +00:00
/* History fix (python?), shape key adrcode numbers have to be sorted */
sort_shape_fix ( main ) ;
2007-01-07 14:18:03 +00:00
2006-11-26 21:17:15 +00:00
/* now, subversion control! */
2006-12-20 17:57:56 +00:00
if ( main - > subversionfile < 3 ) {
bScreen * sc ;
Image * ima ;
Tex * tex ;
/* Image refactor initialize */
for ( ima = main - > image . first ; ima ; ima = ima - > id . next ) {
ima - > source = IMA_SRC_FILE ;
ima - > type = IMA_TYPE_IMAGE ;
ima - > gen_x = 256 ; ima - > gen_y = 256 ;
ima - > gen_type = 1 ;
if ( 0 = = strncmp ( ima - > id . name + 2 , " Viewer Node " , sizeof ( ima - > id . name + 2 ) ) ) {
ima - > source = IMA_SRC_VIEWER ;
ima - > type = IMA_TYPE_COMPOSITE ;
}
if ( 0 = = strncmp ( ima - > id . name + 2 , " Render Result " , sizeof ( ima - > id . name + 2 ) ) ) {
ima - > source = IMA_SRC_VIEWER ;
ima - > type = IMA_TYPE_R_RESULT ;
}
}
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
if ( tex - > type = = TEX_IMAGE & & tex - > ima ) {
ima = newlibadr ( fd , lib , tex - > ima ) ;
if ( tex - > imaflag & TEX_ANIM5_ )
ima - > source = IMA_SRC_MOVIE ;
if ( tex - > imaflag & TEX_FIELDS_ )
ima - > flag | = IMA_FIELDS ;
if ( tex - > imaflag & TEX_STD_FIELD_ )
ima - > flag | = IMA_STD_FIELD ;
}
tex - > iuser . frames = tex - > frames ;
tex - > iuser . fie_ima = tex - > fie_ima ;
tex - > iuser . offset = tex - > offset ;
tex - > iuser . sfra = tex - > sfra ;
tex - > iuser . cycl = ( tex - > imaflag & TEX_ANIMCYCLIC_ ) ! = 0 ;
}
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > nodetree )
do_version_ntree_242_2 ( sce - > nodetree ) ;
}
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next )
do_version_ntree_242_2 ( ntree ) ;
2007-01-05 23:49:51 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next )
if ( ma - > nodetree )
do_version_ntree_242_2 ( ma - > nodetree ) ;
2006-12-20 17:57:56 +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_IMAGE )
( ( SpaceImage * ) sl ) - > iuser . fie_ima = 2 ;
else if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
2010-01-19 22:44:43 +00:00
BGpic * bgpic ;
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next )
bgpic - > iuser . fie_ima = 2 ;
2006-12-20 17:57:56 +00:00
}
}
}
}
2007-01-09 11:10:12 +00:00
}
if ( main - > subversionfile < 4 ) {
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
sce - > r . bake_mode = 1 ; /* prevent to include render stuff here */
sce - > r . bake_filter = 2 ;
sce - > r . bake_osa = 5 ;
sce - > r . bake_flag = R_BAKE_CLEAR ;
2007-01-21 16:08:34 +00:00
}
}
2007-01-21 00:09:24 +00:00
2007-01-21 16:08:34 +00:00
if ( main - > subversionfile < 5 ) {
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2007-01-21 00:09:24 +00:00
/* improved triangle to quad conversion settings */
if ( sce - > toolsettings - > jointrilimit = = 0.0f )
2007-01-21 16:08:34 +00:00
sce - > toolsettings - > jointrilimit = 0.8f ;
2007-01-09 11:10:12 +00:00
}
2006-11-26 21:17:15 +00:00
}
2006-08-13 11:11:22 +00:00
}
2007-03-23 13:12:11 +00:00
if ( main - > versionfile < = 243 ) {
2007-04-27 11:16:35 +00:00
Object * ob = main - > object . first ;
2007-05-03 21:37:52 +00:00
Material * ma ;
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > sss_scale = = 0.0f ) {
ma - > sss_radius [ 0 ] = 1.0f ;
ma - > sss_radius [ 1 ] = 1.0f ;
ma - > sss_radius [ 2 ] = 1.0f ;
ma - > sss_col [ 0 ] = 0.8f ;
ma - > sss_col [ 1 ] = 0.8f ;
ma - > sss_col [ 2 ] = 0.8f ;
ma - > sss_error = 0.05f ;
ma - > sss_scale = 0.1f ;
ma - > sss_ior = 1.3f ;
ma - > sss_colfac = 1.0f ;
ma - > sss_texfac = 0.0f ;
}
if ( ma - > sss_front = = 0 & & ma - > sss_back = = 0 ) {
ma - > sss_front = 1.0f ;
ma - > sss_back = 1.0f ;
}
if ( ma - > sss_col [ 0 ] = = 0 & & ma - > sss_col [ 1 ] = = 0 & & ma - > sss_col [ 2 ] = = 0 ) {
ma - > sss_col [ 0 ] = ma - > r ;
ma - > sss_col [ 1 ] = ma - > g ;
ma - > sss_col [ 2 ] = ma - > b ;
}
}
2007-04-27 11:16:35 +00:00
for ( ; ob ; ob = ob - > id . next ) {
bDeformGroup * curdef ;
for ( curdef = ob - > defbase . first ; curdef ; curdef = curdef - > next ) {
/* replace an empty-string name with unique name */
if ( curdef - > name [ 0 ] = = ' \0 ' ) {
2010-01-26 13:50:17 +00:00
defgroup_unique_name ( curdef , ob ) ;
2007-04-27 11:16:35 +00:00
}
}
2007-04-29 14:00:30 +00:00
if ( main - > versionfile < 243 | | main - > subversionfile < 1 ) {
ModifierData * md ;
/* translate old mirror modifier axis values to new flags */
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
if ( md - > type = = eModifierType_Mirror ) {
MirrorModifierData * mmd = ( MirrorModifierData * ) md ;
switch ( mmd - > axis )
{
case 0 :
mmd - > flag | = MOD_MIR_AXIS_X ;
break ;
case 1 :
mmd - > flag | = MOD_MIR_AXIS_Y ;
break ;
case 2 :
mmd - > flag | = MOD_MIR_AXIS_Z ;
break ;
}
mmd - > axis = 0 ;
}
}
}
2007-04-27 11:16:35 +00:00
}
2007-05-02 00:01:23 +00:00
/* render layer added, this is not the active layer */
if ( main - > versionfile < = 243 | | main - > subversionfile < 2 ) {
Mesh * me ;
for ( me = main - > mesh . first ; me ; me = me - > id . next )
customdata_version_243 ( me ) ;
2007-09-02 17:25:03 +00:00
}
}
2007-09-14 18:21:23 +00:00
2007-05-17 16:51:09 +00:00
if ( main - > versionfile < = 244 ) {
Scene * sce ;
2007-06-19 11:52:14 +00:00
bScreen * sc ;
2007-09-07 03:48:50 +00:00
Lamp * la ;
World * wrld ;
2007-06-01 16:53:55 +00:00
if ( main - > versionfile ! = 244 | | main - > subversionfile < 2 ) {
2007-05-17 16:51:09 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
sce - > r . mode | = R_SSS ;
2007-06-01 16:53:55 +00:00
2007-06-19 11:52:14 +00:00
/* correct older action editors - incorrect scrolling */
for ( sc = main - > screen . first ; sc ; sc = sc - > id . next ) {
ScrArea * sa ;
sa = sc - > areabase . first ;
while ( sa ) {
SpaceLink * sl ;
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_ACTION ) {
SpaceAction * saction = ( SpaceAction * ) sl ;
saction - > v2d . tot . ymin = - 1000.0 ;
saction - > v2d . tot . ymax = 0.0 ;
saction - > v2d . cur . ymin = - 75.0 ;
saction - > v2d . cur . ymax = 5.0 ;
}
}
sa = sa - > next ;
2007-06-30 03:26:18 +00:00
}
2007-06-19 11:52:14 +00:00
}
}
2007-10-02 11:14:12 +00:00
if ( main - > versionfile ! = 244 | | main - > subversionfile < 3 ) {
/* constraints recode version patch used to be here. Moved to 245 now... */
for ( wrld = main - > world . first ; wrld ; wrld = wrld - > id . next ) {
if ( wrld - > mode & WO_AMB_OCC )
wrld - > ao_samp_method = WO_AOSAMP_CONSTANT ;
else
wrld - > ao_samp_method = WO_AOSAMP_HAMMERSLEY ;
2007-11-07 21:45:35 +00:00
wrld - > ao_adapt_thresh = 0.005f ;
2007-10-02 11:14:12 +00:00
}
for ( la = main - > lamp . first ; la ; la = la - > id . next ) {
if ( la - > type = = LA_AREA )
la - > ray_samp_method = LA_SAMP_CONSTANT ;
else
la - > ray_samp_method = LA_SAMP_HALTON ;
2009-01-02 06:03:53 +00:00
la - > adapt_thresh = 0.001f ;
2007-10-02 11:14:12 +00:00
}
}
}
if ( main - > versionfile < = 245 ) {
2007-11-07 00:28:45 +00:00
Scene * sce ;
2007-10-02 11:14:12 +00:00
bScreen * sc ;
Object * ob ;
Image * ima ;
Lamp * la ;
Material * ma ;
2007-12-04 13:57:28 +00:00
ParticleSettings * part ;
2008-01-17 19:27:16 +00:00
World * wrld ;
2008-01-12 22:06:42 +00:00
Mesh * me ;
2008-02-04 21:17:15 +00:00
bNodeTree * ntree ;
2008-02-26 11:38:32 +00:00
Tex * tex ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
ModifierData * md ;
ParticleSystem * psys ;
2007-10-02 11:14:12 +00:00
/* unless the file was created 2.44.3 but not 2.45, update the constraints */
2007-10-29 05:26:53 +00:00
if ( ! ( main - > versionfile = = 244 & & main - > subversionfile = = 3 ) & &
( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile = = 0 ) ) )
{
2007-10-02 11:14:12 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
ListBase * list ;
2007-07-15 14:55:09 +00:00
list = & ob - > constraints ;
2007-10-02 11:14:12 +00:00
/* fix up constraints due to constraint recode changes (originally at 2.44.3) */
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
if ( list ) {
bConstraint * curcon ;
for ( curcon = list - > first ; curcon ; curcon = curcon - > next ) {
/* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
if ( curcon - > flag & 0x20 ) {
curcon - > ownspace = CONSTRAINT_SPACE_LOCAL ;
curcon - > tarspace = CONSTRAINT_SPACE_LOCAL ;
}
switch ( curcon - > type ) {
case CONSTRAINT_TYPE_LOCLIMIT :
{
bLocLimitConstraint * data = ( bLocLimitConstraint * ) curcon - > data ;
2007-07-23 11:28:43 +00:00
/* old limit without parent option for objects */
if ( data - > flag2 )
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
curcon - > ownspace = CONSTRAINT_SPACE_LOCAL ;
2007-07-23 11:28:43 +00:00
}
break ;
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
}
}
}
/* correctly initialise constinv matrix */
2009-11-10 20:43:45 +00:00
unit_m4 ( ob - > constinv ) ;
2007-10-02 11:14:12 +00:00
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
if ( ob - > type = = OB_ARMATURE ) {
if ( ob - > pose ) {
bConstraint * curcon ;
bPoseChannel * pchan ;
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
/* make sure constraints are all up to date */
for ( curcon = pchan - > constraints . first ; curcon ; curcon = curcon - > next ) {
/* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
if ( curcon - > flag & 0x20 ) {
curcon - > ownspace = CONSTRAINT_SPACE_LOCAL ;
curcon - > tarspace = CONSTRAINT_SPACE_LOCAL ;
}
switch ( curcon - > type ) {
case CONSTRAINT_TYPE_ACTION :
{
bActionConstraint * data = ( bActionConstraint * ) curcon - > data ;
2007-07-23 11:28:43 +00:00
/* 'data->local' used to mean that target was in local-space */
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
if ( data - > local )
curcon - > tarspace = CONSTRAINT_SPACE_LOCAL ;
}
break ;
}
}
/* correctly initialise constinv matrix */
2009-11-10 20:43:45 +00:00
unit_m4 ( pchan - > constinv ) ;
== Constraints System ==
After just over a week of coding, I've finished doing a major refactor/cleanup of the constraints code. In the process, quite a few old kludges and ugly hacks have been removed. Also, some new features which will greatly benefit riggers have been implemented.
=== What's New ===
* The long-awaited ``ChildOf Constraint'':
This allows you to animate parent influences, and choose which transformation channels the parent affects the child on (i.e. no translation/rotation/scaling). It should be noted that disabling some combinations may not totally work as expected. Also, the 'Set Inverse' and 'Clear Inverse' buttons at the bottom of this constraint's panel set/clear the inverse correction for the parent's effects. Use these to make the owner not stick/be glued to the parent.
* Constraint/Target Evaluation Spaces:
In some constraints, there are now 1-2 combo boxes at the bottom of their panel, which allows you to pick which `co-ordinate space' they are evaluated in. This is much more flexible than the old 'local' options for bones only were.
* Action Constraint - Loc/Rot/Size Inputs
The Action Constraint can finally use the target's location/rotation/scaling transforms as input, to control the owner of the constraint. This should work much more reliably than it used to. The target evaluation should now also be more accurate due to the new space conversion stuff.
* Transform - No longer in Crazy Space (TM)
Transforming objects/bones with constraints applied should no longer occur in Crazy Space. They are now correctly inverse-corrected. This also applies to old-style object tracking.
=== General Code Changes ===
* solve_constraints is now in constraints.c. I've removed the old `blend consecutive constraints of same type' junk, which made the code more complex than it needed to be.
* evaluate_constraint is now only passed the constraint, and two matrices. A few unused variables have been removed from here.
* A tempolary struct, bConstraintOb, is now passed to solve_constraints instead of relying on an ugly, static workobject in some cases. This works much better.
* Made the formatting of constraint code consistent
* There's a version patch for older files so that constraint settings are correctly converted to the new system. This is currently done for MajorVersion <= 244, and SubVersion < 3. I've bumped up the subversion to 3 for this purpose. However, with the imminent 2.45 release, this may need to be adjusted accordingly.
* LocEulSizeToMat4 and LocQuatSizeToMat4 now work in the order Size, Rot, Location. I've also added a few other math functions.
* Mat4BlendMat4 is now in arithb. I've modified it's method slightly, to use other arithb functions, instead of its crazy blending scheme.
* Moved some of the RigidBodyJoint constraint's code out of blenkernel, and into src. It shouldn't be setting its target in its data initialisation function based + accessing scene stuff where it was doing so.
=== Future Work ===
* Geometry to act as targets for constraints. A space has been reserved for this already.
* Tidy up UI buttons of constraints
2007-07-15 03:35:37 +00:00
}
}
}
}
}
2007-09-20 05:56:57 +00:00
2007-09-14 18:21:23 +00:00
/* fix all versions before 2.45 */
if ( main - > versionfile ! = 245 ) {
/* repair preview from 242 - 244*/
for ( ima = main - > image . first ; ima ; ima = ima - > id . next ) {
ima - > preview = NULL ;
}
/* repair imasel space - completely reworked */
for ( sc = main - > screen . first ; sc ; sc = sc - > id . next ) {
ScrArea * sa ;
sa = sc - > areabase . first ;
while ( sa ) {
SpaceLink * sl ;
2007-10-02 11:14:12 +00:00
2007-09-14 18:21:23 +00:00
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_IMASEL ) {
SpaceImaSel * simasel = ( SpaceImaSel * ) sl ;
2009-01-02 06:03:53 +00:00
simasel - > blockscale = 0.7f ;
2007-09-14 18:21:23 +00:00
/* view 2D */
2009-01-02 06:03:53 +00:00
simasel - > v2d . tot . xmin = - 10.0f ;
simasel - > v2d . tot . ymin = - 10.0f ;
2007-09-14 18:21:23 +00:00
simasel - > v2d . tot . xmax = ( float ) sa - > winx + 10.0f ;
simasel - > v2d . tot . ymax = ( float ) sa - > winy + 10.0f ;
2009-01-02 06:03:53 +00:00
simasel - > v2d . cur . xmin = 0.0f ;
simasel - > v2d . cur . ymin = 0.0f ;
2007-09-14 18:21:23 +00:00
simasel - > v2d . cur . xmax = ( float ) sa - > winx ;
simasel - > v2d . cur . ymax = ( float ) sa - > winy ;
simasel - > v2d . min [ 0 ] = 1.0 ;
simasel - > v2d . min [ 1 ] = 1.0 ;
simasel - > v2d . max [ 0 ] = 32000.0f ;
simasel - > v2d . max [ 1 ] = 32000.0f ;
simasel - > v2d . minzoom = 0.5f ;
simasel - > v2d . maxzoom = 1.21f ;
simasel - > v2d . scroll = 0 ;
2009-07-29 22:57:53 +00:00
simasel - > v2d . keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT ;
2007-09-14 18:21:23 +00:00
simasel - > v2d . keeptot = 0 ;
simasel - > prv_h = 96 ;
simasel - > prv_w = 96 ;
simasel - > flag = 7 ; /* ??? elubie */
strcpy ( simasel - > dir , U . textudir ) ; /* TON */
strcpy ( simasel - > file , " " ) ;
2007-10-02 11:14:12 +00:00
2007-09-14 18:21:23 +00:00
simasel - > returnfunc = 0 ;
simasel - > title [ 0 ] = 0 ;
}
}
sa = sa - > next ;
}
}
}
2008-01-12 22:06:42 +00:00
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
/* add point caches */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > soft & & ! ob - > soft - > pointcache )
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
ob - > soft - > pointcache = BKE_ptcache_add ( & ob - > soft - > ptcaches ) ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
for ( psys = ob - > particlesystem . first ; psys ; psys = psys - > next ) {
2009-09-10 22:32:33 +00:00
//if(psys->soft && !psys->soft->pointcache)
// psys->soft->pointcache= BKE_ptcache_add(&psys->soft->ptcaches);
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
if ( ! psys - > pointcache )
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
psys - > pointcache = BKE_ptcache_add ( & psys - > ptcaches ) ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
}
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
if ( md - > type = = eModifierType_Cloth ) {
ClothModifierData * clmd = ( ClothModifierData * ) md ;
if ( ! clmd - > point_cache )
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
clmd - > point_cache = BKE_ptcache_add ( & clmd - > ptcaches ) ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
}
}
}
2008-01-12 22:06:42 +00:00
/* Copy over old per-level multires vertex data
into a single vertex array in struct Multires */
for ( me = main - > mesh . first ; me ; me = me - > id . next ) {
if ( me - > mr & & ! me - > mr - > verts ) {
MultiresLevel * lvl = me - > mr - > levels . last ;
if ( lvl ) {
me - > mr - > verts = lvl - > verts ;
lvl - > verts = NULL ;
/* Don't need the other vert arrays */
for ( lvl = lvl - > prev ; lvl ; lvl = lvl - > prev ) {
MEM_freeN ( lvl - > verts ) ;
lvl - > verts = NULL ;
}
}
}
}
2007-09-20 05:56:57 +00:00
if ( main - > versionfile ! = 245 | | main - > subversionfile < 1 ) {
for ( la = main - > lamp . first ; la ; la = la - > id . next ) {
if ( la - > mode & LA_QUAD ) la - > falloff_type = LA_FALLOFF_SLIDERS ;
else la - > falloff_type = LA_FALLOFF_INVLINEAR ;
if ( la - > curfalloff = = NULL ) {
la - > curfalloff = curvemapping_add ( 1 , 0.0f , 1.0f , 1.0f , 0.0f ) ;
curvemapping_initialize ( la - > curfalloff ) ;
}
}
}
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
2007-12-20 16:35:27 +00:00
if ( ma - > samp_gloss_mir = = 0 ) {
2009-01-02 06:03:53 +00:00
ma - > gloss_mir = ma - > gloss_tra = 1.0f ;
ma - > aniso_gloss_mir = 1.0f ;
2007-09-20 05:56:57 +00:00
ma - > samp_gloss_mir = ma - > samp_gloss_tra = 18 ;
2009-01-02 06:03:53 +00:00
ma - > adapt_thresh_mir = ma - > adapt_thresh_tra = 0.005f ;
ma - > dist_mir = 0.0f ;
2007-09-20 05:56:57 +00:00
ma - > fadeto_mir = MA_RAYMIR_FADETOSKY ;
}
2007-12-20 16:35:27 +00:00
if ( ma - > strand_min = = 0.0f )
ma - > strand_min = 1.0f ;
2007-09-20 05:56:57 +00:00
}
2007-12-04 13:57:28 +00:00
2007-12-20 16:35:27 +00:00
for ( part = main - > particle . first ; part ; part = part - > id . next ) {
2007-12-04 13:57:28 +00:00
if ( part - > ren_child_nbr = = 0 )
part - > ren_child_nbr = part - > child_nbr ;
2007-12-20 16:35:27 +00:00
if ( part - > simplify_refsize = = 0 ) {
part - > simplify_refsize = 1920 ;
part - > simplify_rate = 1.0f ;
part - > simplify_transition = 0.1f ;
part - > simplify_viewport = 0.8f ;
}
}
2008-01-17 19:27:16 +00:00
for ( wrld = main - > world . first ; wrld ; wrld = wrld - > id . next ) {
if ( wrld - > ao_approx_error = = 0.0f )
wrld - > ao_approx_error = 0.25f ;
}
2008-02-13 11:18:08 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2008-02-04 21:17:15 +00:00
if ( sce - > nodetree )
2008-02-26 11:38:32 +00:00
ntree_version_245 ( fd , lib , sce - > nodetree ) ;
2008-02-04 21:17:15 +00:00
2008-02-13 11:18:08 +00:00
if ( sce - > r . simplify_shadowsamples = = 0 ) {
sce - > r . simplify_subsurf = 6 ;
sce - > r . simplify_particles = 1.0f ;
sce - > r . simplify_shadowsamples = 16 ;
sce - > r . simplify_aosss = 1.0f ;
}
2008-03-10 11:39:37 +00:00
if ( sce - > r . cineongamma = = 0 ) {
sce - > r . cineonblack = 95 ;
sce - > r . cineonwhite = 685 ;
sce - > r . cineongamma = 1.7f ;
}
2008-02-13 11:18:08 +00:00
}
2008-02-04 21:17:15 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next )
2008-02-26 11:38:32 +00:00
ntree_version_245 ( fd , lib , ntree ) ;
/* fix for temporary flag changes during 245 cycle */
for ( ima = main - > image . first ; ima ; ima = ima - > id . next ) {
if ( ima - > flag & IMA_OLD_PREMUL ) {
ima - > flag & = ~ IMA_OLD_PREMUL ;
ima - > flag | = IMA_DO_PREMUL ;
}
}
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
if ( tex - > iuser . flag & IMA_OLD_PREMUL ) {
tex - > iuser . flag & = ~ IMA_OLD_PREMUL ;
tex - > iuser . flag | = IMA_DO_PREMUL ;
}
ima = newlibadr ( fd , lib , tex - > ima ) ;
if ( ima & & ( tex - > iuser . flag & IMA_DO_PREMUL ) ) {
ima - > flag & = ~ IMA_OLD_PREMUL ;
ima - > flag | = IMA_DO_PREMUL ;
}
}
2007-09-14 18:21:23 +00:00
}
2008-08-12 19:56:03 +00:00
/* sanity check for skgen
* */
{
Scene * sce ;
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
{
if ( sce - > toolsettings - > skgen_subdivisions [ 0 ] = = sce - > toolsettings - > skgen_subdivisions [ 1 ] | |
sce - > toolsettings - > skgen_subdivisions [ 0 ] = = sce - > toolsettings - > skgen_subdivisions [ 2 ] | |
sce - > toolsettings - > skgen_subdivisions [ 1 ] = = sce - > toolsettings - > skgen_subdivisions [ 2 ] )
{
sce - > toolsettings - > skgen_subdivisions [ 0 ] = SKGEN_SUB_CORRELATION ;
sce - > toolsettings - > skgen_subdivisions [ 1 ] = SKGEN_SUB_LENGTH ;
sce - > toolsettings - > skgen_subdivisions [ 2 ] = SKGEN_SUB_ANGLE ;
}
}
}
2007-09-14 18:21:23 +00:00
2007-09-20 22:38:04 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 2 ) ) {
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
Image * ima ;
2007-09-20 22:38:04 +00:00
/* initialize 1:1 Aspect */
for ( ima = main - > image . first ; ima ; ima = ima - > id . next ) {
ima - > aspx = ima - > aspy = 1.0f ;
}
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
2007-09-20 22:38:04 +00:00
}
2007-10-10 09:00:47 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 4 ) ) {
bArmature * arm ;
ModifierData * md ;
Object * ob ;
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
2007-10-10 09:00:47 +00:00
for ( arm = main - > armature . first ; arm ; arm = arm - > id . next )
arm - > deformflag | = ARM_DEF_B_BONE_REST ;
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
2007-10-10 09:00:47 +00:00
if ( md - > type = = eModifierType_Armature )
( ( ArmatureModifierData * ) md ) - > deformflag | = ARM_DEF_B_BONE_REST ;
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
}
}
2007-10-10 09:00:47 +00:00
}
2007-10-20 16:17:27 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 5 ) ) {
/* foreground color needs to be somthing other then black */
Scene * sce ;
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2009-01-02 06:03:53 +00:00
sce - > r . fg_stamp [ 0 ] = sce - > r . fg_stamp [ 1 ] = sce - > r . fg_stamp [ 2 ] = 0.8f ;
sce - > r . fg_stamp [ 3 ] = 1.0f ; /* dont use text alpha yet */
sce - > r . bg_stamp [ 3 ] = 0.25f ; /* make sure the background has full alpha */
2007-10-20 16:17:27 +00:00
}
}
2007-10-21 19:19:53 +00:00
2007-10-20 16:17:27 +00:00
2007-10-21 19:19:53 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 6 ) ) {
Scene * sce ;
/* fix frs_sec_base */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > r . frs_sec_base = = 0 ) {
sce - > r . frs_sec_base = 1 ;
}
}
}
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 7 ) ) {
Object * ob ;
bPoseChannel * pchan ;
bConstraint * con ;
bConstraintTarget * ct ;
Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman)
For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as:
- A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point)
- Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage)
- Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch)
It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor.
Notes:
- This is accessed by the Head/Tail number-slider.
- This value can be animated per constraint
- The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints
- In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
2007-11-12 04:17:03 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > pose ) {
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
for ( con = pchan - > constraints . first ; con ; con = con - > next ) {
if ( con - > type = = CONSTRAINT_TYPE_PYTHON ) {
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
bPythonConstraint * data = ( bPythonConstraint * ) con - > data ;
if ( data - > tar ) {
/* version patching needs to be done */
ct = MEM_callocN ( sizeof ( bConstraintTarget ) , " PyConTarget " ) ;
ct - > tar = data - > tar ;
strcpy ( ct - > subtarget , data - > subtarget ) ;
ct - > space = con - > tarspace ;
BLI_addtail ( & data - > targets , ct ) ;
data - > tarnum + + ;
/* clear old targets to avoid problems */
data - > tar = NULL ;
strcpy ( data - > subtarget , " " ) ;
}
}
Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman)
For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as:
- A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point)
- Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage)
- Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch)
It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor.
Notes:
- This is accessed by the Head/Tail number-slider.
- This value can be animated per constraint
- The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints
- In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
2007-11-12 04:17:03 +00:00
else if ( con - > type = = CONSTRAINT_TYPE_LOCLIKE ) {
bLocateLikeConstraint * data = ( bLocateLikeConstraint * ) con - > data ;
/* new headtail functionality makes Bone-Tip function obsolete */
if ( data - > flag & LOCLIKE_TIP )
con - > headtail = 1.0f ;
}
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
}
}
}
Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman)
For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as:
- A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point)
- Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage)
- Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch)
It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor.
Notes:
- This is accessed by the Head/Tail number-slider.
- This value can be animated per constraint
- The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints
- In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
2007-11-12 04:17:03 +00:00
for ( con = ob - > constraints . first ; con ; con = con - > next ) {
if ( con - > type = = CONSTRAINT_TYPE_PYTHON ) {
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
bPythonConstraint * data = ( bPythonConstraint * ) con - > data ;
if ( data - > tar ) {
/* version patching needs to be done */
ct = MEM_callocN ( sizeof ( bConstraintTarget ) , " PyConTarget " ) ;
ct - > tar = data - > tar ;
strcpy ( ct - > subtarget , data - > subtarget ) ;
ct - > space = con - > tarspace ;
BLI_addtail ( & data - > targets , ct ) ;
data - > tarnum + + ;
/* clear old targets to avoid problems */
data - > tar = NULL ;
strcpy ( data - > subtarget , " " ) ;
}
}
Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman)
For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as:
- A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point)
- Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage)
- Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch)
It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor.
Notes:
- This is accessed by the Head/Tail number-slider.
- This value can be animated per constraint
- The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints
- In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
2007-11-12 04:17:03 +00:00
else if ( con - > type = = CONSTRAINT_TYPE_LOCLIKE ) {
bLocateLikeConstraint * data = ( bLocateLikeConstraint * ) con - > data ;
/* new headtail functionality makes Bone-Tip function obsolete */
if ( data - > flag & LOCLIKE_TIP )
con - > headtail = 1.0f ;
}
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were:
* To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes.
* To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target.
As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up.
Known issues:
* PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon.
* Constraints BPy-API is currently has a few features which currently don't work yet
* Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
2007-10-21 23:00:29 +00:00
}
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
if ( ob - > soft & & ob - > soft - > keys ) {
SoftBody * sb = ob - > soft ;
int k ;
for ( k = 0 ; k < sb - > totkey ; k + + ) {
if ( sb - > keys [ k ] )
MEM_freeN ( sb - > keys [ k ] ) ;
}
MEM_freeN ( sb - > keys ) ;
sb - > keys = NULL ;
sb - > totkey = 0 ;
}
}
}
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 8 ) ) {
Scene * sce ;
Object * ob ;
PartEff * paf = 0 ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > soft & & ob - > soft - > keys ) {
SoftBody * sb = ob - > soft ;
int k ;
for ( k = 0 ; k < sb - > totkey ; k + + ) {
if ( sb - > keys [ k ] )
MEM_freeN ( sb - > keys [ k ] ) ;
}
MEM_freeN ( sb - > keys ) ;
sb - > keys = NULL ;
sb - > totkey = 0 ;
}
/* convert old particles to new system */
if ( ( paf = give_parteff ( ob ) ) ) {
ParticleSystem * psys ;
ModifierData * md ;
ParticleSystemModifierData * psmd ;
ParticleSettings * part ;
/* create new particle system */
psys = MEM_callocN ( sizeof ( ParticleSystem ) , " particle_system " ) ;
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
psys - > pointcache = BKE_ptcache_add ( & psys - > ptcaches ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
2009-07-20 23:52:53 +00:00
part = psys - > part = psys_new_settings ( " ParticleSettings " , main ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
/* needed for proper libdata lookup */
oldnewmap_insert ( fd - > libmap , psys - > part , psys - > part , 0 ) ;
2008-05-23 09:23:57 +00:00
part - > id . lib = ob - > id . lib ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > id . us - - ;
2007-12-18 16:55:09 +00:00
part - > id . flag | = ( ob - > id . flag & LIB_NEEDLINK ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
psys - > totpart = 0 ;
Point Cache Refactoring
=======================
Caching and Baking:
- The point cache is now cleared on DAG_object_flush_update(), and not cleared for time dependency graph updates.
- There is now a Bake button instead of Protect. Also cache start and end frames were added to softbody and particles.
- The cloth autoprotect feature was removed.
- The Ctrl+B menu now also bakes cloth and particles next to softbody and fluids. Additionally there are now frree bake and free cache menu entries.
- The point cache api has been changed. There is now a PTCacheID struct for each point cache type that can be filled and then used to call the point cache functions.
- PointCache struct was added to DNA and is automatically allocated for each physics type.
- Soft body now supports Bake Editing just like cloth.
- Tried to make the systems deal consistently with time ipo's and offsets. Still not sure it all works correct, but too complicated to solve completely now.
Library Linking:
- Added some more warnings to prevent editing settings on library linked objects.
- Linked objects now read from the cache located next to the original library file, and never write to it. This restores old behavior for softbodies. For local simulation the mesh and not the object should be linked.
- Dupligroups and proxies can't create local point caches at the moment, how to implement that I'm not sure. We probably need a proxy point cache for that to work (ugh).
Physics UI:
- Renamed deflection panel to collision for consistency and reorganized the buttons. Also removed some softbody collision buttons from the softbody panel that were duplicated in this panel for cloth.
- Tweaked field panel buttons to not jump around when changing options.
- Tabbing e.g. Soft Body Collision into the Soft Body panel, it now only shows Collision to make the panel names readable.
- I tried to make enabled/disabling physics more consistent, since all three system did things different. Now the two modifier buttons to enable the modifier for the viewport and rendering are also duplicated in the physics panels. Toggling the Soft Body and Cloth buttons now both remove their modifiers.
- Fixed modifier error drawing glitch.
Particles:
- Particles are now recalculated more often than before. Previously it did partial updates based on the changes, but that doesn't work well with DAG_object_flush_update() ..
- Fixed memory leak loading keyed particle system. Now keys are not written to file anymore but always created after loading.
- Make particle threads work with autothreads.
Continue Physics:
- The timeline play now has a Continue Physics option in the playback menu, which keeps the simulations going without writing them to the cache.
- This doesn't always work that well, some changes are not immediately updated, but this can be improved later. Still it's fun to get a feel for the physics.
Todo:
- Point cache can get out of sync with and undo and changing a file without saving it.
- Change the point cache file format to store a version (so old point cache files can be either converted or at least ignored), and to do correct endian conversion.
- Menu item and/or buttons for Ctrl+B.
- A system("rm ..") was changed to remove() since the former is very slow for clearing point caches. These system() calls were already giving trouble in a bug in the tracker, but really most use of this system("") should be changed and tested.
- The Soft Body Collision and Clot Collision panel titles don't mention there's point cache settings there too, doing that makes them unreadable with the default panel setup.. but may need to make the names longer anyway.
2008-04-10 11:39:20 +00:00
psys - > flag = PSYS_ENABLED | PSYS_CURRENT ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
BLI_addtail ( & ob - > particlesystem , psys ) ;
md = modifier_new ( eModifierType_ParticleSystem ) ;
sprintf ( md - > name , " ParticleSystem %i " , BLI_countlist ( & ob - > particlesystem ) ) ;
psmd = ( ParticleSystemModifierData * ) md ;
psmd - > psys = psys ;
BLI_addtail ( & ob - > modifiers , md ) ;
/* convert settings from old particle system */
/* general settings */
2007-12-04 13:57:28 +00:00
part - > totpart = MIN2 ( paf - > totpart , 100000 ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > sta = paf - > sta ;
part - > end = paf - > end ;
part - > lifetime = paf - > lifetime ;
part - > randlife = paf - > randlife ;
psys - > seed = paf - > seed ;
part - > disp = paf - > disp ;
part - > omat = paf - > mat [ 0 ] ;
part - > hair_step = paf - > totkey ;
part - > eff_group = paf - > group ;
2008-02-17 15:46:03 +00:00
/* old system didn't interpolate between keypoints at render time */
part - > draw_step = part - > ren_step = 0 ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
/* physics */
part - > normfac = paf - > normfac * 25.0f ;
part - > obfac = paf - > obfac ;
part - > randfac = paf - > randfac * 25.0f ;
part - > dampfac = paf - > damp ;
VECCOPY ( part - > acc , paf - > force ) ;
/* flags */
if ( paf - > stype & PAF_VECT ) {
if ( paf - > flag & PAF_STATIC ) {
/* new hair lifetime is always 100.0f */
float fac = paf - > lifetime / 100.0f ;
part - > draw_as = PART_DRAW_PATH ;
part - > type = PART_HAIR ;
2009-06-05 23:59:33 +00:00
psys - > recalc | = PSYS_RECALC_REDO ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
part - > normfac * = fac ;
part - > randfac * = fac ;
}
else {
part - > draw_as = PART_DRAW_LINE ;
part - > draw | = PART_DRAW_VEL_LENGTH ;
part - > draw_line [ 1 ] = 0.04f ;
}
}
part - > rotmode = PART_ROT_VEL ;
part - > flag | = ( paf - > flag & PAF_BSPLINE ) ? PART_HAIR_BSPLINE : 0 ;
part - > flag | = ( paf - > flag & PAF_TRAND ) ? PART_TRAND : 0 ;
part - > flag | = ( paf - > flag & PAF_EDISTR ) ? PART_EDISTR : 0 ;
part - > flag | = ( paf - > flag & PAF_UNBORN ) ? PART_UNBORN : 0 ;
part - > flag | = ( paf - > flag & PAF_DIED ) ? PART_DIED : 0 ;
part - > from | = ( paf - > flag & PAF_FACE ) ? PART_FROM_FACE : 0 ;
part - > draw | = ( paf - > flag & PAF_SHOWE ) ? PART_DRAW_EMITTER : 0 ;
psys - > vgroup [ PSYS_VG_DENSITY ] = paf - > vertgroup ;
psys - > vgroup [ PSYS_VG_VEL ] = paf - > vertgroup_v ;
psys - > vgroup [ PSYS_VG_LENGTH ] = paf - > vertgroup_v ;
/* dupliobjects */
if ( ob - > transflag & OB_DUPLIVERTS ) {
Object * dup = main - > object . first ;
for ( ; dup ; dup = dup - > id . next ) {
if ( ob = = newlibadr ( fd , lib , dup - > parent ) ) {
part - > dup_ob = dup ;
ob - > transflag | = OB_DUPLIPARTS ;
ob - > transflag & = ~ OB_DUPLIVERTS ;
part - > draw_as = PART_DRAW_OB ;
2008-04-21 10:15:01 +00:00
/* needed for proper libdata lookup */
oldnewmap_insert ( fd - > libmap , dup , dup , 0 ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
}
}
}
2008-07-25 18:57:16 +00:00
{
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) modifiers_findByType ( ob , eModifierType_Fluidsim ) ;
if ( fluidmd & & fluidmd - > fss & & fluidmd - > fss - > type = = OB_FLUIDSIM_PARTICLE )
part - > type = PART_FLUID ;
}
2008-04-02 17:48:46 +00:00
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
free_effects ( & ob - > effect ) ;
printf ( " Old particle system converted to new system. \n " ) ;
}
}
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
ParticleEditSettings * pset = & sce - > toolsettings - > particle ;
int a ;
if ( pset - > brush [ 0 ] . size = = 0 ) {
pset - > flag = PE_KEEP_LENGTHS | PE_LOCK_FIRST | PE_DEFLECT_EMITTER ;
pset - > emitterdist = 0.25f ;
pset - > totrekey = 5 ;
pset - > totaddkey = 5 ;
pset - > brushtype = PE_BRUSH_NONE ;
for ( a = 0 ; a < PE_TOT_BRUSH ; a + + ) {
pset - > brush [ a ] . strength = 50 ;
pset - > brush [ a ] . size = 50 ;
pset - > brush [ a ] . step = 10 ;
}
pset - > brush [ PE_BRUSH_CUT ] . strength = 100 ;
}
}
}
2007-11-28 22:21:12 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 9 ) ) {
Material * ma ;
int a ;
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next )
if ( ma - > mode & MA_NORMAP_TANG )
for ( a = 0 ; a < MAX_MTEX ; a + + )
if ( ma - > mtex [ a ] & & ma - > mtex [ a ] - > tex )
ma - > mtex [ a ] - > normapspace = MTEX_NSPACE_TANGENT ;
}
2007-11-30 10:38:59 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 10 ) ) {
Object * ob ;
2007-12-07 04:24:02 +00:00
2007-11-30 10:38:59 +00:00
/* dupliface scale */
2007-12-04 13:57:28 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next )
2007-11-30 10:38:59 +00:00
ob - > dupfacesca = 1.0f ;
}
2007-12-07 04:24:02 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 11 ) ) {
Object * ob ;
bActionStrip * strip ;
/* nla-strips - scale */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( strip = ob - > nlastrips . first ; strip ; strip = strip - > next ) {
float length , actlength , repeat ;
if ( strip - > flag & ACTSTRIP_USESTRIDE )
repeat = 1.0f ;
else
repeat = strip - > repeat ;
length = strip - > end - strip - > start ;
if ( length = = 0.0f ) length = 1.0f ;
actlength = strip - > actend - strip - > actstart ;
2007-12-07 10:50:02 +00:00
strip - > scale = length / ( repeat * actlength ) ;
2007-12-07 04:24:02 +00:00
if ( strip - > scale = = 0.0f ) strip - > scale = 1.0f ;
}
2008-01-10 00:07:31 +00:00
if ( ob - > soft ) {
ob - > soft - > inpush = ob - > soft - > inspring ;
ob - > soft - > shearstiff = 1.0f ;
}
2007-12-07 04:24:02 +00:00
}
}
2007-11-30 10:38:59 +00:00
2008-01-30 10:27:16 +00:00
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 14 ) ) {
2008-12-15 05:21:44 +00:00
Scene * sce ;
2008-01-30 10:27:16 +00:00
Sequence * seq ;
2008-12-15 05:21:44 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2008-12-16 07:53:59 +00:00
SEQ_BEGIN ( sce - > ed , seq ) {
2008-12-15 05:21:44 +00:00
if ( seq - > blend_mode = = 0 )
2009-01-02 06:03:53 +00:00
seq - > blend_opacity = 100.0f ;
2008-01-30 10:27:16 +00:00
}
2008-12-15 05:21:44 +00:00
SEQ_END
2008-01-30 10:27:16 +00:00
}
}
2008-02-23 02:12:50 +00:00
/*fix broken group lengths in id properties*/
if ( ( main - > versionfile < 245 ) | | ( main - > versionfile = = 245 & & main - > subversionfile < 15 ) ) {
idproperties_fix_group_lengths ( main - > scene ) ;
idproperties_fix_group_lengths ( main - > library ) ;
idproperties_fix_group_lengths ( main - > object ) ;
idproperties_fix_group_lengths ( main - > mesh ) ;
idproperties_fix_group_lengths ( main - > curve ) ;
idproperties_fix_group_lengths ( main - > mball ) ;
idproperties_fix_group_lengths ( main - > mat ) ;
idproperties_fix_group_lengths ( main - > tex ) ;
idproperties_fix_group_lengths ( main - > image ) ;
idproperties_fix_group_lengths ( main - > latt ) ;
idproperties_fix_group_lengths ( main - > lamp ) ;
idproperties_fix_group_lengths ( main - > camera ) ;
idproperties_fix_group_lengths ( main - > ipo ) ;
idproperties_fix_group_lengths ( main - > key ) ;
idproperties_fix_group_lengths ( main - > world ) ;
idproperties_fix_group_lengths ( main - > screen ) ;
idproperties_fix_group_lengths ( main - > script ) ;
idproperties_fix_group_lengths ( main - > vfont ) ;
idproperties_fix_group_lengths ( main - > text ) ;
idproperties_fix_group_lengths ( main - > sound ) ;
idproperties_fix_group_lengths ( main - > group ) ;
idproperties_fix_group_lengths ( main - > armature ) ;
idproperties_fix_group_lengths ( main - > action ) ;
idproperties_fix_group_lengths ( main - > nodetree ) ;
idproperties_fix_group_lengths ( main - > brush ) ;
idproperties_fix_group_lengths ( main - > particle ) ;
}
2008-01-30 10:27:16 +00:00
2008-07-03 10:38:35 +00:00
/* sun/sky */
2008-07-29 15:48:31 +00:00
if ( main - > versionfile < 246 ) {
2008-09-22 17:12:57 +00:00
Object * ob ;
bActuator * act ;
2008-07-29 15:48:31 +00:00
2008-09-22 17:12:57 +00:00
/* dRot actuator change direction in 2.46 */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * ba = act - > data ;
ba - > drot [ 0 ] = - ba - > drot [ 0 ] ;
ba - > drot [ 1 ] = - ba - > drot [ 1 ] ;
ba - > drot [ 2 ] = - ba - > drot [ 2 ] ;
}
}
}
2008-07-03 10:38:35 +00:00
}
2008-07-25 18:57:16 +00:00
// convert fluids to modifier
2008-09-22 17:12:57 +00:00
if ( main - > versionfile < 246 | | ( main - > versionfile = = 246 & & main - > subversionfile < 1 ) )
2008-07-25 18:57:16 +00:00
{
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > fluidsimSettings )
{
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) modifier_new ( eModifierType_Fluidsim ) ;
BLI_addhead ( & ob - > modifiers , ( ModifierData * ) fluidmd ) ;
MEM_freeN ( fluidmd - > fss ) ;
fluidmd - > fss = MEM_dupallocN ( ob - > fluidsimSettings ) ;
fluidmd - > fss - > ipo = newlibadr_us ( fd , ob - > id . lib , ob - > fluidsimSettings - > ipo ) ;
MEM_freeN ( ob - > fluidsimSettings ) ;
2008-07-27 12:28:34 +00:00
fluidmd - > fss - > lastgoodframe = INT_MAX ;
2008-08-14 09:19:41 +00:00
fluidmd - > fss - > flag = 0 ;
2009-01-26 08:34:40 +00:00
fluidmd - > fss - > meshSurfNormals = 0 ;
2008-07-25 18:57:16 +00:00
}
}
}
BGE patch: add state engine support in the logic bricks.
This patch introduces a simple state engine system with the logic bricks. This system features full
backward compatibility, multiple active states, multiple state transitions, automatic disabling of
sensor and actuators, full GUI support and selective display of sensors and actuators.
Note: Python API is available but not documented yet. It will be added asap.
State internals
===============
The state system is object based. The current state mask is stored in the object as a 32 bit value;
each bit set in the mask is an active state. The controllers have a state mask too but only one bit
can be set: a controller belongs to a single state. The game engine will only execute controllers
that belong to active states. Sensors and actuators don't have a state mask but are effectively
attached to states via their links to the controllers. Sensors and actuators can be connected to more
than one state. When a controller becomes inactive because of a state change, its links to sensors
and actuators are temporarily broken (until the state becomes active again). If an actuator gets isolated,
i.e all the links to controllers are broken, it is automatically disabled. If a sensor gets isolated,
the game engine will stop calling it to save CPU. It will also reset the sensor internal state so that
it can react as if the game just started when it gets reconnected to an active controller. For example,
an Always sensor in no pulse mode that is connected to a single state (i.e connected to one or more
controllers of a single state) will generate a pulse each time the state becomes active. This feature is
not available on all sensors, see the notes below.
GUI
===
This system system is fully configurable through the GUI: the object state mask is visible under the
object bar in the controller's colum as an array of buttons just like the 3D view layer mask.
Click on a state bit to only display the controllers of that state. You can select more than one state
with SHIFT-click. The All button sets all the bits so that you can see all the controllers of the object.
The Ini button sets the state mask back to the object default state. You can change the default state
of object by first selecting the desired state mask and storing using the menu under the State button.
If you define a default state mask, it will be loaded into the object state make when you load the blend
file or when you run the game under the blenderplayer. However, when you run the game under Blender,
the current selected state mask will be used as the startup state for the object. This allows you to test
specific state during the game design.
The controller display the state they belong to with a new button in the controller header. When you add
a new controller, it is added by default in the lowest enabled state. You can change the controller state
by clicking on the button and selecting another state. If more than one state is enabled in the object
state mask, controllers are grouped by state for more readibility.
The new Sta button in the sensor and actuator column header allows you to display only the sensors and
actuators that are linked to visible controllers.
A new state actuator is available to modify the state during the game. It defines a bit mask and
the operation to apply on the current object state mask:
Cpy: the bit mask is copied to the object state mask.
Add: the bits that set in the bit mask will be turned on in the object state mask.
Sub: the bits that set in the bit mask will be turned off in the object state mask.
Inv: the bits that set in the bit mask will be inverted in the objecyy state mask.
Notes
=====
- Although states have no name, a simply convention consists in using the name of the first controller
of the state as the state name. The GUI will support that convention by displaying as a hint the name
of the first controller of the state when you move the mouse over a state bit of the object state mask
or of the state actuator bit mask.
- Each object has a state mask and each object can have a state engine but if several objects are
part of a logical group, it is recommended to put the state engine only in the main object and to
link the controllers of that object to the sensors and actuators of the different objects.
- When loading an old blend file, the state mask of all objects and controllers are initialized to 1
so that all the controllers belong to this single state. This ensures backward compatibility with
existing game.
- When the state actuator is activated at the same time as other actuators, these actuators are
guaranteed to execute before being eventually disabled due to the state change. This is useful for
example to send a message or update a property at the time of changing the state.
- Sensors that depend on underlying resource won't reset fully when they are isolated. By the time they
are acticated again, they will behave as follow:
* keyboard sensor: keys already pressed won't be detected. The keyboard sensor is only sensitive
to new key press.
* collision sensor: objects already colliding won't be detected. Only new collisions are
detected.
* near and radar sensor: same as collision sensor.
2008-06-22 14:23:57 +00:00
2008-09-14 00:32:18 +00:00
if ( main - > versionfile < 246 | | ( main - > versionfile = = 246 & & main - > subversionfile < 1 ) ) {
2008-07-29 15:48:31 +00:00
Mesh * me ;
for ( me = main - > mesh . first ; me ; me = me - > id . next )
alphasort_version_246 ( fd , lib , me ) ;
}
2008-08-30 14:32:16 +00:00
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
if ( main - > versionfile < 246 | | ( main - > versionfile = = 246 & & main - > subversionfile < 1 ) ) {
2008-08-30 14:32:16 +00:00
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > pd & & ( ob - > pd - > forcefield = = PFIELD_WIND ) )
2009-01-02 06:03:53 +00:00
ob - > pd - > f_noise = 0.0f ;
2008-08-30 14:32:16 +00:00
}
}
2008-08-01 23:39:52 +00:00
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 2 ) ) {
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2008-09-16 22:52:42 +00:00
ob - > gameflag | = OB_COLLISION ;
2009-01-02 06:03:53 +00:00
ob - > margin = 0.06f ;
BGE patch: new Physics button and margin parameter in Logic panel. Change subversion.
The Physics button controls the creation of a physics representation
of the object when starting the game. If the button is not selected,
the object is a pure graphical object with no physics representation
and all the other physics buttons are hidden.
Selecting this button gives access to the usual physics buttons.
The physics button is enabled by default to match previous Blender
behavior.
The margin parameter allows to control the collision margin from
the UI. Previously, this parameter was only accessible through
Python. By default, the collision margin is set to 0.0 on static
objects and 0.06 on dynamic objects.
To maintain compatibility with older games, the collision margin
is set to 0.06 on all objects when loading older blend file.
Note about the collision algorithms in Bullet 2.71
--------------------------------------------------
Bullet 2.71 handles the collision margin differently than Bullet 2.53
(the previous Bullet version in Blender). The collision margin is
now kept "inside" the object for box, sphere and cylinder bound
shapes. This means that two objects bound to any of these shape will
come in close contact when colliding.
The static mesh, convex hull and cone shapes still have their
collision margin "outside" the object, which leaves a space of 1
or 2 times the collision margin between objects.
The situation with Bullet 2.53 was more complicated, generally
leading to more space between objects, except for box-box collisions.
This means that running a old game under Bullet 2.71 may cause
visual problems, especially if the objects are small. You can fix
these problems by changing some visual aspect of the objects:
center, shape, size, position of children, etc.
2008-09-14 19:34:06 +00:00
}
}
2008-07-29 15:48:31 +00:00
2008-09-19 20:41:38 +00:00
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 3 ) ) {
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
// Starting from subversion 3, ACTOR is a separate feature.
// Before it was conditioning all the other dynamic flags
if ( ! ( ob - > gameflag & OB_ACTOR ) )
ob - > gameflag & = ~ ( OB_GHOST | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION_RESPONSE ) ;
2008-09-24 22:58:49 +00:00
/* suitable default for older files */
2008-09-19 20:41:38 +00:00
}
}
2008-09-19 21:57:15 +00:00
2008-09-21 16:04:33 +00:00
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 5 ) ) {
Lamp * la = main - > lamp . first ;
for ( ; la ; la = la - > id . next ) {
la - > skyblendtype = MA_RAMP_ADD ;
la - > skyblendfac = 1.0f ;
}
}
2008-09-23 13:35:32 +00:00
/* set the curve radius interpolation to 2.47 default - easy */
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 6 ) ) {
Curve * cu ;
Nurb * nu ;
2008-01-07 18:03:41 +00:00
2008-09-23 13:35:32 +00:00
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
for ( nu = cu - > nurb . first ; nu ; nu = nu - > next ) {
if ( nu ) {
nu - > radius_interp = 3 ;
2008-09-26 19:00:49 +00:00
/* resolu and resolv are now used differently for surfaces
* rather then using the resolution to define the entire number of divisions ,
* use it for the number of divisions per segment
*/
if ( nu - > pntsv > 1 ) {
nu - > resolu = MAX2 ( 1 , ( int ) ( ( ( float ) nu - > resolu / ( float ) nu - > pntsu ) + 0.5f ) ) ;
nu - > resolv = MAX2 ( 1 , ( int ) ( ( ( float ) nu - > resolv / ( float ) nu - > pntsv ) + 0.5f ) ) ;
}
2008-09-23 13:35:32 +00:00
}
}
}
}
2008-09-26 18:03:14 +00:00
/* direction constraint actuators were always local in previous version */
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 7 ) ) {
bActuator * act ;
Object * ob ;
2008-01-07 18:03:41 +00:00
2008-09-26 18:03:14 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
if ( act - > type = = ACT_CONSTRAINT ) {
bConstraintActuator * coa = act - > data ;
if ( coa - > type = = ACT_CONST_TYPE_DIST ) {
coa - > flag | = ACT_CONST_LOCAL ;
}
}
}
}
}
2008-09-29 17:03:24 +00:00
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 9 ) ) {
Lamp * la = main - > lamp . first ;
for ( ; la ; la = la - > id . next ) {
la - > sky_exposure = 1.0f ;
}
}
2008-10-03 09:51:43 +00:00
/* BGE message actuators needed OB prefix, very confusing */
if ( main - > versionfile < 247 | | ( main - > versionfile = = 247 & & main - > subversionfile < 10 ) ) {
bActuator * act ;
Object * ob ;
2008-09-29 17:03:24 +00:00
2008-10-03 09:51:43 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
if ( act - > type = = ACT_MESSAGE ) {
bMessageActuator * msgAct = ( bMessageActuator * ) act - > data ;
if ( strlen ( msgAct - > toPropName ) > 2 ) {
/* strip first 2 chars, would have only worked if these were OB anyway */
2008-10-19 04:02:37 +00:00
memmove ( msgAct - > toPropName , msgAct - > toPropName + 2 , sizeof ( msgAct - > toPropName ) - 2 ) ;
2008-10-03 09:51:43 +00:00
} else {
msgAct - > toPropName [ 0 ] = ' \0 ' ;
}
}
}
}
}
2008-10-12 13:32:28 +00:00
if ( main - > versionfile < 248 ) {
Lamp * la ;
for ( la = main - > lamp . first ; la ; la = la - > id . next ) {
if ( la - > atm_turbidity = = 0.0 ) {
la - > sun_effect_type = 0 ;
2009-01-02 06:03:53 +00:00
la - > horizon_brightness = 1.0f ;
la - > spread = 1.0f ;
la - > sun_brightness = 1.0f ;
la - > sun_size = 1.0f ;
la - > backscattered_light = 1.0f ;
la - > atm_turbidity = 2.0f ;
la - > atm_inscattering_factor = 1.0f ;
la - > atm_extinction_factor = 1.0f ;
la - > atm_distance_factor = 1.0f ;
la - > sun_intensity = 1.0f ;
2008-10-12 13:32:28 +00:00
}
}
}
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
2008-11-12 21:16:53 +00:00
2008-12-14 17:32:24 +00:00
if ( main - > versionfile < 248 | | ( main - > versionfile = = 248 & & main - > subversionfile < 2 ) ) {
Scene * sce ;
/* Note, these will need to be added for painting */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
sce - > toolsettings - > imapaint . seam_bleed = 2 ;
sce - > toolsettings - > imapaint . normal_angle = 80 ;
2009-02-23 21:00:42 +00:00
/* initialize skeleton generation toolsettings */
2008-11-12 19:16:46 +00:00
sce - > toolsettings - > skgen_resolution = 250 ;
sce - > toolsettings - > skgen_threshold_internal = 0.1f ;
sce - > toolsettings - > skgen_threshold_external = 0.1f ;
sce - > toolsettings - > skgen_angle_limit = 30.0f ;
sce - > toolsettings - > skgen_length_ratio = 1.3f ;
sce - > toolsettings - > skgen_length_limit = 1.5f ;
sce - > toolsettings - > skgen_correlation_limit = 0.98f ;
sce - > toolsettings - > skgen_symmetry_limit = 0.1f ;
sce - > toolsettings - > skgen_postpro = SKGEN_SMOOTH ;
sce - > toolsettings - > skgen_postpro_passes = 3 ;
sce - > toolsettings - > skgen_options = SKGEN_FILTER_INTERNAL | SKGEN_FILTER_EXTERNAL | SKGEN_FILTER_SMART | SKGEN_SUB_CORRELATION | SKGEN_HARMONIC ;
sce - > toolsettings - > skgen_subdivisions [ 0 ] = SKGEN_SUB_CORRELATION ;
sce - > toolsettings - > skgen_subdivisions [ 1 ] = SKGEN_SUB_LENGTH ;
sce - > toolsettings - > skgen_subdivisions [ 2 ] = SKGEN_SUB_ANGLE ;
sce - > toolsettings - > skgen_retarget_angle_weight = 1.0f ;
sce - > toolsettings - > skgen_retarget_length_weight = 1.0f ;
sce - > toolsettings - > skgen_retarget_distance_weight = 1.0f ;
/* Skeleton Sketching */
sce - > toolsettings - > bone_sketching = 0 ;
2008-11-17 20:38:04 +00:00
sce - > toolsettings - > skgen_retarget_roll = SK_RETARGET_ROLL_VIEW ;
2008-12-14 17:32:24 +00:00
}
}
2008-12-19 11:45:46 +00:00
if ( main - > versionfile < 248 | | ( main - > versionfile = = 248 & & main - > subversionfile < 3 ) ) {
bScreen * sc ;
/* adjust default settings for Animation Editors */
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 ) {
switch ( sl - > spacetype ) {
case SPACE_ACTION :
{
SpaceAction * sact = ( SpaceAction * ) sl ;
sact - > mode = SACTCONT_DOPESHEET ;
sact - > autosnap = SACTSNAP_FRAME ;
}
break ;
case SPACE_IPO :
{
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
sipo - > autosnap = SACTSNAP_FRAME ;
}
break ;
case SPACE_NLA :
{
SpaceNla * snla = ( SpaceNla * ) sl ;
snla - > autosnap = SACTSNAP_FRAME ;
}
break ;
}
}
}
}
}
2008-12-14 17:32:24 +00:00
2009-04-20 15:06:46 +00:00
if ( main - > versionfile < 248 | | ( main - > versionfile = = 248 & & main - > subversionfile < 3 ) ) {
Object * ob ;
/* Adjustments needed after Bullets update */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
ob - > damping * = 0.635f ;
2010-10-19 22:17:34 +00:00
ob - > rdamping = 0.1f + ( 0.8f * ob - > rdamping ) ;
2009-04-20 15:06:46 +00:00
}
}
2008-12-06 13:42:55 +00:00
2009-04-20 15:06:46 +00:00
if ( main - > versionfile < 248 | | ( main - > versionfile = = 248 & & main - > subversionfile < 4 ) ) {
Scene * sce ;
World * wrld ;
/* Dome (Fisheye) default parameters */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
sce - > r . domeangle = 180 ;
sce - > r . domemode = 1 ;
sce - > r . domeres = 4 ;
sce - > r . domeresbuf = 1.0f ;
2009-06-08 20:08:19 +00:00
sce - > r . dometilt = 0 ;
2009-04-20 15:06:46 +00:00
}
/* DBVT culling by default */
for ( wrld = main - > world . first ; wrld ; wrld = wrld - > id . next ) {
wrld - > mode | = WO_DBVT_CULLING ;
wrld - > occlusionRes = 128 ;
}
}
2009-06-08 20:08:19 +00:00
if ( main - > versionfile < 248 | | ( main - > versionfile = = 248 & & main - > subversionfile < 5 ) ) {
Object * ob ;
World * wrld ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
ob - > m_contactProcessingThreshold = 1. ; //pad3 is used for m_contactProcessingThreshold
if ( ob - > parent ) {
/* check if top parent has compound shape set and if yes, set this object
to compound shaper as well ( was the behaviour before , now it ' s optional ) */
Object * parent = newlibadr ( fd , lib , ob - > parent ) ;
2010-03-26 05:55:55 +00:00
while ( parent & & parent ! = ob & & parent - > parent ! = NULL ) {
2009-06-08 20:08:19 +00:00
parent = newlibadr ( fd , lib , parent - > parent ) ;
}
if ( parent ) {
if ( parent - > gameflag & OB_CHILD )
ob - > gameflag | = OB_CHILD ;
}
}
}
for ( wrld = main - > world . first ; wrld ; wrld = wrld - > id . next ) {
wrld - > ticrate = 60 ;
wrld - > maxlogicstep = 5 ;
wrld - > physubstep = 1 ;
wrld - > maxphystep = 5 ;
}
}
if ( main - > versionfile < 249 ) {
Scene * sce ;
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
sce - > r . renderer = 0 ;
}
// correct introduce of seed for wind force
if ( main - > versionfile < 249 & & main - > subversionfile < 1 ) {
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > pd )
ob - > pd - > seed = ( ( unsigned int ) ( ceil ( PIL_check_seconds_timer ( ) ) ) + 1 ) % 128 ;
}
}
2009-06-23 00:41:55 +00:00
if ( main - > versionfile < 249 & & main - > subversionfile < 2 ) {
Scene * sce = main - > scene . first ;
Sequence * seq ;
Editing * ed ;
while ( sce ) {
ed = sce - > ed ;
if ( ed ) {
SEQP_BEGIN ( ed , seq ) {
if ( seq - > strip & & seq - > strip - > proxy ) {
if ( sce - > r . size ! = 100.0 ) {
seq - > strip - > proxy - > size
= sce - > r . size ;
} else {
2010-10-19 22:17:34 +00:00
seq - > strip - > proxy - > size = 25 ;
2009-06-23 00:41:55 +00:00
}
seq - > strip - > proxy - > quality = 90 ;
}
}
SEQ_END
}
sce = sce - > id . next ;
}
}
2008-01-07 18:03:41 +00:00
if ( main - > versionfile < 250 ) {
bScreen * screen ;
2009-01-04 14:14:06 +00:00
Scene * scene ;
2.5: Render
* UI layout for scene buttons has quite some changes, I tried to
better organize things according to the pipeline, and also showing
important properties by default, and collapsing less important ones.
Some changes compared to 2.4x:
* Panorama is now a Camera property.
* Sequence and Compositing are now enabled by default, but will only
do something when there is a node tree using nodes, or a strip in the
sequence editor.
* Enabling Full Sample now automatically enables Save Buffers too.
* Stamp option to include info in file is removed, it now simply always
does this if one of the stamp infos is enabled.
* Xvid, H.264 and Ogg Theora are now directly in the file format menu,
but still using FFMPEG. Unfortunately Ogg is broken at the moment
(also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux,
maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes
it work.
* Organized file format menu by image/movie types.
Added:
* Render layers RNA wrapped, operatorized, layouted.
* FFMPEG format/codec options are now working.
Defaults changed:
* Compositing & Sequencer enabled.
* Tiles set to 8x8.
* Time/Date/Frame/Scene/Camera/Filename enabled for stamp.
2009-07-13 19:09:13 +00:00
Base * base ;
2009-01-03 18:43:11 +00:00
Material * ma ;
2.5: Render
* UI layout for scene buttons has quite some changes, I tried to
better organize things according to the pipeline, and also showing
important properties by default, and collapsing less important ones.
Some changes compared to 2.4x:
* Panorama is now a Camera property.
* Sequence and Compositing are now enabled by default, but will only
do something when there is a node tree using nodes, or a strip in the
sequence editor.
* Enabling Full Sample now automatically enables Save Buffers too.
* Stamp option to include info in file is removed, it now simply always
does this if one of the stamp infos is enabled.
* Xvid, H.264 and Ogg Theora are now directly in the file format menu,
but still using FFMPEG. Unfortunately Ogg is broken at the moment
(also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux,
maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes
it work.
* Organized file format menu by image/movie types.
Added:
* Render layers RNA wrapped, operatorized, layouted.
* FFMPEG format/codec options are now working.
Defaults changed:
* Compositing & Sequencer enabled.
* Tiles set to 8x8.
* Time/Date/Frame/Scene/Camera/Filename enabled for stamp.
2009-07-13 19:09:13 +00:00
Camera * cam ;
2009-01-31 13:30:56 +00:00
Mesh * me ;
2009-09-08 00:23:33 +00:00
Curve * cu ;
2009-01-03 18:43:11 +00:00
Scene * sce ;
Tex * tx ;
2009-06-05 23:59:33 +00:00
ParticleSettings * part ;
2009-06-21 10:16:52 +00:00
Object * ob ;
2009-08-15 16:36:25 +00:00
//PTCacheID *pid;
//ListBase pidlist;
2009-08-09 21:16:39 +00:00
bSound * sound ;
Sequence * seq ;
bActuator * act ;
2010-02-01 19:35:32 +00:00
int a ;
2009-08-09 21:16:39 +00:00
for ( sound = main - > sound . first ; sound ; sound = sound - > id . next )
{
if ( sound - > newpackedfile )
{
sound - > packedfile = sound - > newpackedfile ;
sound - > newpackedfile = NULL ;
}
}
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
if ( act - > type = = ACT_SOUND ) {
bSoundActuator * sAct = ( bSoundActuator * ) act - > data ;
if ( sAct - > sound )
{
sound = newlibadr ( fd , lib , sAct - > sound ) ;
2010-07-14 08:55:08 +00:00
sAct - > flag = sound - > flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0 ;
2009-08-09 21:16:39 +00:00
sAct - > pitch = sound - > pitch ;
sAct - > volume = sound - > volume ;
sAct - > sound3D . reference_distance = sound - > distance ;
sAct - > sound3D . max_gain = sound - > max_gain ;
sAct - > sound3D . min_gain = sound - > min_gain ;
sAct - > sound3D . rolloff_factor = sound - > attenuation ;
}
else
{
sAct - > sound3D . reference_distance = 1.0f ;
sAct - > volume = 1.0f ;
sAct - > sound3D . max_gain = 1.0f ;
sAct - > sound3D . rolloff_factor = 1.0f ;
}
sAct - > sound3D . cone_inner_angle = 360.0f ;
sAct - > sound3D . cone_outer_angle = 360.0f ;
sAct - > sound3D . max_distance = FLT_MAX ;
}
}
}
for ( scene = main - > scene . first ; scene ; scene = scene - > id . next )
{
if ( scene - > ed & & scene - > ed - > seqbasep )
{
for ( seq = scene - > ed - > seqbasep - > first ; seq ; seq = seq - > next )
{
if ( seq - > type = = SEQ_HD_SOUND )
{
char str [ FILE_MAX ] ;
BLI_join_dirfile ( str , seq - > strip - > dir , seq - > strip - > stripdata - > name ) ;
2010-10-18 06:41:16 +00:00
BLI_path_abs ( str , G . main - > name ) ;
2009-08-09 21:16:39 +00:00
seq - > sound = sound_new_file ( main , str ) ;
}
2010-04-11 19:26:46 +00:00
/* don't know, if anybody used that
this way , but just in case , upgrade
to new way . . . */
if ( ( seq - > flag & SEQ_USE_PROXY_CUSTOM_FILE ) & &
! ( seq - > flag & SEQ_USE_PROXY_CUSTOM_DIR ) )
{
snprintf ( seq - > strip - > proxy - > dir ,
FILE_MAXDIR , " %s/BL_proxy " ,
seq - > strip - > dir ) ;
}
2009-08-09 21:16:39 +00:00
}
}
}
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
2008-01-07 18:03:41 +00:00
do_versions_windowmanager_2_50 ( screen ) ;
2.5
Patch from Joshua, converting Grease Pencil to 2.5.
All GP data now is an ID block, allowing re-use, link and append.
For better contextual control within 2.5, these GP ID's will get
linked to actual data, like NodeTrees, Scenes, Images or Objects.
That will ensure Undo works, and opens up exciting new use cases
as well. :)
Patch note: on reading files, GPencils linked from editors will
get moved to the main library, using standard naming (indicating
where it was used), and with "Fake User" set. That way the user
can manually relink the pencils where appropriate.
We can check on just linking GP to some default, like 3d window
pencils to Scene? Nice to experiment with.
Notes for Joshua:
- for reading old GPencil, it has to use old code as well, meaning
to tread data as "indirect data, within another ID".
- Saving ID data means the chunk in file BHead needs the ID_GD code,
and not "DATA", which indicates 'indirect data'. That's the file
format spec.
- I've added do_versions_gpencil_2_50(), feel free to further tweak
things here, like linking things to scene or so.
- Formerly GPencil saved 2.50 files won't convert gpencil
2009-04-20 10:13:55 +00:00
do_versions_gpencil_2_50 ( main , screen ) ;
}
2009-01-03 18:43:11 +00:00
/* shader, composit and texture node trees have id.name empty, put something in
* to have them show in RNA viewer and accessible otherwise .
*/
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > nodetree & & strlen ( ma - > nodetree - > id . name ) = = 0 )
strcpy ( ma - > nodetree - > id . name , " NTShader Nodetree " ) ;
2010-02-01 19:35:32 +00:00
/* which_output 0 is now "not specified" */
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
if ( ma - > mtex [ a ] ) {
tx = newlibadr ( fd , lib , ma - > mtex [ a ] - > tex ) ;
if ( tx & & tx - > use_nodes )
ma - > mtex [ a ] - > which_output + + ;
}
}
2009-01-17 22:14:08 +00:00
}
2009-01-03 18:43:11 +00:00
/* and composit trees */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > nodetree & & strlen ( sce - > nodetree - > id . name ) = = 0 )
2009-11-10 04:01:44 +00:00
strcpy ( sce - > nodetree - > id . name , " NTCompositing Nodetree " ) ;
2.5: Render
* UI layout for scene buttons has quite some changes, I tried to
better organize things according to the pipeline, and also showing
important properties by default, and collapsing less important ones.
Some changes compared to 2.4x:
* Panorama is now a Camera property.
* Sequence and Compositing are now enabled by default, but will only
do something when there is a node tree using nodes, or a strip in the
sequence editor.
* Enabling Full Sample now automatically enables Save Buffers too.
* Stamp option to include info in file is removed, it now simply always
does this if one of the stamp infos is enabled.
* Xvid, H.264 and Ogg Theora are now directly in the file format menu,
but still using FFMPEG. Unfortunately Ogg is broken at the moment
(also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux,
maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes
it work.
* Organized file format menu by image/movie types.
Added:
* Render layers RNA wrapped, operatorized, layouted.
* FFMPEG format/codec options are now working.
Defaults changed:
* Compositing & Sequencer enabled.
* Tiles set to 8x8.
* Time/Date/Frame/Scene/Camera/Filename enabled for stamp.
2009-07-13 19:09:13 +00:00
/* move to cameras */
2009-09-24 12:15:17 +00:00
if ( sce - > r . mode & R_PANORAMA ) {
2009-08-06 23:19:05 +00:00
for ( base = sce - > base . first ; base ; base = base - > next ) {
2.5: Render
* UI layout for scene buttons has quite some changes, I tried to
better organize things according to the pipeline, and also showing
important properties by default, and collapsing less important ones.
Some changes compared to 2.4x:
* Panorama is now a Camera property.
* Sequence and Compositing are now enabled by default, but will only
do something when there is a node tree using nodes, or a strip in the
sequence editor.
* Enabling Full Sample now automatically enables Save Buffers too.
* Stamp option to include info in file is removed, it now simply always
does this if one of the stamp infos is enabled.
* Xvid, H.264 and Ogg Theora are now directly in the file format menu,
but still using FFMPEG. Unfortunately Ogg is broken at the moment
(also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux,
maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes
it work.
* Organized file format menu by image/movie types.
Added:
* Render layers RNA wrapped, operatorized, layouted.
* FFMPEG format/codec options are now working.
Defaults changed:
* Compositing & Sequencer enabled.
* Tiles set to 8x8.
* Time/Date/Frame/Scene/Camera/Filename enabled for stamp.
2009-07-13 19:09:13 +00:00
ob = newlibadr ( fd , lib , base - > object ) ;
if ( ob - > type = = OB_CAMERA & & ! ob - > id . lib ) {
cam = newlibadr ( fd , lib , ob - > data ) ;
cam - > flag | = CAM_PANORAMA ;
}
}
2009-09-24 12:15:17 +00:00
sce - > r . mode & = ~ R_PANORAMA ;
2.5: Render
* UI layout for scene buttons has quite some changes, I tried to
better organize things according to the pipeline, and also showing
important properties by default, and collapsing less important ones.
Some changes compared to 2.4x:
* Panorama is now a Camera property.
* Sequence and Compositing are now enabled by default, but will only
do something when there is a node tree using nodes, or a strip in the
sequence editor.
* Enabling Full Sample now automatically enables Save Buffers too.
* Stamp option to include info in file is removed, it now simply always
does this if one of the stamp infos is enabled.
* Xvid, H.264 and Ogg Theora are now directly in the file format menu,
but still using FFMPEG. Unfortunately Ogg is broken at the moment
(also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux,
maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes
it work.
* Organized file format menu by image/movie types.
Added:
* Render layers RNA wrapped, operatorized, layouted.
* FFMPEG format/codec options are now working.
Defaults changed:
* Compositing & Sequencer enabled.
* Tiles set to 8x8.
* Time/Date/Frame/Scene/Camera/Filename enabled for stamp.
2009-07-13 19:09:13 +00:00
}
2009-01-03 18:43:11 +00:00
}
/* and texture trees */
for ( tx = main - > tex . first ; tx ; tx = tx - > id . next ) {
2010-02-01 19:35:32 +00:00
bNode * node ;
if ( tx - > nodetree ) {
if ( strlen ( tx - > nodetree - > id . name ) = = 0 )
strcpy ( tx - > nodetree - > id . name , " NTTexture Nodetree " ) ;
/* which_output 0 is now "not specified" */
for ( node = tx - > nodetree - > nodes . first ; node ; node = node - > next )
if ( node - > type = = TEX_NODE_OUTPUT )
node - > custom1 + + ;
}
2009-01-03 18:43:11 +00:00
}
2009-01-31 13:30:56 +00:00
/* copy standard draw flag to meshes(used to be global, is not available here) */
for ( me = main - > mesh . first ; me ; me = me - > id . next ) {
me - > drawflag = ME_DRAWEDGES | ME_DRAWFACES | ME_DRAWCREASES ;
}
2009-06-05 23:59:33 +00:00
2009-06-21 10:16:52 +00:00
/* particle draw and render types */
2009-06-05 23:59:33 +00:00
for ( part = main - > particle . first ; part ; part = part - > id . next ) {
if ( part - > draw_as ) {
if ( part - > draw_as = = PART_DRAW_DOT ) {
part - > ren_as = PART_DRAW_HALO ;
part - > draw_as = PART_DRAW_REND ;
}
else if ( part - > draw_as < = PART_DRAW_AXIS ) {
part - > ren_as = PART_DRAW_HALO ;
}
else {
part - > ren_as = part - > draw_as ;
part - > draw_as = PART_DRAW_REND ;
}
}
2009-07-04 03:50:12 +00:00
part - > path_end = 1.0f ;
2009-07-24 19:36:08 +00:00
part - > clength = 1.0f ;
2009-06-05 23:59:33 +00:00
}
2009-06-21 10:16:52 +00:00
/* set old pointcaches to have disk cache flag */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2009-08-12 13:07:12 +00:00
//BKE_ptcache_ids_from_object(&pidlist, ob);
Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
- exact (not marked)
- outdated (simulation is not done completely with current settings)
- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
- Speeds up the "quick caching" very much.
- Frames between cached frames are interpolated from the cached frames.
- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
[Normal cache]
- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
- Becomes non-exact: After larger than 1 frame steps.
- Becomes outdated: After any change effecting the simulation other than frame steps.
- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
[Quick cache]
- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
- Becomes non-exact: Always from frame 1 (unless cache step = 1).
- Becomes outdated: Never.
- Pros/cons: Not very accurate, but super fast!
- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
- step forwards (to unknown) -> simulate from last exact frame, store result
- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
- Baking does the same, but runs the simulation all the way to the end of simulation.
- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
2009-06-27 15:28:58 +00:00
2009-08-12 13:07:12 +00:00
//for(pid=pidlist.first; pid; pid=pid->next)
// pid->cache->flag |= PTCACHE_DISK_CACHE;
2009-06-21 10:16:52 +00:00
2009-08-12 13:07:12 +00:00
//BLI_freelistN(&pidlist);
2009-06-21 10:16:52 +00:00
}
2009-09-08 00:23:33 +00:00
/* type was a mixed flag & enum. move the 2d flag elsewhere */
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
Nurb * nu ;
for ( nu = cu - > nurb . first ; nu ; nu = nu - > next ) {
nu - > flag | = ( nu - > type & CU_2D ) ;
nu - > type & = CU_TYPE ;
}
}
2008-01-07 18:03:41 +00:00
}
2009-01-06 18:59:03 +00:00
2009-07-15 19:19:43 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 1 ) ) {
2009-01-06 18:59:03 +00:00
Object * ob ;
2009-05-20 13:34:04 +00:00
Material * ma ;
2009-07-21 13:20:35 +00:00
Tex * tex ;
2009-06-23 00:41:55 +00:00
Scene * sce ;
ToolSettings * ts ;
2009-08-15 16:36:25 +00:00
//PTCacheID *pid;
//ListBase pidlist;
2009-12-10 17:37:04 +00:00
int a ;
2009-01-06 18:59:03 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2009-08-12 13:07:12 +00:00
//BKE_ptcache_ids_from_object(&pidlist, ob);
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
2009-08-12 13:07:12 +00:00
//for(pid=pidlist.first; pid; pid=pid->next) {
// if(pid->ptcaches->first == NULL)
// pid->ptcaches->first = pid->ptcaches->last = pid->cache;
//}
New point cache file format:
- HEADER (beginning of each file)
* general header:
+ 8 char: "BPHYSICS"
+ 1 int: simulation type (same as PTCacheID->type)
* custom header (same for sb, particles and cloth, but can be different for new dynamics)
+ 1 int: totpoint (number of points)
+ 1 int: data_types (bit flags for what the stored data is)
- DATA (directly after header)
*totpoint times the data as specified in data_types flags
- simulation type
soft body = 0, particles = 1, cloth = 2
- data types (more can be added easily when needed)
data flag contains
----------------------------------------
index (1<<0) 1 int (index of current point)
location (1<<1) 3 float
velocity (1<<2) 3 float
rotation (1<<3) 4 float (quaternion)
avelocity (1<<4) 3 float (used for particles)
xconst (1<<4) 3 float (used for cloth)
size (1<<5) 1 float
times (1<<6) 3 float (birth, die & lifetime of particle)
boids (1<<7) 1 BoidData
Notes:
- Every frame is not nescessary since data is interpolated for the inbetween frames.
- For now every point is needed for every cached frame, the "index" data type is reserved for future usage.
- For loading external particle caches only "location" data is necessary, other needed values are determined from the given data.
- Non-dynamic data should be written into an info file if external usage is desired.
* Info file is named as normal cache files, but with frame number 0;
* "Non-dynamic" means data such as particle times.
* Written automatically when baking to disk so basically a library of particle simulations should be possible.
- Old disk cache format is supported for reading, so pre 2.5 files shouldn't break. However old style memory cache (added during 2.5 development) is not supported. To keep memory cached simulations convert the cache to disk cache before svn update and save the blend.
- External sb and cloth caches should be perfectly possible, but due to lack of testing these are not yet enabled in ui.
Other changes:
- Multiple point caches per dynamics system.
* In the future these will hopefully be nla editable etc, but for now things are simple and the current (selected) point cache is used.
* Changing the amount of cached points (for example particle count) is allowed, but might not give correct results if multiple caches are present.
- Generalization of point cache baking etc operator & rna code.
- Comb brushing particle hair didn't work smoothly.
2009-08-12 09:54:29 +00:00
2009-08-12 13:07:12 +00:00
//BLI_freelistN(&pidlist);
2009-01-06 18:59:03 +00:00
if ( ob - > type = = OB_MESH ) {
Mesh * me = newlibadr ( fd , lib , ob - > data ) ;
void * olddata = ob - > data ;
ob - > data = me ;
2010-03-26 06:10:21 +00:00
if ( me & & me - > id . lib = = NULL & & me - > mr & & me - > mr - > level_count > 1 ) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */
2009-12-10 17:37:04 +00:00
multires_load_old ( ob , me ) ;
2009-01-06 18:59:03 +00:00
ob - > data = olddata ;
}
2009-07-13 00:40:20 +00:00
if ( ob - > totcol & & ob - > matbits = = NULL ) {
int a ;
ob - > matbits = MEM_callocN ( sizeof ( char ) * ob - > totcol , " ob->matbits " ) ;
for ( a = 0 ; a < ob - > totcol ; a + + )
ob - > matbits [ a ] = ob - > colbits & ( 1 < < a ) ;
}
2009-01-06 18:59:03 +00:00
}
2009-05-20 13:34:04 +00:00
2009-07-21 13:20:35 +00:00
/* texture filter */
2009-07-21 13:46:49 +00:00
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
2009-07-21 13:20:35 +00:00
if ( tex - > afmax = = 0 )
tex - > afmax = 8 ;
2009-07-21 13:46:49 +00:00
}
2009-07-21 13:20:35 +00:00
2009-05-20 13:34:04 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
2009-07-25 21:31:17 +00:00
if ( ma - > mode & MA_WIRE ) {
ma - > material_type = MA_TYPE_WIRE ;
ma - > mode & = ~ MA_WIRE ;
}
2009-05-20 13:34:04 +00:00
if ( ma - > mode & MA_HALO ) {
ma - > material_type = MA_TYPE_HALO ;
ma - > mode & = ~ MA_HALO ;
}
2009-07-21 13:46:49 +00:00
2009-08-15 19:35:03 +00:00
if ( ma - > mode & ( MA_ZTRANSP | MA_RAYTRANSP ) ) {
ma - > mode | = MA_TRANSP ;
}
else {
ma - > mode | = MA_ZTRANSP ;
ma - > mode & = ~ MA_TRANSP ;
}
2009-07-21 13:46:49 +00:00
/* set new bump for unused slots */
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
if ( ma - > mtex [ a ] ) {
2009-08-07 05:25:17 +00:00
tex = ma - > mtex [ a ] - > tex ;
if ( ! tex )
2009-07-21 13:46:49 +00:00
ma - > mtex [ a ] - > texflag | = MTEX_NEW_BUMP ;
2009-08-07 05:25:17 +00:00
else {
tex = ( Tex * ) newlibadr ( fd , ma - > id . lib , tex ) ;
if ( tex & & tex - > type = = 0 ) /* invalid type */
ma - > mtex [ a ] - > texflag | = MTEX_NEW_BUMP ;
}
2009-07-21 13:46:49 +00:00
}
}
2009-08-13 05:21:25 +00:00
/* volume rendering settings */
2009-08-17 22:09:36 +00:00
if ( ma - > vol . stepsize < 0.0001f ) {
ma - > vol . density = 1.0f ;
ma - > vol . emission = 0.0f ;
ma - > vol . scattering = 1.0f ;
ma - > vol . emission_col [ 0 ] = ma - > vol . emission_col [ 1 ] = ma - > vol . emission_col [ 2 ] = 1.0f ;
ma - > vol . density_scale = 1.0f ;
ma - > vol . depth_cutoff = 0.01f ;
ma - > vol . stepsize_type = MA_VOL_STEP_RANDOMIZED ;
ma - > vol . stepsize = 0.2f ;
* changes/additions to volume lighting
Volumes can now receive shadows from external objects, either raytraced shadows or shadow maps.
To use external shadows, enable 'external shadows' in volume material 'lighting' panel. This an extra toggle since it causes a performance hit, but this can probably be revisited/optimised when the new raytrace accelerator is integrated. For shadow maps at least, it's still very quick.
Renamed 'scattering mode' to 'lighting mode' (a bit simpler to understand), and the options inside. Now there's:
- Shadeless
takes light contribution, but without shadowing or self-shading (fast)
good for fog-like volumes, such as mist, or underwater effects
- Shadowed (new)
takes light contribution with shadows, but no self-shading. (medium)
good for mist etc. with directional light sources
eg. http://vimeo.com/6901636
- Shaded
takes light contribution with internal/external shadows, and self shading (slower)
good for thicker/textured volumes like smoke
- Multiple scattering etc (still doesn't work properly, on the todo).
2009-10-05 02:59:47 +00:00
ma - > vol . shade_type = MA_VOL_SHADE_SHADED ;
2009-08-17 22:09:36 +00:00
ma - > vol . shadeflag | = MA_VOL_PRECACHESHADING ;
ma - > vol . precache_resolution = 50 ;
}
2009-05-20 13:34:04 +00:00
}
2009-06-23 00:41:55 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
ts = sce - > toolsettings ;
2009-07-09 19:49:04 +00:00
if ( ts - > normalsize = = 0.0 | | ! ts - > uv_selectmode | | ts - > vgroup_weight = = 0.0 ) {
2009-06-23 00:41:55 +00:00
ts - > normalsize = 0.1f ;
ts - > selectmode = SCE_SELECT_VERTEX ;
2009-07-02 03:50:20 +00:00
/* autokeying - setting should be taken from the user-prefs
* but the userprefs version may not have correct flags set
* ( i . e . will result in blank box when enabled )
*/
2009-06-23 00:41:55 +00:00
ts - > autokey_mode = U . autokey_mode ;
2009-07-02 03:50:20 +00:00
if ( ts - > autokey_mode = = 0 )
ts - > autokey_mode = 2 ; /* 'add/replace' but not on */
2009-07-09 19:49:04 +00:00
ts - > uv_selectmode = UV_SELECT_VERTEX ;
ts - > vgroup_weight = 1.0f ;
2009-06-14 18:54:35 +00:00
}
2009-07-20 20:28:29 +00:00
/* Game Settings */
//Dome
sce - > gm . dome . angle = sce - > r . domeangle ;
sce - > gm . dome . mode = sce - > r . domemode ;
sce - > gm . dome . res = sce - > r . domeres ;
sce - > gm . dome . resbuf = sce - > r . domeresbuf ;
sce - > gm . dome . tilt = sce - > r . dometilt ;
sce - > gm . dome . warptext = sce - > r . dometext ;
//Stand Alone
sce - > gm . fullscreen = sce - > r . fullscreen ;
sce - > gm . xplay = sce - > r . xplay ;
sce - > gm . yplay = sce - > r . yplay ;
sce - > gm . freqplay = sce - > r . freqplay ;
sce - > gm . depth = sce - > r . depth ;
sce - > gm . attrib = sce - > r . attrib ;
//Stereo
sce - > gm . xsch = sce - > r . xsch ;
sce - > gm . ysch = sce - > r . ysch ;
sce - > gm . stereomode = sce - > r . stereomode ;
/* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
if ( sce - > gm . stereomode = = 1 ) { //1 = STEREO_NOSTEREO
sce - > gm . stereoflag = STEREO_NOSTEREO ;
sce - > gm . stereomode = STEREO_ANAGLYPH ;
}
else if ( sce - > gm . stereomode = = 8 ) { //8 = STEREO_DOME
sce - > gm . stereoflag = STEREO_DOME ;
sce - > gm . stereomode = STEREO_ANAGLYPH ;
}
else
2009-07-20 22:36:56 +00:00
sce - > gm . stereoflag = STEREO_ENABLED ;
2009-07-20 20:28:29 +00:00
//Framing
sce - > gm . framing = sce - > framing ;
sce - > gm . xplay = sce - > r . xplay ;
sce - > gm . yplay = sce - > r . yplay ;
sce - > gm . freqplay = sce - > r . freqplay ;
sce - > gm . depth = sce - > r . depth ;
//Physic (previously stored in world)
2009-08-03 14:56:46 +00:00
sce - > gm . gravity = 9.8f ;
sce - > gm . physicsEngine = WOPHY_BULLET ; // Bullet by default
sce - > gm . mode = WO_DBVT_CULLING ; // DBVT culling by default
sce - > gm . occlusionRes = 128 ;
sce - > gm . ticrate = 60 ;
sce - > gm . maxlogicstep = 5 ;
sce - > gm . physubstep = 1 ;
sce - > gm . maxphystep = 5 ;
2009-06-14 18:54:35 +00:00
}
}
2009-08-18 15:27:48 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 2 ) ) {
Scene * sce ;
2009-09-08 09:41:15 +00:00
Object * ob ;
2009-08-18 15:27:48 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( fd - > fileflags & G_FILE_ENABLE_ALL_FRAMES )
sce - > gm . flag | = GAME_ENABLE_ALL_FRAMES ;
if ( fd - > fileflags & G_FILE_SHOW_DEBUG_PROPS )
sce - > gm . flag | = GAME_SHOW_DEBUG_PROPS ;
if ( fd - > fileflags & G_FILE_SHOW_FRAMERATE )
sce - > gm . flag | = GAME_SHOW_FRAMERATE ;
if ( fd - > fileflags & G_FILE_SHOW_PHYSICS )
sce - > gm . flag | = GAME_SHOW_PHYSICS ;
if ( fd - > fileflags & G_FILE_GLSL_NO_SHADOWS )
sce - > gm . flag | = GAME_GLSL_NO_SHADOWS ;
if ( fd - > fileflags & G_FILE_GLSL_NO_SHADERS )
sce - > gm . flag | = GAME_GLSL_NO_SHADERS ;
if ( fd - > fileflags & G_FILE_GLSL_NO_RAMPS )
sce - > gm . flag | = GAME_GLSL_NO_RAMPS ;
if ( fd - > fileflags & G_FILE_GLSL_NO_NODES )
sce - > gm . flag | = GAME_GLSL_NO_NODES ;
if ( fd - > fileflags & G_FILE_GLSL_NO_EXTRA_TEX )
sce - > gm . flag | = GAME_GLSL_NO_EXTRA_TEX ;
if ( fd - > fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS )
sce - > gm . flag | = GAME_IGNORE_DEPRECATION_WARNINGS ;
if ( fd - > fileflags & G_FILE_GAME_MAT_GLSL )
sce - > gm . matmode = GAME_MAT_GLSL ;
else if ( fd - > fileflags & G_FILE_GAME_MAT )
sce - > gm . matmode = GAME_MAT_MULTITEX ;
else
sce - > gm . matmode = GAME_MAT_TEXFACE ;
sce - > gm . flag | = GAME_DISPLAY_LISTS ;
}
2009-09-08 09:41:15 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > flag & 8192 ) // OB_POSEMODE = 8192
ob - > mode | = OB_MODE_POSE ;
}
2009-08-18 15:27:48 +00:00
}
2009-10-01 17:15:23 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 4 ) ) {
2009-09-14 19:12:29 +00:00
Scene * sce ;
2009-09-15 03:54:13 +00:00
Object * ob ;
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
Material * ma ;
2009-10-01 17:15:23 +00:00
Lamp * la ;
World * wo ;
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
Tex * tex ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
ParticleSettings * part ;
int do_gravity = 0 ;
2009-09-14 19:12:29 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
if ( sce - > unit . scale_length = = 0.0f )
sce - > unit . scale_length = 1.0f ;
2009-09-15 03:54:13 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2009-09-28 10:19:20 +00:00
/* fluid-sim stuff */
2009-09-21 06:43:20 +00:00
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) modifiers_findByType ( ob , eModifierType_Fluidsim ) ;
if ( fluidmd ) fluidmd - > fss - > fmd = fluidmd ;
2009-09-28 10:19:20 +00:00
/* rotation modes were added, but old objects would now default to being 'quaternion based' */
ob - > rotmode = ROT_MODE_EUL ;
2009-09-15 03:54:13 +00:00
}
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
2009-10-01 17:15:23 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > vol . reflection = = 0.f ) {
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
ma - > vol . reflection = 1.f ;
ma - > vol . transmission_col [ 0 ] = ma - > vol . transmission_col [ 1 ] = ma - > vol . transmission_col [ 2 ] = 1.0f ;
ma - > vol . reflection_col [ 0 ] = ma - > vol . reflection_col [ 1 ] = ma - > vol . reflection_col [ 2 ] = 1.0f ;
}
2009-09-20 17:55:03 +00:00
2009-10-01 17:15:23 +00:00
do_version_mtex_factor_2_50 ( ma - > mtex , ID_MA ) ;
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
}
2009-10-01 17:15:23 +00:00
for ( la = main - > lamp . first ; la ; la = la - > id . next )
do_version_mtex_factor_2_50 ( la - > mtex , ID_LA ) ;
for ( wo = main - > world . first ; wo ; wo = wo - > id . next )
do_version_mtex_factor_2_50 ( wo - > mtex , ID_WO ) ;
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next )
if ( tex - > vd )
if ( tex - > vd - > extend = = 0 )
tex - > vd - > extend = TEX_CLIP ;
Rework of volume shading
After code review and experimentation, this commit makes some changes to the way that volumes are shaded. Previously, there were problems with the 'scattering' component, in that it wasn't physically correct - it didn't conserve energy and was just acting as a brightness multiplier. This has been changed to be more correct, so that as the light is scattered out of the volume, there is less remaining to penetrate through.
Since this behaviour is very similar to absorption but more useful, absorption has been removed and has been replaced by a 'transmission colour' - controlling the colour of light penetrating through the volume after it has been scattered/absorbed. As well as this, there's now 'reflection', a non-physically correct RGB multiplier for out-scattered light. This is handy for tweaking the overall colour of the volume, without having to worry about wavelength dependent absorption, and its effects on transmitted light. Now at least, even though there is the ability to tweak things non-physically, volume shading is physically based by default, and has a better combination of correctness and ease of use.
There's more detailed information and example images here:
http://wiki.blender.org/index.php/User:Broken/VolumeRendering
Also did some tweaks/optimisation:
* Removed shading step size (was a bit annoying, if it comes back, it will be in a different form)
* Removed phase function options, now just one asymmetry slider controls the range between back-scattering, isotropic scattering, and forward scattering. (note, more extreme values gives artifacts with light cache, will fix...)
* Disabled the extra 'bounce lights' from the preview render for volumes, speeds updates significantly
* Enabled voxeldata texture in preview render
* Fixed volume shadows (they were too dark, fixed by avoiding using the shadfac/AddAlphaLight stuff)
More revisions to come later...
2009-09-29 22:01:32 +00:00
2009-09-20 17:55:03 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
{
2010-10-19 22:17:34 +00:00
if ( sce - > audio . main = = 0.0f )
sce - > audio . main = 1.0f ;
2009-09-20 17:55:03 +00:00
sce - > r . ffcodecdata . audio_mixrate = sce - > audio . mixrate ;
sce - > r . ffcodecdata . audio_volume = sce - > audio . main ;
2010-10-19 22:17:34 +00:00
sce - > audio . distance_model = 2 ;
sce - > audio . doppler_factor = 1.0f ;
sce - > audio . speed_of_sound = 343.3f ;
2009-09-20 17:55:03 +00:00
}
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
/* Add default gravity to scenes */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( ( sce - > physics_settings . flag & PHYS_GLOBAL_GRAVITY ) = = 0
2009-11-10 20:43:45 +00:00
& & len_v3 ( sce - > physics_settings . gravity ) = = 0.0f ) {
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
sce - > physics_settings . gravity [ 0 ] = sce - > physics_settings . gravity [ 1 ] = 0.0f ;
sce - > physics_settings . gravity [ 2 ] = - 9.81f ;
sce - > physics_settings . flag = PHYS_GLOBAL_GRAVITY ;
do_gravity = 1 ;
}
}
/* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
if ( do_gravity ) for ( part = main - > particle . first ; part ; part = part - > id . next )
part - > effector_weights - > global_gravity = part - > acc [ 2 ] / - 9.81f ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
ModifierData * md ;
if ( do_gravity ) {
for ( md = ob - > modifiers . first ; md ; md = md - > next ) {
ClothModifierData * clmd = ( ClothModifierData * ) modifiers_findByType ( ob , eModifierType_Cloth ) ;
if ( clmd )
2010-10-19 22:17:34 +00:00
clmd - > sim_parms - > effector_weights - > global_gravity = clmd - > sim_parms - > gravity [ 2 ] / - 9.81f ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
}
if ( ob - > soft )
2010-10-19 22:17:34 +00:00
ob - > soft - > effector_weights - > global_gravity = ob - > soft - > grav / 9.81f ;
Unified effector functionality for particles, cloth and softbody
* Unified scene wide gravity (currently in scene buttons)
instead of each simulation having it's own gravity.
* Weight parameters for all effectors and an effector group
setting.
* Every effector can use noise.
* Most effectors have "shapes" point, plane, surface, every point.
- "Point" is most like the old effectors and uses the
effector location as the effector point.
- "Plane" uses the closest point on effectors local xy-plane
as the effector point.
- "Surface" uses the closest point on an effector object's
surface as the effector point.
- "Every Point" uses every point in a mesh effector object
as an effector point.
- The falloff is calculated from this point, so for example
with "surface" shape and "use only negative z axis" it's
possible to apply force only "inside" the effector object.
* Spherical effector is now renamed as "force" as it's no longer
just spherical.
* New effector parameter "flow", which makes the effector act as
surrounding air velocity, so the resulting force is
proportional to the velocity difference of the point and "air
velocity". For example a wind field with flow=1.0 results in
proper non-accelerating wind.
* New effector fields "turbulence", which creates nice random
flow paths, and "drag", which slows the points down.
* Much improved vortex field.
* Effectors can now effect particle rotation as well as location.
* Use full, or only positive/negative z-axis to apply force
(note. the z-axis is the surface normal in the case of
effector shape "surface")
* New "force field" submenu in add menu, which adds an empty
with the chosen effector (curve object for corve guides).
* Other dynamics should be quite easy to add to the effector
system too if wanted.
* "Unified" doesn't mean that force fields give the exact same results for
particles, softbody & cloth, since their final effect depends on many external
factors, like for example the surface area of the effected faces.
Code changes
* Subversion bump for correct handling of global gravity.
* Separate ui py file for common dynamics stuff.
* Particle settings updating is flushed with it's id through
DAG_id_flush_update(..).
Known issues
* Curve guides don't yet have all ui buttons in place, but they
should work none the less.
* Hair dynamics don't yet respect force fields.
Other changes
* Particle emission defaults now to frames 1-200 with life of 50
frames to fill the whole default timeline.
* Many particles drawing related crashes fixed.
* Sometimes particles didn't update on first frame properly.
* Hair with object/group visualization didn't work properly.
* Memory leaks with PointCacheID lists (Genscher, remember to
free pidlists after use :).
2009-09-30 22:10:14 +00:00
}
/* Normal wind shape is plane */
if ( ob - > pd ) {
if ( ob - > pd - > forcefield = = PFIELD_WIND )
ob - > pd - > shape = PFIELD_SHAPE_PLANE ;
if ( ob - > pd - > flag & PFIELD_PLANAR )
ob - > pd - > shape = PFIELD_SHAPE_PLANE ;
else if ( ob - > pd - > flag & PFIELD_SURFACE )
ob - > pd - > shape = PFIELD_SHAPE_SURFACE ;
}
}
2009-08-15 19:38:52 +00:00
}
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 6 ) ) {
2009-10-08 11:29:27 +00:00
Object * ob ;
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
Lamp * la ;
2009-10-08 11:29:27 +00:00
/* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialisation */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
/* new variables for all objects */
ob - > quat [ 0 ] = 1.0f ;
ob - > rotAxis [ 1 ] = 1.0f ;
/* bones */
if ( ob - > pose ) {
bPoseChannel * pchan ;
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
/* just need to initalise rotation axis properly... */
pchan - > rotAxis [ 1 ] = 1.0f ;
}
}
}
Deep Shadow Buffer
Since the deep shadow buffer summer of code project is not actively under
development anymore, I decided to build my own DSM implementation from
scratch, based on reusing as much existing shadow buffer code as possible.
It's not very advanced, but implements the basic algorithm. Just enough so
we can do shading tests with it, optimizations and other improvements can
be done later.
Supported:
* Classical shadow buffer options: filter, soft, bias, ..
* Multiple sample buffers, merged into one.
* Halfway trick to support lower bias.
* Compression with user defined threshold.
* Non-textured alpha transparency, using Casting Alpha value.
* Strand render.
Not Supported:
* Tiling disk cache, so can use a lot of memory.
* Per part rendering for lower memory usage during creation.
* Colored shadow.
* Textured color/alpha shadow.
* Mipmaps for faster filtering.
* Volume shadows.
Usage Hints:
* Use sample buffers + smaller size rather than large size.
* For example 512 size x 9 sample buffers instead of 2048 x 1.
* Compression threshold 0.05 works, but is on the conservative side.
2009-10-12 19:41:40 +00:00
for ( la = main - > lamp . first ; la ; la = la - > id . next )
la - > compressthresh = 0.05f ;
2009-10-01 17:15:23 +00:00
}
2009-10-22 09:31:07 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 7 ) ) {
Mesh * me ;
Nurb * nu ;
Lattice * lt ;
Curve * cu ;
Key * key ;
float * data ;
int a , tot ;
/* shape keys are no longer applied to the mesh itself, but rather
to the derivedmesh / displist , so here we ensure that the basis
shape key is always set in the mesh coordinates . */
for ( me = main - > mesh . first ; me ; me = me - > id . next ) {
if ( ( key = newlibadr ( fd , lib , me - > key ) ) & & key - > refkey ) {
data = key - > refkey - > data ;
tot = MIN2 ( me - > totvert , key - > refkey - > totelem ) ;
for ( a = 0 ; a < tot ; a + + , data + = 3 )
VECCOPY ( me - > mvert [ a ] . co , data )
}
}
for ( lt = main - > latt . first ; lt ; lt = lt - > id . next ) {
if ( ( key = newlibadr ( fd , lib , lt - > key ) ) & & key - > refkey ) {
data = key - > refkey - > data ;
tot = MIN2 ( lt - > pntsu * lt - > pntsv * lt - > pntsw , key - > refkey - > totelem ) ;
for ( a = 0 ; a < tot ; a + + , data + = 3 )
VECCOPY ( lt - > def [ a ] . vec , data )
}
}
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
if ( ( key = newlibadr ( fd , lib , cu - > key ) ) & & key - > refkey ) {
data = key - > refkey - > data ;
for ( nu = cu - > nurb . first ; nu ; nu = nu - > next ) {
if ( nu - > bezt ) {
BezTriple * bezt = nu - > bezt ;
for ( a = 0 ; a < nu - > pntsu ; a + + , bezt + + ) {
VECCOPY ( bezt - > vec [ 0 ] , data ) ; data + = 3 ;
VECCOPY ( bezt - > vec [ 1 ] , data ) ; data + = 3 ;
VECCOPY ( bezt - > vec [ 2 ] , data ) ; data + = 3 ;
bezt - > alfa = * data ; data + + ;
}
}
else if ( nu - > bp ) {
BPoint * bp = nu - > bp ;
for ( a = 0 ; a < nu - > pntsu * nu - > pntsv ; a + + , bp + + ) {
VECCOPY ( bp - > vec , data ) ; data + = 3 ;
bp - > alfa = * data ; data + + ;
}
}
}
}
}
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 8 ) )
2009-10-22 09:31:07 +00:00
{
2009-11-10 04:56:55 +00:00
{
Scene * sce = main - > scene . first ;
while ( sce ) {
if ( sce - > r . frame_step = = 0 )
sce - > r . frame_step = 1 ;
2010-02-06 20:25:17 +00:00
if ( sce - > r . mblur_samples = = 0 )
sce - > r . mblur_samples = sce - > r . osa ;
2009-11-19 03:21:37 +00:00
2010-05-01 12:39:06 +00:00
if ( sce - > ed & & sce - > ed - > seqbase . first ) {
do_versions_seq_unique_name_all_strips (
sce , & sce - > ed - > seqbase ) ;
2009-11-19 03:21:37 +00:00
}
2010-05-01 12:39:06 +00:00
2009-11-10 04:56:55 +00:00
sce = sce - > id . next ;
}
}
2009-11-11 09:11:21 +00:00
{
/* ensure all nodes have unique names */
bNodeTree * ntree = main - > nodetree . first ;
while ( ntree ) {
bNode * node = ntree - > nodes . first ;
while ( node ) {
nodeUniqueName ( ntree , node ) ;
node = node - > next ;
}
ntree = ntree - > id . next ;
}
}
2009-11-26 06:25:25 +00:00
{
Object * ob = main - > object . first ;
while ( ob ) {
/* shaded mode disabled for now */
if ( ob - > dt = = OB_SHADED ) ob - > dt = OB_TEXTURE ;
ob = ob - > id . next ;
}
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
2009-12-02 23:14:58 +00:00
{
bScreen * screen ;
ScrArea * sa ;
SpaceLink * sl ;
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_VIEW3D ) {
View3D * v3d = ( View3D * ) sl ;
if ( v3d - > drawtype = = OB_SHADED ) v3d - > drawtype = OB_SOLID ;
}
}
}
}
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
/* only convert old 2.50 files with color management */
if ( main - > versionfile = = 250 ) {
Scene * sce = main - > scene . first ;
Material * ma = main - > mat . first ;
World * wo = main - > world . first ;
2010-01-19 02:47:44 +00:00
Tex * tex = main - > tex . first ;
int i , convert = 0 ;
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
/* convert to new color management system:
while previously colors were stored as srgb ,
now they are stored as linear internally ,
with screen gamma correction in certain places in the UI . */
/* don't know what scene is active, so we'll convert if any scene has it enabled... */
while ( sce ) {
if ( sce - > r . color_mgt_flag & R_COLOR_MANAGEMENT )
convert = 1 ;
sce = sce - > id . next ;
}
if ( convert ) {
while ( ma ) {
2010-01-19 02:47:44 +00:00
if ( ma - > ramp_col ) {
ColorBand * band = ( ColorBand * ) ma - > ramp_col ;
for ( i = 0 ; i < band - > tot ; i + + ) {
CBData * data = band - > data + i ;
srgb_to_linearrgb_v3_v3 ( & data - > r , & data - > r ) ;
}
}
if ( ma - > ramp_spec ) {
ColorBand * band = ( ColorBand * ) ma - > ramp_spec ;
for ( i = 0 ; i < band - > tot ; i + + ) {
CBData * data = band - > data + i ;
srgb_to_linearrgb_v3_v3 ( & data - > r , & data - > r ) ;
}
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
srgb_to_linearrgb_v3_v3 ( & ma - > r , & ma - > r ) ;
srgb_to_linearrgb_v3_v3 ( & ma - > specr , & ma - > specr ) ;
srgb_to_linearrgb_v3_v3 ( & ma - > mirr , & ma - > mirr ) ;
srgb_to_linearrgb_v3_v3 ( ma - > sss_col , ma - > sss_col ) ;
ma = ma - > id . next ;
}
2010-01-19 02:47:44 +00:00
while ( tex ) {
if ( tex - > coba ) {
ColorBand * band = ( ColorBand * ) tex - > coba ;
for ( i = 0 ; i < band - > tot ; i + + ) {
CBData * data = band - > data + i ;
srgb_to_linearrgb_v3_v3 ( & data - > r , & data - > r ) ;
}
}
tex = tex - > id . next ;
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
while ( wo ) {
srgb_to_linearrgb_v3_v3 ( & wo - > ambr , & wo - > ambr ) ;
srgb_to_linearrgb_v3_v3 ( & wo - > horr , & wo - > horr ) ;
srgb_to_linearrgb_v3_v3 ( & wo - > zenr , & wo - > zenr ) ;
wo = wo - > id . next ;
}
}
}
2009-10-22 09:31:07 +00:00
}
Changes to Color Management
After testing and feedback, I've decided to slightly modify the way color
management works internally. While the previous method worked well for
rendering, was a smaller transition and had some advantages over this
new method, it was a bit more ambiguous, and was making things difficult
for other areas such as compositing.
This implementation now considers all color data (with only a couple of
exceptions such as brush colors) to be stored in linear RGB color space,
rather than sRGB as previously. This brings it in line with Nuke, which also
operates this way, quite successfully. Color swatches, pickers, color ramp
display are now gamma corrected to display gamma so you can see what
you're doing, but the numbers themselves are considered linear. This
makes understanding blending modes more clear (a 0.5 value on overlay
will not change the result now) as well as making color swatches act more
predictably in the compositor, however bringing over color values from
applications like photoshop or gimp, that operate in a gamma space,
will give identical results.
This commit will convert over existing files saved by earlier 2.5 versions to
work generally the same, though there may be some slight differences with
things like textures. Now that we're set on changing other areas of shading,
this won't be too disruptive overall.
I've made a diagram explaining the pipeline here:
http://mke3.net/blender/devel/2.5/25_linear_workflow_pipeline.png
and some docs here:
http://www.blender.org/development/release-logs/blender-250/color-management/
2009-12-02 07:56:34 +00:00
2009-12-10 17:37:04 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 9 ) )
2009-12-07 17:55:58 +00:00
{
2009-12-10 17:37:04 +00:00
Scene * sce ;
Mesh * me ;
Object * ob ;
2009-12-07 17:55:58 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next )
if ( ! sce - > toolsettings - > particle . selectmode )
sce - > toolsettings - > particle . selectmode = SCE_SELECT_PATH ;
2009-12-10 17:37:04 +00:00
2009-12-11 10:56:20 +00:00
if ( main - > versionfile = = 250 & & main - > subversionfile > 1 ) {
for ( me = main - > mesh . first ; me ; me = me - > id . next )
multires_load_old_250 ( me ) ;
2009-12-10 17:37:04 +00:00
2009-12-11 10:56:20 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
MultiresModifierData * mmd = ( MultiresModifierData * ) modifiers_findByType ( ob , eModifierType_Multires ) ;
2009-12-10 17:37:04 +00:00
2009-12-11 10:56:20 +00:00
if ( mmd ) {
mmd - > totlvl - - ;
mmd - > lvl - - ;
mmd - > sculptlvl = mmd - > lvl ;
mmd - > renderlvl = mmd - > lvl ;
}
2009-12-10 17:37:04 +00:00
}
}
}
2009-12-14 22:59:41 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 10 ) )
2009-12-10 17:37:04 +00:00
{
2009-12-19 22:40:45 +00:00
Object * ob ;
/* properly initialise hair clothsim data on old files */
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_Cloth ) {
ClothModifierData * clmd = ( ClothModifierData * ) md ;
if ( clmd - > sim_parms - > velocity_smooth < 0.01f )
clmd - > sim_parms - > velocity_smooth = 0.f ;
}
}
}
}
/* fix bad area setup in subversion 10 */
if ( main - > versionfile = = 250 & & main - > subversionfile = = 10 )
{
/* fix for new view type in sequencer */
bScreen * screen ;
ScrArea * sa ;
SpaceLink * sl ;
/* remove all preview window in wrong spaces */
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype ! = SPACE_SEQ ) {
ARegion * ar ;
2009-12-20 15:23:29 +00:00
ListBase * regionbase ;
2009-12-19 22:40:45 +00:00
2009-12-20 15:23:29 +00:00
if ( sl = = sa - > spacedata . first ) {
regionbase = & sa - > regionbase ;
} else {
regionbase = & sl - > regionbase ;
}
for ( ar = regionbase - > first ; ar ; ar = ar - > next ) {
2009-12-19 22:40:45 +00:00
if ( ar - > regiontype = = RGN_TYPE_PREVIEW )
break ;
}
2010-02-07 19:07:56 +00:00
if ( ar & & ( ar - > regiontype = = RGN_TYPE_PREVIEW ) ) {
2009-12-19 22:40:45 +00:00
SpaceType * st = BKE_spacetype_from_id ( SPACE_SEQ ) ;
BKE_area_region_free ( st , ar ) ;
2009-12-20 15:23:29 +00:00
BLI_freelinkN ( regionbase , ar ) ;
2009-12-19 22:40:45 +00:00
}
}
}
2009-12-11 00:09:58 +00:00
}
}
2009-12-19 22:40:45 +00:00
}
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 11 ) )
{
2009-12-14 22:59:41 +00:00
{
/* fix for new view type in sequencer */
bScreen * screen ;
ScrArea * sa ;
SpaceLink * sl ;
2009-12-19 22:40:45 +00:00
2009-12-14 22:59:41 +00:00
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_SEQ ) {
ARegion * ar ;
ARegion * ar_main ;
2009-12-20 15:23:29 +00:00
ListBase * regionbase ;
2009-12-14 22:59:41 +00:00
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
2009-12-20 15:23:29 +00:00
if ( sl = = sa - > spacedata . first ) {
regionbase = & sa - > regionbase ;
} else {
regionbase = & sl - > regionbase ;
}
2009-12-14 22:59:41 +00:00
if ( sseq - > view = = 0 ) sseq - > view = SEQ_VIEW_SEQUENCE ;
if ( sseq - > mainb = = 0 ) sseq - > mainb = SEQ_DRAW_IMG_IMBUF ;
2009-12-19 22:40:45 +00:00
2009-12-20 15:23:29 +00:00
ar_main = ( ARegion * ) regionbase - > first ;
2009-12-14 22:59:41 +00:00
for ( ; ar_main ; ar_main = ar_main - > next ) {
if ( ar_main - > regiontype = = RGN_TYPE_WINDOW )
break ;
}
ar = MEM_callocN ( sizeof ( ARegion ) , " preview area for sequencer " ) ;
2009-12-20 15:23:29 +00:00
BLI_insertlinkbefore ( regionbase , ar_main , ar ) ;
2010-02-07 19:07:56 +00:00
sequencer_init_preview_region ( ar ) ;
2009-12-14 22:59:41 +00:00
}
2009-12-14 21:42:25 +00:00
}
}
}
}
}
2009-10-22 09:31:07 +00:00
2010-01-22 04:21:46 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 12 ) )
{
2009-12-29 15:47:20 +00:00
Scene * sce ;
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
Object * ob ;
2010-01-03 08:37:18 +00:00
Brush * brush ;
2010-01-03 23:45:13 +00:00
Material * ma ;
2009-12-29 15:47:20 +00:00
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
/* game engine changes */
2009-12-29 15:47:20 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2010-10-19 22:17:34 +00:00
sce - > gm . eyeseparation = 0.10f ;
2009-12-29 15:47:20 +00:00
}
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
/* anim viz changes */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
/* initialise object defaults */
animviz_settings_init ( & ob - > avs ) ;
2010-01-07 22:54:05 +00:00
/* if armature, copy settings for pose from armature data
* performing initialisation where appropriate
*/
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
if ( ob - > pose & & ob - > data ) {
2010-01-01 14:04:39 +00:00
bArmature * arm = newlibadr ( fd , lib , ob - > data ) ;
2010-01-04 14:22:22 +00:00
if ( arm ) { /* XXX - why does this fail in some cases? */
bAnimVizSettings * avs = & ob - > pose - > avs ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* ghosting settings ---------------- */
/* ranges */
avs - > ghost_bc = avs - > ghost_ac = arm - > ghostep ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
avs - > ghost_sf = arm - > ghostsf ;
avs - > ghost_ef = arm - > ghostef ;
2010-01-19 11:31:49 +00:00
if ( ( avs - > ghost_sf = = avs - > ghost_ef ) & & ( avs - > ghost_sf = = 0 ) ) {
avs - > ghost_sf = 1 ;
avs - > ghost_ef = 100 ;
}
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* type */
2010-01-19 11:31:49 +00:00
if ( arm - > ghostep = = 0 )
avs - > ghost_type = GHOST_TYPE_NONE ;
else
avs - > ghost_type = arm - > ghosttype + 1 ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* stepsize */
avs - > ghost_step = arm - > ghostsize ;
2010-01-07 22:54:05 +00:00
if ( avs - > ghost_step = = 0 )
avs - > ghost_step = 1 ;
2010-01-04 14:22:22 +00:00
/* path settings --------------------- */
/* ranges */
avs - > path_bc = arm - > pathbc ;
avs - > path_ac = arm - > pathac ;
2010-01-19 11:31:49 +00:00
if ( ( avs - > path_bc = = avs - > path_ac ) & & ( avs - > path_bc = = 0 ) )
avs - > path_bc = avs - > path_ac = 10 ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
avs - > path_sf = arm - > pathsf ;
avs - > path_ef = arm - > pathef ;
2010-01-19 11:31:49 +00:00
if ( ( avs - > path_sf = = avs - > path_ef ) & & ( avs - > path_sf = = 0 ) ) {
avs - > path_sf = 1 ;
avs - > path_ef = 250 ;
}
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* flags */
if ( arm - > pathflag & ARM_PATH_FNUMS )
avs - > path_viewflag | = MOTIONPATH_VIEW_FNUMS ;
if ( arm - > pathflag & ARM_PATH_KFRAS )
avs - > path_viewflag | = MOTIONPATH_VIEW_KFRAS ;
if ( arm - > pathflag & ARM_PATH_KFNOS )
avs - > path_viewflag | = MOTIONPATH_VIEW_KFNOS ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* bake flags */
if ( arm - > pathflag & ARM_PATH_HEADS )
avs - > path_bakeflag | = MOTIONPATH_BAKE_HEADS ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* type */
if ( arm - > pathflag & ARM_PATH_ACFRA )
avs - > path_type = MOTIONPATH_TYPE_ACFRA ;
2010-01-07 22:54:05 +00:00
2010-01-04 14:22:22 +00:00
/* stepsize */
avs - > path_step = arm - > pathsize ;
2010-01-07 22:54:05 +00:00
if ( avs - > path_step = = 0 )
avs - > path_step = 1 ;
2010-01-04 14:22:22 +00:00
}
2010-01-19 11:31:49 +00:00
else
animviz_settings_init ( & ob - > pose - > avs ) ;
Cleanup of MotionPaths+Ghosts (AnimViz) - Part 1
This commit sets up some of the groundwork necessary to extend the animation visualisation capabilities, previously only available for bones in PoseMode, to Objects as well. Also, some of the other goals of this refactor is to make future visualisation goodies (i.e. editable paths) more feasible...
(There's really nothing to see here yet. The following log notes are really just for my own reference to keep track of things.)
Currently, the following things have been done:
* New datastructures + settings have been tidied up, ready for usage
* Added these new types into the Object and PoseBone code as necessary, with freeing/adding/copying accounted for
* File IO code for the new data, including version patching to convert the old system to the new one.
* Set up the drawing system for motionpaths based on the old armature path drawing code. Armatures still draw using the old system, since the two systems use different storage systems.
* Started setting up the motionpath 'baking' code, but the core of this still needs to be coded...
Next Steps (after some semi-urgent Durian Driver changes):
* Port the ghosting/onionskinning code over too
* Finish motionpath baking code
* RNA wrapping for the new types
* Hooking up all the new code into the operators, etc.
2010-01-01 12:24:16 +00:00
}
}
2010-01-03 08:37:18 +00:00
/* brush texture changes */
for ( brush = main - > brush . first ; brush ; brush = brush - > id . next ) {
default_mtex ( & brush - > mtex ) ;
}
2010-01-03 23:45:13 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
if ( ma - > vol . ms_spread < 0.0001f ) {
ma - > vol . ms_spread = 0.2f ;
ma - > vol . ms_diff = 1.f ;
ma - > vol . ms_intensity = 1.f ;
}
}
2009-12-29 15:47:20 +00:00
}
2010-01-22 04:21:46 +00:00
2010-01-25 17:51:21 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 13 ) ) {
2010-01-25 18:38:09 +00:00
/* NOTE: if you do more conversion, be sure to do it outside of this and
2010-01-25 17:51:21 +00:00
increase subversion again , otherwise it will not be correct */
Object * ob ;
/* convert degrees to radians for internal use */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2010-01-25 18:38:09 +00:00
bPoseChannel * pchan ;
2010-01-25 06:24:05 +00:00
2010-01-25 18:38:09 +00:00
do_version_constraints_radians_degrees_250 ( & ob - > constraints ) ;
2010-01-25 17:51:21 +00:00
2010-01-25 18:38:09 +00:00
if ( ob - > pose ) {
for ( pchan = ob - > pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
2010-10-19 22:17:34 +00:00
pchan - > limitmin [ 0 ] * = ( float ) ( M_PI / 180.0 ) ;
pchan - > limitmin [ 1 ] * = ( float ) ( M_PI / 180.0 ) ;
pchan - > limitmin [ 2 ] * = ( float ) ( M_PI / 180.0 ) ;
pchan - > limitmax [ 0 ] * = ( float ) ( M_PI / 180.0 ) ;
pchan - > limitmax [ 1 ] * = ( float ) ( M_PI / 180.0 ) ;
pchan - > limitmax [ 2 ] * = ( float ) ( M_PI / 180.0 ) ;
2010-01-25 18:38:09 +00:00
do_version_constraints_radians_degrees_250 ( & pchan - > constraints ) ;
2010-01-25 06:24:05 +00:00
}
}
}
2010-01-26 03:16:14 +00:00
}
2010-01-27 11:58:04 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 14 ) ) {
2010-01-27 11:43:34 +00:00
/* fix for bad View2D extents for Animation Editors */
bScreen * screen ;
ScrArea * sa ;
SpaceLink * sl ;
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
ListBase * regionbase ;
ARegion * ar ;
if ( sl = = sa - > spacedata . first )
regionbase = & sa - > regionbase ;
else
regionbase = & sl - > regionbase ;
if ( ELEM ( sl - > spacetype , SPACE_ACTION , SPACE_NLA ) ) {
for ( ar = ( ARegion * ) regionbase - > first ; ar ; ar = ar - > next ) {
if ( ar - > regiontype = = RGN_TYPE_WINDOW ) {
ar - > v2d . cur . ymax = ar - > v2d . tot . ymax = 0.0f ;
ar - > v2d . cur . ymin = ar - > v2d . tot . ymin = ( float ) ( - sa - > winy ) / 3.0f ;
}
}
}
}
}
}
2010-01-22 04:21:46 +00:00
}
2010-01-27 11:58:04 +00:00
2010-01-27 21:40:08 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 15 ) ) {
World * wo ;
Material * ma ;
/* ambient default from 0.5f to 1.0f */
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next )
ma - > amb * = 2.0f ;
for ( wo = main - > world . first ; wo ; wo = wo - > id . next ) {
/* ao splitting into ao/env/indirect */
wo - > ao_env_energy = wo - > aoenergy ;
wo - > aoenergy = 1.0f ;
if ( wo - > ao_indirect_bounces = = 0 )
wo - > ao_indirect_bounces = 1 ;
else
wo - > mode | = WO_INDIRECT_LIGHT ;
if ( wo - > aomix = = WO_AOSUB )
wo - > ao_env_energy = - wo - > ao_env_energy ;
else if ( wo - > aomix = = WO_AOADDSUB )
wo - > mode | = WO_AMB_OCC ;
wo - > aomix = WO_AOMUL ;
/* ambient default from 0.5f to 1.0f */
mul_v3_fl ( & wo - > ambr , 0.5f ) ;
wo - > ao_env_energy * = 0.5f ;
}
}
2010-01-27 11:58:04 +00:00
2010-02-11 15:43:31 +00:00
if ( main - > versionfile < 250 | | ( main - > versionfile = = 250 & & main - > subversionfile < 17 ) ) {
2010-02-02 17:28:53 +00:00
Scene * sce ;
2010-02-07 23:41:17 +00:00
Sequence * seq ;
2010-02-11 15:43:31 +00:00
Material * ma ;
2010-02-02 17:28:53 +00:00
/* initialize to sane default so toggling on border shows something */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > r . border . xmin = = 0.0f & & sce - > r . border . ymin = = 0.0f & &
sce - > r . border . xmax = = 0.0f & & sce - > r . border . ymax = = 0.0f ) {
sce - > r . border . xmin = 0.0f ;
sce - > r . border . ymin = 0.0f ;
sce - > r . border . xmax = 1.0f ;
sce - > r . border . ymax = 1.0f ;
}
2010-02-07 23:41:17 +00:00
if ( ( sce - > r . ffcodecdata . flags & FFMPEG_MULTIPLEX_AUDIO ) = = 0 )
sce - > r . ffcodecdata . audio_codec = 0x0 ; // CODEC_ID_NONE
SEQ_BEGIN ( sce - > ed , seq ) {
seq - > volume = 1.0f ;
}
SEQ_END
2010-02-02 17:28:53 +00:00
}
2010-02-07 19:07:56 +00:00
2010-09-14 09:32:43 +00:00
/* particle brush strength factor was changed from int to float */
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
ParticleEditSettings * pset = & sce - > toolsettings - > particle ;
int a ;
for ( a = 0 ; a < PE_TOT_BRUSH ; a + + )
2010-10-19 22:17:34 +00:00
pset - > brush [ a ] . strength / = 100.0f ;
2010-09-14 09:32:43 +00:00
}
2010-02-11 15:43:31 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next )
if ( ma - > mode & MA_TRACEBLE )
ma - > shade_flag | = MA_APPROX_OCCLUSION ;
2010-02-07 19:07:56 +00:00
/* sequencer changes */
{
bScreen * screen ;
ScrArea * sa ;
SpaceLink * sl ;
for ( screen = main - > screen . first ; screen ; screen = screen - > id . next ) {
for ( sa = screen - > areabase . first ; sa ; sa = sa - > next ) {
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
if ( sl - > spacetype = = SPACE_SEQ ) {
ARegion * ar_preview ;
ListBase * regionbase ;
if ( sl = = sa - > spacedata . first ) {
regionbase = & sa - > regionbase ;
} else {
regionbase = & sl - > regionbase ;
}
ar_preview = ( ARegion * ) regionbase - > first ;
for ( ; ar_preview ; ar_preview = ar_preview - > next ) {
if ( ar_preview - > regiontype = = RGN_TYPE_PREVIEW )
break ;
}
if ( ar_preview & & ( ar_preview - > regiontype = = RGN_TYPE_PREVIEW ) ) {
sequencer_init_preview_region ( ar_preview ) ;
}
}
}
}
}
} /* sequencer changes */
2010-02-02 17:28:53 +00:00
}
2010-05-06 03:15:14 +00:00
if ( main - > versionfile < = 251 ) { /* 2.5.1 had no subversions */
bScreen * sc ;
/* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
* This bit was used in the past for V3D_TRANSFORM_SNAP , which is now deprecated .
* Here we clear it for old files so they don ' t come in with V3D_RENDER_OVERRIDE set ,
* which would cause cameras , lamps , etc to become invisible */
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 - > flag2 & = ~ V3D_RENDER_OVERRIDE ;
}
}
}
}
}
2009-12-14 22:59:41 +00:00
2010-03-25 00:10:41 +00:00
if ( main - > versionfile < 252 | | ( main - > versionfile = = 252 & & main - > subversionfile < 1 ) ) {
2010-03-09 07:41:27 +00:00
Brush * brush ;
2010-03-25 00:10:41 +00:00
Object * ob ;
Scene * scene ;
bNodeTree * ntree ;
2010-03-09 07:41:27 +00:00
for ( brush = main - > brush . first ; brush ; brush = brush - > id . next ) {
if ( brush - > curve ) brush - > curve - > preset = CURVE_PRESET_SMOOTH ;
}
2010-03-25 00:10:41 +00:00
/* properly initialise active flag for fluidsim modifiers */
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_Fluidsim ) {
FluidsimModifierData * fmd = ( FluidsimModifierData * ) md ;
2010-03-25 06:27:25 +00:00
fmd - > fss - > flag | = OB_FLUIDSIM_ACTIVE ;
fmd - > fss - > flag | = OB_FLUIDSIM_OVERRIDE_TIME ;
2010-03-25 00:10:41 +00:00
}
}
}
/* adjustment to color balance node values */
for ( scene = main - > scene . first ; scene ; scene = scene - > id . next ) {
if ( scene - > nodetree ) {
bNode * node = scene - > nodetree - > nodes . first ;
while ( node ) {
if ( node - > type = = CMP_NODE_COLORBALANCE ) {
NodeColorBalance * n = ( NodeColorBalance * ) node - > storage ;
n - > lift [ 0 ] + = 1.f ;
n - > lift [ 1 ] + = 1.f ;
n - > lift [ 2 ] + = 1.f ;
}
node = node - > next ;
}
}
}
/* check inside node groups too */
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
bNode * node = ntree - > nodes . first ;
while ( node ) {
if ( node - > type = = CMP_NODE_COLORBALANCE ) {
NodeColorBalance * n = ( NodeColorBalance * ) node - > storage ;
n - > lift [ 0 ] + = 1.f ;
n - > lift [ 1 ] + = 1.f ;
n - > lift [ 2 ] + = 1.f ;
}
node = node - > next ;
}
}
}
2010-03-26 02:57:49 +00:00
/* old-track -> constraints (this time we're really doing it!) */
if ( main - > versionfile < 252 | | ( main - > versionfile = = 252 & & main - > subversionfile < 2 ) ) {
Object * ob ;
for ( ob = main - > object . first ; ob ; ob = ob - > id . next )
do_version_old_trackto_to_constraints ( ob ) ;
}
2010-04-09 00:44:35 +00:00
if ( main - > versionfile < 252 | | ( main - > versionfile = = 252 & & main - > subversionfile < 5 ) ) {
2010-04-06 02:05:54 +00:00
bScreen * sc ;
2010-03-25 00:10:41 +00:00
2010-04-06 02:05:54 +00:00
/* Image editor scopes */
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_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
2010-05-10 01:46:44 +00:00
scopes_new ( & sima - > scopes ) ;
2010-04-06 02:05:54 +00:00
}
}
}
}
2010-02-11 15:43:31 +00:00
}
2010-04-09 00:44:35 +00:00
2010-05-25 08:42:11 +00:00
2010-07-21 09:25:00 +00:00
if ( main - > versionfile < 253 )
2010-04-09 00:44:35 +00:00
{
2010-05-25 08:42:11 +00:00
Object * ob ;
2010-06-04 01:39:34 +00:00
Scene * scene ;
2010-05-12 18:51:36 +00:00
bScreen * sc ;
2010-07-05 10:18:59 +00:00
Tex * tex ;
2010-07-21 09:25:00 +00:00
Brush * brush ;
2010-05-12 18:51:36 +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_NODE ) {
Timeline addition: Display cached frames
This started off doing pointcache debugging but it's also very useful for users too.
Previously it was very hard to see the state of the system when you're working caches
such as physics point cache - is it baked? which frames are cached? is it out of date?
Now, for better feedback, cached frames are drawn for the active object at the bottom
of the timeline - a semitransparent area shows the entire cache extents, and more
solid blocks on top show the frames that are cached. Darker versions indicate it's
using a disk cache.
It can be disabled in general in the timeline View -> Caches menu, or by each individual
system that can be shown.
There's still a bit to do on this, behaviour needs to be clarified still eg. deciding what
shows when it's out of date, or when it's been played back but not cached, etc. etc.
Part of this is due to a lack of definition in the point cache system itself, so we should
try and clean up/clarify this behaviour and what it means to users, at the same time.
Also would be interested in extending this to other caches such as fluid cache,
sequencer memory cache etc. in the future, too.
2010-06-22 02:29:52 +00:00
SpaceNode * snode = ( SpaceNode * ) sl ;
2010-07-01 19:29:27 +00:00
ListBase * regionbase ;
ARegion * ar ;
if ( sl = = sa - > spacedata . first )
regionbase = & sa - > regionbase ;
else
regionbase = & sl - > regionbase ;
2010-05-12 18:51:36 +00:00
if ( snode - > v2d . minzoom > 0.09f )
snode - > v2d . minzoom = 0.09f ;
if ( snode - > v2d . maxzoom < 2.31f )
snode - > v2d . maxzoom = 2.31f ;
2010-07-01 19:29:27 +00:00
for ( ar = regionbase - > first ; ar ; ar = ar - > next ) {
if ( ar - > regiontype = = RGN_TYPE_WINDOW ) {
if ( ar - > v2d . minzoom > 0.09f )
ar - > v2d . minzoom = 0.09f ;
if ( ar - > v2d . maxzoom < 2.31f )
ar - > v2d . maxzoom = 2.31f ;
}
}
2010-05-12 18:51:36 +00:00
}
Timeline addition: Display cached frames
This started off doing pointcache debugging but it's also very useful for users too.
Previously it was very hard to see the state of the system when you're working caches
such as physics point cache - is it baked? which frames are cached? is it out of date?
Now, for better feedback, cached frames are drawn for the active object at the bottom
of the timeline - a semitransparent area shows the entire cache extents, and more
solid blocks on top show the frames that are cached. Darker versions indicate it's
using a disk cache.
It can be disabled in general in the timeline View -> Caches menu, or by each individual
system that can be shown.
There's still a bit to do on this, behaviour needs to be clarified still eg. deciding what
shows when it's out of date, or when it's been played back but not cached, etc. etc.
Part of this is due to a lack of definition in the point cache system itself, so we should
try and clean up/clarify this behaviour and what it means to users, at the same time.
Also would be interested in extending this to other caches such as fluid cache,
sequencer memory cache etc. in the future, too.
2010-06-22 02:29:52 +00:00
else if ( sl - > spacetype = = SPACE_TIME ) {
SpaceTime * stime = ( SpaceTime * ) sl ;
/* enable all cache display */
stime - > cache_display | = TIME_CACHE_DISPLAY ;
stime - > cache_display | = ( TIME_CACHE_SOFTBODY | TIME_CACHE_PARTICLES ) ;
stime - > cache_display | = ( TIME_CACHE_CLOTH | TIME_CACHE_SMOKE ) ;
}
2010-05-12 18:51:36 +00:00
}
}
}
2010-10-16 02:40:31 +00:00
do_version_mdef_250 ( main ) ;
2010-05-25 08:42:11 +00:00
/* parent type to modifier */
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > parent ) {
2010-05-25 15:26:12 +00:00
Object * parent = ( Object * ) newlibadr ( fd , lib , ob - > parent ) ;
2010-05-25 18:31:36 +00:00
if ( parent ) { /* parent may not be in group */
if ( parent - > type = = OB_ARMATURE & & ob - > partype = = PARSKEL ) {
ArmatureModifierData * amd ;
bArmature * arm = ( bArmature * ) newlibadr ( fd , lib , parent - > data ) ;
amd = ( ArmatureModifierData * ) modifier_new ( eModifierType_Armature ) ;
amd - > object = ob - > parent ;
BLI_addtail ( ( ListBase * ) & ob - > modifiers , amd ) ;
amd - > deformflag = arm - > deformflag ;
ob - > partype = PAROBJECT ;
}
else if ( parent - > type = = OB_LATTICE & & ob - > partype = = PARSKEL ) {
LatticeModifierData * lmd ;
lmd = ( LatticeModifierData * ) modifier_new ( eModifierType_Lattice ) ;
lmd - > object = ob - > parent ;
BLI_addtail ( ( ListBase * ) & ob - > modifiers , lmd ) ;
ob - > partype = PAROBJECT ;
}
else if ( parent - > type = = OB_CURVE & & ob - > partype = = PARCURVE ) {
CurveModifierData * cmd ;
cmd = ( CurveModifierData * ) modifier_new ( eModifierType_Curve ) ;
cmd - > object = ob - > parent ;
BLI_addtail ( ( ListBase * ) & ob - > modifiers , cmd ) ;
ob - > partype = PAROBJECT ;
}
2010-05-25 08:42:11 +00:00
}
}
}
2010-06-04 01:39:34 +00:00
/* initialise scene active layer */
for ( scene = main - > scene . first ; scene ; scene = scene - > id . next ) {
int i ;
for ( i = 0 ; i < 20 ; i + + ) {
if ( scene - > lay & ( 1 < < i ) ) {
scene - > layact = 1 < < i ;
break ;
}
}
}
2010-07-05 10:18:59 +00:00
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
/* if youre picky, this isn't correct until we do a version bump
* since you could set saturation to be 0.0 */
if ( tex - > saturation = = 0.0f )
tex - > saturation = 1.0f ;
}
2010-07-13 22:21:59 +00:00
{
Curve * cu ;
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
cu - > smallcaps_scale = 0.75f ;
}
}
2010-07-13 09:28:01 +00:00
for ( scene = main - > scene . first ; scene ; scene = scene - > id . next ) {
if ( scene ) {
Sequence * seq ;
SEQ_BEGIN ( scene - > ed , seq ) {
2010-07-18 15:19:50 +00:00
if ( seq - > sat = = 0.0f ) {
seq - > sat = 1.0f ;
}
2010-07-13 09:28:01 +00:00
}
SEQ_END
}
}
2010-02-11 15:43:31 +00:00
2010-07-14 14:11:03 +00:00
/* GSOC 2010 Sculpt - New settings for Brush */
for ( brush = main - > brush . first ; brush ; brush = brush - > id . next ) {
/* Sanity Check */
// infinite number of dabs
if ( brush - > spacing = = 0 )
brush - > spacing = 10 ;
// will have no effect
if ( brush - > alpha = = 0 )
brush - > alpha = 0.5f ;
// bad radius
if ( brush - > unprojected_radius = = 0 )
2010-10-19 22:17:34 +00:00
brush - > unprojected_radius = 0.125f ;
2010-07-14 14:11:03 +00:00
// unusable size
if ( brush - > size = = 0 )
brush - > size = 35 ;
// can't see overlay
if ( brush - > texture_overlay_alpha = = 0 )
brush - > texture_overlay_alpha = 33 ;
// same as draw brush
if ( brush - > crease_pinch_factor = = 0 )
brush - > crease_pinch_factor = 0.5f ;
// will sculpt no vertexes
if ( brush - > plane_trim = = 0 )
brush - > plane_trim = 0.5f ;
// same as smooth stroke off
if ( brush - > smooth_stroke_radius = = 0 )
brush - > smooth_stroke_radius = 75 ;
// will keep cursor in one spot
if ( brush - > smooth_stroke_radius = = 1 )
brush - > smooth_stroke_factor = 0.9f ;
// same as dots
if ( brush - > rate = = 0 )
brush - > rate = 0.1f ;
/* New Settings */
2010-07-14 20:16:04 +00:00
if ( main - > versionfile < 252 | | ( main - > versionfile = = 252 & & main - > subversionfile < 5 ) ) {
2010-07-14 14:11:03 +00:00
brush - > flag | = BRUSH_SPACE_ATTEN ; // explicitly enable adaptive space
// spacing was originally in pixels, convert it to percentage for new version
// size should not be zero due to sanity check above
brush - > spacing = ( int ) ( 100 * ( ( float ) brush - > spacing ) / ( ( float ) brush - > size ) ) ;
if ( brush - > add_col [ 0 ] = = 0 & &
brush - > add_col [ 1 ] = = 0 & &
brush - > add_col [ 2 ] = = 0 )
{
2010-10-19 22:17:34 +00:00
brush - > add_col [ 0 ] = 1.00f ;
brush - > add_col [ 1 ] = 0.39f ;
brush - > add_col [ 2 ] = 0.39f ;
2010-07-14 14:11:03 +00:00
}
if ( brush - > sub_col [ 0 ] = = 0 & &
brush - > sub_col [ 1 ] = = 0 & &
brush - > sub_col [ 2 ] = = 0 )
{
2010-10-19 22:17:34 +00:00
brush - > sub_col [ 0 ] = 0.39f ;
brush - > sub_col [ 1 ] = 0.39f ;
brush - > sub_col [ 2 ] = 1.00f ;
2010-07-14 14:11:03 +00:00
}
}
}
}
2010-07-22 18:56:46 +00:00
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
if ( main - > versionfile < 253 ) {
Scene * sce ;
2010-07-22 23:06:09 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2010-07-22 18:56:46 +00:00
if ( sce - > toolsettings - > sculpt_paint_unified_alpha = = 0 )
sce - > toolsettings - > sculpt_paint_unified_alpha = 0.5f ;
if ( sce - > toolsettings - > sculpt_paint_unified_unprojected_radius = = 0 )
sce - > toolsettings - > sculpt_paint_unified_unprojected_radius = 0.125f ;
if ( sce - > toolsettings - > sculpt_paint_unified_size = = 0 )
sce - > toolsettings - > sculpt_paint_unified_size = 35 ;
}
}
Smoke Patch + additions: a) Applying patch #22765 by Miika Hämäläinen (domain border collision settings, vorticity settings, time scale, non absolute density, smooth high res emitter, initial velocity multiplier, high res strength available to be set to 0), b) Additions by me: --Initial velocity is now per flow object, not per domain; --Using boundingbox as standard display mode for domains (was wire before); --When adding a flow object, an initial nice SmokeParticle system is added too with nice initial settings (life=1, no_render, unborn, etc) fitting smoke simulation; --Adaptive timesteps introduced to the smoke sim (depending on the magnitude of the velocity) because it was quite unstable when used for fire simulations, still needs to be tested and will also slow down some simulations.
2010-07-27 14:53:20 +00:00
if ( main - > versionfile < 253 | | ( main - > versionfile = = 253 & & main - > subversionfile < 1 ) )
{
Object * ob ;
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_Smoke ) {
SmokeModifierData * smd = ( SmokeModifierData * ) md ;
if ( ( smd - > type & MOD_SMOKE_TYPE_DOMAIN ) & & smd - > domain )
{
smd - > domain - > vorticity = 2.0f ;
smd - > domain - > time_scale = 1.0f ;
if ( ! ( smd - > domain - > flags & ( 1 < < 4 ) ) )
continue ;
/* delete old MOD_SMOKE_INITVELOCITY flag */
smd - > domain - > flags & = ~ ( 1 < < 4 ) ;
/* for now just add it to all flow objects in the scene */
{
Object * ob2 ;
for ( ob2 = main - > object . first ; ob2 ; ob2 = ob2 - > id . next ) {
ModifierData * md2 ;
for ( md2 = ob2 - > modifiers . first ; md2 ; md2 = md2 - > next ) {
if ( md2 - > type = = eModifierType_Smoke ) {
SmokeModifierData * smd2 = ( SmokeModifierData * ) md2 ;
if ( ( smd2 - > type & MOD_SMOKE_TYPE_FLOW ) & & smd2 - > flow )
{
smd2 - > flow - > flags | = MOD_SMOKE_FLOW_INITVELOCITY ;
}
}
}
}
}
}
else if ( ( smd - > type & MOD_SMOKE_TYPE_FLOW ) & & smd - > flow )
{
smd - > flow - > vel_multi = 1.0f ;
}
}
}
}
}
2010-07-21 09:25:00 +00:00
/* put compatibility code here until next subversion bump */
{
2010-08-04 12:18:07 +00:00
Brush * br ;
for ( br = main - > brush . first ; br ; br = br - > id . next ) {
if ( br - > ob_mode = = 0 )
2010-11-03 21:23:02 +00:00
br - > ob_mode = OB_MODE_ALL_PAINT ;
2010-08-04 12:18:07 +00:00
}
2010-07-21 09:25:00 +00:00
}
2010-09-16 20:06:10 +00:00
{
ParticleSettings * part ;
for ( part = main - > particle . first ; part ; part = part - > id . next ) {
if ( part - > boids )
part - > boids - > pitch = 1.0f ;
}
}
2010-07-21 09:25:00 +00:00
2010-11-11 13:36:57 +00:00
{
bScreen * sc ;
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_INFO ) {
SpaceInfo * sinfo = ( SpaceInfo * ) sl ;
ARegion * ar ;
sinfo - > rpt_mask = INFO_RPT_OP ;
for ( ar = sa - > regionbase . first ; ar ; ar = ar - > next ) {
if ( ar - > regiontype = = RGN_TYPE_WINDOW ) {
ar - > v2d . scroll = ( V2D_SCROLL_RIGHT ) ;
ar - > v2d . align = V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y ; /* align bottom left */
ar - > v2d . keepofs = V2D_LOCKOFS_X ;
ar - > v2d . keepzoom = ( V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT ) ;
ar - > v2d . keeptot = V2D_KEEPTOT_BOUNDS ;
ar - > v2d . minzoom = ar - > v2d . maxzoom = 1.0f ;
}
}
}
}
}
}
}
2005-07-26 18:46:28 +00:00
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
2010-01-26 03:16:14 +00:00
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
2005-07-26 18:46:28 +00:00
/* don't forget to set version number in blender.c! */
2002-10-12 11:37:38 +00:00
}
2010-07-04 12:16:01 +00:00
#if 0 // XXX: disabled for now... we still don't have this in the right place in the loading code for it to work
2010-06-19 10:50:23 +00:00
static void do_versions_after_linking ( FileData * fd , Library * lib , Main * main )
{
2010-07-04 12:16:01 +00:00
/* old Animation System (using IPO's) needs to be converted to the new Animato system */
2010-06-19 10:50:23 +00:00
if ( main - > versionfile < 250 )
do_versions_ipos_to_animato ( main ) ;
}
2010-07-04 12:16:01 +00:00
# endif
2010-06-19 10:50:23 +00:00
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 ) ;
2007-12-24 18:53:37 +00:00
lib_link_windowmanager ( fd , main ) ;
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 ) ;
2009-01-22 10:53:22 +00:00
lib_link_ipo ( fd , main ) ; // XXX depreceated... still needs to be maintained for version patches still
2002-10-12 11:37:38 +00:00
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 ) ;
2006-02-07 15:50:55 +00:00
lib_link_nodetree ( fd , main ) ; /* has to be done after scene/materials, this will verify group nodes */
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
lib_link_brush ( fd , main ) ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
lib_link_particlesettings ( fd , main ) ;
2004-06-23 18:22:51 +00:00
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
lib_link_mesh ( fd , main ) ; /* as last: tpage images with users at zero */
2004-06-23 18:22:51 +00:00
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
lib_link_library ( fd , main ) ; /* only init users */
2002-10-12 11:37:38 +00:00
}
2007-12-24 18:53:37 +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 )
{
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
UserDef * user ;
wmKeyMap * keymap ;
wmKeyMapItem * kmi ;
2004-06-23 18:22:51 +00:00
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
bfd - > user = user = read_struct ( fd , bhead , " user def " ) ;
2009-08-09 21:16:39 +00:00
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap ( fd , bhead , " user def " ) ;
2004-06-23 18:22:51 +00:00
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
link_list ( fd , & user - > themes ) ;
link_list ( fd , & user - > keymaps ) ;
2010-02-26 14:28:29 +00:00
link_list ( fd , & user - > addons ) ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
for ( keymap = user - > keymaps . first ; keymap ; keymap = keymap - > next ) {
keymap - > modal_items = NULL ;
keymap - > poll = NULL ;
link_list ( fd , & keymap - > items ) ;
for ( kmi = keymap - > items . first ; kmi ; kmi = kmi - > next ) {
kmi - > properties = newdataadr ( fd , kmi - > properties ) ;
if ( kmi - > properties )
IDP_DirectLinkProperty ( kmi - > properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
kmi - > ptr = NULL ;
}
- 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
}
2004-06-23 18:22:51 +00:00
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
// XXX
user - > uifonts . first = user - > uifonts . last = NULL ;
user - > uistyles . first = user - > uistyles . last = NULL ;
/* free fd->datamap again */
oldnewmap_free_unused ( fd - > datamap ) ;
oldnewmap_clear ( fd - > datamap ) ;
- 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 ;
}
2010-03-17 21:38:53 +00:00
BlendFileData * blo_read_file_internal ( FileData * fd , const char * filename )
2002-10-12 11:37:38 +00:00
{
BHead * bhead = blo_firstbhead ( fd ) ;
BlendFileData * bfd ;
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 ;
2006-11-30 21:40:11 +00:00
2009-08-27 09:52:41 +00:00
bfd - > type = BLENFILETYPE_BLEND ;
2010-03-17 21:38:53 +00:00
strncpy ( bfd - > main - > name , filename , sizeof ( bfd - > main - > name ) - 1 ) ;
2009-08-27 09:52:41 +00:00
2002-10-12 11:37:38 +00:00
while ( bhead ) {
switch ( bhead - > code ) {
case DATA :
case DNA1 :
2010-05-24 21:52:18 +00:00
case TEST : /* used as preview since 2.5x */
2002-10-12 11:37:38 +00:00
case REND :
bhead = blo_nextbhead ( fd , bhead ) ;
break ;
2007-12-24 18:53:37 +00:00
case GLOB :
bhead = read_global ( bfd , 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 :
2009-10-20 16:43:25 +00:00
/* skip library datablocks in undo, this works together with
BLO_read_from_memfile , where the old main - > library is restored
overwriting the libraries from the memory file . previously
it did not save ID_LI / ID_ID blocks in this case , but they are
needed to make quit . blend recover them correctly . */
if ( fd - > memfile )
bhead = blo_nextbhead ( fd , bhead ) ;
else
bhead = read_libblock ( fd , bfd - > main , bhead , LIB_LOCAL , NULL ) ;
2002-10-12 11:37:38 +00:00
break ;
case ID_ID :
2009-10-20 16:43:25 +00:00
/* same as above */
if ( fd - > memfile )
bhead = blo_nextbhead ( fd , bhead ) ;
else
2002-10-12 11:37:38 +00:00
/* always adds to the most recently loaded
* ID_LI block , see direct_link_library .
2009-10-20 16:43:25 +00:00
* this is part of the file format definition . */
bhead = read_libblock ( fd , fd - > mainlist . last , bhead , LIB_READ + LIB_EXTERN , NULL ) ;
2002-10-12 11:37:38 +00:00
break ;
2005-12-15 18:37:47 +00:00
2008-11-27 16:00:59 +00:00
/* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
case ID_SCRN :
bhead - > code = ID_SCR ;
/* deliberate pass on to default */
2002-10-12 11:37:38 +00:00
default :
bhead = read_libblock ( fd , bfd - > main , bhead , LIB_LOCAL , NULL ) ;
}
}
2006-11-25 13:07:28 +00:00
/* do before read_libraries, but skip undo case */
// if(fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton)
do_versions ( fd , NULL , bfd - > main ) ;
2008-01-30 18:18:33 +00:00
2002-10-12 11:37:38 +00:00
read_libraries ( fd , & fd - > mainlist ) ;
2006-12-01 10:12:41 +00:00
2002-10-12 11:37:38 +00:00
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 ) ;
2010-07-04 12:16:01 +00:00
//do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010)
2010-10-16 02:40:31 +00:00
lib_verify_nodetree ( bfd - > main , TRUE ) ;
2009-10-20 16:43:25 +00:00
fix_relpaths_library ( fd - > relabase , bfd - > main ) ; /* make all relative paths, relative to the open blend file */
2005-12-16 17:35:38 +00:00
2007-12-24 18:53:37 +00:00
link_global ( fd , bfd ) ; /* as last */
2006-11-30 21:40:11 +00:00
2002-10-12 11:37:38 +00:00
return bfd ;
}
/* ************* APPEND LIBRARY ************** */
2008-01-30 18:18:33 +00:00
struct bheadsort {
BHead * bhead ;
void * old ;
} ;
static int verg_bheadsort ( const void * v1 , const void * v2 )
{
const struct bheadsort * x1 = v1 , * x2 = v2 ;
if ( x1 - > old > x2 - > old ) return 1 ;
else if ( x1 - > old < x2 - > old ) return - 1 ;
return 0 ;
}
static void sort_bhead_old_map ( FileData * fd )
{
BHead * bhead ;
struct bheadsort * bhs ;
int tot = 0 ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) )
tot + + ;
fd - > tot_bheadmap = tot ;
if ( tot = = 0 ) return ;
bhs = fd - > bheadmap = MEM_mallocN ( tot * sizeof ( struct bheadsort ) , " bheadsort " ) ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) , bhs + + ) {
bhs - > bhead = bhead ;
bhs - > old = bhead - > old ;
}
qsort ( fd - > bheadmap , tot , sizeof ( struct bheadsort ) , verg_bheadsort ) ;
}
2002-10-12 11:37:38 +00:00
static BHead * find_previous_lib ( FileData * fd , BHead * bhead )
{
2009-10-20 16:43:25 +00:00
/* skip library datablocks in undo, see comment in read_libblock */
if ( fd - > memfile )
return NULL ;
2002-10-12 11:37:38 +00:00
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 )
{
2008-02-03 18:50:03 +00:00
#if 0
2002-10-12 11:37:38 +00:00
BHead * bhead ;
2008-02-03 18:50:03 +00:00
# endif
2008-01-30 18:18:33 +00:00
struct bheadsort * bhs , bhs_s ;
2002-10-12 11:37:38 +00:00
if ( ! old )
return NULL ;
2004-06-23 18:22:51 +00:00
2008-01-30 18:18:33 +00:00
if ( fd - > bheadmap = = NULL )
sort_bhead_old_map ( fd ) ;
bhs_s . old = old ;
bhs = bsearch ( & bhs_s , fd - > bheadmap , fd - > tot_bheadmap , sizeof ( struct bheadsort ) , verg_bheadsort ) ;
if ( bhs )
return bhs - > bhead ;
2008-02-03 18:50:03 +00:00
#if 0
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 ;
2008-02-03 18:50:03 +00:00
# endif
2004-06-23 18:22:51 +00:00
2002-10-12 11:37:38 +00:00
return NULL ;
}
2007-04-28 16:15:00 +00:00
char * bhead_id_name ( FileData * fd , BHead * bhead )
{
return ( ( char * ) ( bhead + 1 ) ) + fd - > id_name_offs ;
}
static ID * is_yet_read ( FileData * fd , Main * mainvar , BHead * bhead )
2002-10-12 11:37:38 +00:00
{
2010-02-22 09:22:36 +00:00
const char * idname = bhead_id_name ( fd , bhead ) ;
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 12:15:16 +00:00
/* which_libbase can be NULL, intentionally not using idname+2 */
return BLI_findstring ( which_libbase ( mainvar , GS ( idname ) ) , idname , offsetof ( ID , name ) ) ;
2002-10-12 11:37:38 +00:00
}
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 ) {
2007-04-28 16:15:00 +00:00
Library * lib = read_struct ( fd , bheadlib , " Library " ) ;
2009-10-20 16:43:25 +00:00
Main * ptr = blo_find_main ( fd , & fd - > mainlist , lib - > name , fd - > relabase ) ;
2004-06-23 18:22:51 +00:00
2007-04-28 16:15:00 +00:00
id = is_yet_read ( fd , ptr , bhead ) ;
2004-06-23 18:22:51 +00:00
2007-04-28 16:15:00 +00:00
if ( id = = NULL ) {
2007-03-16 05:39:30 +00:00
read_libblock ( fd , ptr , bhead , LIB_READ + LIB_INDIRECT , NULL ) ;
2010-01-16 22:53:05 +00:00
// commented because this can print way too much
// if(G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
2006-11-30 21:40:11 +00:00
/* for outliner dependency only */
2007-03-16 05:39:30 +00:00
ptr - > curlib - > parent = mainvar - > curlib ;
2002-10-12 11:37:38 +00:00
}
else {
2008-03-13 21:41:28 +00:00
/* The line below was commented by Ton (I assume), when Hos did the merge from the orange branch. rev 6568
* This line is NEEDED , the case is that you have 3 blend files . . .
2010-07-17 18:08:14 +00:00
* user . blend , lib . blend and lib_indirect . blend - if user . blend already references a " tree " from
2008-03-13 21:41:28 +00:00
* lib_indirect . blend but lib . blend does too , linking in a Scene or Group from lib . blend can result in an
* empty without the dupli group referenced . Once you save and reload the group would appier . - Campbell */
2008-03-14 09:46:53 +00:00
/* This crashes files, must look further into it */
/*oldnewmap_insert(fd->libmap, bhead->old, id, 1);*/
2005-12-16 17:35:38 +00:00
change_idid_adr_fd ( fd , bhead - > old , id ) ;
2010-01-16 22:53:05 +00:00
// commented because this can print way too much
// if(G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
2002-10-12 11:37:38 +00:00
}
2007-04-28 16:15:00 +00:00
MEM_freeN ( lib ) ;
2002-10-12 11:37:38 +00:00
}
}
else {
2007-04-28 16:15:00 +00:00
id = is_yet_read ( fd , mainvar , bhead ) ;
2006-02-12 20:17:12 +00:00
if ( id = = NULL ) {
2002-10-12 11:37:38 +00:00
read_libblock ( fd , mainvar , bhead , LIB_TESTIND , NULL ) ;
}
else {
2006-02-12 20:17:12 +00:00
/* this is actually only needed on UI call? when ID was already read before, and another append
happens which invokes same ID . . . in that case the lookup table needs this entry */
oldnewmap_insert ( fd - > libmap , bhead - > old , id , 1 ) ;
2010-03-22 09:30:00 +00:00
// commented because this can print way too much
2010-02-08 14:12:18 +00:00
// if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
2002-10-12 11:37:38 +00:00
}
}
}
}
2008-01-18 14:30:26 +00:00
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system
2006-06-08 19:26:08 +00:00
static void expand_ipo ( FileData * fd , Main * mainvar , Ipo * ipo )
{
IpoCurve * icu ;
for ( icu = ipo - > curve . first ; icu ; icu = icu - > next ) {
if ( icu - > driver )
expand_doit ( fd , mainvar , icu - > driver - > ob ) ;
}
}
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system
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 ) ;
}
}
2009-11-22 11:15:38 +00:00
static void expand_fmodifiers ( FileData * fd , Main * mainvar , ListBase * list )
{
FModifier * fcm ;
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
/* library data for specific F-Modifier types */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_PYTHON :
{
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
expand_doit ( fd , mainvar , data - > script ) ;
}
break ;
}
}
}
static void expand_fcurves ( FileData * fd , Main * mainvar , ListBase * list )
{
FCurve * fcu ;
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
/* Driver targets if there is a driver */
if ( fcu - > driver ) {
ChannelDriver * driver = fcu - > driver ;
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
DriverVar * dvar ;
2009-11-22 11:15:38 +00:00
Durian Request: Drivers Recode
Highlights:
* Support for Multi-Target Variables
This was the main reason for this recode. Previously, variables could only be used to give some RNA property used as an input source to the driver a name. However, this meant that effects such as Rotational Difference couldn't be used in conjunction with other effects and/or settings to achieve the powerful results. Now, a variable can take several input targets, perform some interesting operations on them, and spit out a representative value based on that.
* New Variable Types
With the introduction of multi-target variables, there are now 3 types of variable that can be used: single property (i.e. the only type previously), Rotational Difference (angle between two bones), and Distance (distance between two objects or bones).
* New Driver Types
In addition to the existing 'Average', 'Sum', and 'Expression' types, there is now the additional options of 'Minimum' and 'Maximum'. These take the smallest/largest value that one of the variables evaluates to.
* Fix for Driver F-Curve colouring bug
Newly added drivers did not get automatically coloured in the Graph Editor properly. Was caused by inappropriate notifiers being used.
Notes:
* This commit breaks existing 2.5 files with drivers (in other words, they are lost forever).
* Rigify has been corrected to work with the new system. The PyAPI for accessing targets used for the variables could still be made nicer (using subclassing to directly access?), but that is left for later.
* Version patching for 2.49 files still needs to be put back in place.
2010-01-04 21:15:45 +00:00
for ( dvar = driver - > variables . first ; dvar ; dvar = dvar - > next ) {
DRIVER_TARGETS_LOOPER ( dvar )
{
// TODO: only expand those that are going to get used?
expand_doit ( fd , mainvar , dtar - > id ) ;
}
DRIVER_TARGETS_LOOPER_END
}
2009-11-22 11:15:38 +00:00
}
/* F-Curve Modifiers */
expand_fmodifiers ( fd , mainvar , & fcu - > modifiers ) ;
}
}
2009-01-19 02:26:46 +00:00
static void expand_action ( FileData * fd , Main * mainvar , bAction * act )
{
bActionChannel * chan ;
2009-11-22 11:15:38 +00:00
// XXX depreceated - old animation system --------------
2009-01-19 02:26:46 +00:00
for ( chan = act - > chanbase . first ; chan ; chan = chan - > next ) {
expand_doit ( fd , mainvar , chan - > ipo ) ;
expand_constraint_channels ( fd , mainvar , & chan - > constraintChannels ) ;
}
2009-11-22 11:15:38 +00:00
// ---------------------------------------------------
/* F-Curves in Action */
expand_fcurves ( fd , mainvar , & act - > curves ) ;
2009-01-19 02:26:46 +00:00
}
2009-02-11 12:19:42 +00:00
static void expand_keyingsets ( FileData * fd , Main * mainvar , ListBase * list )
{
KeyingSet * ks ;
KS_Path * ksp ;
/* expand the ID-pointers in KeyingSets's paths */
for ( ks = list - > first ; ks ; ks = ks - > next ) {
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
expand_doit ( fd , mainvar , ksp - > id ) ;
}
}
}
2009-07-06 03:44:44 +00:00
static void expand_animdata_nlastrips ( FileData * fd , Main * mainvar , ListBase * list )
{
NlaStrip * strip ;
for ( strip = list - > first ; strip ; strip = strip - > next ) {
/* check child strips */
expand_animdata_nlastrips ( fd , mainvar , & strip - > strips ) ;
2009-11-26 02:13:56 +00:00
/* check F-Curves */
expand_fcurves ( fd , mainvar , & strip - > fcurves ) ;
2009-11-22 11:15:38 +00:00
/* check F-Modifiers */
expand_fmodifiers ( fd , mainvar , & strip - > modifiers ) ;
2009-07-06 03:44:44 +00:00
/* relink referenced action */
expand_doit ( fd , mainvar , strip - > act ) ;
}
}
2009-01-19 02:26:46 +00:00
static void expand_animdata ( FileData * fd , Main * mainvar , AnimData * adt )
{
2009-05-22 11:19:35 +00:00
NlaTrack * nlt ;
2009-01-19 02:26:46 +00:00
/* own action */
expand_doit ( fd , mainvar , adt - > action ) ;
2009-06-06 05:06:46 +00:00
expand_doit ( fd , mainvar , adt - > tmpact ) ;
2009-01-19 02:26:46 +00:00
/* drivers - assume that these F-Curves have driver data to be in this list... */
2009-11-22 11:15:38 +00:00
expand_fcurves ( fd , mainvar , & adt - > drivers ) ;
2009-05-22 11:19:35 +00:00
/* nla-data - referenced actions */
2009-07-06 03:44:44 +00:00
for ( nlt = adt - > nla_tracks . first ; nlt ; nlt = nlt - > next )
expand_animdata_nlastrips ( fd , mainvar , & nlt - > strips ) ;
2009-01-19 02:26:46 +00:00
}
static void expand_particlesettings ( FileData * fd , Main * mainvar , ParticleSettings * part )
{
expand_doit ( fd , mainvar , part - > dup_ob ) ;
expand_doit ( fd , mainvar , part - > dup_group ) ;
expand_doit ( fd , mainvar , part - > eff_group ) ;
expand_doit ( fd , mainvar , part - > bb_ob ) ;
2009-06-24 02:11:36 +00:00
2009-07-24 16:41:12 +00:00
if ( part - > adt )
expand_animdata ( fd , mainvar , part - > adt ) ;
2009-01-19 02:26:46 +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 )
{
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , key - > ipo ) ; // XXX depreceated - old animation system
2009-01-22 10:53:22 +00:00
if ( key - > adt )
expand_animdata ( fd , mainvar , key - > adt ) ;
2002-10-12 11:37:38 +00:00
}
2008-11-12 22:03:11 +00:00
static void expand_nodetree ( FileData * fd , Main * mainvar , bNodeTree * ntree )
{
bNode * node ;
2009-02-20 16:39:39 +00:00
if ( ntree - > adt )
expand_animdata ( fd , mainvar , ntree - > adt ) ;
2009-11-11 09:59:51 +00:00
if ( ntree - > gpd )
expand_doit ( fd , mainvar , ntree - > gpd ) ;
2009-02-20 16:39:39 +00:00
2008-11-12 22:03:11 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next )
if ( node - > id & & node - > type ! = CMP_NODE_R_LAYERS )
expand_doit ( fd , mainvar , node - > id ) ;
}
2002-10-12 11:37:38 +00:00
static void expand_texture ( FileData * fd , Main * mainvar , Tex * tex )
{
expand_doit ( fd , mainvar , tex - > ima ) ;
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , tex - > ipo ) ; // XXX depreceated - old animation system
if ( tex - > adt )
expand_animdata ( fd , mainvar , tex - > adt ) ;
2008-11-12 22:03:11 +00:00
if ( tex - > nodetree )
expand_nodetree ( fd , mainvar , tex - > nodetree ) ;
2002-10-12 11:37:38 +00:00
}
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
static void expand_brush ( FileData * fd , Main * mainvar , Brush * brush )
{
2010-01-03 08:37:18 +00:00
expand_doit ( fd , mainvar , brush - > mtex . tex ) ;
2006-07-31 15:53:03 +00:00
expand_doit ( fd , mainvar , brush - > clone . image ) ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
}
2002-10-12 11:37:38 +00:00
static void expand_material ( FileData * fd , Main * mainvar , 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
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
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , ma - > ipo ) ; // XXX depreceated - old animation system
if ( ma - > adt )
expand_animdata ( fd , mainvar , ma - > adt ) ;
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: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
if ( ma - > nodetree )
expand_nodetree ( fd , mainvar , ma - > nodetree ) ;
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 ) ;
}
}
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , la - > ipo ) ; // XXX depreceated - old animation system
if ( la - > adt )
expand_animdata ( fd , mainvar , la - > adt ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_lattice ( FileData * fd , Main * mainvar , Lattice * lt )
{
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , lt - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
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 ) ;
}
}
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , wrld - > ipo ) ; // XXX depreceated - old animation system
if ( wrld - > adt )
expand_animdata ( fd , mainvar , wrld - > adt ) ;
2002-10-12 11:37:38 +00:00
}
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 ] ) ;
}
2009-08-03 13:09:23 +00:00
if ( mb - > adt )
expand_animdata ( fd , mainvar , mb - > adt ) ;
2002-10-12 11:37:38 +00:00
}
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 ] ) ;
}
2009-01-19 02:26:46 +00:00
2002-10-12 11:37:38 +00:00
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 ) ;
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , cu - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
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 ) ;
2009-01-19 02:26:46 +00:00
if ( cu - > adt )
expand_animdata ( fd , mainvar , cu - > adt ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_mesh ( FileData * fd , Main * mainvar , Mesh * me )
{
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
CustomDataLayer * layer ;
2006-11-21 16:54:00 +00:00
MTFace * mtf ;
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
TFace * tf ;
int a , i ;
2005-05-26 13:17:12 +00:00
2010-07-27 06:06:36 +00:00
if ( me - > adt )
expand_animdata ( fd , mainvar , me - > adt ) ;
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
2006-11-21 16:54:00 +00:00
if ( me - > tface ) {
tf = me - > tface ;
for ( i = 0 ; i < me - > totface ; i + + , tf + + )
if ( tf - > tpage )
expand_doit ( fd , mainvar , tf - > tpage ) ;
}
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
for ( a = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
2006-11-21 16:54:00 +00:00
if ( layer - > type = = CD_MTFACE ) {
mtf = ( MTFace * ) layer - > data ;
for ( i = 0 ; i < me - > totface ; i + + , mtf + + )
if ( mtf - > tpage )
expand_doit ( fd , mainvar , mtf - > tpage ) ;
}
2002-10-12 11:37:38 +00:00
}
}
2010-02-06 11:50:39 +00:00
/* temp struct used to transport needed info to expand_constraint_cb() */
typedef struct tConstraintExpandData {
FileData * fd ;
Main * mainvar ;
} tConstraintExpandData ;
/* callback function used to expand constraint ID-links */
2010-10-16 02:40:31 +00:00
static void expand_constraint_cb ( bConstraint * UNUSED ( con ) , ID * * idpoin , void * userdata )
2010-02-06 11:50:39 +00:00
{
tConstraintExpandData * ced = ( tConstraintExpandData * ) userdata ;
expand_doit ( ced - > fd , ced - > mainvar , * idpoin ) ;
}
2002-10-12 11:37:38 +00:00
static void expand_constraints ( FileData * fd , Main * mainvar , ListBase * lb )
{
2010-02-06 11:50:39 +00:00
tConstraintExpandData ced ;
2002-10-12 11:37:38 +00:00
bConstraint * curcon ;
2010-02-06 11:50:39 +00:00
/* relink all ID-blocks used by the constraints */
ced . fd = fd ;
ced . mainvar = mainvar ;
id_loop_constraints ( lb , expand_constraint_cb , & ced ) ;
/* depreceated manual expansion stuff */
2002-10-12 11:37:38 +00:00
for ( curcon = lb - > first ; curcon ; curcon = curcon - > next ) {
2007-12-02 18:33:14 +00:00
if ( curcon - > ipo )
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , curcon - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
}
}
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 ) ;
2006-11-14 16:29:03 +00:00
expand_doit ( fd , mainvar , chan - > custom ) ;
2002-10-12 11:37:38 +00:00
}
}
static void expand_armature ( FileData * fd , Main * mainvar , bArmature * arm )
{
Bone * curBone ;
2004-06-23 18:22:51 +00:00
2009-09-21 06:43:20 +00:00
if ( arm - > adt )
expand_animdata ( fd , mainvar , arm - > adt ) ;
2002-10-12 11:37:38 +00:00
for ( curBone = arm - > bonebase . first ; curBone ; curBone = curBone - > next ) {
expand_bones ( fd , mainvar , curBone ) ;
}
}
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 ) ;
}
2006-03-01 15:30:10 +00:00
else if ( md - > type = = eModifierType_Array ) {
ArrayModifierData * amd = ( ArrayModifierData * ) md ;
expand_doit ( fd , mainvar , amd - > curve_ob ) ;
expand_doit ( fd , mainvar , amd - > offset_ob ) ;
}
2007-11-13 06:56:55 +00:00
else if ( md - > type = = eModifierType_Mirror ) {
MirrorModifierData * mmd = ( MirrorModifierData * ) md ;
expand_doit ( fd , mainvar , mmd - > mirror_ob ) ;
}
2008-01-02 18:44:13 +00:00
else if ( md - > type = = eModifierType_Displace ) {
DisplaceModifierData * dmd = ( DisplaceModifierData * ) md ;
expand_doit ( fd , mainvar , dmd - > map_object ) ;
expand_doit ( fd , mainvar , dmd - > texture ) ;
}
2009-07-30 15:00:26 +00:00
else if ( md - > type = = eModifierType_Smoke ) {
SmokeModifierData * smd = ( SmokeModifierData * ) md ;
if ( smd - > type = = MOD_SMOKE_TYPE_DOMAIN & & smd - > domain )
{
2009-07-30 22:11:28 +00:00
expand_doit ( fd , mainvar , smd - > domain - > coll_group ) ;
expand_doit ( fd , mainvar , smd - > domain - > fluid_group ) ;
expand_doit ( fd , mainvar , smd - > domain - > eff_group ) ;
2009-07-30 15:00:26 +00:00
}
}
2005-07-20 18:04:50 +00:00
}
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 ;
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
ParticleSystem * psys ;
2002-10-12 11:37:38 +00:00
bSensor * sens ;
bController * cont ;
bActuator * act ;
bActionStrip * strip ;
2006-02-05 19:43:46 +00:00
PartEff * paf ;
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
expand_doit ( fd , mainvar , ob - > data ) ;
2009-01-19 02:26:46 +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 ) ;
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , ob - > poselib ) ;
2002-10-12 11:37:38 +00:00
expand_constraints ( fd , mainvar , & ob - > constraints ) ;
2009-01-18 10:41:45 +00:00
2009-08-28 12:41:45 +00:00
expand_doit ( fd , mainvar , ob - > gpd ) ;
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system (for version patching only)
expand_doit ( fd , mainvar , ob - > ipo ) ;
expand_doit ( fd , mainvar , ob - > action ) ;
2002-10-12 11:37:38 +00:00
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 ) ;
}
2009-01-19 02:26:46 +00:00
// XXX depreceated - old animation system (for version patching only)
if ( ob - > adt )
expand_animdata ( fd , mainvar , ob - > adt ) ;
2002-10-12 11:37:38 +00:00
for ( a = 0 ; a < ob - > totcol ; a + + ) {
expand_doit ( fd , mainvar , ob - > mat [ a ] ) ;
}
2004-10-13 17:59:44 +00:00
2006-02-05 19:43:46 +00:00
paf = give_parteff ( ob ) ;
if ( paf & & paf - > group )
expand_doit ( fd , mainvar , paf - > group ) ;
2006-02-20 17:44:21 +00:00
if ( ob - > dup_group )
expand_doit ( fd , mainvar , ob - > dup_group ) ;
2006-11-30 15:54:21 +00:00
if ( ob - > proxy )
expand_doit ( fd , mainvar , ob - > proxy ) ;
if ( ob - > proxy_group )
expand_doit ( fd , mainvar , ob - > proxy_group ) ;
2006-02-20 17:44:21 +00:00
Particles
=========
Merge of the famous particle patch by Janne Karhu, a full rewrite
of the Blender particle system. This includes:
- Emitter, Hair and Reactor particle types.
- Newtonian, Keyed and Boids physics.
- Various particle visualisation and rendering types.
- Vertex group and texture control for various properties.
- Interpolated child particles from parents.
- Hair editing with combing, growing, cutting, .. .
- Explode modifier.
- Harmonic, Magnetic fields, and multiple falloff types.
.. and lots of other things, some more info is here:
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite
http://wiki.blender.org/index.php/BlenderDev/Particles_Rewrite_Doc
The new particle system cannot be backwards compatible. Old particle
systems are being converted to the new system, but will require
tweaking to get them looking the same as before.
Point Cache
===========
The new system to replace manual baking, based on automatic caching
on disk. This is currently used by softbodies and the particle system.
See the Cache API section on:
http://wiki.blender.org/index.php/BlenderDev/PhysicsSprint
Documentation
=============
These new features still need good docs for the release logs, help
for this is appreciated.
2007-11-26 22:09:57 +00:00
for ( psys = ob - > particlesystem . first ; psys ; psys = psys - > next )
expand_doit ( fd , mainvar , psys - > part ) ;
2002-10-12 11:37:38 +00:00
sens = ob - > sensors . first ;
while ( sens ) {
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 ) {
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 ) ;
}
}
2009-06-08 20:08:19 +00:00
else if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * oa = act - > data ;
expand_doit ( fd , mainvar , oa - > reference ) ;
}
2009-09-24 21:22:24 +00:00
else if ( act - > type = = ACT_ADD_OBJECT ) {
bAddObjectActuator * aoa = act - > data ;
expand_doit ( fd , mainvar , aoa - > ob ) ;
}
2002-10-12 11:37:38 +00:00
else if ( act - > type = = ACT_SCENE ) {
bSceneActuator * sa = act - > data ;
expand_doit ( fd , mainvar , sa - > camera ) ;
expand_doit ( fd , mainvar , sa - > scene ) ;
}
2009-09-24 21:22:24 +00:00
else if ( act - > type = = ACT_2DFILTER ) {
bTwoDFilterActuator * tdfa = act - > data ;
expand_doit ( fd , mainvar , tdfa - > text ) ;
}
2002-10-12 11:37:38 +00:00
else if ( act - > type = = ACT_ACTION ) {
bActionActuator * aa = act - > data ;
expand_doit ( fd , mainvar , aa - > act ) ;
}
2008-06-18 06:46:49 +00:00
else if ( act - > type = = ACT_SHAPEACTION ) {
bActionActuator * aa = act - > data ;
expand_doit ( fd , mainvar , aa - > act ) ;
}
2002-10-12 11:37:38 +00:00
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 ) ;
}
2009-09-24 21:22:24 +00:00
else if ( act - > type = = ACT_PARENT ) {
bParentActuator * pa = act - > data ;
expand_doit ( fd , mainvar , pa - > ob ) ;
}
else if ( act - > type = = ACT_ARMATURE ) {
bArmatureActuator * arma = act - > data ;
expand_doit ( fd , mainvar , arma - > target ) ;
}
2002-10-12 11:37:38 +00:00
act = act - > next ;
}
2008-02-28 11:39:13 +00:00
if ( ob - > pd & & ob - > pd - > tex )
expand_doit ( fd , mainvar , ob - > pd - > tex ) ;
2006-11-25 16:24:52 +00:00
2002-10-12 11:37:38 +00:00
}
static void expand_scene ( FileData * fd , Main * mainvar , Scene * sce )
{
Base * base ;
2006-12-07 14:17:38 +00:00
SceneRenderLayer * srl ;
2004-06-23 18:22:51 +00:00
2006-12-07 14:17:38 +00:00
for ( base = sce - > base . first ; base ; base = base - > next ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , base - > object ) ;
}
expand_doit ( fd , mainvar , sce - > camera ) ;
expand_doit ( fd , mainvar , sce - > world ) ;
2006-02-07 15:50:55 +00:00
2009-01-19 02:26:46 +00:00
if ( sce - > adt )
expand_animdata ( fd , mainvar , sce - > adt ) ;
2009-02-11 12:19:42 +00:00
expand_keyingsets ( fd , mainvar , & sce - > keyingsets ) ;
2009-01-19 02:26:46 +00:00
2009-02-17 03:43:56 +00:00
if ( sce - > set )
expand_doit ( fd , mainvar , sce - > set ) ;
2006-02-07 15:50:55 +00:00
if ( sce - > nodetree )
expand_nodetree ( fd , mainvar , sce - > nodetree ) ;
2006-12-07 14:17:38 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
expand_doit ( fd , mainvar , srl - > mat_override ) ;
expand_doit ( fd , mainvar , srl - > light_override ) ;
}
2009-04-20 15:06:46 +00:00
if ( sce - > r . dometext )
2009-07-20 20:28:29 +00:00
expand_doit ( fd , mainvar , sce - > gm . dome . warptext ) ;
2009-08-26 12:01:15 +00:00
if ( sce - > gpd )
expand_doit ( fd , mainvar , sce - > gpd ) ;
2009-12-16 19:49:33 +00:00
2009-12-18 13:28:03 +00:00
if ( sce - > ed ) {
Sequence * seq ;
SEQ_BEGIN ( sce - > ed , seq ) {
if ( seq - > scene ) expand_doit ( fd , mainvar , seq - > scene ) ;
2010-03-09 13:52:52 +00:00
if ( seq - > scene_camera ) expand_doit ( fd , mainvar , seq - > scene_camera ) ;
2009-12-18 13:28:03 +00:00
if ( seq - > sound ) expand_doit ( fd , mainvar , seq - > sound ) ;
}
SEQ_END
}
2009-12-16 19:49:33 +00:00
# ifdef DURIAN_CAMERA_SWITCH
{
TimeMarker * marker ;
for ( marker = sce - > markers . first ; marker ; marker = marker - > next ) {
if ( marker - > camera ) {
expand_doit ( fd , mainvar , marker - > camera ) ;
}
}
}
# endif
2002-10-12 11:37:38 +00:00
}
static void expand_camera ( FileData * fd , Main * mainvar , Camera * ca )
{
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , ca - > ipo ) ; // XXX depreceated - old animation system
if ( ca - > adt )
expand_animdata ( fd , mainvar , ca - > adt ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_sound ( FileData * fd , Main * mainvar , bSound * snd )
{
2009-01-19 02:26:46 +00:00
expand_doit ( fd , mainvar , snd - > ipo ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
}
static void expand_main ( FileData * fd , Main * mainvar )
{
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2002-10-12 11:37:38 +00:00
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 :
2009-01-19 02:26:46 +00:00
expand_action ( fd , mainvar , ( bAction * ) id ) ; // XXX depreceated - old animation system
2002-10-12 11:37:38 +00:00
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 ;
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
case ID_NT :
expand_nodetree ( fd , mainvar , ( bNodeTree * ) id ) ;
break ;
Brush Datablock:
- Added a new Brush datablock, only used by image paint, but intended
to be used in texture paint, vertex paint, weight paint and sculpt
mode also.
- Being a datablock, these brushes can be saved, appended and linked.
They have a fake user by default, to make sure they are saved even if
not selected.
Image Painting:
- Replaced the img module with C code in imagepaint.c
- Airbrush is no longer a separate tool, but rather an option that can
be used for soften, smear and clone also.
- Blend modes mix, add, subtract, multiply, darken and lighten have been
added, code taken directly from vertex paint.
Note to project files maintainers:
- The img module was removed from SCons and Makefiles, and this should
be done in other build systems also. I'll wait to remove the module
from cvs, to not break compilation.
2006-07-26 22:29:23 +00:00
case ID_BR :
expand_brush ( fd , mainvar , ( Brush * ) id ) ;
break ;
2006-06-08 19:26:08 +00:00
case ID_IP :
2009-01-19 02:26:46 +00:00
expand_ipo ( fd , mainvar , ( Ipo * ) id ) ; // XXX depreceated - old animation system
2006-06-08 19:26:08 +00:00
break ;
2008-01-18 14:30:26 +00:00
case ID_PA :
expand_particlesettings ( fd , mainvar , ( ParticleSettings * ) id ) ;
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 ;
}
}
}
}
2008-12-19 16:36:15 +00:00
static int object_in_any_scene ( Main * mainvar , Object * ob )
2006-06-02 20:48:22 +00:00
{
Scene * sce ;
2008-12-19 16:36:15 +00:00
for ( sce = mainvar - > scene . first ; sce ; sce = sce - > id . next )
2006-06-02 20:48:22 +00:00
if ( object_in_scene ( ob , sce ) )
return 1 ;
return 0 ;
}
2004-12-08 19:08:37 +00:00
2006-06-19 12:29:35 +00:00
/* when *lib set, it also does objects that were in the appended group */
2008-12-19 16:36:15 +00:00
static void give_base_to_objects ( Main * mainvar , Scene * sce , Library * lib , int is_group_append )
2002-10-12 11:37:38 +00:00
{
Object * ob ;
Base * base ;
2004-06-23 18:22:51 +00:00
2006-06-19 12:29:35 +00:00
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
2008-12-19 16:36:15 +00:00
for ( ob = mainvar - > object . first ; ob ; ob = ob - > id . next ) {
2008-01-18 11:51:46 +00:00
2006-02-05 19:43:46 +00:00
if ( ob - > id . flag & LIB_INDIRECT ) {
2006-06-19 12:29:35 +00:00
2008-01-18 11:51:46 +00:00
/* IF below is quite confusing!
if we are appending , but this object wasnt just added allong with a group ,
2010-07-17 18:08:14 +00:00
then this is already used indirectly in the scene somewhere else and we didnt just append it .
2008-01-18 11:51:46 +00:00
2010-01-07 16:19:38 +00:00
( ob - > id . flag & LIB_PRE_EXISTING ) = = 0 means that this is a newly appended object - Campbell */
if ( is_group_append = = 0 | | ( ob - > id . flag & LIB_PRE_EXISTING ) = = 0 ) {
2008-01-18 11:51:46 +00:00
int do_it = 0 ;
if ( ob - > id . us = = 0 )
2006-06-19 12:29:35 +00:00
do_it = 1 ;
2008-01-18 11:51:46 +00:00
else if ( ob - > id . us = = 1 & & lib )
2008-12-19 16:36:15 +00:00
if ( ob - > id . lib = = lib & & ( ob - > flag & OB_FROMGROUP ) & & object_in_any_scene ( mainvar , ob ) = = 0 )
2008-01-18 11:51:46 +00:00
do_it = 1 ;
if ( do_it ) {
base = MEM_callocN ( sizeof ( Base ) , " add_ext_base " ) ;
BLI_addtail ( & ( sce - > base ) , base ) ;
base - > lay = ob - > lay ;
base - > object = ob ;
base - > flag = ob - > flag ;
ob - > id . us = 1 ;
2006-06-19 12:29:35 +00:00
2008-01-18 11:51:46 +00:00
ob - > id . flag - = LIB_INDIRECT ;
ob - > id . flag | = LIB_EXTERN ;
}
2002-10-12 11:37:38 +00:00
}
}
}
}
2004-12-08 19:08:37 +00:00
2010-01-07 14:28:00 +00:00
/* when *lib set, it also does objects that were in the appended group */
2010-01-07 16:19:38 +00:00
static void give_base_to_groups ( Main * mainvar , Scene * scene )
2010-01-07 14:28:00 +00:00
{
Group * group ;
/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
for ( group = mainvar - > group . first ; group ; group = group - > id . next ) {
2010-01-07 16:19:38 +00:00
if ( ( ( group - > id . flag & LIB_INDIRECT ) = = 0 & & ( group - > id . flag & LIB_PRE_EXISTING ) = = 0 ) ) {
2010-01-07 14:59:22 +00:00
Base * base ;
/* add_object(...) messes with the selection */
Object * ob = add_only_object ( OB_EMPTY , group - > id . name + 2 ) ;
ob - > type = OB_EMPTY ;
ob - > lay = scene - > lay ;
/* assign the base */
base = scene_add_base ( scene , ob ) ;
base - > flag | = SELECT ;
base - > object - > flag = base - > flag ;
2010-07-05 03:55:28 +00:00
ob - > recalc | = OB_RECALC_ALL ;
2010-01-07 14:59:22 +00:00
scene - > basact = base ;
/* assign the group */
2010-01-07 14:28:00 +00:00
ob - > dup_group = group ;
ob - > transflag | = OB_DUPLIGROUP ;
2010-01-07 14:59:22 +00:00
rename_id ( & ob - > id , group - > id . name + 2 ) ;
VECCOPY ( ob - > loc , scene - > cursor ) ;
2010-01-07 14:28:00 +00:00
}
}
}
2002-10-12 11:37:38 +00:00
2009-09-12 19:54:39 +00:00
static void append_named_part ( const bContext * C , Main * mainl , FileData * fd , char * name , int idcode , short flag )
2002-10-12 11:37:38 +00:00
{
2009-09-12 19:54:39 +00:00
Scene * scene = CTX_data_scene ( C ) ;
2002-10-12 11:37:38 +00:00
Object * ob ;
Base * base ;
BHead * bhead ;
ID * id ;
2007-04-28 16:15:00 +00:00
int endloop = 0 ;
2002-10-12 11:37:38 +00:00
bhead = blo_firstbhead ( fd ) ;
2007-04-28 16:15:00 +00:00
while ( bhead & & endloop = = 0 ) {
2004-06-23 18:22:51 +00:00
2007-04-28 16:15:00 +00:00
if ( bhead - > code = = ENDB ) endloop = 1 ;
2002-10-12 11:37:38 +00:00
else if ( bhead - > code = = idcode ) {
2007-04-28 16:15:00 +00:00
char * idname = bhead_id_name ( fd , bhead ) ;
if ( strcmp ( idname + 2 , name ) = = 0 ) {
2004-06-23 18:22:51 +00:00
2009-09-12 19:54:39 +00:00
id = is_yet_read ( fd , mainl , bhead ) ;
2007-04-28 16:15:00 +00:00
if ( id = = NULL ) {
2009-09-12 19:54:39 +00:00
read_libblock ( fd , mainl , bhead , LIB_TESTEXT , NULL ) ;
2002-10-12 11:37:38 +00:00
}
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
2009-08-04 09:20:48 +00:00
if ( idcode = = ID_OB & & scene ) { /* 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
2009-09-12 19:54:39 +00:00
if ( id = = NULL ) ob = mainl - > object . last ;
2002-10-12 11:37:38 +00:00
else ob = ( Object * ) id ;
2005-01-30 15:40:42 +00:00
2009-09-12 19:54:39 +00:00
/* link at active layer (view3d->lay if in context, else scene->lay */
if ( ( flag & FILE_ACTIVELAY ) ) {
View3D * v3d = CTX_wm_view3d ( C ) ;
if ( v3d ) {
ob - > lay = v3d - > layact ;
} else {
ob - > lay = scene - > lay ;
}
}
2010-07-05 13:14:14 +00:00
ob - > mode = 0 ;
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
}
2007-04-28 16:15:00 +00:00
endloop = 1 ;
2002-10-12 11:37:38 +00:00
}
}
bhead = blo_nextbhead ( fd , bhead ) ;
}
}
2009-09-12 19:54:39 +00:00
void BLO_library_append_named_part ( const bContext * C , Main * mainl , BlendHandle * * bh , char * name , int idcode , short flag )
{
FileData * fd = ( FileData * ) ( * bh ) ;
append_named_part ( C , mainl , fd , name , idcode , flag ) ;
}
2002-10-12 11:37:38 +00:00
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 ) ) {
2007-04-28 16:15:00 +00:00
if ( BLI_streq ( id - > name , bhead_id_name ( fd , bhead ) ) ) {
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 ;
}
}
2007-03-16 05:39:30 +00:00
/* common routine to append/link something from a library */
2006-01-04 19:05:24 +00:00
2009-09-12 19:54:39 +00:00
static Main * library_append_begin ( const bContext * C , FileData * * fd , char * dir )
2002-10-12 11:37:38 +00:00
{
2009-09-12 19:54:39 +00:00
Main * mainvar = CTX_data_main ( C ) ;
2002-12-20 02:08:46 +00:00
Main * mainl ;
2004-06-23 18:22:51 +00:00
2003-04-26 18:01:01 +00:00
/* make mains */
2008-12-19 16:36:15 +00:00
blo_split_main ( & ( * fd ) - > mainlist , mainvar ) ;
2004-06-23 18:22:51 +00:00
2003-04-26 18:01:01 +00:00
/* which one do we need? */
2010-10-18 06:41:16 +00:00
mainl = blo_find_main ( * fd , & ( * fd ) - > mainlist , dir , G . main - > name ) ;
2006-11-26 21:17:15 +00:00
2010-05-05 14:59:22 +00:00
/* needed for do_version */
mainl - > versionfile = ( * fd ) - > fileversion ;
read_file_version ( * fd , mainl ) ;
2006-11-26 21:17:15 +00:00
2009-09-12 19:54:39 +00:00
return mainl ;
}
Main * BLO_library_append_begin ( const bContext * C , BlendHandle * * bh , char * dir )
{
FileData * fd = ( FileData * ) ( * bh ) ;
return library_append_begin ( C , & fd , dir ) ;
}
static void append_do_cursor ( Scene * scene , Library * curlib , short flag )
{
Base * centerbase ;
Object * ob ;
float * curs , centerloc [ 3 ] , vec [ 3 ] , min [ 3 ] , max [ 3 ] ;
int count = 0 ;
/* when not linking (appending)... */
if ( flag & FILE_LINK )
return ;
/* we're not appending at cursor */
if ( ( flag & FILE_ATCURSOR ) = = 0 )
return ;
2004-07-27 11:00:09 +00:00
2009-09-12 19:54:39 +00:00
/* find the center of everything appended */
INIT_MINMAX ( min , max ) ;
centerbase = ( scene - > base . first ) ;
while ( centerbase ) {
if ( centerbase - > object - > id . lib = = curlib & & centerbase - > object - > parent = = NULL ) {
VECCOPY ( vec , centerbase - > object - > loc ) ;
DO_MINMAX ( vec , min , max ) ;
count + + ;
}
centerbase = centerbase - > next ;
2002-10-12 11:37:38 +00:00
}
2009-09-12 19:54:39 +00:00
/* we haven't found any objects to move to cursor */
if ( ! count )
return ;
/* move from the center of the appended objects to cursor */
2010-07-31 10:58:10 +00:00
mid_v3_v3v3 ( centerloc , min , max ) ;
2009-09-12 19:54:39 +00:00
curs = scene - > cursor ;
VECSUB ( centerloc , curs , centerloc ) ;
/* now translate the center of the objects */
centerbase = ( scene - > base . first ) ;
while ( centerbase ) {
if ( centerbase - > object - > id . lib = = curlib & & centerbase - > object - > parent = = NULL ) {
ob = centerbase - > object ;
ob - > loc [ 0 ] + = centerloc [ 0 ] ;
ob - > loc [ 1 ] + = centerloc [ 1 ] ;
ob - > loc [ 2 ] + = centerloc [ 2 ] ;
2002-10-12 11:37:38 +00:00
}
2009-09-12 19:54:39 +00:00
centerbase = centerbase - > next ;
2002-10-12 11:37:38 +00:00
}
2009-09-12 19:54:39 +00:00
}
static void library_append_end ( const bContext * C , Main * mainl , FileData * * fd , int idcode , short flag )
{
Main * mainvar = CTX_data_main ( C ) ;
Scene * scene = CTX_data_scene ( C ) ;
2010-10-07 21:25:05 +00:00
Library * curlib ;
2004-06-23 18:22:51 +00:00
2010-01-26 14:00:13 +00:00
/* make main consistent */
2008-03-20 04:59:59 +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 */
2008-03-20 04:59:59 +00:00
read_libraries ( * fd , & ( * fd ) - > mainlist ) ;
2010-10-07 21:25:05 +00:00
curlib = mainl - > curlib ;
2002-10-12 11:37:38 +00:00
2009-09-12 19:54:39 +00:00
/* make the lib path relative if required */
2010-03-09 17:36:23 +00:00
if ( flag & FILE_RELPATH ) {
2005-12-11 22:54:46 +00:00
2006-01-04 19:05:24 +00:00
/* use the full path, this could have been read by other library even */
2010-10-07 21:25:05 +00:00
BLI_strncpy ( curlib - > name , curlib - > filepath , sizeof ( curlib - > name ) ) ;
2006-01-04 19:05:24 +00:00
/* uses current .blend file as reference */
2010-10-18 06:41:16 +00:00
BLI_path_rel ( curlib - > name , G . main - > name ) ;
2005-10-25 20:19:31 +00:00
}
2008-03-20 04:59:59 +00:00
blo_join_main ( & ( * fd ) - > mainlist ) ;
2008-12-19 16:36:15 +00:00
mainvar = ( * fd ) - > mainlist . first ;
2010-10-07 21:25:05 +00:00
mainl = NULL ; /* blo_join_main free's mainl, cant use anymore */
2002-10-12 11:37:38 +00:00
2008-12-19 16:36:15 +00:00
lib_link_all ( * fd , mainvar ) ;
2010-10-16 02:40:31 +00:00
lib_verify_nodetree ( mainvar , FALSE ) ;
2010-10-18 06:41:16 +00:00
fix_relpaths_library ( G . main - > name , mainvar ) ; /* make all relative paths, relative to the open blend file */
2002-10-12 11:37:38 +00:00
2006-06-19 12:29:35 +00:00
/* give a base to loose objects. If group append, do it for objects too */
2009-08-22 17:11:36 +00:00
if ( scene ) {
2010-04-22 18:19:21 +00:00
if ( idcode = = ID_SCE ) {
/* dont instance anything when linking in scenes, assume the scene its self instances the data */
}
else if ( idcode = = ID_GR ) {
2009-08-22 17:11:36 +00:00
if ( flag & FILE_LINK ) {
give_base_to_objects ( mainvar , scene , NULL , 0 ) ;
} else {
2010-10-07 21:25:05 +00:00
give_base_to_objects ( mainvar , scene , curlib , 1 ) ;
2010-01-07 14:28:00 +00:00
}
if ( flag & FILE_GROUP_INSTANCE ) {
2010-01-07 16:19:38 +00:00
give_base_to_groups ( mainvar , scene ) ;
2010-01-07 14:28:00 +00:00
}
2008-01-18 11:51:46 +00:00
} else {
2009-08-22 17:11:36 +00:00
give_base_to_objects ( mainvar , scene , NULL , 0 ) ;
}
2008-01-18 11:51:46 +00:00
}
2007-03-16 05:39:30 +00:00
/* has been removed... erm, why? s..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 */
2008-03-20 04:59:59 +00:00
if ( ( * fd ) - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
blo_freefiledata ( * fd ) ;
* fd = NULL ;
2007-09-02 17:25:03 +00:00
}
2007-04-01 19:00:10 +00:00
2010-10-07 21:25:05 +00:00
append_do_cursor ( scene , curlib , flag ) ;
2009-09-12 19:54:39 +00:00
}
void BLO_library_append_end ( const bContext * C , struct Main * mainl , BlendHandle * * bh , int idcode , short flag )
{
FileData * fd = ( FileData * ) ( * bh ) ;
library_append_end ( C , mainl , & fd , idcode , flag ) ;
* bh = ( BlendHandle * ) fd ;
2007-03-16 05:39:30 +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 . */
2007-12-24 18:53:37 +00:00
/* append to scene */
2007-03-16 05:39:30 +00:00
/* this should probably be moved into the Python code anyway */
2009-09-12 19:54:39 +00:00
/* tentatively removed, Python should be able to use the split functions too: */
/* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */
#if 0
2008-03-20 04:59:59 +00:00
void BLO_script_library_append ( BlendHandle * * bh , char * dir , char * name ,
2008-12-29 13:38:08 +00:00
int idcode , short flag , Main * mainvar , Scene * scene , ReportList * reports )
2007-03-16 05:39:30 +00:00
{
2008-12-29 13:38:08 +00:00
FileData * fd = ( FileData * ) ( * bh ) ;
2007-03-16 05:39:30 +00:00
/* try to append the requested object */
2008-12-29 13:38:08 +00:00
fd - > reports = reports ;
library_append ( mainvar , scene , name , dir , idcode , 0 , & fd , NULL , 0 , flag ) ;
if ( fd ) fd - > reports = NULL ;
2007-03-16 05:39:30 +00:00
/* do we need to do this? */
2009-08-04 09:20:48 +00:00
if ( scene )
2010-08-01 12:47:49 +00:00
DAG_scene_sort ( bmain , scene ) ;
2008-12-29 13:38:08 +00:00
* bh = ( BlendHandle * ) fd ;
2007-03-16 05:39:30 +00:00
}
2009-09-12 19:54:39 +00:00
# endif
2002-10-12 11:37:38 +00:00
/* ************* READ LIBRARY ************** */
static int mainvar_count_libread_blocks ( Main * mainvar )
{
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2002-10-12 11:37:38 +00:00
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 ;
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2002-10-12 11:37:38 +00:00
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
2007-04-28 16:15:00 +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 ) {
2008-12-19 00:50:21 +00:00
2010-01-11 11:59:14 +00:00
/* printf and reports for now... its important users know this */
2010-06-02 17:58:28 +00:00
BKE_reportf ( basefd - > reports , RPT_INFO , " read library: '%s', '%s' \n " , mainptr - > curlib - > filepath , mainptr - > curlib - > name ) ;
if ( ! G . background & & basefd - > reports ) printf ( " read library: '%s', '%s' \n " , mainptr - > curlib - > filepath , mainptr - > curlib - > name ) ;
2010-01-11 11:59:14 +00:00
2010-06-02 17:58:28 +00:00
fd = blo_openblenderfile ( mainptr - > curlib - > filepath , basefd - > reports ) ;
2010-04-20 10:36:00 +00:00
/* allow typing in a new lib path */
if ( G . rt = = - 666 ) {
while ( fd = = NULL ) {
char newlib_path [ 240 ] = { 0 } ;
2010-04-20 21:38:55 +00:00
printf ( " Missing library...' \n " ) ;
2010-10-18 06:41:16 +00:00
printf ( " current file: %s \n " , G . main - > name ) ;
2010-06-02 17:58:28 +00:00
printf ( " absolute lib: %s \n " , mainptr - > curlib - > filepath ) ;
2010-04-20 21:38:55 +00:00
printf ( " relative lib: %s \n " , mainptr - > curlib - > name ) ;
2010-04-20 10:36:00 +00:00
printf ( " enter a new path: \n " ) ;
2010-04-23 11:19:06 +00:00
if ( scanf ( " %s " , newlib_path ) > 0 ) {
strcpy ( mainptr - > curlib - > name , newlib_path ) ;
2010-06-02 17:58:28 +00:00
strcpy ( mainptr - > curlib - > filepath , newlib_path ) ;
2010-10-18 06:41:16 +00:00
cleanup_path ( G . main - > name , mainptr - > curlib - > filepath ) ;
2010-04-23 11:19:06 +00:00
2010-06-02 17:58:28 +00:00
fd = blo_openblenderfile ( mainptr - > curlib - > filepath , basefd - > reports ) ;
2010-04-20 10:36:00 +00:00
2010-04-23 11:19:06 +00:00
if ( fd ) {
2010-06-02 17:58:28 +00:00
printf ( " found: '%s', party on macuno! \n " , mainptr - > curlib - > filepath ) ;
2010-04-23 11:19:06 +00:00
}
2010-04-20 10:36:00 +00:00
}
}
}
2008-12-19 00:50:21 +00:00
2002-10-12 11:37:38 +00:00
if ( fd ) {
2009-09-13 03:30:51 +00:00
fd - > reports = basefd - > reports ;
2002-10-12 11:37:38 +00:00
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 ;
2007-12-01 14:36:06 +00:00
/* subversion */
read_file_version ( fd , mainptr ) ;
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
2010-01-11 11:59:14 +00:00
if ( fd = = NULL ) {
2010-06-02 17:58:28 +00:00
BKE_reportf ( basefd - > reports , RPT_ERROR , " Can't find lib '%s' \n " , mainptr - > curlib - > filepath ) ;
if ( ! G . background & & basefd - > reports ) printf ( " ERROR: can't find lib %s \n " , mainptr - > curlib - > filepath ) ;
2010-01-11 11:59:14 +00:00
}
2002-10-12 11:37:38 +00:00
}
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 ) ;
2010-01-11 12:24:08 +00:00
if ( ! realid ) {
2010-08-10 15:14:19 +00:00
BKE_reportf ( fd - > reports , RPT_ERROR , " LIB ERROR: %s:'%s' missing from '%s' \n " , BKE_idcode_to_name ( GS ( id - > name ) ) , id - > name + 2 , mainptr - > curlib - > filepath ) ;
if ( ! G . background & & basefd - > reports ) printf ( " LIB ERROR: %s:'%s' missing from '%s' \n " , BKE_idcode_to_name ( GS ( id - > name ) ) , id - > name + 2 , mainptr - > curlib - > filepath ) ;
2010-01-11 12:24:08 +00:00
}
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 ) ;
2010-08-10 15:14:19 +00:00
BKE_reportf ( basefd - > reports , RPT_ERROR , " LIB ERROR: %s:'%s' unread libblock missing from '%s' \n " , BKE_idcode_to_name ( GS ( id - > name ) ) , id - > name + 2 , mainptr - > curlib - > filepath ) ;
if ( ! G . background & & basefd - > reports ) printf ( " LIB ERROR: %s:'%s' unread libblock missing from '%s' \n " , BKE_idcode_to_name ( GS ( id - > name ) ) , id - > name + 2 , mainptr - > curlib - > filepath ) ;
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
}
}
2008-02-02 11:19:34 +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
2008-12-19 00:50:21 +00:00
BlendFileData * blo_read_blendafterruntime ( int file , char * name , int actualsize , ReportList * reports )
2004-09-05 13:43: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
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
2008-09-11 13:00:54 +00:00
/* needed for library_append and read_libraries */
2009-10-20 16:43:25 +00:00
BLI_strncpy ( fd - > relabase , name , sizeof ( fd - > relabase ) ) ;
2008-09-11 13:00:54 +00:00
2008-12-19 00:50:21 +00:00
fd = blo_decode_and_check ( fd , reports ) ;
2005-07-25 18:35:49 +00:00
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
2008-12-29 13:38:08 +00:00
fd - > reports = reports ;
2009-08-27 09:52:41 +00:00
bfd = blo_read_file_internal ( fd , " " ) ;
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
}