2003-04-26 18:01:01 +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
* * * * * * 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
*/
2011-02-27 20:35:41 +00:00
/** \file blender/blenloader/intern/readfile.c
* \ ingroup blenloader
*/
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
2012-01-05 09:50:07 +00:00
# include <stdarg.h> /* for va_start/end */
2013-11-20 23:47:05 +02:00
# include <time.h> /* for gmtime */
2002-10-12 11:37:38 +00:00
2013-02-22 13:35:32 +00:00
# include "BLI_utildefines.h"
2004-06-23 18:22:51 +00:00
# ifndef WIN32
2012-04-15 07:54:07 +00:00
# include <unistd.h> // for read close
2002-10-12 11:37:38 +00:00
# else
2012-04-15 07:54:07 +00:00
# include <io.h> // for open close read
# include "winsock2.h"
# include "BLI_winstuff.h"
2002-10-12 11:37:38 +00:00
# endif
2011-12-04 06:05:48 +00:00
/* allow readfile to use deprecated functionality */
# define DNA_DEPRECATED_ALLOW
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"
2011-05-24 07:08:58 +00:00
# include "DNA_dynamicpaint_types.h"
2005-05-02 13:28:13 +00:00
# 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"
2013-03-23 03:00:37 +00:00
# include "DNA_linestyle_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
2012-04-30 08:24:44 +00:00
# include "DNA_object_types.h"
2005-05-02 13:28:13 +00:00
# include "DNA_packedFile_types.h"
2011-07-15 13:32:02 +00:00
# include "DNA_particle_types.h"
2005-05-02 13:28:13 +00:00
# include "DNA_property_types.h"
2013-01-23 05:56:22 +00:00
# include "DNA_rigidbody_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"
2011-08-01 11:44:20 +00:00
# include "DNA_speaker_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"
2011-11-07 12:55:18 +00:00
# include "DNA_movieclip_types.h"
2012-06-04 16:42:58 +00:00
# include "DNA_mask_types.h"
2002-10-12 11:37:38 +00:00
# include "MEM_guardedalloc.h"
2010-08-16 05:46:10 +00:00
2012-09-03 07:37:38 +00:00
# include "BLI_endian_switch.h"
2002-10-12 11:37:38 +00:00
# include "BLI_blenlib.h"
2009-11-10 20:43:45 +00:00
# include "BLI_math.h"
2013-04-24 17:31:09 +00:00
# include "BLI_threads.h"
2013-08-03 11:35:09 +00:00
# include "BLI_mempool.h"
2002-10-12 11:37:38 +00:00
2015-08-16 17:32:01 +10:00
# include "BLT_translation.h"
2012-10-19 16:43:10 +00:00
2015-05-12 13:13:36 +05: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"
2014-09-01 17:46:17 +02:00
# include "BKE_cloth.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"
2013-02-21 19:33:04 +00:00
# include "BKE_depsgraph.h"
2011-12-04 17:24:34 +00:00
# include "BKE_effect.h"
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"
* 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
2015-10-08 14:21:11 +02:00
# include "BKE_library_query.h"
2010-08-10 15:14:19 +00:00
# include "BKE_idcode.h"
2010-12-06 02:32:16 +00:00
# include "BKE_material.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-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"
2015-04-07 11:01:47 +10:00
# include "BKE_outliner_treehash.h"
2009-08-09 21:16:39 +00:00
# include "BKE_sound.h"
2011-12-21 11:01:08 +00:00
2013-03-18 16:34:57 +00:00
# include "NOD_common.h"
2011-09-05 21:01:50 +00:00
# include "NOD_socket.h"
2002-10-12 11:37:38 +00:00
# include "BLO_readfile.h"
2004-09-05 13:43:51 +00:00
# include "BLO_undofile.h"
2012-09-03 10:12:25 +00:00
# include "BLO_blend_defs.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
2011-11-02 18:20:53 +00:00
# include "RE_engine.h"
2002-10-12 11:37:38 +00:00
# include "readfile.h"
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
/*
2012-06-30 22:49:33 +00:00
* Remark : still a weak point is the newaddress ( ) function , that doesnt solve reading from
* multiple files at the same time
*
* ( added remark : oh , i thought that was solved ? will look at that . . . ( ton )
*
* READ
* - Existing Library ( Main ) push or free
* - allocate new Main
* - load file
* - read SDNA
* - for each LibBlock
* - read LibBlock
* - if a Library
* - make a new Main
* - attach ID ' s to it
* - else
* - read associated ' direct data '
* - link direct data ( internal and to LibBlock )
* - read FileGlobal
* - read USER data , only when indicated ( file is ~ / X . XX / startup . blend )
* - free file
* - per Library ( per Main )
* - read file
* - read SDNA
* - find LibBlocks and attach IDs to Main
* - if external LibBlock
* - search all Main ' s
* - or it ' s already read ,
* - or not read yet
* - or make new Main
* - per LibBlock
* - read recursive
* - read associated direct data
* - link direct data ( internal and to LibBlock )
* - free file
* - per Library with unread LibBlocks
* - read file
* - read SDNA
* - per LibBlock
* - read recursive
* - read associated direct data
* - link direct data ( internal and to LibBlock )
* - free file
* - join all Mains
* - link all LibBlocks and indirect pointers to libblocks
* - initialize FileGlobal and copy pointers to Global
2012-10-04 13:26:15 +00:00
*/
2002-10-12 11:37:38 +00:00
2015-03-11 00:33:44 +11:00
/* use GHash for BHead name-based lookups (speeds up linking) */
# define USE_GHASH_BHEAD
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 */
2010-12-03 17:05:21 +00:00
static void * read_struct ( FileData * fd , BHead * bh , const char * blockname ) ;
2011-04-08 02:21:43 +00:00
static void direct_link_modifiers ( FileData * fd , ListBase * lb ) ;
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
static void convert_tface_mt ( FileData * fd , Main * main ) ;
2015-03-11 00:33:44 +11:00
static BHead * find_bhead_from_code_name ( FileData * fd , const short idcode , const char * name ) ;
static BHead * find_bhead_from_idname ( FileData * fd , const char * idname ) ;
2005-03-09 19:45:59 +00:00
2012-01-05 09:50:07 +00:00
/* this function ensures that reports are printed,
* in the case of libraray linking errors this is important !
*
* bit kludge but better then doubling up on prints ,
2012-07-16 23:23:33 +00:00
* we could alternatively have a versions of a report function which forces printing - campbell
2012-01-05 09:50:07 +00:00
*/
2012-09-23 18:50:56 +00:00
2013-11-29 23:16:13 +06:00
void blo_reportf_wrap ( ReportList * reports , ReportType type , const char * format , . . . )
2012-01-05 09:50:07 +00:00
{
char fixed_buf [ 1024 ] ; /* should be long enough */
2012-05-17 12:59:34 +00:00
2012-01-05 09:50:07 +00:00
va_list args ;
2012-05-17 12:59:34 +00:00
2012-01-05 09:50:07 +00:00
va_start ( args , format ) ;
vsnprintf ( fixed_buf , sizeof ( fixed_buf ) , format , args ) ;
va_end ( args ) ;
2012-05-17 12:59:34 +00:00
2012-01-05 09:50:07 +00:00
fixed_buf [ sizeof ( fixed_buf ) - 1 ] = ' \0 ' ;
2012-05-17 12:59:34 +00:00
2012-01-05 09:50:07 +00:00
BKE_report ( reports , type , fixed_buf ) ;
2012-05-17 12:59:34 +00:00
if ( G . background = = 0 ) {
2012-01-05 09:50:07 +00:00
printf ( " %s \n " , fixed_buf ) ;
}
}
2014-10-19 12:49:01 +02:00
/* for reporting linking messages */
static const char * library_parent_filepath ( Library * lib )
{
return lib - > parent ? lib - > parent - > filepath : " <direct> " ;
}
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 " ) ;
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
if ( x1 - > old > x2 - > old ) return 1 ;
else if ( x1 - > old < x2 - > old ) return - 1 ;
2005-12-15 18:42:02 +00:00
return 0 ;
}
static void oldnewmap_sort ( FileData * fd )
{
qsort ( fd - > libmap - > entries , fd - > libmap - > nentries , sizeof ( OldNew ) , verg_oldnewmap ) ;
2012-05-17 12:59:34 +00:00
fd - > libmap - > sorted = 1 ;
2005-12-15 18:42:02 +00:00
}
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 ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( oldaddr = = NULL | | newaddr = = NULL ) return ;
2005-12-16 17:35:38 +00:00
2015-03-13 01:54:38 +11:00
if ( UNLIKELY ( onm - > nentries = = onm - > entriessize ) ) {
2012-05-17 12:59:34 +00:00
onm - > entriessize * = 2 ;
2015-03-13 01:54:38 +11:00
onm - > entries = MEM_reallocN ( onm - > entries , sizeof ( * onm - > entries ) * onm - > entriessize ) ;
2002-10-12 11:37:38 +00:00
}
2004-06-23 18:22:51 +00:00
2012-05-17 12:59:34 +00:00
entry = & onm - > entries [ onm - > nentries + + ] ;
entry - > old = oldaddr ;
entry - > newp = newaddr ;
entry - > nr = nr ;
2002-10-12 11:37:38 +00:00
}
2012-05-04 15:42:49 +00:00
void blo_do_versions_oldnewmap_insert ( OldNewMap * onm , void * oldaddr , void * newaddr , int nr )
{
oldnewmap_insert ( onm , oldaddr , newaddr , nr ) ;
}
2015-08-18 11:22:07 +10:00
/**
* Do a full search ( no state ) .
*
* \ param lasthit : Use as a reference position to avoid a full search
* from either end of the array , giving more efficient lookups .
*
* \ note This would seem an ideal case for hash or btree lookups .
* However the data is written in - order , using the \ a lasthit will normally avoid calling this function .
* Creating a btree / hash structure adds overhead for the common - case to optimize the corner - case
* ( since most entries will never be retrieved ) .
* So just keep full lookups as a fall - back .
*/
static int oldnewmap_lookup_entry_full ( const OldNewMap * onm , const void * addr , int lasthit )
{
const int nentries = onm - > nentries ;
const OldNew * entries = onm - > entries ;
int i ;
/* search relative to lasthit where possible */
if ( lasthit > = 0 & & lasthit < nentries ) {
/* search forwards */
i = lasthit ;
while ( + + i ! = nentries ) {
if ( entries [ i ] . old = = addr ) {
return i ;
}
}
/* search backwards */
i = lasthit + 1 ;
while ( i - - ) {
if ( entries [ i ] . old = = addr ) {
return i ;
}
}
}
else {
/* search backwards (full) */
i = nentries ;
while ( i - - ) {
if ( entries [ i ] . old = = addr ) {
return i ;
}
}
}
return - 1 ;
}
2013-08-07 19:29:15 +00:00
static void * oldnewmap_lookup_and_inc ( OldNewMap * onm , void * addr , bool increase_users )
2005-12-13 19:21:56 +00:00
{
2002-10-12 11:37:38 +00:00
int i ;
2012-05-17 12:59:34 +00:00
if ( addr = = NULL ) return NULL ;
if ( onm - > lasthit < onm - > nentries - 1 ) {
OldNew * entry = & onm - > entries [ + + onm - > lasthit ] ;
if ( entry - > old = = addr ) {
2013-08-07 19:29:15 +00:00
if ( increase_users )
entry - > nr + + ;
2002-10-12 11:37:38 +00:00
return entry - > newp ;
}
}
2012-05-17 12:59:34 +00:00
2015-08-18 11:22:07 +10:00
i = oldnewmap_lookup_entry_full ( onm , addr , onm - > lasthit ) ;
if ( i ! = - 1 ) {
2012-05-17 12:59:34 +00:00
OldNew * entry = & onm - > entries [ i ] ;
2015-08-18 11:22:07 +10:00
BLI_assert ( entry - > old = = addr ) ;
onm - > lasthit = i ;
if ( increase_users )
entry - > nr + + ;
return entry - > newp ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return NULL ;
}
2006-11-25 13:07:28 +00:00
/* for libdata, nr has ID code, no increment */
2012-11-10 02:38:16 +00:00
static void * oldnewmap_liblookup ( OldNewMap * onm , void * addr , void * lib )
2005-12-13 19:21:56 +00:00
{
2012-11-10 02:38:16 +00:00
if ( addr = = NULL ) {
return NULL ;
}
2005-12-15 18:42:02 +00:00
/* lasthit works fine for non-libdata, linking there is done in same sequence as writing */
2012-03-24 06:18:31 +00:00
if ( onm - > sorted ) {
2005-12-15 18:42:02 +00:00
OldNew entry_s , * entry ;
2012-11-10 02:38:16 +00:00
2012-05-17 12:59:34 +00:00
entry_s . old = addr ;
2012-11-10 02:38:16 +00:00
2012-05-17 12:59:34 +00:00
entry = bsearch ( & entry_s , onm - > entries , onm - > nentries , sizeof ( OldNew ) , verg_oldnewmap ) ;
2012-03-24 06:18:31 +00:00
if ( entry ) {
2012-05-17 12:59:34 +00:00
ID * id = entry - > newp ;
2012-11-10 02:38:16 +00:00
2002-10-12 11:37:38 +00:00
if ( id & & ( ! lib | | id - > lib ) ) {
2012-11-10 02:38:16 +00:00
return id ;
2002-10-12 11:37:38 +00:00
}
}
}
2012-11-10 02:38:16 +00:00
else {
/* note, this can be a bottle neck when loading some files */
2015-08-18 11:22:07 +10:00
const int i = oldnewmap_lookup_entry_full ( onm , addr , - 1 ) ;
if ( i ! = - 1 ) {
OldNew * entry = & onm - > entries [ i ] ;
ID * id = entry - > newp ;
BLI_assert ( entry - > old = = addr ) ;
if ( id & & ( ! lib | | id - > lib ) ) {
return id ;
2002-10-12 11:37:38 +00:00
}
}
}
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
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < onm - > nentries ; i + + ) {
OldNew * entry = & onm - > entries [ i ] ;
if ( entry - > nr = = 0 ) {
2002-10-12 11:37:38 +00:00
MEM_freeN ( entry - > newp ) ;
2012-05-17 12:59:34 +00:00
entry - > newp = NULL ;
2002-10-12 11:37:38 +00:00
}
}
}
2005-12-13 19:21:56 +00:00
static void oldnewmap_clear ( OldNewMap * onm )
{
2012-05-17 12:59:34 +00:00
onm - > nentries = 0 ;
onm - > lasthit = 0 ;
2002-10-12 11:37:38 +00:00
}
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 ;
2012-05-17 12:59:34 +00:00
2011-01-06 01:35:07 +00:00
set_listbasepointers ( mainvar , lbarray ) ;
2012-05-17 12:59:34 +00:00
a = set_listbasepointers ( from , fromarray ) ;
2012-03-24 07:52:14 +00:00
while ( a - - ) {
2010-12-21 14:49:34 +00:00
BLI_movelisttolist ( lbarray [ a ] , fromarray [ a ] ) ;
2002-10-12 11:37:38 +00:00
}
}
void blo_join_main ( ListBase * mainlist )
{
2006-12-01 10:12:41 +00:00
Main * tojoin , * mainl ;
2012-05-17 12:59:34 +00:00
mainl = mainlist - > first ;
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 ) ;
2014-08-04 16:00:57 +02:00
BKE_main_free ( 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 ;
2012-05-17 12:59:34 +00:00
id = lb - > first ;
2012-03-24 07:52:14 +00:00
while ( id ) {
2012-05-17 12:59:34 +00:00
idnext = id - > next ;
2012-03-24 06:18:31 +00:00
if ( id - > lib ) {
2012-05-17 12:59:34 +00:00
mainvar = first ;
2012-03-24 07:52:14 +00:00
while ( mainvar ) {
2012-05-17 12:59:34 +00:00
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 ;
}
2012-05-17 12:59:34 +00:00
mainvar = mainvar - > next ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
if ( mainvar = = NULL ) printf ( " error split_libdata \n " ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
id = idnext ;
2002-10-12 11:37:38 +00:00
}
}
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 ;
2012-05-17 12:59:34 +00:00
mainlist - > first = mainlist - > last = main ;
main - > next = NULL ;
2014-02-08 06:07:10 +11:00
if ( BLI_listbase_is_empty ( & main - > library ) )
2006-11-25 13:07:28 +00:00
return ;
2012-05-17 12:59:34 +00:00
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
2013-12-26 17:24:42 +06:00
Main * libmain = BKE_main_new ( ) ;
2012-05-17 12:59:34 +00:00
libmain - > curlib = lib ;
2002-10-12 11:37:38 +00:00
BLI_addtail ( mainlist , libmain ) ;
}
2012-05-17 12:59:34 +00:00
i = set_listbasepointers ( main , lbarray ) ;
2012-03-24 07:52:14 +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
}
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 ) ) {
2012-05-17 12:59:34 +00:00
if ( bhead - > code = = GLOB ) {
2007-11-30 15:12:31 +00:00
FileGlobal * fg = read_struct ( fd , bhead , " Global " ) ;
2012-03-24 06:18:31 +00:00
if ( fg ) {
2007-11-30 15:12:31 +00:00
main - > subversionfile = fg - > subversion ;
main - > minversionfile = fg - > minversion ;
main - > minsubversionfile = fg - > minsubversion ;
MEM_freeN ( fg ) ;
}
2012-05-17 12:59:34 +00:00
else if ( bhead - > code = = ENDB )
2007-11-30 15:12:31 +00:00
break ;
}
}
}
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
static void read_file_bhead_idname_map_create ( FileData * fd )
{
BHead * bhead ;
/* dummy values */
bool is_link = false ;
int code_prev = ENDB ;
unsigned int reserve = 0 ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( code_prev ! = bhead - > code ) {
code_prev = bhead - > code ;
is_link = BKE_idcode_is_valid ( code_prev ) ? BKE_idcode_is_linkable ( code_prev ) : false ;
}
if ( is_link ) {
reserve + = 1 ;
}
}
BLI_assert ( fd - > bhead_idname_hash = = NULL ) ;
fd - > bhead_idname_hash = BLI_ghash_str_new_ex ( __func__ , reserve ) ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( code_prev ! = bhead - > code ) {
code_prev = bhead - > code ;
is_link = BKE_idcode_is_valid ( code_prev ) ? BKE_idcode_is_linkable ( code_prev ) : false ;
}
if ( is_link ) {
BLI_ghash_insert ( fd - > bhead_idname_hash , ( void * ) bhead_id_name ( fd , bhead ) , bhead ) ;
}
}
}
# endif
2007-11-30 15:12:31 +00:00
2012-05-25 17:13:30 +00:00
static Main * blo_find_main ( FileData * fd , const char * filepath , const char * relabase )
2002-10-12 11:37:38 +00:00
{
2012-05-25 17:13:30 +00:00
ListBase * mainlist = fd - > mainlist ;
2002-10-12 11:37:38 +00:00
Main * m ;
Library * lib ;
2011-11-26 13:11:55 +00:00
char name1 [ FILE_MAX ] ;
2005-12-14 09:59:22 +00:00
2011-05-18 06:27:32 +00:00
BLI_strncpy ( name1 , filepath , sizeof ( name1 ) ) ;
2013-03-05 06:26:10 +00:00
BLI_cleanup_path ( relabase , name1 ) ;
2012-12-27 15:07:19 +00:00
// printf("blo_find_main: relabase %s\n", relabase);
// printf("blo_find_main: original in %s\n", filepath);
2006-01-04 19:05:24 +00:00
// printf("blo_find_main: converted to %s\n", name1);
2012-05-17 12:59:34 +00:00
for ( m = mainlist - > first ; m ; m = m - > next ) {
2014-04-27 00:24:11 +10:00
const char * libname = ( m - > curlib ) ? m - > curlib - > filepath : m - > name ;
2004-06-23 18:48:55 +00:00
2011-04-06 06:03:48 +00:00
if ( BLI_path_cmp ( name1 , libname ) = = 0 ) {
2012-03-31 00:59:17 +00:00
if ( G . debug & 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
}
2012-05-17 12:59:34 +00:00
2013-12-26 17:24:42 +06:00
m = BKE_main_new ( ) ;
2002-10-12 11:37:38 +00:00
BLI_addtail ( mainlist , m ) ;
2012-05-17 12:59:34 +00:00
2015-09-21 15:01:55 +02:00
/* Add library datablock itself to 'main' Main, since libraries are **never** linked data.
* Fixes bug where you could end with all ID_LI datablocks having the same name . . . */
lib = BKE_libblock_alloc ( mainlist - > first , ID_LI , " Lib " ) ;
2011-09-26 18:51:10 +00:00
BLI_strncpy ( lib - > name , filepath , sizeof ( lib - > name ) ) ;
2010-06-02 17:58:28 +00:00
BLI_strncpy ( lib - > filepath , name1 , sizeof ( lib - > filepath ) ) ;
2006-01-04 19:05:24 +00:00
2012-05-17 12:59:34 +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 ) ;
2012-03-31 00:59:17 +00:00
if ( G . debug & G_DEBUG ) printf ( " blo_find_main: added new lib %s \n " , filepath ) ;
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 */
2012-05-17 12:59:34 +00:00
if ( ( bhead - > code & 0xFFFF ) = = 0 ) bhead - > code > > = 16 ;
2002-10-12 11:37:38 +00:00
if ( bhead - > code ! = ENDB ) {
2012-09-03 07:37:38 +00:00
BLI_endian_switch_int32 ( & bhead - > len ) ;
BLI_endian_switch_int32 ( & bhead - > SDNAnr ) ;
BLI_endian_switch_int32 ( & bhead - > nr ) ;
2002-10-12 11:37:38 +00:00
}
}
static void switch_endian_bh8 ( BHead8 * bhead )
{
2003-04-26 18:01:01 +00:00
/* the ID_.. codes */
2012-05-17 12:59:34 +00:00
if ( ( bhead - > code & 0xFFFF ) = = 0 ) bhead - > code > > = 16 ;
2002-10-12 11:37:38 +00:00
if ( bhead - > code ! = ENDB ) {
2012-09-03 07:37:38 +00:00
BLI_endian_switch_int32 ( & bhead - > len ) ;
BLI_endian_switch_int32 ( & bhead - > SDNAnr ) ;
BLI_endian_switch_int32 ( & bhead - > nr ) ;
2002-10-12 11:37:38 +00:00
}
}
static void bh4_from_bh8 ( BHead * bhead , BHead8 * bhead8 , int do_endian_swap )
{
BHead4 * bhead4 = ( BHead4 * ) bhead ;
2012-09-15 04:57:51 +00:00
int64_t old ;
2002-10-12 11:37:38 +00:00
2012-05-17 12:59:34 +00:00
bhead4 - > code = bhead8 - > code ;
bhead4 - > len = bhead8 - > len ;
2002-10-12 11:37:38 +00:00
if ( bhead4 - > code ! = ENDB ) {
2012-05-17 12:59:34 +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 ) {
2012-09-03 07:37:38 +00:00
BLI_endian_switch_int64 ( & bhead8 - > old ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +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
2012-04-22 11:54:53 +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 ) ;
2012-05-17 12:59:34 +00:00
bhead4 - > SDNAnr = bhead8 - > SDNAnr ;
bhead4 - > nr = bhead8 - > nr ;
2002-10-12 11:37:38 +00:00
}
}
static void bh8_from_bh4 ( BHead * bhead , BHead4 * bhead4 )
{
BHead8 * bhead8 = ( BHead8 * ) bhead ;
2012-05-17 12:59:34 +00:00
bhead8 - > code = bhead4 - > code ;
bhead8 - > len = bhead4 - > len ;
2004-06-23 18:22:51 +00:00
if ( bhead8 - > code ! = ENDB ) {
2012-05-17 12:59:34 +00:00
bhead8 - > old = bhead4 - > old ;
bhead8 - > SDNAnr = bhead4 - > SDNAnr ;
2002-10-12 11:37:38 +00:00
bhead8 - > nr = bhead4 - > nr ;
}
}
static BHeadN * get_bhead ( FileData * fd )
{
2011-02-13 10:52:18 +00:00
BHeadN * new_bhead = NULL ;
2002-10-12 11:37:38 +00:00
int readsize ;
2009-06-08 20:08:19 +00:00
2002-10-12 11:37:38 +00:00
if ( fd ) {
2012-05-17 12:59:34 +00:00
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 */
2012-05-17 12:59:34 +00:00
BHead8 bhead8 = { 0 } ;
BHead4 bhead4 = { 0 } ;
BHead bhead = { 0 } ;
2009-06-08 20:08:19 +00:00
2012-05-17 12:59:34 +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 .
*/
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 ) ) ;
2012-05-17 12:59:34 +00:00
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 ) ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( fd - > flags & FD_FLAGS_POINTSIZE_DIFFERS ) {
bh8_from_bh4 ( & bhead , & bhead4 ) ;
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
memcpy ( & bhead , & bhead4 , sizeof ( bhead ) ) ;
}
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
fd - > eof = 1 ;
2006-12-01 19:52:04 +00:00
bhead . len = 0 ;
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
bhead8 . code = DATA ;
readsize = fd - > read ( fd , & bhead8 , sizeof ( bhead8 ) ) ;
2012-05-17 12:59:34 +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 ) ;
}
2012-05-17 12:59:34 +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 ) ) ;
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
memcpy ( & bhead , & bhead8 , sizeof ( bhead ) ) ;
}
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
fd - > eof = 1 ;
2006-12-01 19:52:04 +00:00
bhead . len = 0 ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +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 ) {
2002-10-12 11:37:38 +00:00
new_bhead = MEM_mallocN ( sizeof ( BHeadN ) + bhead . len , " new_bhead " ) ;
if ( new_bhead ) {
2011-02-13 10:52:18 +00:00
new_bhead - > next = new_bhead - > prev = NULL ;
2002-10-12 11:37:38 +00:00
new_bhead - > bhead = bhead ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
readsize = fd - > read ( fd , new_bhead + 1 , bhead . len ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( readsize ! = bhead . len ) {
fd - > eof = 1 ;
MEM_freeN ( new_bhead ) ;
2011-02-13 10:52:18 +00:00
new_bhead = NULL ;
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
fd - > eof = 1 ;
}
}
}
}
2004-06-23 18:22:51 +00:00
2012-05-17 12:59:34 +00:00
/* We've read a new block. Now add it to the list
* of blocks .
*/
2002-10-12 11:37:38 +00:00
if ( new_bhead ) {
BLI_addtail ( & fd - > listbase , new_bhead ) ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return ( new_bhead ) ;
}
BHead * blo_firstbhead ( FileData * fd )
{
BHeadN * new_bhead ;
2011-02-13 10:52:18 +00:00
BHead * bhead = NULL ;
2012-05-17 12:59:34 +00:00
/* Rewind the file
* Read in a new block if necessary
*/
2002-10-12 11:37:38 +00:00
new_bhead = fd - > listbase . first ;
2011-02-13 10:52:18 +00:00
if ( new_bhead = = NULL ) {
2002-10-12 11:37:38 +00:00
new_bhead = get_bhead ( fd ) ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( new_bhead ) {
bhead = & new_bhead - > bhead ;
}
2012-05-17 12:59:34 +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
{
2015-03-10 23:40:39 +11:00
BHeadN * bheadn = ( BHeadN * ) POINTER_OFFSET ( thisblock , - offsetof ( BHeadN , bhead ) ) ;
2012-05-17 12:59:34 +00:00
BHeadN * prev = bheadn - > prev ;
return ( prev ) ? & prev - > bhead : NULL ;
2002-10-12 11:37:38 +00:00
}
BHead * blo_nextbhead ( FileData * fd , BHead * thisblock )
{
2008-01-30 18:18:33 +00:00
BHeadN * new_bhead = NULL ;
BHead * bhead = NULL ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( thisblock ) {
2012-08-01 15:21:39 +00:00
/* bhead is actually a sub part of BHeadN
* We calculate the BHeadN pointer from the BHead pointer below */
2015-03-10 23:40:39 +11:00
new_bhead = ( BHeadN * ) POINTER_OFFSET ( thisblock , - offsetof ( BHeadN , bhead ) ) ;
2012-05-17 12:59:34 +00:00
2012-08-01 15:21:39 +00:00
/* get the next BHeadN. If it doesn't exist we read in the next one */
2002-10-12 11:37:38 +00:00
new_bhead = new_bhead - > next ;
2011-02-13 10:52:18 +00:00
if ( new_bhead = = NULL ) {
2002-10-12 11:37:38 +00:00
new_bhead = get_bhead ( fd ) ;
}
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( new_bhead ) {
2012-08-01 15:21:39 +00:00
/* here we do the reverse:
* go from the BHeadN pointer to the BHead pointer */
2002-10-12 11:37:38 +00:00
bhead = & new_bhead - > bhead ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return ( bhead ) ;
}
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
/* Warning! Caller's responsability to ensure given bhead **is** and ID one! */
const char * bhead_id_name ( const FileData * fd , const BHead * bhead )
{
return ( const char * ) POINTER_OFFSET ( bhead , sizeof ( * bhead ) + fd - > id_name_offs ) ;
}
2002-10-12 11:37:38 +00:00
static void decode_blender_header ( FileData * fd )
{
char header [ SIZEOFBLENDERHEADER ] , num [ 4 ] ;
int readsize ;
2012-05-17 12:59:34 +00:00
/* read in the header data */
2002-10-12 11:37:38 +00:00
readsize = fd - > read ( fd , header , sizeof ( header ) ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( readsize = = sizeof ( header ) ) {
2015-01-26 16:03:11 +01:00
if ( STREQLEN ( header , " BLENDER " , 7 ) ) {
2012-05-17 12:59:34 +00:00
int remove_this_endian_test = 1 ;
2002-10-12 11:37:38 +00:00
fd - > flags | = FD_FLAGS_FILE_OK ;
2012-05-17 12:59:34 +00:00
/* what size are pointers in the file ? */
2012-03-24 06:18:31 +00:00
if ( header [ 7 ] = = ' _ ' ) {
2002-10-12 11:37:38 +00:00
fd - > flags | = FD_FLAGS_FILE_POINTSIZE_IS_4 ;
if ( sizeof ( void * ) ! = 4 ) {
fd - > flags | = FD_FLAGS_POINTSIZE_DIFFERS ;
}
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
if ( sizeof ( void * ) ! = 8 ) {
fd - > flags | = FD_FLAGS_POINTSIZE_DIFFERS ;
}
}
2012-05-17 12:59:34 +00:00
/* is the file saved in a different endian
* than we need ?
*/
2012-12-11 22:00:22 +00:00
if ( ( ( ( ( char * ) & remove_this_endian_test ) [ 0 ] = = 1 ) ? L_ENDIAN : B_ENDIAN ) ! = ( ( header [ 8 ] = = ' v ' ) ? L_ENDIAN : B_ENDIAN ) ) {
2002-10-12 11:37:38 +00:00
fd - > flags | = FD_FLAGS_SWITCH_ENDIAN ;
}
2012-05-17 12:59:34 +00:00
/* get the version number */
memcpy ( num , header + 9 , 3 ) ;
2002-10-12 11:37:38 +00:00
num [ 3 ] = 0 ;
fd - > fileversion = atoi ( num ) ;
}
}
}
static int read_file_dna ( FileData * fd )
{
BHead * bhead ;
2012-05-17 12:59:34 +00:00
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > code = = DNA1 ) {
2013-02-22 13:35:32 +00:00
const bool do_endian_swap = ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) ! = 0 ;
2012-05-17 12:59:34 +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 ) {
2012-05-17 12:59:34 +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) */
2012-05-17 12:59:34 +00:00
fd - > id_name_offs = DNA_elem_offset ( fd - > filesdna , " ID " , " char " , " name[] " ) ;
2007-04-28 16:15:00 +00:00
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return 1 ;
2012-03-24 06:18:31 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( bhead - > code = = ENDB )
2002-10-12 11:37:38 +00:00
break ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return 0 ;
}
2006-11-26 21:17:15 +00:00
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.
Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.
Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.
This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.
Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.
Reviewers: sergey, campbellbarton
Subscribers: Severin, psy-fi
Differential Revision: https://developer.blender.org/D1469
2015-08-27 15:53:23 +02:00
static int * read_file_thumbnail ( FileData * fd )
{
BHead * bhead ;
int * blend_thumb = NULL ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > code = = TEST ) {
const bool do_endian_swap = ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) ! = 0 ;
int * data = ( int * ) ( bhead + 1 ) ;
if ( bhead - > len < ( 2 * sizeof ( int ) ) ) {
break ;
}
if ( do_endian_swap ) {
BLI_endian_switch_int32 ( & data [ 0 ] ) ;
BLI_endian_switch_int32 ( & data [ 1 ] ) ;
}
if ( bhead - > len < BLEN_THUMB_MEMSIZE_FILE ( data [ 0 ] , data [ 1 ] ) ) {
break ;
}
blend_thumb = data ;
break ;
}
else if ( bhead - > code ! = REND ) {
/* Thumbnail is stored in TEST immediately after first REND... */
break ;
}
}
return blend_thumb ;
}
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 ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( readsize < 0 ) {
readsize = EOF ;
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
filedata - > seek + = readsize ;
}
2012-05-17 12:59:34 +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 ) ;
2012-05-17 12:59:34 +00:00
Patch provided by Shaul Kedem: Compressed files are back!
He even made a nice doc in wiki:
http://wiki.blender.org/bin/view.pl/Blenderdev/Blendgz
Usage: set the option "Compress File" in the main "File" pulldown menu.
This setting is a user-def, meaning it is not changed on reading files.
If you want it default, save it with CTRL+U.
The longest debate went over the file naming convention. Shaul started
with .blend.gz files, which gave issues in Blender because of the code
hanging out everywhere that detects blender files, and that appends the
.blend extension if needed.
Daniel Dunbar proposed to just save it as .blend, and not bother users
with such details. This is indeed the most elegant solution, with as
only drawback that old Blender executables cannot read it.
This drawback isn't very relevant at the moment, since we're heading
towards a release that isn't upward compatible anyway... the recode
going on on Meshes, Modfiers, Armatures, Poses, Actions, NLA already
have upward compatibility issues.
We might check - during the next month(s) - on a builtin system to
warn users in the future when we change things that make a file risky
to read in an older release.
2005-07-27 19:46:06 +00:00
if ( readsize < 0 ) {
readsize = EOF ;
2012-03-24 06:18:31 +00:00
}
else {
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
filedata - > seek + = readsize ;
}
2012-05-17 12:59:34 +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
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
{
2012-05-17 12:59:34 +00:00
/* don't read more bytes then there are available in the buffer */
2010-10-19 22:17:34 +00:00
int readsize = ( int ) MIN2 ( size , ( unsigned int ) ( filedata - > buffersize - filedata - > seek ) ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
memcpy ( buffer , filedata - > buffer + filedata - > seek , readsize ) ;
filedata - > seek + = readsize ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
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
{
2012-05-17 12:59:34 +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
2012-05-17 12:59:34 +00:00
if ( size = = 0 ) return 0 ;
2004-09-05 13:43:51 +00:00
2012-03-24 06:18:31 +00:00
if ( seek ! = ( unsigned int ) filedata - > seek ) {
2012-05-17 12:59:34 +00:00
chunk = filedata - > memfile - > chunks . first ;
seek = 0 ;
2004-09-05 13:43:51 +00:00
2012-03-24 07:52:14 +00:00
while ( chunk ) {
2012-03-24 06:18:31 +00:00
if ( seek + chunk - > size > ( unsigned ) filedata - > seek ) break ;
2012-05-17 12:59:34 +00:00
seek + = chunk - > size ;
chunk = chunk - > next ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
offset = seek ;
seek = filedata - > seek ;
2004-09-05 13:43:51 +00:00
}
2012-03-24 06:18:31 +00:00
if ( chunk ) {
2012-05-17 12:59:34 +00:00
totread = 0 ;
2008-03-05 15:13:41 +00:00
do {
/* first check if it's on the end if current chunk */
2012-03-24 06:18:31 +00:00
if ( seek - offset = = chunk - > size ) {
2012-05-17 12:59:34 +00:00
offset + = chunk - > size ;
chunk = chunk - > next ;
2008-03-05 15:13:41 +00:00
}
2012-05-17 12:59:34 +00:00
2008-03-05 15:13:41 +00:00
/* debug, should never happen */
2012-05-17 12:59:34 +00:00
if ( chunk = = NULL ) {
2008-03-05 15:13:41 +00:00
printf ( " illegal read, chunk zero \n " ) ;
return 0 ;
}
2012-05-17 12:59:34 +00:00
chunkoffset = seek - offset ;
readsize = size - totread ;
2008-03-05 15:13:41 +00:00
/* data can be spread over multiple chunks, so clamp size
* to within this chunk , and then it will read further in
* the next chunk */
2012-03-24 06:18:31 +00:00
if ( chunkoffset + readsize > chunk - > size )
2008-03-05 15:13:41 +00:00
readsize = chunk - > size - chunkoffset ;
2012-05-17 12:59:34 +00:00
2015-03-10 23:40:39 +11:00
memcpy ( POINTER_OFFSET ( buffer , totread ) , chunk - > buf + chunkoffset , readsize ) ;
2008-03-05 15:13:41 +00:00
totread + = readsize ;
filedata - > seek + = readsize ;
seek + = readsize ;
2012-03-24 07:52:14 +00:00
} 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
}
2012-05-17 12:59:34 +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 " ) ;
2012-05-17 12:59:34 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2013-02-22 13:35:32 +00:00
/* XXX, this doesn't need to be done all the time,
* but it keeps us re - entrant , remove once we have
* a lib that provides a nice lock . - zr
*/
fd - > memsdna = DNA_sdna_from_data ( DNAstr , DNAlen , false ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
fd - > datamap = oldnewmap_new ( ) ;
fd - > globmap = oldnewmap_new ( ) ;
fd - > libmap = oldnewmap_new ( ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2005-07-25 18:35:49 +00:00
if ( fd - > flags & FD_FLAGS_FILE_OK ) {
if ( ! read_file_dna ( fd ) ) {
2012-10-19 16:43:10 +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 ) ;
2012-05-17 12:59:34 +00:00
fd = NULL ;
2005-07-25 18:35:49 +00:00
}
2012-12-11 22:00:22 +00:00
}
2006-11-26 21:17:15 +00:00
else {
2012-10-19 16:43:10 +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 ) ;
2012-05-17 12:59:34 +00:00
fd = NULL ;
2005-07-25 18:35:49 +00:00
}
2012-05-17 12:59:34 +00:00
2005-07-25 18:35:49 +00:00
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 */
2011-05-18 06:27:32 +00:00
FileData * blo_openblenderfile ( const char * filepath , 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 ;
2012-05-17 12:59:34 +00:00
errno = 0 ;
gzfile = BLI_gzopen ( filepath , " rb " ) ;
2011-02-13 10:52:18 +00:00
if ( gzfile = = ( gzFile ) Z_NULL ) {
2012-10-19 16:43:10 +00:00
BKE_reportf ( reports , RPT_WARNING , " Unable to open '%s': %s " ,
2012-10-26 17:32:50 +00:00
filepath , errno ? strerror ( errno ) : TIP_ ( " unknown error reading file " ) ) ;
2002-10-12 11:37:38 +00:00
return NULL ;
2012-03-24 06:18:31 +00:00
}
else {
2002-10-12 11:37:38 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2008-09-11 13:00:54 +00:00
/* needed for library_append and read_libraries */
2011-05-18 06:27:32 +00:00
BLI_strncpy ( fd - > relabase , filepath , sizeof ( fd - > relabase ) ) ;
2012-05-17 12:59:34 +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
}
}
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.
Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.
Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.
This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.
Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.
Reviewers: sergey, campbellbarton
Subscribers: Severin, psy-fi
Differential Revision: https://developer.blender.org/D1469
2015-08-27 15:53:23 +02:00
/**
* Same as blo_openblenderfile ( ) , but does not reads DNA data , only header . Use it for light access
* ( e . g . thumbnail reading ) .
*/
static FileData * blo_openblenderfile_minimal ( const char * filepath )
{
gzFile gzfile ;
errno = 0 ;
gzfile = BLI_gzopen ( filepath , " rb " ) ;
if ( gzfile ! = ( gzFile ) Z_NULL ) {
FileData * fd = filedata_new ( ) ;
fd - > gzfiledes = gzfile ;
fd - > read = fd_read_gzip_from_file ;
decode_blender_header ( fd ) ;
if ( fd - > flags & FD_FLAGS_FILE_OK ) {
return fd ;
}
blo_freefiledata ( fd ) ;
}
return NULL ;
}
2012-12-27 15:07:19 +00:00
static int fd_read_gzip_from_memory ( FileData * filedata , void * buffer , unsigned int size )
{
int err ;
2012-12-29 01:54:58 +00:00
2012-12-27 15:07:19 +00:00
filedata - > strm . next_out = ( Bytef * ) buffer ;
2012-12-29 01:54:58 +00:00
filedata - > strm . avail_out = size ;
// Inflate another chunk.
err = inflate ( & filedata - > strm , Z_SYNC_FLUSH ) ;
if ( err = = Z_STREAM_END ) {
2012-12-27 15:07:19 +00:00
return 0 ;
}
2013-03-24 12:13:13 +00:00
else if ( err ! = Z_OK ) {
2012-12-27 15:07:19 +00:00
printf ( " fd_read_gzip_from_memory: zlib error \n " ) ;
return 0 ;
2012-12-29 01:54:58 +00:00
}
2012-12-27 15:07:19 +00:00
filedata - > seek + = size ;
2012-12-29 01:54:58 +00:00
2012-12-27 15:07:19 +00:00
return ( size ) ;
}
static int fd_read_gzip_from_memory_init ( FileData * fd )
{
fd - > strm . next_in = ( Bytef * ) fd - > buffer ;
fd - > strm . avail_in = fd - > buffersize ;
fd - > strm . total_out = 0 ;
fd - > strm . zalloc = Z_NULL ;
fd - > strm . zfree = Z_NULL ;
if ( inflateInit2 ( & fd - > strm , ( 16 + MAX_WBITS ) ) ! = Z_OK )
return 0 ;
fd - > read = fd_read_gzip_from_memory ;
return 1 ;
}
2013-03-17 19:13:04 +00:00
FileData * blo_openblendermemory ( const void * mem , int memsize , ReportList * reports )
2002-10-12 11:37:38 +00:00
{
if ( ! mem | | memsize < SIZEOFBLENDERHEADER ) {
2012-10-19 16:43:10 +00:00
BKE_report ( reports , RPT_WARNING , ( mem ) ? TIP_ ( " Unable to read " ) : TIP_ ( " Unable to open " ) ) ;
2002-10-12 11:37:38 +00:00
return NULL ;
2012-03-24 06:18:31 +00:00
}
else {
2012-05-17 12:59:34 +00:00
FileData * fd = filedata_new ( ) ;
2013-03-17 19:13:04 +00:00
const char * cp = mem ;
2012-12-27 15:07:19 +00:00
2012-05-17 12:59:34 +00:00
fd - > buffer = mem ;
fd - > buffersize = memsize ;
2012-12-27 15:07:19 +00:00
/* test if gzip */
if ( cp [ 0 ] = = 0x1f & & cp [ 1 ] = = 0x8b ) {
if ( 0 = = fd_read_gzip_from_memory_init ( fd ) ) {
blo_freefiledata ( fd ) ;
return NULL ;
}
}
else
2013-03-26 09:59:43 +00:00
fd - > read = fd_read_from_memory ;
2012-12-27 15:07:19 +00:00
2012-05-17 12:59:34 +00:00
fd - > flags | = FD_FLAGS_NOT_MY_BUFFER ;
2013-03-26 09:59:43 +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 ) {
2012-09-30 10:45:37 +00:00
BKE_report ( reports , RPT_WARNING , " Unable to open blend <memory> " ) ;
2004-09-05 13:43:51 +00:00
return NULL ;
2012-03-24 06:18:31 +00:00
}
else {
2012-05-17 12:59:34 +00:00
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 ) {
if ( fd - > filedes ! = - 1 ) {
close ( fd - > filedes ) ;
}
2012-05-17 12:59:34 +00:00
2012-04-28 06:31:57 +00:00
if ( fd - > gzfiledes ! = NULL ) {
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
gzclose ( fd - > gzfiledes ) ;
}
2012-05-17 12:59:34 +00:00
2012-12-27 15:07:19 +00:00
if ( fd - > strm . next_in ) {
if ( inflateEnd ( & fd - > strm ) ! = Z_OK ) {
printf ( " close gzip stream error \n " ) ;
}
}
2002-10-12 11:37:38 +00:00
if ( fd - > buffer & & ! ( fd - > flags & FD_FLAGS_NOT_MY_BUFFER ) ) {
2013-03-17 19:13:04 +00:00
MEM_freeN ( ( void * ) fd - > buffer ) ;
2011-02-13 10:52:18 +00:00
fd - > buffer = NULL ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
// Free all BHeadN data blocks
BLI_freelistN ( & fd - > listbase ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
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 ) ;
2011-11-07 12:55:18 +00:00
if ( fd - > movieclipmap )
oldnewmap_free ( fd - > movieclipmap ) ;
2014-11-24 18:18:35 +01:00
if ( fd - > soundmap )
oldnewmap_free ( fd - > soundmap ) ;
2012-12-27 17:09:27 +00:00
if ( fd - > packedmap )
oldnewmap_free ( fd - > packedmap ) ;
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 ) ;
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
if ( fd - > bhead_idname_hash ) {
BLI_ghash_free ( fd - > bhead_idname_hash , NULL , NULL ) ;
}
# endif
2002-10-12 11:37:38 +00:00
MEM_freeN ( fd ) ;
}
}
/* ************ DIV ****************** */
2015-10-12 14:21:34 +02:00
/**
* Check whether given path ends with a blend file compatible extension ( . blend , . ble or . blend . gz ) .
*
* \ param str The path to check .
* \ return true is this path ends with a blender file extension .
*/
2014-01-31 03:09:01 +11:00
bool BLO_has_bfile_extension ( const char * str )
2002-10-12 11:37:38 +00:00
{
2014-01-31 03:09:01 +11:00
const char * ext_test [ 4 ] = { " .blend " , " .ble " , " .blend.gz " , NULL } ;
return BLI_testextensie_array ( str , ext_test ) ;
2002-10-12 11:37:38 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Try to explode given path into its ' library components ' ( i . e . a . blend file , id type / group , and datablock itself ) .
*
* \ param path the full path to explode .
* \ param r_dir the string that ' ll contain path up to blend file itself ( ' library ' path ) .
* \ param r_group the string that ' ll contain ' group ' part of the path , if any . May be NULL .
* \ param r_name the string that ' ll contain data ' s name part of the path , if any . May be NULL .
* \ return true if path contains a blend file .
*/
2015-08-18 13:18:50 +02:00
bool BLO_library_path_explode ( const char * path , char * r_dir , char * * r_group , char * * r_name )
2009-09-12 19:54:39 +00:00
{
2015-08-18 13:18:50 +02:00
/* We might get some data names with slashes, so we have to go up in path until we find blend file itself,
* then we now next path item is group , and everything else is data name . */
char * slash = NULL , * prev_slash = NULL , c = ' \0 ' ;
2014-11-10 18:51:56 +01:00
2015-08-18 13:18:50 +02:00
r_dir [ 0 ] = ' \0 ' ;
if ( r_group ) {
* r_group = NULL ;
}
if ( r_name ) {
* r_name = NULL ;
}
/* if path leads to an existing directory, we can be sure we're not (in) a library */
if ( BLI_is_dir ( path ) ) {
return false ;
}
strcpy ( r_dir , path ) ;
2009-09-12 19:54:39 +00:00
2015-08-18 13:18:50 +02:00
while ( ( slash = ( char * ) BLI_last_slash ( r_dir ) ) ) {
char tc = * slash ;
* slash = ' \0 ' ;
if ( BLO_has_bfile_extension ( r_dir ) ) {
break ;
}
2009-09-12 19:54:39 +00:00
2015-08-18 13:18:50 +02:00
if ( prev_slash ) {
* prev_slash = c ;
}
prev_slash = slash ;
c = tc ;
2009-09-12 19:54:39 +00:00
}
2015-08-18 13:18:50 +02:00
if ( ! slash ) {
return false ;
2009-09-12 19:54:39 +00:00
}
2015-08-18 13:18:50 +02:00
if ( slash [ 1 ] ! = ' \0 ' ) {
BLI_assert ( strlen ( slash + 1 ) < BLO_GROUP_MAX ) ;
if ( r_group ) {
* r_group = slash + 1 ;
}
}
if ( prev_slash & & ( prev_slash [ 1 ] ! = ' \0 ' ) ) {
BLI_assert ( strlen ( prev_slash + 1 ) < MAX_ID_NAME - 2 ) ;
if ( r_name ) {
* r_name = prev_slash + 1 ;
}
}
return true ;
2009-09-12 19:54:39 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Does a very light reading of given . blend file to extract its stored thumbnail .
*
* \ param filepath The path of the file to extract thumbnail from .
* \ return The raw thumbnail
* ( MEM - allocated , as stored in file , use BKE_main_thumbnail_to_imbuf ( ) to convert it to ImBuf image ) .
*/
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.
Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.
Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.
This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.
Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.
Reviewers: sergey, campbellbarton
Subscribers: Severin, psy-fi
Differential Revision: https://developer.blender.org/D1469
2015-08-27 15:53:23 +02:00
BlendThumbnail * BLO_thumbnail_from_file ( const char * filepath )
{
FileData * fd ;
BlendThumbnail * data ;
int * fd_data ;
fd = blo_openblenderfile_minimal ( filepath ) ;
fd_data = fd ? read_file_thumbnail ( fd ) : NULL ;
if ( fd_data ) {
const size_t sz = BLEN_THUMB_MEMSIZE ( fd_data [ 0 ] , fd_data [ 1 ] ) ;
data = MEM_mallocN ( sz , __func__ ) ;
BLI_assert ( ( sz - sizeof ( * data ) ) = = ( BLEN_THUMB_MEMSIZE_FILE ( fd_data [ 0 ] , fd_data [ 1 ] ) - ( sizeof ( * fd_data ) * 2 ) ) ) ;
data - > width = fd_data [ 0 ] ;
data - > height = fd_data [ 1 ] ;
memcpy ( data - > rect , & fd_data [ 2 ] , sz - sizeof ( * data ) ) ;
}
else {
data = NULL ;
}
blo_freefiledata ( fd ) ;
return data ;
}
2002-10-12 11:37:38 +00:00
/* ************** OLD POINTERS ******************* */
static void * newdataadr ( FileData * fd , void * adr ) /* only direct databocks */
{
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > datamap , adr , true ) ;
}
2015-08-08 22:17:03 +02:00
/* This is a special version of newdataadr() which allows us to keep lasthit of
* map unchanged . In certain cases this makes file loading time significantly
* faster .
*
* Use this function in cases like restoring pointer from one list element to
* another list element , but keep lasthit value so we can continue restoring
* pointers efficiently .
*
* Example of this could be found in direct_link_fcurves ( ) which restores the
* fcurve group pointer and keeps lasthit optimal for linking all further
* fcurves .
*/
static void * newdataadr_ex ( FileData * fd , void * adr , bool increase_lasthit ) /* only direct databocks */
{
if ( increase_lasthit ) {
return newdataadr ( fd , adr ) ;
}
else {
int lasthit = fd - > datamap - > lasthit ;
void * newadr = newdataadr ( fd , adr ) ;
fd - > datamap - > lasthit = lasthit ;
return newadr ;
}
}
2013-08-07 19:29:15 +00:00
static void * newdataadr_no_us ( FileData * fd , void * adr ) /* only direct databocks */
{
return oldnewmap_lookup_and_inc ( fd - > datamap , adr , false ) ;
2002-10-12 11:37:38 +00:00
}
2013-03-26 09:59:43 +00:00
static void * newglobadr ( FileData * fd , void * adr ) /* direct datablocks with global linking */
2002-10-12 11:37:38 +00:00
{
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > globmap , adr , true ) ;
2002-10-12 11:37:38 +00:00
}
2013-03-26 09:59:43 +00:00
static void * newimaadr ( FileData * fd , void * adr ) /* used to restore image data after undo */
2006-11-10 10:17:04 +00:00
{
2012-03-24 06:18:31 +00:00
if ( fd - > imamap & & adr )
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > imamap , adr , true ) ;
2006-11-10 10:17:04 +00:00
return NULL ;
}
2013-03-26 09:59:43 +00:00
static void * newmclipadr ( FileData * fd , void * adr ) /* used to restore movie clip data after undo */
2011-11-07 12:55:18 +00:00
{
2012-03-24 06:18:31 +00:00
if ( fd - > movieclipmap & & adr )
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > movieclipmap , adr , true ) ;
2011-11-07 12:55:18 +00:00
return NULL ;
}
2014-11-24 18:18:35 +01:00
static void * newsoundadr ( FileData * fd , void * adr ) /* used to restore sound data after undo */
{
if ( fd - > soundmap & & adr )
return oldnewmap_lookup_and_inc ( fd - > soundmap , adr , true ) ;
return NULL ;
}
2012-12-27 15:07:19 +00:00
static void * newpackedadr ( FileData * fd , void * adr ) /* used to restore packed data after undo */
{
if ( fd - > packedmap & & adr )
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > packedmap , adr , true ) ;
2013-03-26 09:59:43 +00:00
2013-08-07 19:29:15 +00:00
return oldnewmap_lookup_and_inc ( fd - > datamap , adr , true ) ;
2012-12-27 15:07:19 +00:00
}
2006-11-10 10:17:04 +00:00
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
}
2012-05-04 15:42:49 +00:00
void * blo_do_versions_newlibadr ( FileData * fd , void * lib , void * adr ) /* only lib data */
{
return newlibadr ( fd , lib , adr ) ;
}
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
{
2012-05-17 12:59:34 +00:00
ID * id = newlibadr ( fd , lib , adr ) ;
2012-03-24 06:18:31 +00:00
if ( id )
2002-10-12 11:37:38 +00:00
id - > us + + ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return id ;
}
2012-05-04 15:42:49 +00:00
void * blo_do_versions_newlibadr_us ( FileData * fd , void * lib , void * adr ) /* increases user number */
{
return newlibadr_us ( fd , lib , adr ) ;
}
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
2012-05-17 12:59:34 +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 ) {
2012-05-17 12:59:34 +00:00
entry - > newp = new ;
if ( new ) entry - > nr = GS ( ( ( ID * ) new ) - > name ) ;
2002-10-12 11:37:38 +00:00
}
}
}
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
2012-05-17 12:59:34 +00:00
for ( mainptr = mainlist - > first ; mainptr ; mainptr = mainptr - > next ) {
2005-12-16 17:35:38 +00:00
FileData * fd ;
2012-05-17 12:59:34 +00:00
if ( mainptr - > curlib )
fd = mainptr - > curlib - > filedata ;
else
fd = basefd ;
2005-12-16 17:35:38 +00:00
2012-03-24 06:18:31 +00:00
if ( fd ) {
2005-12-16 17:35:38 +00:00
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
{
2012-05-17 12:59:34 +00:00
Object * ob = oldmain - > object . first ;
2008-11-02 00:25:39 +00:00
2012-05-17 12:59:34 +00:00
for ( ; ob ; ob = ob - > id . next ) {
2012-03-24 06:18:31 +00:00
if ( ob - > id . lib )
2012-05-17 12:59:34 +00:00
ob - > proxy_from = NULL ;
}
2008-11-02 00:25:39 +00:00
}
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
{
2012-05-17 12:59:34 +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
2012-05-17 12:59:34 +00:00
fd - > imamap = oldnewmap_new ( ) ;
2006-11-10 10:17:04 +00:00
2012-05-21 06:33:32 +00:00
for ( ; ima ; ima = ima - > id . next ) {
2013-12-13 16:22:08 +06:00
if ( ima - > cache )
oldnewmap_insert ( fd - > imamap , ima - > cache , ima - > cache , 0 ) ;
2012-03-24 06:18:31 +00:00
if ( ima - > gputexture )
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
oldnewmap_insert ( fd - > imamap , ima - > gputexture , ima - > gputexture , 0 ) ;
2013-04-22 10:08:58 +00:00
if ( ima - > rr )
oldnewmap_insert ( fd - > imamap , ima - > rr , ima - > rr , 0 ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < IMA_MAX_RENDER_SLOT ; a + + )
2012-03-24 06:18:31 +00:00
if ( ima - > renders [ a ] )
2010-03-27 15:35:34 +00:00
oldnewmap_insert ( fd - > imamap , ima - > renders [ a ] , ima - > renders [ a ] , 0 ) ;
2006-11-10 10:17:04 +00:00
}
2012-05-21 06:33:32 +00:00
for ( ; sce ; sce = sce - > id . next ) {
2013-03-18 16:34:57 +00:00
if ( sce - > nodetree & & sce - > nodetree - > previews ) {
bNodeInstanceHashIterator iter ;
NODE_INSTANCE_HASH_ITER ( iter , sce - > nodetree - > previews ) {
bNodePreview * preview = BKE_node_instance_hash_iterator_get_value ( & iter ) ;
oldnewmap_insert ( fd - > imamap , preview , preview , 0 ) ;
}
2006-11-18 13:25:42 +00:00
}
}
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
{
2012-05-17 12:59:34 +00:00
OldNew * entry = fd - > imamap - > entries ;
Image * ima = oldmain - > image . first ;
Scene * sce = oldmain - > scene . first ;
2011-03-10 17:34:27 +00:00
int i ;
2006-11-10 10:17:04 +00:00
/* used entries were restored, so we put them to zero */
2012-05-21 06:33:32 +00:00
for ( i = 0 ; i < fd - > imamap - > nentries ; i + + , entry + + ) {
2012-05-17 12:59:34 +00:00
if ( entry - > nr > 0 )
entry - > newp = NULL ;
2006-11-10 10:17:04 +00:00
}
2012-05-21 06:33:32 +00:00
for ( ; ima ; ima = ima - > id . next ) {
2013-12-26 16:34:57 +06:00
ima - > cache = newimaadr ( fd , ima - > cache ) ;
if ( ima - > cache = = NULL ) {
ima - > bindcode = 0 ;
ima - > tpageflag & = ~ IMA_GLBIND_IS_DATA ;
ima - > gputexture = NULL ;
ima - > rr = NULL ;
}
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < IMA_MAX_RENDER_SLOT ; i + + )
ima - > renders [ i ] = newimaadr ( fd , ima - > renders [ i ] ) ;
ima - > gputexture = newimaadr ( fd , ima - > gputexture ) ;
2013-04-22 10:08:58 +00:00
ima - > rr = newimaadr ( fd , ima - > rr ) ;
2006-11-10 10:17:04 +00:00
}
2012-05-17 12:59:34 +00:00
for ( ; sce ; sce = sce - > id . next ) {
2013-03-18 16:34:57 +00:00
if ( sce - > nodetree & & sce - > nodetree - > previews ) {
bNodeInstanceHash * new_previews = BKE_node_instance_hash_new ( " node previews " ) ;
bNodeInstanceHashIterator iter ;
/* reconstruct the preview hash, only using remaining pointers */
NODE_INSTANCE_HASH_ITER ( iter , sce - > nodetree - > previews ) {
bNodePreview * preview = BKE_node_instance_hash_iterator_get_value ( & iter ) ;
if ( preview ) {
bNodePreview * new_preview = newimaadr ( fd , preview ) ;
if ( new_preview ) {
bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key ( & iter ) ;
BKE_node_instance_hash_insert ( new_previews , key , new_preview ) ;
}
}
}
BKE_node_instance_hash_free ( sce - > nodetree - > previews , NULL ) ;
sce - > nodetree - > previews = new_previews ;
2006-11-18 13:25:42 +00:00
}
}
2006-11-10 10:17:04 +00:00
}
2011-11-07 12:55:18 +00:00
void blo_make_movieclip_pointer_map ( FileData * fd , Main * oldmain )
{
2012-05-17 12:59:34 +00:00
MovieClip * clip = oldmain - > movieclip . first ;
Scene * sce = oldmain - > scene . first ;
fd - > movieclipmap = oldnewmap_new ( ) ;
2012-05-21 06:33:32 +00:00
for ( ; clip ; clip = clip - > id . next ) {
2012-03-24 06:18:31 +00:00
if ( clip - > cache )
2011-11-07 12:55:18 +00:00
oldnewmap_insert ( fd - > movieclipmap , clip - > cache , clip - > cache , 0 ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( clip - > tracking . camera . intrinsics )
2011-11-07 12:55:18 +00:00
oldnewmap_insert ( fd - > movieclipmap , clip - > tracking . camera . intrinsics , clip - > tracking . camera . intrinsics , 0 ) ;
}
2012-05-17 12:59:34 +00:00
for ( ; sce ; sce = sce - > id . next ) {
2012-03-24 06:18:31 +00:00
if ( sce - > nodetree ) {
2011-11-07 12:56:05 +00:00
bNode * node ;
2013-03-18 18:25:05 +00:00
for ( node = sce - > nodetree - > nodes . first ; node ; node = node - > next )
2012-05-17 12:59:34 +00:00
if ( node - > type = = CMP_NODE_MOVIEDISTORTION )
2011-11-07 12:56:05 +00:00
oldnewmap_insert ( fd - > movieclipmap , node - > storage , node - > storage , 0 ) ;
}
}
2011-11-07 12:55:18 +00:00
}
/* set old main movie clips caches to zero if it has been restored */
/* this works because freeing old main only happens after this call */
void blo_end_movieclip_pointer_map ( FileData * fd , Main * oldmain )
{
2012-05-17 12:59:34 +00:00
OldNew * entry = fd - > movieclipmap - > entries ;
MovieClip * clip = oldmain - > movieclip . first ;
Scene * sce = oldmain - > scene . first ;
2011-11-07 12:55:18 +00:00
int i ;
2012-05-17 12:59:34 +00:00
2011-11-07 12:55:18 +00:00
/* used entries were restored, so we put them to zero */
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < fd - > movieclipmap - > nentries ; i + + , entry + + ) {
if ( entry - > nr > 0 )
entry - > newp = NULL ;
2011-11-07 12:55:18 +00:00
}
2012-05-17 12:59:34 +00:00
for ( ; clip ; clip = clip - > id . next ) {
clip - > cache = newmclipadr ( fd , clip - > cache ) ;
clip - > tracking . camera . intrinsics = newmclipadr ( fd , clip - > tracking . camera . intrinsics ) ;
2011-11-07 12:55:18 +00:00
}
2012-05-17 12:59:34 +00:00
for ( ; sce ; sce = sce - > id . next ) {
2012-03-24 06:18:31 +00:00
if ( sce - > nodetree ) {
2011-11-07 12:56:05 +00:00
bNode * node ;
2012-05-17 12:59:34 +00:00
for ( node = sce - > nodetree - > nodes . first ; node ; node = node - > next )
if ( node - > type = = CMP_NODE_MOVIEDISTORTION )
node - > storage = newmclipadr ( fd , node - > storage ) ;
2011-11-07 12:56:05 +00:00
}
}
2011-11-07 12:55:18 +00:00
}
2014-11-24 18:18:35 +01:00
void blo_make_sound_pointer_map ( FileData * fd , Main * oldmain )
{
bSound * sound = oldmain - > sound . first ;
fd - > soundmap = oldnewmap_new ( ) ;
for ( ; sound ; sound = sound - > id . next ) {
if ( sound - > waveform )
oldnewmap_insert ( fd - > soundmap , sound - > waveform , sound - > waveform , 0 ) ;
}
}
/* set old main sound caches to zero if it has been restored */
/* this works because freeing old main only happens after this call */
void blo_end_sound_pointer_map ( FileData * fd , Main * oldmain )
{
OldNew * entry = fd - > soundmap - > entries ;
bSound * sound = oldmain - > sound . first ;
int i ;
/* used entries were restored, so we put them to zero */
for ( i = 0 ; i < fd - > soundmap - > nentries ; i + + , entry + + ) {
if ( entry - > nr > 0 )
entry - > newp = NULL ;
}
for ( ; sound ; sound = sound - > id . next ) {
sound - > waveform = newsoundadr ( fd , sound - > waveform ) ;
}
}
2013-01-13 12:25:56 +00:00
/* XXX disabled this feature - packed files also belong in temp saves and quit.blend, to make restore work */
2012-12-27 15:07:19 +00:00
static void insert_packedmap ( FileData * fd , PackedFile * pf )
{
oldnewmap_insert ( fd - > packedmap , pf , pf , 0 ) ;
oldnewmap_insert ( fd - > packedmap , pf - > data , pf - > data , 0 ) ;
}
void blo_make_packed_pointer_map ( FileData * fd , Main * oldmain )
{
Image * ima ;
VFont * vfont ;
bSound * sound ;
Library * lib ;
fd - > packedmap = oldnewmap_new ( ) ;
2015-04-06 10:40:12 -03:00
for ( ima = oldmain - > image . first ; ima ; ima = ima - > id . next ) {
ImagePackedFile * imapf ;
2015-05-31 18:28:28 +02:00
if ( ima - > packedfile )
insert_packedmap ( fd , ima - > packedfile ) ;
2015-04-06 10:40:12 -03:00
for ( imapf = ima - > packedfiles . first ; imapf ; imapf = imapf - > next )
if ( imapf - > packedfile )
insert_packedmap ( fd , imapf - > packedfile ) ;
}
2012-12-27 15:07:19 +00:00
for ( vfont = oldmain - > vfont . first ; vfont ; vfont = vfont - > id . next )
if ( vfont - > packedfile )
insert_packedmap ( fd , vfont - > packedfile ) ;
for ( sound = oldmain - > sound . first ; sound ; sound = sound - > id . next )
if ( sound - > packedfile )
insert_packedmap ( fd , sound - > packedfile ) ;
for ( lib = oldmain - > library . first ; lib ; lib = lib - > id . next )
if ( lib - > packedfile )
insert_packedmap ( fd , lib - > packedfile ) ;
}
/* set old main packed data to zero if it has been restored */
/* this works because freeing old main only happens after this call */
void blo_end_packed_pointer_map ( FileData * fd , Main * oldmain )
{
Image * ima ;
VFont * vfont ;
bSound * sound ;
Library * lib ;
OldNew * entry = fd - > packedmap - > entries ;
int i ;
/* used entries were restored, so we put them to zero */
for ( i = 0 ; i < fd - > packedmap - > nentries ; i + + , entry + + ) {
if ( entry - > nr > 0 )
entry - > newp = NULL ;
}
2015-04-06 10:40:12 -03:00
for ( ima = oldmain - > image . first ; ima ; ima = ima - > id . next ) {
ImagePackedFile * imapf ;
2015-05-31 18:28:28 +02:00
ima - > packedfile = newpackedadr ( fd , ima - > packedfile ) ;
2015-04-06 10:40:12 -03:00
for ( imapf = ima - > packedfiles . first ; imapf ; imapf = imapf - > next )
imapf - > packedfile = newpackedadr ( fd , imapf - > packedfile ) ;
}
2012-12-27 15:07:19 +00:00
for ( vfont = oldmain - > vfont . first ; vfont ; vfont = vfont - > id . next )
vfont - > packedfile = newpackedadr ( fd , vfont - > packedfile ) ;
for ( sound = oldmain - > sound . first ; sound ; sound = sound - > id . next )
sound - > packedfile = newpackedadr ( fd , sound - > packedfile ) ;
for ( lib = oldmain - > library . first ; lib ; lib = lib - > id . next )
lib - > packedfile = newpackedadr ( fd , lib - > packedfile ) ;
}
2011-11-07 12:55:18 +00:00
2006-11-25 13:07:28 +00:00
/* undo file support: add all library pointers in lookup */
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
void blo_add_library_pointer_map ( ListBase * old_mainlist , FileData * fd )
2006-11-25 13:07:28 +00:00
{
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
Main * ptr = old_mainlist - > first ;
2006-11-25 13:07:28 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
2012-05-17 12:59:34 +00:00
for ( ptr = ptr - > next ; ptr ; ptr = ptr - > next ) {
int i = set_listbasepointers ( ptr , lbarray ) ;
2012-03-24 07:52:14 +00:00
while ( i - - ) {
2006-11-25 13:07:28 +00:00
ID * id ;
2012-05-17 12:59:34 +00:00
for ( id = lbarray [ i ] - > first ; id ; id = id - > next )
2006-11-25 13:07:28 +00:00
oldnewmap_insert ( fd - > libmap , id , id , GS ( id - > name ) ) ;
}
}
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
fd - > old_mainlist = old_mainlist ;
2006-11-25 13:07:28 +00:00
}
2012-05-17 12:59:34 +00:00
2006-11-25 13:07:28 +00:00
2003-04-26 18:01:01 +00:00
/* ********** END OLD POINTERS ****************** */
2002-10-12 11:37:38 +00:00
/* ********** READ FILE ****************** */
static void switch_endian_structs ( struct SDNA * filesdna , BHead * bhead )
{
int blocksize , nblocks ;
char * data ;
2012-05-17 12:59:34 +00:00
data = ( char * ) ( bhead + 1 ) ;
blocksize = filesdna - > typelens [ filesdna - > structs [ bhead - > SDNAnr ] [ 0 ] ] ;
nblocks = bhead - > nr ;
2012-03-24 07:52:14 +00:00
while ( nblocks - - ) {
2008-10-31 23:50:02 +00:00
DNA_struct_switch_endian ( filesdna , bhead - > SDNAnr , data ) ;
2012-05-17 12:59:34 +00:00
data + = blocksize ;
2002-10-12 11:37:38 +00:00
}
}
2010-12-03 17:05:21 +00:00
static void * read_struct ( FileData * fd , BHead * bh , const char * blockname )
2002-10-12 11:37:38 +00:00
{
2012-05-17 12:59:34 +00:00
void * temp = NULL ;
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 ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( fd - > compflags [ bh - > SDNAnr ] ) { /* flag==0: doesn't exist anymore */
2012-05-17 12:59:34 +00:00
if ( fd - > compflags [ bh - > SDNAnr ] = = 2 ) {
temp = DNA_struct_reconstruct ( fd - > memsdna , fd - > filesdna , fd - > compflags , bh - > SDNAnr , bh - > nr , ( bh + 1 ) ) ;
2012-03-24 06:18:31 +00:00
}
else {
2012-05-17 12:59:34 +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
}
2015-08-08 19:50:11 +02:00
typedef void ( * link_list_cb ) ( FileData * fd , void * data ) ;
static void link_list_ex ( FileData * fd , ListBase * lb , link_list_cb callback ) /* only direct data */
2002-10-12 11:37:38 +00:00
{
Link * ln , * prev ;
2012-05-17 12:59:34 +00:00
2014-02-08 06:07:10 +11:00
if ( BLI_listbase_is_empty ( lb ) ) return ;
2012-05-17 12:59:34 +00:00
lb - > first = newdataadr ( fd , lb - > first ) ;
2015-08-08 19:50:11 +02:00
if ( callback ! = NULL ) {
callback ( fd , lb - > first ) ;
}
2012-05-17 12:59:34 +00:00
ln = lb - > first ;
prev = NULL ;
2012-03-24 07:52:14 +00:00
while ( ln ) {
2012-05-17 12:59:34 +00:00
ln - > next = newdataadr ( fd , ln - > next ) ;
2015-08-08 19:50:11 +02:00
if ( ln - > next ! = NULL & & callback ! = NULL ) {
callback ( fd , ln - > next ) ;
}
2012-05-17 12:59:34 +00:00
ln - > prev = prev ;
prev = ln ;
ln = ln - > next ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
lb - > last = prev ;
2002-10-12 11:37:38 +00:00
}
2015-08-08 19:50:11 +02:00
static void link_list ( FileData * fd , ListBase * lb ) /* only direct data */
{
link_list_ex ( fd , lb , NULL ) ;
}
2002-10-12 11:37:38 +00:00
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
2014-02-08 06:07:10 +11:00
if ( BLI_listbase_is_empty ( lb ) ) return ;
2012-05-17 12:59:34 +00:00
poin = newdataadr ( fd , lb - > first ) ;
2012-03-24 06:18:31 +00:00
if ( lb - > first ) {
2002-10-12 11:37:38 +00:00
oldnewmap_insert ( fd - > globmap , lb - > first , poin , 0 ) ;
}
2012-05-17 12:59:34 +00:00
lb - > first = poin ;
ln = lb - > first ;
prev = NULL ;
2012-03-24 07:52:14 +00:00
while ( ln ) {
2012-05-17 12:59:34 +00:00
poin = newdataadr ( fd , ln - > next ) ;
2012-03-24 06:18:31 +00:00
if ( ln - > next ) {
2002-10-12 11:37:38 +00:00
oldnewmap_insert ( fd - > globmap , ln - > next , poin , 0 ) ;
}
2012-05-17 12:59:34 +00:00
ln - > next = poin ;
ln - > prev = prev ;
prev = ln ;
ln = ln - > next ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
lb - > last = prev ;
2002-10-12 11:37:38 +00:00
}
static void test_pointer_array ( FileData * fd , void * * mat )
{
2012-09-03 07:37:38 +00:00
int64_t * lpoin , * lmat ;
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 .
*/
2012-03-24 06:18:31 +00:00
if ( * mat ) {
2012-05-17 12:59:34 +00:00
len = MEM_allocN_len ( * mat ) / fd - > filesdna - > pointerlen ;
2012-03-24 06:18:31 +00:00
if ( fd - > filesdna - > pointerlen = = 8 & & fd - > memsdna - > pointerlen = = 4 ) {
2012-05-17 12:59:34 +00:00
ipoin = imat = MEM_mallocN ( len * 4 , " newmatar " ) ;
2002-10-12 11:37:38 +00:00
lpoin = * mat ;
2012-05-17 12:59:34 +00:00
2012-03-24 07:52:14 +00:00
while ( len - - > 0 ) {
2012-03-24 06:18:31 +00:00
if ( ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) )
2012-09-03 07:37:38 +00:00
BLI_endian_switch_int64 ( lpoin ) ;
2012-05-17 12:59:34 +00:00
* ipoin = ( int ) ( ( * lpoin ) > > 3 ) ;
2002-10-12 11:37:38 +00:00
ipoin + + ;
lpoin + + ;
}
MEM_freeN ( * mat ) ;
2012-05-17 12:59:34 +00:00
* mat = imat ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( fd - > filesdna - > pointerlen = = 4 & & fd - > memsdna - > pointerlen = = 8 ) {
2012-05-17 12:59:34 +00:00
lpoin = lmat = MEM_mallocN ( len * 8 , " newmatar " ) ;
ipoin = * mat ;
2012-03-24 07:52:14 +00:00
while ( len - - > 0 ) {
2012-05-17 12:59:34 +00:00
* lpoin = * ipoin ;
2002-10-12 11:37:38 +00:00
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 ;
2012-05-17 12:59:34 +00:00
/* since we didn't save the extra buffer, set totallen to len */
2008-12-31 13:16:37 +00:00
prop - > totallen = prop - > len ;
prop - > data . pointer = newdataadr ( fd , prop - > data . pointer ) ;
2012-05-21 06:33:32 +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
2012-03-18 07:38:51 +00:00
* theres not really anything we can do to correct this , at least don ' t crash */
2012-05-17 12:59:34 +00:00
if ( array = = NULL ) {
prop - > len = 0 ;
prop - > totallen = 0 ;
2010-09-20 05:46:07 +00:00
}
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < prop - > len ; i + + )
2009-08-28 20:51:30 +00:00
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 ;
2012-05-17 12:59:34 +00:00
/* 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 ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( prop - > subtype = = IDP_GROUP ) {
2009-08-28 20:51:30 +00:00
test_pointer_array ( fd , prop - > data . pointer ) ;
2012-05-17 12:59:34 +00:00
array = prop - > data . pointer ;
for ( i = 0 ; i < prop - > len ; i + + )
2009-08-28 20:51:30 +00:00
IDP_DirectLinkProperty ( array [ i ] , switch_endian , fd ) ;
}
2012-03-24 06:18:31 +00:00
else if ( prop - > subtype = = IDP_DOUBLE ) {
2009-08-28 20:51:30 +00:00
if ( switch_endian ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_double_array ( prop - > data . pointer , prop - > len ) ;
2009-08-28 20:51:30 +00:00
}
}
else {
if ( switch_endian ) {
2012-09-03 09:03:25 +00:00
/* also used for floats */
BLI_endian_switch_int32_array ( prop - > data . pointer , prop - > len ) ;
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 ;
2012-05-17 12:59:34 +00:00
2006-11-17 04:46:48 +00:00
link_list ( fd , lb ) ;
2012-05-17 12:59:34 +00:00
2006-11-17 04:46:48 +00:00
/*Link child id properties now*/
for ( loop = prop - > data . group . first ; loop ; loop = loop - > next ) {
IDP_DirectLinkProperty ( loop , switch_endian , fd ) ;
}
}
2011-02-13 10:52:18 +00:00
static 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 :
2011-11-11 13:09:14 +00:00
/* 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
2012-04-22 11:54:53 +00:00
*
2011-11-11 13:09:14 +00:00
* 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 .
2008-07-24 19:22:17 +00:00
*/
if ( switch_endian ) {
2012-09-03 07:37:38 +00:00
BLI_endian_switch_int32 ( & prop - > data . val ) ;
BLI_endian_switch_int32 ( & prop - > data . val2 ) ;
BLI_endian_switch_int64 ( ( int64_t * ) & prop - > data . val ) ;
2008-07-24 19:22:17 +00:00
}
2006-11-17 04:46:48 +00:00
break ;
}
}
2013-09-30 13:44:16 +00:00
# define IDP_DirectLinkGroup_OrFree(prop, switch_endian, fd) \
_IDP_DirectLinkGroup_OrFree ( prop , switch_endian , fd , __func__ )
static void _IDP_DirectLinkGroup_OrFree ( IDProperty * * prop , int switch_endian , FileData * fd ,
const char * caller_func_id )
{
if ( * prop ) {
if ( ( * prop ) - > type = = IDP_GROUP ) {
IDP_DirectLinkGroup ( * prop , switch_endian , fd ) ;
}
else {
/* corrupt file! */
printf ( " %s: found non group data, freeing type %d! \n " ,
caller_func_id , ( * prop ) - > type ) ;
/* don't risk id, data's likely corrupt. */
// IDP_FreeProperty(*prop);
* prop = NULL ;
}
}
}
2012-05-17 12:59:34 +00:00
/* stub function */
2011-02-13 10:52:18 +00:00
static void IDP_LibLinkProperty ( IDProperty * UNUSED ( prop ) , int UNUSED ( switch_endian ) , FileData * UNUSED ( fd ) )
2006-11-17 04:46:48 +00:00
{
}
2015-08-10 15:41:28 +02:00
/* ************ READ IMAGE PREVIEW *************** */
static PreviewImage * direct_link_preview_image ( FileData * fd , PreviewImage * old_prv )
{
PreviewImage * prv = newdataadr ( fd , old_prv ) ;
if ( prv ) {
int i ;
for ( i = 0 ; i < NUM_ICON_SIZES ; + + i ) {
if ( prv - > rect [ i ] ) {
prv - > rect [ i ] = newdataadr ( fd , prv - > rect [ i ] ) ;
}
prv - > gputexture [ i ] = NULL ;
}
}
return prv ;
}
2012-10-23 12:38:47 +00:00
/* ************ READ ID *************** */
static void direct_link_id ( FileData * fd , ID * id )
{
/*link direct data of ID properties*/
if ( id - > properties ) {
id - > properties = newdataadr ( fd , id - > properties ) ;
2013-09-30 13:44:16 +00:00
/* this case means the data was written incorrectly, it should not happen */
IDP_DirectLinkGroup_OrFree ( & id - > properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2012-10-23 12:38:47 +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 ;
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < CM_TOT ; a + + ) {
2012-05-17 12:59:34 +00:00
cumap - > cm [ a ] . curve = newdataadr ( fd , cumap - > cm [ a ] . curve ) ;
cumap - > cm [ a ] . table = NULL ;
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 */
2012-05-21 06:33:32 +00:00
for ( brush = main - > brush . first ; brush ; brush = brush - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( brush - > id . flag & LIB_NEED_LINK ) {
brush - > id . flag - = LIB_NEED_LINK ;
2012-05-17 12:59:34 +00:00
brush - > mtex . tex = newlibadr_us ( fd , brush - > id . lib , brush - > mtex . tex ) ;
2013-03-25 01:00:16 +00:00
brush - > mask_mtex . tex = newlibadr_us ( fd , brush - > id . lib , brush - > mask_mtex . tex ) ;
2012-05-17 12:59:34 +00:00
brush - > clone . image = newlibadr_us ( fd , brush - > id . lib , brush - > clone . image ) ;
2014-07-21 12:02:05 +02:00
brush - > paint_curve = newlibadr_us ( fd , brush - > id . lib , brush - > paint_curve ) ;
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 */
2012-05-17 12:59:34 +00:00
brush - > curve = newdataadr ( fd , brush - > curve ) ;
2014-07-21 12:02:05 +02:00
brush - > gradient = newdataadr ( fd , brush - > gradient ) ;
2012-03-24 06:18:31 +00:00
if ( brush - > curve )
2009-01-07 04:38:30 +00:00
direct_link_curvemapping ( fd , brush - > curve ) ;
2009-02-22 19:31:25 +00:00
else
2012-05-05 00:58:22 +00:00
BKE_brush_curve_preset ( brush , CURVE_PRESET_SHARP ) ;
2010-07-20 19:39:07 +00:00
2012-05-17 12:59:34 +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
}
2014-07-21 12:02:05 +02:00
/* ************ READ Palette *************** */
static void lib_link_palette ( FileData * UNUSED ( fd ) , Main * main )
{
Palette * palette ;
/* only link ID pointers */
for ( palette = main - > palettes . first ; palette ; palette = palette - > id . next ) {
if ( palette - > id . flag & LIB_NEED_LINK ) {
palette - > id . flag - = LIB_NEED_LINK ;
}
}
}
static void direct_link_palette ( FileData * fd , Palette * palette )
{
/* palette itself has been read */
link_list ( fd , & palette - > colors ) ;
}
static void lib_link_paint_curve ( FileData * UNUSED ( fd ) , Main * main )
{
PaintCurve * pc ;
/* only link ID pointers */
for ( pc = main - > paintcurves . first ; pc ; pc = pc - > id . next ) {
if ( pc - > id . flag & LIB_NEED_LINK ) {
pc - > id . flag - = LIB_NEED_LINK ;
}
}
}
static void direct_link_paint_curve ( FileData * fd , PaintCurve * pc )
{
pc - > points = newdataadr ( fd , pc - > points ) ;
}
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 ;
2012-03-28 01:06:43 +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 )
{
2012-12-27 15:07:19 +00:00
PackedFile * pf = newpackedadr ( fd , oldpf ) ;
2015-06-01 13:09:45 +02:00
2002-10-12 11:37:38 +00:00
if ( pf ) {
2012-12-27 15:07:19 +00:00
pf - > data = newpackedadr ( fd , pf - > data ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
return pf ;
}
2009-01-19 02:26:46 +00:00
/* ************ READ ANIMATION STUFF ***************** */
/* Legacy Data Support (for Version Patching) ----------------------------- */
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
static void lib_link_ipo ( FileData * fd , Main * main )
{
Ipo * ipo ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( ipo = main - > ipo . first ; ipo ; ipo = ipo - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ipo - > id . flag & LIB_NEED_LINK ) {
2009-01-19 02:26:46 +00:00
IpoCurve * icu ;
2012-05-17 12:59:34 +00:00
for ( icu = ipo - > curve . first ; icu ; icu = icu - > next ) {
2012-03-24 06:18:31 +00:00
if ( icu - > driver )
2012-05-17 12:59:34 +00:00
icu - > driver - > ob = newlibadr ( fd , ipo - > id . lib , icu - > driver - > ob ) ;
2009-01-19 02:26:46 +00:00
}
2012-08-01 15:32:27 +00:00
ipo - > id . flag - = LIB_NEED_LINK ;
2009-01-19 02:26:46 +00:00
}
}
}
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
static void direct_link_ipo ( FileData * fd , Ipo * ipo )
{
IpoCurve * icu ;
link_list ( fd , & ( ipo - > curve ) ) ;
2012-05-21 06:33:32 +00:00
for ( icu = ipo - > curve . first ; icu ; icu = icu - > next ) {
2012-05-17 12:59:34 +00:00
icu - > bezt = newdataadr ( fd , icu - > bezt ) ;
icu - > bp = newdataadr ( fd , icu - > bp ) ;
icu - > driver = newdataadr ( fd , icu - > driver ) ;
2009-01-19 02:26:46 +00:00
}
}
2002-10-12 11:37:38 +00:00
2012-09-26 20:05:38 +00:00
// XXX deprecated - 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 ;
2012-03-24 06:18:31 +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 ) ;
2012-05-21 06:33:32 +00:00
for ( amod = strip - > modifiers . first ; amod ; amod = amod - > next )
2012-05-17 12:59:34 +00:00
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
}
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
static void direct_link_nlastrips ( FileData * fd , ListBase * strips )
{
bActionStrip * strip ;
link_list ( fd , strips ) ;
2012-05-21 06:33:32 +00:00
for ( strip = strips - > first ; strip ; strip = strip - > next )
2009-01-19 02:26:46 +00:00
link_list ( fd , & strip - > modifiers ) ;
}
2012-09-26 20:05:38 +00:00
// XXX deprecated - 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 ;
2012-03-24 06:18:31 +00:00
for ( chan = chanbase - > first ; chan ; chan = chan - > next ) {
2002-10-12 11:37:38 +00:00
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 ;
2012-05-17 12:59:34 +00:00
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
2009-05-22 11:19:35 +00:00
/* data for specific modifiers */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_PYTHON :
{
2012-05-17 12:59:34 +00:00
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
2009-05-22 11:19:35 +00:00
data - > script = newlibadr ( fd , id - > lib , data - > script ) ;
2015-07-18 19:02:39 +10:00
2009-05-22 11:19:35 +00:00
break ;
2015-07-18 19:02:39 +10:00
}
2009-05-22 11:19:35 +00:00
}
}
}
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... */
2012-05-17 12:59:34 +00:00
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
2009-01-19 02:26:46 +00:00
/* driver data */
if ( fcu - > driver ) {
2012-05-17 12:59:34 +00:00
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 )
2012-12-11 22:00:22 +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
/* only relink if still used */
if ( tarIndex < dvar - > num_targets )
2012-05-17 12:59:34 +00:00
dtar - > id = newlibadr ( fd , id - > lib , dtar - > id ) ;
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
else
2012-05-17 12:59:34 +00:00
dtar - > id = NULL ;
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
}
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 ;
2012-05-17 12:59:34 +00:00
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
2009-05-22 11:19:35 +00:00
/* relink general data */
2012-05-17 12:59:34 +00:00
fcm - > data = newdataadr ( fd , fcm - > data ) ;
2009-05-22 11:19:35 +00:00
/* do relinking of data for specific types */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_GENERATOR :
{
2012-05-17 12:59:34 +00:00
FMod_Generator * data = ( FMod_Generator * ) fcm - > data ;
data - > coefficients = newdataadr ( fd , data - > coefficients ) ;
2009-05-22 11:19:35 +00:00
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_float_array ( data - > coefficients , data - > arraysize ) ;
2011-06-01 13:10:37 +00:00
}
2015-07-18 19:02:39 +10:00
2009-05-22 11:19:35 +00:00
break ;
2015-07-18 19:02:39 +10:00
}
2009-05-22 11:19:35 +00:00
case FMODIFIER_TYPE_ENVELOPE :
{
2012-05-17 12:59:34 +00:00
FMod_Envelope * data = ( FMod_Envelope * ) fcm - > data ;
2009-05-22 11:19:35 +00:00
data - > data = newdataadr ( fd , data - > data ) ;
2015-07-18 19:02:39 +10:00
2009-05-22 11:19:35 +00:00
break ;
2015-07-18 19:02:39 +10:00
}
2009-05-22 11:19:35 +00:00
case FMODIFIER_TYPE_PYTHON :
{
2012-05-17 12:59:34 +00:00
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
2009-05-22 11:19:35 +00:00
data - > prop = newdataadr ( fd , data - > prop ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & data - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2015-07-18 19:02:39 +10:00
2009-05-22 11:19:35 +00:00
break ;
2015-07-18 19:02:39 +10:00
}
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) */
2012-05-17 12:59:34 +00:00
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
2009-01-19 02:26:46 +00:00
/* curve data */
2012-05-17 12:59:34 +00:00
fcu - > bezt = newdataadr ( fd , fcu - > bezt ) ;
fcu - > fpt = newdataadr ( fd , fcu - > fpt ) ;
2009-01-19 02:26:46 +00:00
/* rna path */
2012-05-17 12:59:34 +00:00
fcu - > rna_path = newdataadr ( fd , fcu - > rna_path ) ;
2009-01-19 02:26:46 +00:00
2009-01-20 11:07:42 +00:00
/* group */
2015-08-08 22:17:03 +02:00
fcu - > grp = newdataadr_ex ( fd , fcu - > grp , false ) ;
2009-01-20 11:07:42 +00:00
2012-07-23 12:10:02 +00:00
/* clear disabled flag - allows disabled drivers to be tried again ([#32155]),
* but also means that another method for " reviving disabled F-Curves " exists
*/
fcu - > flag & = ~ FCURVE_DISABLED ;
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 ;
2012-05-17 12:59:34 +00:00
2012-07-23 12:10:02 +00:00
/* compiled expression data will need to be regenerated (old pointer may still be set here) */
2012-05-17 12:59:34 +00:00
driver - > expr_comp = NULL ;
2009-01-19 02:26:46 +00:00
2012-07-23 12:10:02 +00:00
/* give the driver a fresh chance - the operating environment may be different now
* ( addons , etc . may be different ) so the driver namespace may be sane now [ # 32155 ]
*/
driver - > flag & = ~ DRIVER_FLAG_INVALID ;
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 )
2012-05-17 12:59:34 +00:00
dtar - > rna_path = newdataadr ( fd , dtar - > rna_path ) ;
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
else
2012-05-17 12:59:34 +00:00
dtar - > rna_path = NULL ;
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
}
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 ;
2012-05-21 06:33:32 +00:00
for ( act = main - > action . first ; act ; act = act - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( act - > id . flag & LIB_NEED_LINK ) {
act - > id . flag - = LIB_NEED_LINK ;
2009-01-19 02:26:46 +00:00
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system <<<
2009-01-19 02:26:46 +00:00
for ( chan = act - > chanbase . first ; chan ; chan = chan - > next ) {
2012-05-17 12:59:34 +00:00
chan - > ipo = newlibadr_us ( fd , act - > id . lib , chan - > ipo ) ;
2009-01-19 02:26:46 +00:00
lib_link_constraint_channels ( fd , & act - > id , & chan - > constraintChannels ) ;
}
2012-09-26 20:05:38 +00:00
// >>> XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
lib_link_fcurves ( fd , & act - > id , & act - > curves ) ;
}
}
}
static void direct_link_action ( FileData * fd , bAction * act )
{
2012-09-26 20:05:38 +00:00
bActionChannel * achan ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
bActionGroup * agrp ;
2009-01-22 10:53:22 +00:00
link_list ( fd , & act - > curves ) ;
2012-09-26 20:05:38 +00:00
link_list ( fd , & act - > chanbase ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
link_list ( fd , & act - > groups ) ;
link_list ( fd , & act - > markers ) ;
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system <<<
2009-01-19 02:26:46 +00:00
for ( achan = act - > chanbase . first ; achan ; achan = achan - > next ) {
2012-05-17 12:59:34 +00:00
achan - > grp = newdataadr ( fd , achan - > grp ) ;
2009-01-19 02:26:46 +00:00
link_list ( fd , & achan - > constraintChannels ) ;
}
2012-09-26 20:05:38 +00:00
// >>> XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
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 ;
2012-05-17 12:59:34 +00:00
for ( strip = list - > first ; strip ; strip = strip - > next ) {
2009-07-06 03:44:44 +00:00
/* 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 ) ;
2011-04-19 13:01:50 +00:00
/* fix action id-root (i.e. if it comes from a pre 2.57 .blend file) */
if ( ( strip - > act ) & & ( strip - > act - > idroot = = 0 ) )
strip - > act - > idroot = GS ( id - > name ) ;
2009-07-06 03:44:44 +00:00
}
}
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 */
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
for ( strip = list - > first ; strip ; strip = strip - > next ) {
2009-07-06 03:44:44 +00:00
/* 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 ) ;
2011-11-16 16:08:45 +00:00
direct_link_fmodifiers ( 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 ;
2012-05-17 12:59:34 +00:00
for ( nlt = list - > first ; nlt ; nlt = nlt - > next ) {
2009-05-22 11:19:35 +00:00
/* 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 */
2012-05-17 12:59:34 +00:00
for ( ks = list - > first ; ks ; ks = ks - > next ) {
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
2009-02-11 12:19:42 +00:00
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) */
2012-05-17 12:59:34 +00:00
for ( ks = list - > first ; ks ; ks = ks - > next ) {
2009-02-11 12:19:42 +00:00
/* paths */
link_list ( fd , & ks - > paths ) ;
2012-05-17 12:59:34 +00:00
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
2009-02-11 12:19:42 +00:00
/* 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
2011-04-19 13:01:50 +00:00
/* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */
if ( ( adt - > action ) & & ( adt - > action - > idroot = = 0 ) )
adt - > action - > idroot = GS ( id - > name ) ;
if ( ( adt - > tmpact ) & & ( adt - > tmpact - > idroot = = 0 ) )
adt - > tmpact - > idroot = GS ( id - > name ) ;
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
2015-04-14 17:10:04 +12:00
/* relink active track/strip - even though strictly speaking this should only be used
2010-11-05 00:09:45 +00:00
* 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...
2015-04-14 17:10:04 +12:00
adt - > act_track = newdataadr ( fd , adt - > act_track ) ;
2012-05-17 12:59:34 +00:00
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 */
2012-05-17 12:59:34 +00:00
mpath - > points = newdataadr ( fd , mpath - > points ) ;
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
}
2009-02-20 16:39:39 +00:00
/* ************ READ NODE TREE *************** */
2013-03-18 16:34:57 +00:00
static void lib_link_node_socket ( FileData * fd , ID * UNUSED ( id ) , bNodeSocket * sock )
{
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this . */
if ( sock - > prop )
IDP_LibLinkProperty ( sock - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
}
2009-02-20 16:39:39 +00:00
/* 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 ;
2013-03-18 16:34:57 +00:00
bNodeSocket * sock ;
2009-02-20 16:39:39 +00:00
2012-03-24 06:18:31 +00:00
if ( ntree - > adt ) lib_link_animdata ( fd , & ntree - > id , ntree - > adt ) ;
2009-02-20 16:39:39 +00:00
2012-05-17 12:59:34 +00:00
ntree - > gpd = newlibadr_us ( fd , id - > lib , ntree - > gpd ) ;
2009-11-11 08:12:54 +00:00
2013-03-18 16:34:57 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this . */
if ( node - > prop )
IDP_LibLinkProperty ( node - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
node - > id = newlibadr_us ( fd , id - > lib , node - > id ) ;
2013-03-18 18:25:05 +00:00
for ( sock = node - > inputs . first ; sock ; sock = sock - > next )
2013-03-18 16:34:57 +00:00
lib_link_node_socket ( fd , id , sock ) ;
2013-03-18 18:25:05 +00:00
for ( sock = node - > outputs . first ; sock ; sock = sock - > next )
2013-03-18 16:34:57 +00:00
lib_link_node_socket ( fd , id , sock ) ;
}
2013-03-18 18:25:05 +00:00
for ( sock = ntree - > inputs . first ; sock ; sock = sock - > next )
2013-03-18 16:34:57 +00:00
lib_link_node_socket ( fd , id , sock ) ;
2013-03-18 18:25:05 +00:00
for ( sock = ntree - > outputs . first ; sock ; sock = sock - > next )
2013-03-18 16:34:57 +00:00
lib_link_node_socket ( fd , id , sock ) ;
2009-02-20 16:39:39 +00:00
}
/* library ntree linking after fileread */
static void lib_link_nodetree ( FileData * fd , Main * main )
{
bNodeTree * ntree ;
/* only link ID pointers */
2012-05-21 06:33:32 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ntree - > id . flag & LIB_NEED_LINK ) {
ntree - > id . flag - = LIB_NEED_LINK ;
2009-02-20 16:39:39 +00:00
lib_link_ntree ( fd , & ntree - > id , ntree ) ;
}
}
}
2013-04-17 15:55:10 +00:00
/* get node tree stored locally in other IDs */
static bNodeTree * nodetree_from_id ( ID * id )
{
if ( ! id )
return NULL ;
switch ( GS ( id - > name ) ) {
case ID_SCE : return ( ( Scene * ) id ) - > nodetree ;
case ID_MA : return ( ( Material * ) id ) - > nodetree ;
case ID_WO : return ( ( World * ) id ) - > nodetree ;
case ID_LA : return ( ( Lamp * ) id ) - > nodetree ;
case ID_TE : return ( ( Tex * ) id ) - > nodetree ;
2014-05-03 18:51:53 +09:00
case ID_LS : return ( ( FreestyleLineStyle * ) id ) - > nodetree ;
2013-04-17 15:55:10 +00:00
}
return NULL ;
}
2013-03-18 16:34:57 +00:00
/* updates group node socket identifier so that
2011-02-21 18:18:37 +00:00
* external links to / from the group node are preserved .
*/
2011-09-05 21:01:50 +00:00
static void lib_node_do_versions_group_indices ( bNode * gnode )
2011-02-21 18:18:37 +00:00
{
2012-05-17 12:59:34 +00:00
bNodeTree * ngroup = ( bNodeTree * ) gnode - > id ;
2013-03-18 16:34:57 +00:00
bNodeSocket * sock ;
bNodeLink * link ;
2011-02-21 18:18:37 +00:00
2013-03-18 18:25:05 +00:00
for ( sock = gnode - > outputs . first ; sock ; sock = sock - > next ) {
2011-02-21 18:18:37 +00:00
int old_index = sock - > to_index ;
2013-03-18 16:34:57 +00:00
for ( link = ngroup - > links . first ; link ; link = link - > next ) {
2013-04-03 08:25:29 +00:00
if ( link - > tonode = = NULL & & link - > fromsock - > own_index = = old_index ) {
2013-03-18 16:34:57 +00:00
strcpy ( sock - > identifier , link - > fromsock - > identifier ) ;
/* deprecated */
sock - > own_index = link - > fromsock - > own_index ;
sock - > to_index = 0 ;
sock - > groupsock = NULL ;
2011-02-21 18:18:37 +00:00
}
}
}
2013-03-18 18:25:05 +00:00
for ( sock = gnode - > inputs . first ; sock ; sock = sock - > next ) {
2011-02-21 18:18:37 +00:00
int old_index = sock - > to_index ;
2013-03-18 16:34:57 +00:00
for ( link = ngroup - > links . first ; link ; link = link - > next ) {
2013-04-03 08:25:29 +00:00
if ( link - > fromnode = = NULL & & link - > tosock - > own_index = = old_index ) {
2013-03-18 16:34:57 +00:00
strcpy ( sock - > identifier , link - > tosock - > identifier ) ;
/* deprecated */
sock - > own_index = link - > tosock - > own_index ;
sock - > to_index = 0 ;
sock - > groupsock = NULL ;
2011-02-21 18:18:37 +00:00
}
}
}
}
2009-02-20 16:39:39 +00:00
/* 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
2012-04-22 11:54:53 +00:00
* 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
{
bNodeTree * ntree ;
2012-05-17 12:59:34 +00:00
2012-04-22 11:54:53 +00:00
/* this crashes blender on undo/redo */
#if 0
2012-05-17 12:59:34 +00:00
if ( open = = 1 ) {
2009-02-20 16:39:39 +00:00
reinit_nodesystem ( ) ;
2012-04-22 11:54:53 +00:00
}
# endif
2009-02-20 16:39:39 +00:00
2011-09-05 21:01:50 +00:00
/* set node->typeinfo pointers */
2013-03-18 16:34:57 +00:00
FOREACH_NODETREE ( main , ntree , id ) {
ntreeSetTypes ( NULL , ntree ) ;
} FOREACH_NODETREE_END
/* verify static socket templates */
FOREACH_NODETREE ( main , ntree , id ) {
bNode * node ;
for ( node = ntree - > nodes . first ; node ; node = node - > next )
node_verify_socket_templates ( ntree , node ) ;
} FOREACH_NODETREE_END
2009-02-20 16:39:39 +00:00
2011-02-21 18:18:37 +00:00
{
2014-04-11 11:25:41 +10:00
bool has_old_groups = false ;
2011-02-21 18:18:37 +00:00
/* XXX this should actually be part of do_versions, but since we need
* finished library linking , it is not possible there . Instead in do_versions
2013-03-18 16:34:57 +00:00
* we have set the NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 flag , so at this point we can do the
2011-02-21 18:18:37 +00:00
* actual group node updates .
*/
2012-05-17 12:59:34 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
2013-03-18 16:34:57 +00:00
if ( ntree - > flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 )
2011-09-05 21:01:50 +00:00
has_old_groups = 1 ;
2011-02-21 18:18:37 +00:00
}
2011-09-05 21:01:50 +00:00
if ( has_old_groups ) {
2013-03-18 16:34:57 +00:00
FOREACH_NODETREE ( main , ntree , id ) {
/* updates external links for all group nodes in a tree */
bNode * node ;
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > type = = NODE_GROUP ) {
bNodeTree * ngroup = ( bNodeTree * ) node - > id ;
if ( ngroup & & ( ngroup - > flag & NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 ) )
lib_node_do_versions_group_indices ( node ) ;
}
}
} FOREACH_NODETREE_END
2011-02-21 18:18:37 +00:00
}
2011-02-22 08:22:06 +00:00
2012-05-21 06:33:32 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next )
2013-03-18 16:34:57 +00:00
ntree - > flag & = ~ NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 ;
2009-02-20 16:39:39 +00:00
}
2013-03-18 16:34:57 +00:00
{
/* Convert the previously used ntree->inputs/ntree->outputs lists to interface nodes.
* Pre 2.56 .2 node trees automatically have all unlinked sockets exposed already
* ( see NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2 ) .
*
* XXX this should actually be part of do_versions ,
* but needs valid typeinfo pointers to create interface nodes .
2013-03-24 12:13:13 +00:00
*
* Note : theoretically only needed in node groups ( main - > nodetree ) ,
* but due to a temporary bug such links could have been added in all trees ,
* so have to clean up all of them . . .
2013-03-18 16:34:57 +00:00
*/
2012-05-17 12:59:34 +00:00
2013-03-24 12:13:13 +00:00
FOREACH_NODETREE ( main , ntree , id ) {
2013-03-18 16:34:57 +00:00
if ( ntree - > flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP ) {
bNode * input_node = NULL , * output_node = NULL ;
int num_inputs = 0 , num_outputs = 0 ;
bNodeLink * link , * next_link ;
/* Only create new interface nodes for actual older files.
* New file versions already have input / output nodes with duplicate links ,
* in that case just remove the invalid links .
*/
2015-04-20 23:37:04 +10:00
const bool create_io_nodes = ( ntree - > flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE ) ! = 0 ;
2013-03-18 16:34:57 +00:00
float input_locx = 1000000.0f , input_locy = 0.0f ;
float output_locx = - 1000000.0f , output_locy = 0.0f ;
/* rough guess, not nice but we don't have access to UI constants here ... */
static const float offsetx = 42 + 3 * 20 + 20 ;
/*static const float offsety = 0.0f;*/
if ( create_io_nodes ) {
if ( ntree - > inputs . first )
input_node = nodeAddStaticNode ( NULL , ntree , NODE_GROUP_INPUT ) ;
if ( ntree - > outputs . first )
output_node = nodeAddStaticNode ( NULL , ntree , NODE_GROUP_OUTPUT ) ;
}
/* Redirect links from/to the node tree interface to input/output node.
* If the fromnode / tonode pointers are NULL , this means a link from / to
* the ntree interface sockets , which need to be redirected to new interface nodes .
*/
for ( link = ntree - > links . first ; link ; link = next_link ) {
2014-04-01 11:34:00 +11:00
bool free_link = false ;
2013-03-18 16:34:57 +00:00
next_link = link - > next ;
if ( link - > fromnode = = NULL ) {
if ( input_node ) {
link - > fromnode = input_node ;
link - > fromsock = node_group_input_find_socket ( input_node , link - > fromsock - > identifier ) ;
+ + num_inputs ;
2013-05-09 08:29:59 +00:00
if ( link - > tonode ) {
if ( input_locx > link - > tonode - > locx - offsetx )
input_locx = link - > tonode - > locx - offsetx ;
input_locy + = link - > tonode - > locy ;
}
2013-03-18 16:34:57 +00:00
}
2014-04-01 11:34:00 +11:00
else {
free_link = true ;
}
2013-03-18 16:34:57 +00:00
}
if ( link - > tonode = = NULL ) {
if ( output_node ) {
link - > tonode = output_node ;
link - > tosock = node_group_output_find_socket ( output_node , link - > tosock - > identifier ) ;
+ + num_outputs ;
2013-05-09 08:29:59 +00:00
if ( link - > fromnode ) {
if ( output_locx < link - > fromnode - > locx + offsetx )
output_locx = link - > fromnode - > locx + offsetx ;
output_locy + = link - > fromnode - > locy ;
}
2013-03-18 16:34:57 +00:00
}
2014-04-01 11:34:00 +11:00
else {
free_link = true ;
}
2013-03-18 16:34:57 +00:00
}
if ( free_link )
nodeRemLink ( ntree , link ) ;
}
if ( num_inputs > 0 ) {
input_locy / = num_inputs ;
input_node - > locx = input_locx ;
input_node - > locy = input_locy ;
}
if ( num_outputs > 0 ) {
output_locy / = num_outputs ;
output_node - > locx = output_locx ;
output_node - > locy = output_locy ;
}
/* clear do_versions flags */
ntree - > flag & = ~ ( NTREE_DO_VERSIONS_CUSTOMNODES_GROUP | NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE ) ;
}
}
2013-03-24 12:13:13 +00:00
FOREACH_NODETREE_END
2013-03-18 16:34:57 +00:00
}
2011-09-05 21:01:50 +00:00
/* verify all group user nodes */
2012-05-17 12:59:34 +00:00
for ( ntree = main - > nodetree . first ; ntree ; ntree = ntree - > id . next ) {
2011-09-05 21:01:50 +00:00
ntreeVerifyNodes ( main , & ntree - > id ) ;
2009-02-20 16:39:39 +00:00
}
2011-09-05 21:01:50 +00:00
/* make update calls where necessary */
{
2013-03-18 16:34:57 +00:00
FOREACH_NODETREE ( main , ntree , id ) {
/* make an update call for the tree */
2013-05-07 15:28:42 +00:00
ntreeUpdateTree ( main , ntree ) ;
2013-03-18 16:34:57 +00:00
} FOREACH_NODETREE_END
2009-02-20 16:39:39 +00:00
}
}
2011-09-05 21:01:50 +00:00
static void direct_link_node_socket ( FileData * fd , bNodeSocket * sock )
{
2013-03-18 16:34:57 +00:00
sock - > prop = newdataadr ( fd , sock - > prop ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & sock - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2013-03-18 16:34:57 +00:00
2012-05-17 12:59:34 +00:00
sock - > link = newdataadr ( fd , sock - > link ) ;
2013-03-18 16:34:57 +00:00
sock - > typeinfo = NULL ;
2012-05-17 12:59:34 +00:00
sock - > storage = newdataadr ( fd , sock - > storage ) ;
sock - > default_value = newdataadr ( fd , sock - > default_value ) ;
sock - > cache = NULL ;
2011-09-05 21:01:50 +00:00
}
2009-02-20 16:39:39 +00:00
/* 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 ;
2012-05-17 12:59:34 +00:00
ntree - > init = 0 ; /* to set callbacks and force setting types */
2014-04-01 11:34:00 +11:00
ntree - > is_updating = false ;
2013-03-18 16:34:57 +00:00
ntree - > typeinfo = NULL ;
ntree - > interface_type = NULL ;
2012-05-17 12:59:34 +00:00
ntree - > progress = NULL ;
ntree - > execdata = NULL ;
2015-06-26 17:50:08 +02:00
ntree - > duplilock = NULL ;
2012-05-17 12:59:34 +00:00
ntree - > adt = newdataadr ( fd , ntree - > adt ) ;
2009-02-20 16:39:39 +00:00
direct_link_animdata ( fd , ntree - > adt ) ;
2012-12-03 16:21:43 +00:00
ntree - > id . flag & = ~ ( LIB_ID_RECALC | LIB_ID_RECALC_DATA ) ;
2009-02-20 16:39:39 +00:00
link_list ( fd , & ntree - > nodes ) ;
2012-05-17 12:59:34 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
node - > typeinfo = NULL ;
2009-02-20 16:39:39 +00:00
2011-09-05 21:01:50 +00:00
link_list ( fd , & node - > inputs ) ;
link_list ( fd , & node - > outputs ) ;
2009-02-20 16:39:39 +00:00
2013-03-18 16:34:57 +00:00
node - > prop = newdataadr ( fd , node - > prop ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & node - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2013-03-18 16:34:57 +00:00
2012-10-25 16:49:06 +00:00
link_list ( fd , & node - > internal_links ) ;
2012-10-27 11:56:21 +00:00
for ( link = node - > internal_links . first ; link ; link = link - > next ) {
link - > fromnode = newdataadr ( fd , link - > fromnode ) ;
link - > fromsock = newdataadr ( fd , link - > fromsock ) ;
link - > tonode = newdataadr ( fd , link - > tonode ) ;
link - > tosock = newdataadr ( fd , link - > tosock ) ;
}
2012-10-25 16:49:06 +00:00
2012-03-24 06:18:31 +00:00
if ( node - > type = = CMP_NODE_MOVIEDISTORTION ) {
2012-05-17 12:59:34 +00:00
node - > storage = newmclipadr ( fd , node - > storage ) ;
2012-03-24 06:18:31 +00:00
}
2013-03-18 16:34:57 +00:00
else {
2012-05-17 12:59:34 +00:00
node - > storage = newdataadr ( fd , node - > storage ) ;
2013-03-18 16:34:57 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( node - > storage ) {
2009-02-20 16:39:39 +00:00
/* could be handlerized at some point */
2012-11-03 14:32:26 +00:00
if ( ntree - > type = = NTREE_SHADER ) {
if ( node - > type = = SH_NODE_CURVE_VEC | | node - > type = = SH_NODE_CURVE_RGB ) {
2012-12-11 22:00:22 +00:00
direct_link_curvemapping ( fd , node - > storage ) ;
2012-11-03 14:32:26 +00:00
}
else if ( node - > type = = SH_NODE_SCRIPT ) {
NodeShaderScript * nss = ( NodeShaderScript * ) node - > storage ;
nss - > bytecode = newdataadr ( fd , nss - > bytecode ) ;
}
}
2012-03-24 06:18:31 +00:00
else if ( ntree - > type = = NTREE_COMPOSIT ) {
2014-07-20 01:30:29 +10:00
if ( ELEM ( 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 ) ;
2014-07-20 01:30:29 +10:00
else if ( ELEM ( node - > type , CMP_NODE_IMAGE , CMP_NODE_VIEWER , CMP_NODE_SPLITVIEWER ) )
2012-05-17 12:59:34 +00:00
( ( ImageUser * ) node - > storage ) - > ok = 1 ;
2009-02-20 16:39:39 +00:00
}
2012-03-24 06:18:31 +00:00
else if ( ntree - > type = = NTREE_TEXTURE ) {
if ( node - > type = = TEX_NODE_CURVE_RGB | | node - > type = = TEX_NODE_CURVE_TIME )
2011-01-15 18:00:46 +00:00
direct_link_curvemapping ( fd , node - > storage ) ;
2012-03-24 06:18:31 +00:00
else if ( node - > type = = TEX_NODE_IMAGE )
2012-05-17 12:59:34 +00:00
( ( ImageUser * ) node - > storage ) - > ok = 1 ;
2009-02-20 16:39:39 +00:00
}
}
}
link_list ( fd , & ntree - > links ) ;
/* and we connect the rest */
2012-05-17 12:59:34 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
2011-09-05 21:01:50 +00:00
node - > parent = newdataadr ( fd , node - > parent ) ;
2012-05-17 12:59:34 +00:00
node - > lasty = 0 ;
2011-09-05 21:01:50 +00:00
2012-05-17 12:59:34 +00:00
for ( sock = node - > inputs . first ; sock ; sock = sock - > next )
2011-09-05 21:01:50 +00:00
direct_link_node_socket ( fd , sock ) ;
2012-05-17 12:59:34 +00:00
for ( sock = node - > outputs . first ; sock ; sock = sock - > next )
2011-09-05 21:01:50 +00:00
direct_link_node_socket ( fd , sock ) ;
2009-02-20 16:39:39 +00:00
}
2013-03-18 16:34:57 +00:00
/* interface socket lists */
link_list ( fd , & ntree - > inputs ) ;
link_list ( fd , & ntree - > outputs ) ;
2012-05-17 12:59:34 +00:00
for ( sock = ntree - > inputs . first ; sock ; sock = sock - > next )
2011-09-05 21:01:50 +00:00
direct_link_node_socket ( fd , sock ) ;
2012-05-17 12:59:34 +00:00
for ( sock = ntree - > outputs . first ; sock ; sock = sock - > next )
2011-09-05 21:01:50 +00:00
direct_link_node_socket ( fd , sock ) ;
2011-02-21 13:47:49 +00:00
2012-05-17 12:59:34 +00:00
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 ) ;
2009-02-20 16:39:39 +00:00
}
2011-02-21 13:47:49 +00:00
2013-03-18 16:34:57 +00:00
#if 0
if ( ntree - > previews ) {
bNodeInstanceHash * new_previews = BKE_node_instance_hash_new ( " node previews " ) ;
bNodeInstanceHashIterator iter ;
NODE_INSTANCE_HASH_ITER ( iter , ntree - > previews ) {
bNodePreview * preview = BKE_node_instance_hash_iterator_get_value ( & iter ) ;
if ( preview ) {
bNodePreview * new_preview = newimaadr ( fd , preview ) ;
if ( new_preview ) {
bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key ( & iter ) ;
BKE_node_instance_hash_insert ( new_previews , key , new_preview ) ;
}
}
}
BKE_node_instance_hash_free ( ntree - > previews , NULL ) ;
ntree - > previews = new_previews ;
}
# else
/* XXX TODO */
ntree - > previews = NULL ;
# endif
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 */
2014-04-11 11:25:41 +10:00
static void lib_link_constraint_cb ( bConstraint * UNUSED ( con ) , ID * * idpoin , bool is_reference , void * userdata )
2010-02-06 11:50:39 +00:00
{
tConstraintLinkData * cld = ( tConstraintLinkData * ) userdata ;
2012-05-05 15:54:08 +00:00
/* for reference types, we need to increment the usercounts on load... */
2014-04-11 11:25:41 +10:00
if ( is_reference ) {
2012-05-05 15:54:08 +00:00
/* reference type - with usercount */
* idpoin = newlibadr_us ( cld - > fd , cld - > id - > lib , * idpoin ) ;
}
else {
/* target type - no usercount needed */
* idpoin = newlibadr ( cld - > fd , cld - > id - > lib , * idpoin ) ;
}
2010-02-06 11:50:39 +00:00
}
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) */
2012-05-17 12:59:34 +00:00
if ( con - > data = = NULL ) {
con - > type = CONSTRAINT_TYPE_NULL ;
2003-11-19 15:20:18 +00:00
}
2007-11-28 12:11:06 +00:00
/* own ipo, all constraints have it */
2012-09-26 20:05:38 +00:00
con - > ipo = newlibadr_us ( fd , id - > lib , con - > ipo ) ; // XXX deprecated - old animation system
2010-02-06 11:50:39 +00:00
}
/* relink all ID-blocks used by the constraints */
2012-05-17 12:59:34 +00:00
cld . fd = fd ;
cld . id = id ;
2010-02-06 11:50:39 +00:00
2014-04-11 11:47:07 +10:00
BKE_constraints_id_loop ( conlist , lib_link_constraint_cb , & cld ) ;
2010-02-06 11:50:39 +00:00
}
static void direct_link_constraints ( FileData * fd , ListBase * lb )
{
bConstraint * con ;
2012-05-17 12:59:34 +00:00
2010-02-06 11:50:39 +00:00
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 ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & data - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2010-02-06 11:50:39 +00:00
break ;
2013-02-02 04:13:38 +00:00
}
2010-02-06 11:50:39 +00:00
case CONSTRAINT_TYPE_SPLINEIK :
2006-02-19 17:42:20 +00:00
{
2010-02-06 11:50:39 +00:00
bSplineIKConstraint * data = con - > data ;
2013-02-02 04:13:38 +00:00
2010-02-06 11:50:39 +00:00
data - > points = newdataadr ( fd , data - > points ) ;
break ;
2013-02-02 04:13:38 +00:00
}
2010-02-06 11:50:39 +00:00
case CONSTRAINT_TYPE_KINEMATIC :
2002-10-12 11:37:38 +00:00
{
2012-10-24 22:36:06 +00:00
bKinematicConstraint * data = con - > data ;
2009-09-24 21:22:24 +00:00
con - > lin_error = 0.f ;
con - > rot_error = 0.f ;
2012-10-24 22:36:06 +00:00
/* version patch for runtime flag, was not cleared in some case */
data - > flag & = ~ CONSTRAINT_IK_AUTO ;
2013-02-02 04:13:38 +00:00
break ;
2010-12-23 13:16:56 +00:00
}
case CONSTRAINT_TYPE_CHILDOF :
{
/* XXX version patch, in older code this flag wasn't always set, and is inherent to type */
2012-03-24 06:18:31 +00:00
if ( con - > ownspace = = CONSTRAINT_SPACE_POSE )
2010-12-23 13:16:56 +00:00
con - > flag | = CONSTRAINT_SPACEONCE ;
2010-02-06 11:50:39 +00:00
break ;
2013-02-02 04:13:38 +00:00
}
2009-11-01 11:29:40 +00:00
}
2002-10-12 11:37:38 +00:00
}
}
2013-02-23 01:33:47 +00:00
static void lib_link_pose ( FileData * fd , Main * bmain , Object * ob , bPose * pose )
2002-10-12 11:37:38 +00:00
{
2005-09-12 13:02:36 +00:00
bPoseChannel * pchan ;
2012-05-17 12:59:34 +00:00
bArmature * arm = ob - > data ;
2013-01-13 11:31:01 +00:00
int rebuild = 0 ;
2006-11-11 16:45:17 +00:00
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
2013-01-13 11:31:01 +00:00
/* always rebuild to match proxy or lib changes, but on Undo */
if ( fd - > memfile = = NULL )
if ( ob - > proxy | | ( ob - > id . lib = = NULL & & arm - > id . lib ) )
rebuild = 1 ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > proxy ) {
2010-11-24 14:05:53 +00:00
/* sync proxy layer */
2012-03-24 06:18:31 +00:00
if ( pose - > proxy_layer )
2010-11-24 14:05:53 +00:00
arm - > layer = pose - > proxy_layer ;
/* sync proxy active bone */
2012-03-24 06:18:31 +00:00
if ( pose - > proxy_act_bone [ 0 ] ) {
2012-05-05 16:03:57 +00:00
Bone * bone = BKE_armature_find_bone_name ( arm , pose - > proxy_act_bone ) ;
2010-11-24 14:05:53 +00:00
if ( bone )
arm - > act_bone = bone ;
}
2010-05-04 12:31:24 +00:00
}
2012-05-17 12:59:34 +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) */
2012-05-17 12:59:34 +00:00
pchan - > bone = BKE_armature_find_bone_name ( arm , pchan - > name ) ;
2006-11-11 16:45:17 +00:00
2012-05-17 12:59:34 +00:00
pchan - > custom = newlibadr_us ( fd , arm - > id . lib , pchan - > custom ) ;
if ( pchan - > bone = = NULL )
2005-12-14 20:36:04 +00:00
rebuild = 1 ;
2012-03-24 06:18:31 +00:00
else if ( ob - > id . lib = = NULL & & arm - > id . lib ) {
2006-11-11 16:45:17 +00:00
/* 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
2012-03-24 06:18:31 +00:00
if ( rebuild ) {
2013-02-23 01:33:47 +00:00
DAG_id_tag_update_ex ( bmain , & ob - > id , OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME ) ;
2015-05-12 13:13:36 +05:00
BKE_pose_tag_recalc ( bmain , pose ) ;
2002-10-12 11:37:38 +00:00
}
}
static void lib_link_armature ( FileData * fd , Main * main )
{
bArmature * arm ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( arm = main - > armature . first ; arm ; arm = arm - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( arm - > id . flag & LIB_NEED_LINK ) {
2009-09-21 06:43:20 +00:00
if ( arm - > adt ) lib_link_animdata ( fd , & arm - > id , arm - > adt ) ;
2012-08-01 15:32:27 +00:00
arm - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
2012-08-26 11:35:43 +00:00
static void direct_link_bones ( FileData * fd , Bone * bone )
2002-10-12 11:37:38 +00:00
{
2012-05-17 12:59:34 +00:00
Bone * child ;
bone - > parent = newdataadr ( fd , bone - > parent ) ;
bone - > prop = newdataadr ( fd , bone - > prop ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & bone - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2009-11-09 23:41:48 +00:00
bone - > flag & = ~ BONE_DRAW_ACTIVE ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & bone - > childbase ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +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 )
{
2012-05-17 12:59:34 +00:00
Bone * bone ;
2002-10-12 11:37:38 +00:00
link_list ( fd , & arm - > bonebase ) ;
2012-05-17 12:59:34 +00:00
arm - > edbo = NULL ;
2009-07-19 02:26:01 +00:00
arm - > sketch = NULL ;
2009-11-26 03:43:39 +00:00
2012-05-17 12:59:34 +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
2012-05-21 06:33:32 +00:00
for ( bone = arm - > bonebase . first ; bone ; bone = bone - > next ) {
2002-10-12 11:37:38 +00:00
direct_link_bones ( fd , bone ) ;
}
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( ca = main - > camera . first ; ca ; ca = ca - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ca - > id . flag & LIB_NEED_LINK ) {
2009-01-19 02:26:46 +00:00
if ( ca - > adt ) lib_link_animdata ( fd , & ca - > id , ca - > adt ) ;
2012-09-26 20:05:38 +00:00
ca - > ipo = newlibadr_us ( fd , ca - > id . lib , ca - > ipo ) ; // XXX deprecated - old animation system
2007-09-23 18:27:01 +00:00
2012-05-17 12:59:34 +00:00
ca - > dof_ob = newlibadr_us ( fd , ca - > id . lib , ca - > dof_ob ) ;
2007-09-23 18:27:01 +00:00
2012-08-01 15:32:27 +00:00
ca - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_camera ( FileData * fd , Camera * ca )
{
2012-05-17 12:59:34 +00:00
ca - > adt = newdataadr ( fd , ca - > adt ) ;
2009-01-19 02:26:46 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( la = main - > lamp . first ; la ; la = la - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( la - > id . flag & LIB_NEED_LINK ) {
2009-01-19 02:26:46 +00:00
if ( la - > adt ) lib_link_animdata ( fd , & la - > id , la - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
mtex = la - > mtex [ a ] ;
2012-03-24 06:18:31 +00:00
if ( mtex ) {
2012-05-17 12:59:34 +00:00
mtex - > tex = newlibadr_us ( fd , la - > id . lib , mtex - > tex ) ;
mtex - > object = newlibadr ( fd , la - > id . lib , mtex - > object ) ;
2002-10-12 11:37:38 +00:00
}
}
2009-01-19 02:26:46 +00:00
2012-09-26 20:05:38 +00:00
la - > ipo = newlibadr_us ( fd , la - > id . lib , la - > ipo ) ; // XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
2013-06-05 19:06:27 +00:00
if ( la - > nodetree ) {
2011-11-02 18:55:32 +00:00
lib_link_ntree ( fd , & la - > id , la - > nodetree ) ;
2013-06-05 19:06:27 +00:00
la - > nodetree - > id . lib = la - > id . lib ;
}
2009-01-19 02:26:46 +00:00
2012-08-01 15:32:27 +00:00
la - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_lamp ( FileData * fd , Lamp * la )
{
int a ;
2009-01-19 02:26:46 +00:00
2012-05-17 12:59:34 +00:00
la - > adt = newdataadr ( fd , la - > adt ) ;
2009-01-19 02:26:46 +00:00
direct_link_animdata ( fd , la - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-05-17 12:59:34 +00:00
la - > mtex [ a ] = newdataadr ( fd , la - > mtex [ a ] ) ;
2002-10-12 11:37:38 +00:00
}
* 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
2012-05-17 12:59:34 +00:00
la - > curfalloff = newdataadr ( fd , la - > curfalloff ) ;
2012-03-24 06:18:31 +00:00
if ( la - > curfalloff )
* 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
direct_link_curvemapping ( fd , la - > curfalloff ) ;
2011-11-02 18:55:32 +00:00
la - > nodetree = newdataadr ( fd , la - > nodetree ) ;
2012-10-23 12:38:47 +00:00
if ( la - > nodetree ) {
direct_link_id ( fd , & la - > nodetree - > id ) ;
2011-11-02 18:55:32 +00:00
direct_link_nodetree ( fd , la - > nodetree ) ;
2012-10-23 12:38:47 +00:00
}
* 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
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 ***************** */
2013-11-29 23:16:13 +06:00
void blo_do_versions_key_uidgen ( Key * key )
2012-09-23 18:50:56 +00:00
{
KeyBlock * block ;
key - > uidgen = 1 ;
for ( block = key - > block . first ; block ; block = block - > next ) {
block - > uid = key - > uidgen + + ;
}
}
2002-10-12 11:37:38 +00:00
static void lib_link_key ( FileData * fd , Main * main )
{
Key * key ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( key = main - > key . first ; key ; key = key - > id . next ) {
2009-11-02 06:33:16 +00:00
/*check if we need to generate unique ids for the shapekeys*/
if ( ! key - > uidgen ) {
2013-11-29 23:16:13 +06:00
blo_do_versions_key_uidgen ( key ) ;
2009-11-02 06:33:16 +00:00
}
2012-05-17 12:59:34 +00:00
2012-08-01 15:32:27 +00:00
if ( key - > id . flag & LIB_NEED_LINK ) {
2012-03-24 06:18:31 +00:00
if ( key - > adt ) lib_link_animdata ( fd , & key - > id , key - > adt ) ;
2009-02-20 16:39:39 +00:00
2012-09-26 20:05:38 +00:00
key - > ipo = newlibadr_us ( fd , key - > id . lib , key - > ipo ) ; // XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
key - > from = newlibadr ( fd , key - > id . lib , key - > from ) ;
2012-08-01 15:32:27 +00:00
key - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void switch_endian_keyblock ( Key * key , KeyBlock * kb )
{
int elemsize , a , b ;
2015-01-01 23:26:03 +11:00
char * data ;
2012-05-17 12:59:34 +00:00
elemsize = key - > elemsize ;
data = kb - > data ;
for ( a = 0 ; a < kb - > totelem ; a + + ) {
2015-01-01 23:26:03 +11:00
const char * cp = key - > elemstr ;
char * poin = data ;
2012-05-17 12:59:34 +00:00
while ( cp [ 0 ] ) { /* cp[0] == amount */
2012-04-28 06:31:57 +00:00
switch ( cp [ 1 ] ) { /* cp[1] = type */
2012-05-17 12:59:34 +00:00
case IPO_FLOAT :
case IPO_BPOINT :
case IPO_BEZTRIPLE :
b = cp [ 0 ] ;
2012-09-03 09:03:25 +00:00
BLI_endian_switch_float_array ( ( float * ) poin , b ) ;
poin + = sizeof ( float ) * b ;
2012-05-17 12:59:34 +00:00
break ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
cp + = 2 ;
2002-10-12 11:37:38 +00:00
}
2012-12-11 22:00:22 +00:00
data + = elemsize ;
2002-10-12 11:37:38 +00:00
}
}
static void direct_link_key ( FileData * fd , Key * key )
{
KeyBlock * kb ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( key - > block ) ) ;
2009-01-19 02:26:46 +00:00
2012-05-17 12:59:34 +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 ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( kb = key - > block . first ; kb ; kb = kb - > next ) {
2012-05-17 12:59:34 +00:00
kb - > data = newdataadr ( fd , kb - > data ) ;
2011-01-03 11:58:19 +00:00
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN )
2002-10-12 11:37:38 +00:00
switch_endian_keyblock ( key , kb ) ;
}
}
/* ************ READ mball ***************** */
static void lib_link_mball ( FileData * fd , Main * main )
{
MetaBall * mb ;
int a ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( mb = main - > mball . first ; mb ; mb = mb - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( mb - > id . flag & LIB_NEED_LINK ) {
2009-08-03 13:09:23 +00:00
if ( mb - > adt ) lib_link_animdata ( fd , & mb - > id , mb - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < mb - > totcol ; a + + )
2012-12-11 22:00:22 +00:00
mb - > mat [ a ] = newlibadr_us ( fd , mb - > id . lib , mb - > mat [ a ] ) ;
2012-05-17 12:59:34 +00:00
2012-09-26 20:05:38 +00:00
mb - > ipo = newlibadr_us ( fd , mb - > id . lib , mb - > ipo ) ; // XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
2012-08-01 15:32:27 +00:00
mb - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_mball ( FileData * fd , MetaBall * mb )
{
2012-05-17 12:59:34 +00:00
mb - > adt = newdataadr ( fd , mb - > adt ) ;
2009-08-03 13:09:23 +00:00
direct_link_animdata ( fd , mb - > adt ) ;
2012-05-17 12:59:34 +00:00
mb - > mat = newdataadr ( fd , mb - > mat ) ;
2002-10-12 11:37:38 +00:00
test_pointer_array ( fd , ( void * * ) & mb - > mat ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( mb - > elems ) ) ;
2012-05-17 12:59:34 +00:00
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & mb - > disp ) ;
2012-05-17 12:59:34 +00:00
mb - > editelems = NULL ;
2009-07-29 12:35:09 +00:00
/* mb->edit_elems.first= mb->edit_elems.last= NULL;*/
2012-05-17 12:59:34 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( wrld = main - > world . first ; wrld ; wrld = wrld - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( wrld - > id . flag & LIB_NEED_LINK ) {
2009-01-19 02:26:46 +00:00
if ( wrld - > adt ) lib_link_animdata ( fd , & wrld - > id , wrld - > adt ) ;
2012-09-26 20:05:38 +00:00
wrld - > ipo = newlibadr_us ( fd , wrld - > id . lib , wrld - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
mtex = wrld - > mtex [ a ] ;
2012-03-24 06:18:31 +00:00
if ( mtex ) {
2012-05-21 06:33:32 +00:00
mtex - > tex = newlibadr_us ( fd , wrld - > id . lib , mtex - > tex ) ;
mtex - > object = newlibadr ( fd , wrld - > id . lib , mtex - > object ) ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
2013-06-05 19:06:27 +00:00
if ( wrld - > nodetree ) {
2011-11-02 18:55:32 +00:00
lib_link_ntree ( fd , & wrld - > id , wrld - > nodetree ) ;
2013-06-05 19:06:27 +00:00
wrld - > nodetree - > id . lib = wrld - > id . lib ;
}
2009-01-19 02:26:46 +00:00
2012-08-01 15:32:27 +00:00
wrld - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_world ( FileData * fd , World * wrld )
{
int a ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
wrld - > adt = newdataadr ( fd , wrld - > adt ) ;
2009-01-19 02:26:46 +00:00
direct_link_animdata ( fd , wrld - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
wrld - > mtex [ a ] = newdataadr ( fd , wrld - > mtex [ a ] ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
wrld - > nodetree = newdataadr ( fd , wrld - > nodetree ) ;
2012-10-23 12:38:47 +00:00
if ( wrld - > nodetree ) {
direct_link_id ( fd , & wrld - > nodetree - > id ) ;
2011-11-02 18:55:32 +00:00
direct_link_nodetree ( fd , wrld - > nodetree ) ;
2012-10-23 12:38:47 +00:00
}
2012-05-17 12:59:34 +00:00
2007-09-02 17:25:03 +00:00
wrld - > preview = direct_link_preview_image ( fd , wrld - > preview ) ;
2014-11-24 17:18:56 +01:00
BLI_listbase_clear ( & wrld - > gpumaterial ) ;
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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( vf = main - > vfont . first ; vf ; vf = vf - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( vf - > id . flag & LIB_NEED_LINK ) {
vf - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
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 )
{
2012-05-17 12:59:34 +00:00
vf - > data = NULL ;
2012-08-21 10:39:02 +00:00
vf - > temp_pf = NULL ;
2012-05-17 12:59:34 +00:00
vf - > packedfile = direct_link_packedfile ( fd , vf - > packedfile ) ;
2002-10-12 11:37:38 +00:00
}
/* ************ 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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( text = main - > text . first ; text ; text = text - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( text - > id . flag & LIB_NEED_LINK ) {
text - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
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 ;
2012-05-17 12:59:34 +00:00
text - > name = newdataadr ( fd , text - > name ) ;
text - > undo_pos = - 1 ;
text - > undo_len = TXT_INIT_UNDO ;
text - > undo_buf = MEM_mallocN ( text - > undo_len , " undo buf " ) ;
text - > compiled = NULL ;
2012-04-22 11:54:53 +00:00
#if 0
2012-03-24 06:18:31 +00:00
if ( text - > flags & TXT_ISEXT ) {
2012-05-05 14:52:04 +00:00
BKE_text_reload ( text ) ;
2012-03-24 06:18:31 +00:00
}
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/* else { */
2012-04-22 11:54:53 +00:00
# endif
2012-05-17 12:59:34 +00:00
2003-03-25 15:54:46 +00:00
link_list ( fd , & text - > lines ) ;
2012-05-17 12:59:34 +00:00
text - > curl = newdataadr ( fd , text - > curl ) ;
text - > sell = newdataadr ( fd , text - > sell ) ;
2012-05-21 06:33:32 +00:00
for ( ln = text - > lines . first ; ln ; ln = ln - > next ) {
2012-05-17 12:59:34 +00:00
ln - > line = newdataadr ( fd , ln - > line ) ;
ln - > format = NULL ;
2005-05-13 16:11:28 +00:00
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
}
}
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
text - > id . us = 1 ;
2002-10-12 11:37:38 +00:00
}
/* ************ READ IMAGE ***************** */
static void lib_link_image ( FileData * fd , Main * main )
{
Image * ima ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( ima = main - > image . first ; ima ; ima = ima - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ima - > id . flag & LIB_NEED_LINK ) {
2006-11-17 06:14:15 +00:00
if ( ima - > id . properties ) IDP_LibLinkProperty ( ima - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2012-05-17 12:59:34 +00:00
2012-08-01 15:32:27 +00:00
ima - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_image ( FileData * fd , Image * ima )
{
2015-04-06 10:40:12 -03:00
ImagePackedFile * imapf ;
2006-11-10 10:17:04 +00:00
/* for undo system, pointers could be restored */
2012-03-24 06:18:31 +00:00
if ( fd - > imamap )
2014-10-16 20:07:44 +02:00
ima - > cache = newimaadr ( fd , ima - > cache ) ;
2006-12-20 17:57:56 +00:00
else
2013-12-13 16:22:08 +06:00
ima - > cache = NULL ;
2012-12-11 22:00:22 +00:00
2006-12-20 17:57:56 +00:00
/* if not restored, we keep the binded opengl index */
2013-12-26 16:34:57 +06:00
if ( ! ima - > cache ) {
2012-05-17 12:59:34 +00:00
ima - > bindcode = 0 ;
2012-10-25 15:25:28 +00:00
ima - > tpageflag & = ~ IMA_GLBIND_IS_DATA ;
2012-05-17 12:59:34 +00:00
ima - > gputexture = NULL ;
2013-04-22 10:08:58 +00:00
ima - > rr = 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
}
2015-04-06 10:40:12 -03:00
2012-05-17 12:59:34 +00:00
ima - > repbind = NULL ;
2011-03-10 17:34:27 +00:00
/* undo system, try to restore render buffers */
2012-03-24 06:18:31 +00:00
if ( fd - > imamap ) {
2011-03-10 17:34:27 +00:00
int a ;
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < IMA_MAX_RENDER_SLOT ; a + + )
2012-05-17 12:59:34 +00:00
ima - > renders [ a ] = newimaadr ( fd , ima - > renders [ a ] ) ;
2011-03-10 17:34:27 +00:00
}
else {
memset ( ima - > renders , 0 , sizeof ( ima - > renders ) ) ;
2012-05-17 12:59:34 +00:00
ima - > last_render_slot = ima - > render_slot ;
2011-03-10 17:34:27 +00:00
}
2015-04-06 10:40:12 -03:00
link_list ( fd , & ( ima - > views ) ) ;
link_list ( fd , & ( ima - > packedfiles ) ) ;
2015-06-01 13:09:45 +02:00
if ( ima - > packedfiles . first ) {
for ( imapf = ima - > packedfiles . first ; imapf ; imapf = imapf - > next ) {
imapf - > packedfile = direct_link_packedfile ( fd , imapf - > packedfile ) ;
}
ima - > packedfile = NULL ;
}
else {
ima - > packedfile = direct_link_packedfile ( fd , ima - > packedfile ) ;
2015-04-06 10:40:12 -03:00
}
2015-06-20 17:09:05 +10:00
BLI_listbase_clear ( & ima - > anims ) ;
2006-06-05 11:07:15 +00:00
ima - > preview = direct_link_preview_image ( fd , ima - > preview ) ;
2015-04-06 10:40:12 -03:00
ima - > stereo3d_format = newdataadr ( fd , ima - > stereo3d_format ) ;
2012-05-17 12:59:34 +00:00
ima - > ok = 1 ;
2002-10-12 11:37:38 +00:00
}
/* ************ READ CURVE ***************** */
static void lib_link_curve ( FileData * fd , Main * main )
{
Curve * cu ;
int a ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( cu = main - > curve . first ; cu ; cu = cu - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( cu - > id . flag & LIB_NEED_LINK ) {
2012-03-24 06:18:31 +00:00
if ( cu - > adt ) lib_link_animdata ( fd , & cu - > id , cu - > adt ) ;
2012-05-17 12:59:34 +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 ) ;
cu - > taperobj = newlibadr ( fd , cu - > id . lib , cu - > taperobj ) ;
cu - > textoncurve = newlibadr ( fd , cu - > id . lib , cu - > textoncurve ) ;
cu - > vfont = newlibadr_us ( fd , cu - > id . lib , cu - > vfont ) ;
2012-12-11 22:00:22 +00:00
cu - > vfontb = newlibadr_us ( fd , cu - > id . lib , cu - > vfontb ) ;
2012-05-17 12:59:34 +00:00
cu - > vfonti = newlibadr_us ( fd , cu - > id . lib , cu - > vfonti ) ;
cu - > vfontbi = newlibadr_us ( fd , cu - > id . lib , cu - > vfontbi ) ;
2012-09-26 20:05:38 +00:00
cu - > ipo = newlibadr_us ( fd , cu - > id . lib , cu - > ipo ) ; // XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
cu - > key = newlibadr_us ( fd , cu - > id . lib , cu - > key ) ;
2012-08-01 15:32:27 +00:00
cu - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void switch_endian_knots ( Nurb * nu )
{
2012-03-24 06:18:31 +00:00
if ( nu - > knotsu ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_float_array ( nu - > knotsu , KNOTSU ( nu ) ) ;
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
if ( nu - > knotsv ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_float_array ( nu - > knotsv , KNOTSV ( nu ) ) ;
2002-10-12 11:37:38 +00:00
}
}
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 ) ;
2012-05-17 12:59:34 +00:00
cu - > mat = newdataadr ( fd , cu - > mat ) ;
2002-10-12 11:37:38 +00:00
test_pointer_array ( fd , ( void * * ) & cu - > mat ) ;
2012-05-17 12:59:34 +00:00
cu - > str = newdataadr ( fd , cu - > str ) ;
2012-12-11 22:00:22 +00:00
cu - > strinfo = newdataadr ( fd , cu - > strinfo ) ;
2012-05-17 12:59:34 +00:00
cu - > tb = newdataadr ( fd , cu - > tb ) ;
2002-10-12 11:37:38 +00:00
2013-03-09 03:46:30 +00:00
if ( cu - > vfont = = NULL ) {
link_list ( fd , & ( cu - > nurb ) ) ;
}
2002-10-12 11:37:38 +00:00
else {
2011-02-13 10:52:18 +00:00
cu - > nurb . first = cu - > nurb . last = NULL ;
2012-05-17 12:59:34 +00:00
tb = MEM_callocN ( MAXTEXTBOX * sizeof ( TextBox ) , " TextBoxread " ) ;
2005-06-17 21:04:27 +00:00
if ( cu - > tb ) {
memcpy ( tb , cu - > tb , cu - > totbox * sizeof ( TextBox ) ) ;
MEM_freeN ( cu - > tb ) ;
2012-12-11 22:00:22 +00:00
cu - > tb = tb ;
2012-03-24 06:18:31 +00:00
}
else {
2005-06-17 21:04:27 +00:00
cu - > totbox = 1 ;
cu - > actbox = 1 ;
cu - > tb = tb ;
cu - > tb [ 0 ] . w = cu - > linewidth ;
2012-12-11 22:00:22 +00:00
}
2011-03-27 23:11:22 +00:00
if ( cu - > wordspace = = 0.0f ) cu - > wordspace = 1.0f ;
2002-10-12 11:37:38 +00:00
}
2004-06-23 18:22:51 +00:00
2012-05-17 12:59:34 +00:00
cu - > editnurb = NULL ;
cu - > editfont = NULL ;
2009-01-02 19:10:35 +00:00
2012-05-21 06:33:32 +00:00
for ( nu = cu - > nurb . first ; nu ; nu = nu - > next ) {
2012-05-17 12:59:34 +00:00
nu - > bezt = newdataadr ( fd , nu - > bezt ) ;
nu - > bp = newdataadr ( fd , nu - > bp ) ;
nu - > knotsu = newdataadr ( fd , nu - > knotsu ) ;
nu - > knotsv = newdataadr ( fd , nu - > knotsv ) ;
2015-04-29 00:19:34 +10:00
if ( cu - > vfont = = NULL ) nu - > charidx = 0 ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2002-10-12 11:37:38 +00:00
switch_endian_knots ( nu ) ;
}
}
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( tex = main - > tex . first ; tex ; tex = tex - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( tex - > id . flag & LIB_NEED_LINK ) {
2012-03-24 06:18:31 +00:00
if ( tex - > adt ) lib_link_animdata ( fd , & tex - > id , tex - > adt ) ;
2012-05-17 12:59:34 +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 ) ;
2012-03-24 06:18:31 +00:00
if ( tex - > pd )
2012-05-21 06:33:32 +00:00
tex - > pd - > object = newlibadr ( fd , tex - > id . lib , tex - > pd - > object ) ;
2012-05-17 12:59:34 +00:00
if ( tex - > vd )
tex - > vd - > object = newlibadr ( fd , tex - > id . lib , tex - > vd - > object ) ;
if ( tex - > ot )
tex - > ot - > object = newlibadr ( fd , tex - > id . lib , tex - > ot - > object ) ;
2013-06-05 19:06:27 +00:00
if ( tex - > nodetree ) {
2008-11-12 22:03:11 +00:00
lib_link_ntree ( fd , & tex - > id , tex - > nodetree ) ;
2013-06-05 19:06:27 +00:00
tex - > nodetree - > id . lib = tex - > id . lib ;
}
2008-11-12 22:03:11 +00:00
2012-08-01 15:32:27 +00:00
tex - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_texture ( FileData * fd , Tex * tex )
{
2012-05-17 12:59:34 +00:00
tex - > adt = newdataadr ( fd , tex - > adt ) ;
2009-01-19 02:26:46 +00:00
direct_link_animdata ( fd , tex - > adt ) ;
2012-05-29 10:21:07 +00:00
2012-05-17 12:59:34 +00:00
tex - > coba = newdataadr ( fd , tex - > coba ) ;
tex - > env = newdataadr ( fd , tex - > env ) ;
2012-03-24 06:18:31 +00:00
if ( tex - > env ) {
2012-05-17 12:59:34 +00:00
tex - > env - > ima = NULL ;
2013-03-26 09:59:43 +00:00
memset ( tex - > env - > cube , 0 , 6 * sizeof ( void * ) ) ;
2002-10-12 11:37:38 +00:00
tex - > env - > ok = 0 ;
}
2012-05-21 06:33:32 +00:00
tex - > pd = newdataadr ( fd , tex - > pd ) ;
2012-03-24 06:18:31 +00:00
if ( tex - > pd ) {
* 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 - > point_tree = NULL ;
2012-05-17 12:59:34 +00:00
tex - > pd - > coba = newdataadr ( fd , tex - > pd - > coba ) ;
tex - > pd - > falloff_curve = newdataadr ( fd , tex - > pd - > falloff_curve ) ;
2012-03-24 06:18:31 +00:00
if ( tex - > pd - > falloff_curve ) {
2011-05-01 03:57:53 +00:00
direct_link_curvemapping ( fd , tex - > pd - > falloff_curve ) ;
2011-05-01 05:41:08 +00:00
}
* 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
2012-05-17 12:59:34 +00:00
tex - > vd = newdataadr ( fd , tex - > vd ) ;
2012-03-24 06:18:31 +00:00
if ( tex - > vd ) {
* 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 - > dataset = NULL ;
2010-06-01 06:07:22 +00:00
tex - > vd - > ok = 0 ;
2012-03-24 06:18:31 +00:00
}
else {
if ( tex - > type = = TEX_VOXELDATA )
2012-05-17 12:59:34 +00:00
tex - > vd = MEM_callocN ( sizeof ( VoxelData ) , " direct_link_texture VoxelData " ) ;
* 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
2012-05-17 12:59:34 +00:00
tex - > ot = newdataadr ( fd , tex - > ot ) ;
2011-11-13 12:17:27 +00:00
2012-05-21 06:33:32 +00:00
tex - > nodetree = newdataadr ( fd , tex - > nodetree ) ;
2012-10-23 12:38:47 +00:00
if ( tex - > nodetree ) {
direct_link_id ( fd , & tex - > nodetree - > id ) ;
2008-11-12 22:03:11 +00:00
direct_link_nodetree ( fd , tex - > nodetree ) ;
2012-10-23 12:38:47 +00:00
}
2008-11-12 22:03:11 +00:00
2007-09-02 17:25:03 +00:00
tex - > preview = direct_link_preview_image ( fd , tex - > preview ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( ma = main - > mat . first ; ma ; ma = ma - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ma - > id . flag & LIB_NEED_LINK ) {
2012-03-24 06:18:31 +00:00
if ( ma - > adt ) lib_link_animdata ( fd , & ma - > id , ma - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-04-22 11:54:53 +00:00
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this . */
2006-11-17 04:46:48 +00:00
if ( ma - > id . properties ) IDP_LibLinkProperty ( ma - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
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
2012-05-17 12:59:34 +00:00
ma - > ipo = newlibadr_us ( fd , ma - > id . lib , ma - > ipo ) ;
ma - > group = newlibadr_us ( fd , ma - > id . lib , ma - > group ) ;
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-05-17 12:59:34 +00:00
mtex = ma - > mtex [ a ] ;
2012-03-24 06:18:31 +00:00
if ( mtex ) {
2012-05-17 12:59:34 +00:00
mtex - > tex = newlibadr_us ( fd , ma - > id . lib , mtex - > tex ) ;
mtex - > object = newlibadr ( fd , ma - > id . lib , mtex - > object ) ;
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
2013-06-05 19:06:27 +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 ) ;
2013-06-05 19:06:27 +00:00
ma - > nodetree - > id . lib = ma - > id . lib ;
}
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
2012-08-01 15:32:27 +00:00
ma - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_material ( FileData * fd , Material * ma )
{
int a ;
2012-05-17 12:59:34 +00:00
ma - > adt = newdataadr ( fd , ma - > adt ) ;
2009-01-19 02:26:46 +00:00
direct_link_animdata ( fd , ma - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
ma - > mtex [ a ] = newdataadr ( fd , ma - > mtex [ a ] ) ;
2002-10-12 11:37:38 +00:00
}
2014-07-21 12:02:05 +02:00
ma - > texpaintslot = NULL ;
2012-05-17 12:59:34 +00:00
ma - > ramp_col = newdataadr ( fd , ma - > ramp_col ) ;
ma - > ramp_spec = newdataadr ( fd , ma - > ramp_spec ) ;
ma - > nodetree = newdataadr ( fd , ma - > nodetree ) ;
2012-10-23 12:38:47 +00:00
if ( ma - > nodetree ) {
direct_link_id ( fd , & ma - > nodetree - > id ) ;
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
direct_link_nodetree ( fd , ma - > nodetree ) ;
2012-10-23 12:38:47 +00:00
}
2012-05-17 12:59:34 +00:00
2007-09-02 17:25:03 +00:00
ma - > preview = direct_link_preview_image ( fd , ma - > preview ) ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & ma - > gpumaterial ) ;
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 ***************** */
2011-01-10 02:40:24 +00:00
/* update this also to writefile.c */
2011-01-10 05:17:53 +00:00
static const char * ptcache_data_struct [ ] = {
2011-01-10 02:40:24 +00:00
" " , // BPHYS_DATA_INDEX
" " , // BPHYS_DATA_LOCATION
" " , // BPHYS_DATA_VELOCITY
" " , // BPHYS_DATA_ROTATION
" " , // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */
" " , // BPHYS_DATA_SIZE:
2012-12-11 22:00:22 +00:00
" " , // BPHYS_DATA_TIMES:
2011-01-10 02:40:24 +00:00
" BoidData " // case BPHYS_DATA_BOIDS:
} ;
2015-08-08 19:50:11 +02:00
static void direct_link_pointcache_cb ( FileData * fd , void * data )
{
PTCacheMem * pm = data ;
PTCacheExtra * extra ;
int i ;
for ( i = 0 ; i < BPHYS_TOT_DATA ; i + + ) {
pm - > data [ i ] = newdataadr ( fd , pm - > data [ i ] ) ;
/* the cache saves non-struct data without DNA */
if ( pm - > data [ i ] & & ptcache_data_struct [ i ] [ 0 ] = = ' \0 ' & & ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) ) {
int tot = ( BKE_ptcache_data_size ( i ) * pm - > totpoint ) / sizeof ( int ) ; /* data_size returns bytes */
int * poin = pm - > data [ i ] ;
BLI_endian_switch_int32_array ( poin , tot ) ;
}
}
link_list ( fd , & pm - > extradata ) ;
for ( extra = pm - > extradata . first ; extra ; extra = extra - > next )
extra - > data = newdataadr ( fd , extra - > data ) ;
}
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 )
{
2012-03-24 06:18:31 +00:00
if ( ( cache - > flag & PTCACHE_DISK_CACHE ) = = 0 ) {
2015-08-08 19:50:11 +02:00
link_list_ex ( fd , & cache - > mem_cache , direct_link_pointcache_cb ) ;
2009-06-21 10:16:52 +00:00
}
2009-07-12 23:38:47 +00:00
else
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & cache - > mem_cache ) ;
2012-05-17 12:59:34 +00:00
2009-08-29 15:20:36 +00:00
cache - > flag & = ~ PTCACHE_SIMULATION_VALID ;
2012-05-17 12:59:34 +00:00
cache - > simframe = 0 ;
cache - > edit = NULL ;
cache - > free_edit = NULL ;
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
{
2012-03-24 06:18:31 +00:00
if ( ptcaches - > first ) {
2011-02-12 09:09:52 +00:00
PointCache * cache = NULL ;
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
link_list ( fd , ptcaches ) ;
2012-03-24 06:18:31 +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 ) ;
2012-03-24 06:18:31 +00:00
if ( force_disk ) {
2010-11-30 21:31:18 +00:00
cache - > flag | = PTCACHE_DISK_CACHE ;
cache - > step = 1 ;
}
}
2012-05-17 12:59:34 +00:00
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 ) ;
}
2012-03-24 06:18:31 +00:00
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 ) ;
2012-03-24 06:18:31 +00:00
if ( force_disk ) {
2010-11-30 21:31:18 +00:00
( * ocache ) - > flag | = PTCACHE_DISK_CACHE ;
2011-02-12 09:09:52 +00:00
( * ocache ) - > step = 1 ;
2010-11-30 21:31:18 +00:00
}
2012-05-17 12:59:34 +00:00
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
}
}
2011-02-13 10:52:18 +00:00
static void lib_link_partdeflect ( FileData * fd , ID * id , PartDeflect * pd )
2009-12-18 13:08:11 +00:00
{
2012-03-24 06:18:31 +00:00
if ( pd & & pd - > tex )
2012-05-17 12:59:34 +00:00
pd - > tex = newlibadr_us ( fd , id - > lib , pd - > tex ) ;
2012-10-10 13:18:07 +00:00
if ( pd & & pd - > f_source )
pd - > f_source = newlibadr_us ( fd , id - > lib , pd - > f_source ) ;
2009-12-18 13:08:11 +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
static void lib_link_particlesettings ( FileData * fd , Main * main )
{
ParticleSettings * part ;
2009-10-05 13:25:56 +00:00
ParticleDupliWeight * dw ;
2011-02-12 14:38:34 +00:00
MTex * mtex ;
int a ;
2012-05-21 06:33:32 +00:00
for ( part = main - > particle . first ; part ; part = part - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( part - > id . flag & LIB_NEED_LINK ) {
2009-06-24 02:11:36 +00:00
if ( part - > adt ) lib_link_animdata ( fd , & part - > id , part - > adt ) ;
2012-09-26 20:05:38 +00:00
part - > ipo = newlibadr_us ( fd , part - > id . lib , part - > ipo ) ; // XXX deprecated - 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 ) ;
2012-05-17 12:59:34 +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 ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
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 - > group = newlibadr ( fd , part - > id . lib , part - > effector_weights - > group ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( part - > dupliweights . first & & part - > dup_group ) {
2011-07-15 13:32:02 +00:00
int index_ok = 0 ;
/* check for old files without indices (all indexes 0) */
2014-02-08 06:07:10 +11:00
if ( BLI_listbase_is_single ( & part - > dupliweights ) ) {
2011-07-15 13:32:02 +00:00
/* special case for only one object in the group */
index_ok = 1 ;
}
2012-12-11 22:00:22 +00:00
else {
2012-10-26 05:22:24 +00:00
for ( dw = part - > dupliweights . first ; dw ; dw = dw - > next ) {
2012-03-24 06:18:31 +00:00
if ( dw - > index > 0 ) {
2011-07-15 13:32:02 +00:00
index_ok = 1 ;
break ;
}
}
}
2012-12-11 22:00:22 +00:00
2012-03-24 06:18:31 +00:00
if ( index_ok ) {
2011-07-15 13:32:02 +00:00
/* if we have indexes, let's use them */
2012-10-26 05:22:24 +00:00
for ( dw = part - > dupliweights . first ; dw ; dw = dw - > next ) {
2011-07-15 13:32:02 +00:00
GroupObject * go = ( GroupObject * ) BLI_findlink ( & part - > dup_group - > gobject , dw - > index ) ;
2013-10-14 20:13:40 +00:00
dw - > ob = go ? go - > ob : NULL ;
2011-07-15 13:32:02 +00:00
}
}
else {
/* otherwise try to get objects from own library (won't work on library linked groups) */
2012-10-26 05:22:24 +00:00
for ( dw = part - > dupliweights . first ; dw ; dw = dw - > next ) {
2011-07-15 13:32:02 +00:00
dw - > ob = newlibadr ( fd , part - > id . lib , dw - > ob ) ;
2012-12-11 22:00:22 +00:00
}
2011-07-15 13:32:02 +00:00
}
}
2011-07-31 16:26:02 +00:00
else {
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & part - > dupliweights ) ;
2011-07-31 16:26:02 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( part - > boids ) {
2009-07-20 23:52:53 +00:00
BoidState * state = part - > boids - > states . first ;
BoidRule * rule ;
2012-03-24 06:18:31 +00:00
for ( ; state ; state = state - > next ) {
2009-07-20 23:52:53 +00:00
rule = state - > rules . first ;
2015-03-11 13:14:24 +11:00
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 ;
}
2009-07-20 23:52:53 +00:00
}
}
}
}
2015-03-11 13:14:24 +11:00
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2011-02-12 14:38:34 +00:00
mtex = part - > mtex [ a ] ;
2012-03-24 06:18:31 +00:00
if ( mtex ) {
2011-02-12 14:38:34 +00:00
mtex - > tex = newlibadr_us ( fd , part - > id . lib , mtex - > tex ) ;
mtex - > object = newlibadr ( fd , part - > id . lib , mtex - > object ) ;
}
}
2012-05-17 12:59:34 +00:00
2012-08-01 15:32:27 +00:00
part - > id . flag - = LIB_NEED_LINK ;
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-12-18 13:08:11 +00:00
static void direct_link_partdeflect ( PartDeflect * pd )
{
2012-05-17 12:59:34 +00:00
if ( pd ) pd - > rng = NULL ;
2009-12-18 13:08:11 +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
static void direct_link_particlesettings ( FileData * fd , ParticleSettings * part )
{
2011-02-12 14:38:34 +00:00
int a ;
2012-05-21 06:33:32 +00:00
2012-05-17 12:59:34 +00:00
part - > adt = newdataadr ( fd , part - > adt ) ;
part - > pd = newdataadr ( fd , part - > pd ) ;
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 ) ;
2015-01-09 14:24:19 +01:00
part - > clumpcurve = newdataadr ( fd , part - > clumpcurve ) ;
if ( part - > clumpcurve )
direct_link_curvemapping ( fd , part - > clumpcurve ) ;
2015-01-09 15:58:18 +01:00
part - > roughcurve = newdataadr ( fd , part - > roughcurve ) ;
if ( part - > roughcurve )
direct_link_curvemapping ( fd , part - > roughcurve ) ;
2015-01-09 14:24:19 +01:00
2009-12-14 19:17:27 +00:00
part - > effector_weights = newdataadr ( fd , part - > effector_weights ) ;
2012-03-24 06:18:31 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
part - > boids = newdataadr ( fd , part - > boids ) ;
part - > fluid = newdataadr ( fd , part - > fluid ) ;
2009-07-20 23:52:53 +00:00
2012-03-24 06:18:31 +00:00
if ( part - > boids ) {
2009-07-20 23:52:53 +00:00
BoidState * state ;
link_list ( fd , & part - > boids - > states ) ;
2012-03-24 06:18:31 +00:00
for ( state = part - > boids - > states . first ; state ; state = state - > next ) {
2009-07-20 23:52:53 +00:00
link_list ( fd , & state - > rules ) ;
link_list ( fd , & state - > conditions ) ;
link_list ( fd , & state - > actions ) ;
}
}
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
part - > mtex [ a ] = newdataadr ( fd , part - > mtex [ a ] ) ;
2011-02-12 14:38:34 +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
}
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
2012-03-24 06:18:31 +00:00
for ( psys = particles - > first ; psys ; psys = psysnext ) {
2012-05-17 12:59:34 +00:00
psysnext = psys - > next ;
2008-09-16 16:20:51 +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
psys - > part = newlibadr_us ( fd , id - > lib , psys - > part ) ;
2012-03-24 06:18:31 +00:00
if ( psys - > part ) {
2009-07-20 23:52:53 +00:00
ParticleTarget * pt = psys - > targets . first ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
for ( ; pt ; pt = pt - > next )
2009-07-20 23:52:53 +00:00
pt - > ob = newlibadr ( fd , id - > lib , pt - > ob ) ;
2012-05-17 12:59:34 +00:00
2013-10-17 20:18:48 +00:00
psys - > parent = newlibadr ( fd , id - > lib , psys - > parent ) ;
2008-09-16 16:20:51 +00:00
psys - > target_ob = newlibadr ( fd , id - > lib , psys - > target_ob ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( psys - > clmd ) {
2010-02-04 16:54:25 +00:00
/* XXX - from reading existing code this seems correct but intended usage of
2015-08-08 19:50:11 +02:00
* pointcache / w cloth should be added in ' ParticleSystem ' - campbell */
2012-05-17 12:59:34 +00:00
psys - > clmd - > point_cache = psys - > pointcache ;
psys - > clmd - > ptcaches . first = psys - > clmd - > ptcaches . last = NULL ;
psys - > clmd - > coll_parms - > group = newlibadr ( fd , id - > lib , psys - > clmd - > coll_parms - > group ) ;
2013-11-01 04:24:29 +00:00
psys - > clmd - > modifier . error = NULL ;
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 */
2012-05-17 12:59:34 +00:00
ParticleSystemModifierData * psmd = psys_get_modifier ( ob , psys ) ;
2008-09-16 18:40:54 +00:00
BLI_remlink ( & ob - > modifiers , psmd ) ;
modifier_free ( ( ModifierData * ) psmd ) ;
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
for ( psys = particles - > first ; psys ; psys = psys - > next ) {
2012-04-29 15:47:02 +00:00
psys - > particles = newdataadr ( fd , psys - > particles ) ;
2009-07-20 23:52:53 +00:00
2012-03-24 06:18:31 +00:00
if ( psys - > particles & & psys - > particles - > hair ) {
2012-04-29 15:47:02 +00:00
for ( a = 0 , pa = psys - > particles ; a < psys - > totpart ; a + + , pa + + )
pa - > hair = newdataadr ( fd , pa - > hair ) ;
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
2012-03-24 06:18:31 +00:00
if ( psys - > particles & & psys - > particles - > keys ) {
2012-04-29 15:47:02 +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 ;
}
2012-05-17 12:59:34 +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
psys - > flag & = ~ PSYS_KEYED ;
2008-01-17 00:28:14 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +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 ) ;
2012-04-29 15:47:02 +00:00
for ( a = 1 , pa + + ; a < psys - > totpart ; a + + , pa + + )
2009-07-20 23:52:53 +00:00
pa - > boid = ( pa - 1 ) - > boid + 1 ;
}
2012-03-24 06:18:31 +00:00
else if ( psys - > particles ) {
2012-04-29 15:47:02 +00:00
for ( a = 0 , pa = psys - > particles ; a < psys - > totpart ; a + + , pa + + )
2009-07-20 23:52:53 +00:00
pa - > boid = NULL ;
}
2012-05-17 12:59:34 +00:00
2011-01-09 19:09:41 +00:00
psys - > fluid_springs = newdataadr ( fd , psys - > fluid_springs ) ;
2012-05-17 12:59:34 +00:00
2012-04-29 15:47:02 +00:00
psys - > child = newdataadr ( fd , psys - > child ) ;
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 - > effectors = NULL ;
2012-05-17 12:59:34 +00:00
2009-07-20 23:52:53 +00:00
link_list ( fd , & psys - > targets ) ;
2012-05-17 12:59:34 +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 ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & psys - > pathcachebufs ) ;
BLI_listbase_clear ( & psys - > childcachebufs ) ;
2009-09-17 22:00:49 +00:00
psys - > pdd = NULL ;
2010-10-19 17:45:19 +00:00
psys - > renderdata = NULL ;
2010-06-09 02:42:20 +00:00
2012-03-24 06:18:31 +00:00
if ( psys - > clmd ) {
2009-09-10 22:32:33 +00:00
psys - > clmd = newdataadr ( fd , psys - > clmd ) ;
psys - > clmd - > clothObject = NULL ;
2014-11-17 19:44:42 +01:00
psys - > clmd - > hairdata = NULL ;
2009-09-10 22:32:33 +00:00
psys - > clmd - > sim_parms = newdataadr ( fd , psys - > clmd - > sim_parms ) ;
psys - > clmd - > coll_parms = newdataadr ( fd , psys - > clmd - > coll_parms ) ;
2012-03-24 06:18:31 +00:00
if ( psys - > clmd - > sim_parms ) {
2012-10-07 10:01:54 +00:00
psys - > clmd - > sim_parms - > effector_weights = NULL ;
2012-03-24 06:18:31 +00:00
if ( psys - > clmd - > sim_parms - > presets > 10 )
2009-09-10 22:32:33 +00:00
psys - > clmd - > sim_parms - > presets = 0 ;
}
2012-05-17 12:59:34 +00:00
2009-09-10 22:32:33 +00:00
psys - > hair_in_dm = psys - > hair_out_dm = NULL ;
2014-09-22 21:20:22 +02:00
psys - > clmd - > solver_result = NULL ;
2015-08-08 19:50:11 +02:00
}
direct_link_pointcache_list ( fd , & psys - > ptcaches , & psys - > pointcache , 0 ) ;
if ( psys - > clmd ) {
2009-09-10 22:32:33 +00:00
psys - > clmd - > point_cache = psys - > pointcache ;
}
2015-08-08 19:50:11 +02:00
2009-07-20 23:52:53 +00:00
psys - > tree = NULL ;
Completely refactored sph fluid particles. Only the very core of the algorithm remains
the same, but big changes have happened both on the outside and on the inside.
New UI:
* The old parameters were quite true to the underlying algorithm, but were quite obscure
from a users point of view. Now there are only a few intuitive basic parameters that
define the basic fluid behavior.
** By default particle size is now used to determine the interaction radius, rest
density and spring rest lengths so that it's easy to get stable simulations by simply
emitting particles for a few frames and adjusting the particle size (easy when the
particle size is drawn) so that the fluid appears continuous (particles are touching
eachother).
** Stiffness - in reality most fluids are very incompressible, but this is a very hard
problem to solve with particle based fluid simulation so some compromises have to be
made. So the bigger the stiffness parameter is the less the fluid will compress under
stress, but the more substeps are needed for stable simulation.
** Viscosity - how much internal friction there is in the fluid. Large viscosities also
smooth out instabilities, so less viscous fluids again need more substeps to remain
stable.
** Buoancy - with high buoancy low pressure areas inside the fluid start to rise against
gravity, and high pressure areas start to come down.
* In addition to these basic parameters there are separate advanced parameters that can
either be tweaked relative to the basic parameters (or particle size) or defined
independently.
** Repulsion - the stiffness parameter tries to keep the fluid density constant, but this
can lead to small clumps of particles, so the repulsion keeps the particles better
separated.
** Stiff viscosity - the normal viscosity only applies when particles are moving closer to
eachother to allow free flowing fluids. Stiff viscosity also applies smoothing to
particles that are moving away from eachother.
** Interaction radius - by default this is 4 * particle size.
** Rest density - by default this is a density that the particles have when they're packed
densely next to eachother.
** Spring rest length - by default this is 2 * particle size.
* There are also new options for 3d view particle coloring in the display panel to show
particle velocity and acceleration. These make it easier to see what's happening in the
fluid simulations, but can of course be used with other particles as well.
* Viscoelastic springs have some new options too. The plasticity can now be set to much
higher values for instant deletion of springs as the elastic limit is exeeded. In addition
to that there is an option to only create springs for a certain number of frames when a
particle is born. These options give new possibilities for breaking viscoelastic fluids.
New in the code:
* Most of the fluids code is now thread safe, so when particle dynamics go threaded there
will be a nice speed boost to fluids as well.
* Fluids now use a bvh-tree instead of a kd-tree for the neighbor lookups. The bvh-tree
implementation makes the code quite a bit cleaner and should also give a slight speed
boost to the simulation too.
* Previously only force fields were calculated with the different integration methods, but
now the fluid calculations are also done using the selected integration method, so there
are again more choices in effecting simulation accuracy and stability. This change also
included a nice cleanup of the whole particle integration code.
As the internals are pretty stirred up old particle fluid simulations will probably not
work correctly straight away, but with some tweaking the same level of control is still
available by not using the "relative versions" of the advanced parameters (by default these
are not used when loading old files).
2011-03-12 12:38:11 +00:00
psys - > bvhtree = 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 ;
2012-05-17 12:59:34 +00:00
2011-10-23 17:52:20 +00:00
/* Add pseudo-references (not fake users!) to images used by texface. A
2011-11-11 13:09:14 +00:00
* little bogus ; it would be better if each mesh consistently added one ref
* to each image it used . - z0r */
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < totface ; i + + , tf + + ) {
2006-11-21 16:54:00 +00:00
tf - > tpage = newlibadr ( fd , me - > id . lib , tf - > tpage ) ;
2012-03-24 06:18:31 +00:00
if ( tf - > tpage & & tf - > tpage - > id . us = = 0 )
2006-11-21 16:54:00 +00:00
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 )
{
2012-12-11 22:00:22 +00:00
int i ;
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < fdata - > totlayer ; i + + ) {
2007-04-02 00:52:38 +00:00
CustomDataLayer * layer = & fdata - > layers [ i ] ;
2012-03-24 06:18:31 +00:00
if ( layer - > type = = CD_MTFACE )
2007-04-02 00:52:38 +00:00
lib_link_mtface ( fd , me , layer - > data , totface ) ;
}
}
2009-05-26 04:17:47 +00:00
static void lib_link_customdata_mtpoly ( FileData * fd , Mesh * me , CustomData * pdata , int totface )
{
int i ;
2012-05-21 06:33:32 +00:00
for ( i = 0 ; i < pdata - > totlayer ; i + + ) {
2009-05-26 04:17:47 +00:00
CustomDataLayer * layer = & pdata - > layers [ i ] ;
2012-03-24 06:18:31 +00:00
if ( layer - > type = = CD_MTEXPOLY ) {
2009-05-26 04:17:47 +00:00
MTexPoly * tf = layer - > data ;
2012-10-20 08:02:18 +00:00
int j ;
2012-05-17 12:59:34 +00:00
2012-10-20 08:02:18 +00:00
for ( j = 0 ; j < totface ; j + + , tf + + ) {
2012-05-17 12:59:34 +00:00
tf - > tpage = newlibadr ( fd , me - > id . lib , tf - > tpage ) ;
2012-10-20 08:02:18 +00:00
if ( tf - > tpage & & tf - > tpage - > id . us = = 0 ) {
2012-05-17 12:59:34 +00:00
tf - > tpage - > id . us = 1 ;
2012-12-11 22:00:22 +00:00
}
2009-05-26 04:17:47 +00:00
}
}
}
}
2002-10-12 11:37:38 +00:00
static void lib_link_mesh ( FileData * fd , Main * main )
{
Mesh * me ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( me = main - > mesh . first ; me ; me = me - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( me - > id . flag & LIB_NEED_LINK ) {
2002-10-12 11:37:38 +00:00
int i ;
2012-05-17 12:59:34 +00:00
2012-04-22 11:54:53 +00:00
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this . */
2006-11-17 06:14:15 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2003-12-31 15:27:31 +00:00
/* this check added for python created meshes */
2012-03-24 06:18:31 +00:00
if ( me - > mat ) {
2012-05-21 06:33:32 +00:00
for ( i = 0 ; i < me - > totcol ; i + + ) {
2012-05-17 12:59:34 +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
}
2013-03-09 03:46:30 +00:00
else {
me - > totcol = 0 ;
}
2012-05-21 06:33:32 +00:00
me - > ipo = newlibadr_us ( fd , me - > id . lib , me - > ipo ) ; // XXX: deprecated: old anim sys
2012-05-17 12:59:34 +00:00
me - > key = newlibadr_us ( fd , me - > id . lib , me - > key ) ;
me - > texcomesh = newlibadr_us ( fd , me - > id . lib , me - > texcomesh ) ;
2007-04-02 00:52:38 +00:00
lib_link_customdata_mtface ( fd , me , & me - > fdata , me - > totface ) ;
2009-05-26 04:17:47 +00:00
lib_link_customdata_mtpoly ( fd , me , & me - > pdata , me - > totpoly ) ;
2012-03-24 06:18:31 +00:00
if ( me - > mr & & me - > mr - > levels . first )
2007-04-02 00:52:38 +00:00
lib_link_customdata_mtface ( fd , me , & me - > mr - > fdata ,
( ( MultiresLevel * ) me - > mr - > levels . first ) - > totface ) ;
2012-10-03 12:07:29 +00:00
}
}
/* convert texface options to material */
convert_tface_mt ( fd , main ) ;
for ( me = main - > mesh . first ; me ; me = me - > id . next ) {
if ( me - > id . flag & LIB_NEED_LINK ) {
2011-03-31 00:52:12 +00:00
/*check if we need to convert mfaces to mpolys*/
if ( me - > totface & & ! me - > totpoly ) {
2012-04-13 05:39:27 +00:00
/* temporarily switch main so that reading from
2012-04-22 11:54:53 +00:00
* external CustomData works */
2012-04-13 05:39:27 +00:00
Main * gmain = G . main ;
G . main = main ;
2012-06-07 09:11:16 +00:00
BKE_mesh_do_versions_convert_mfaces_to_mpolys ( me ) ;
2012-05-17 12:59:34 +00:00
2012-04-13 05:39:27 +00:00
G . main = gmain ;
2011-03-31 00:52:12 +00:00
}
2012-07-12 15:36:22 +00:00
2011-11-13 15:13:59 +00:00
/*
2012-03-20 22:56:26 +00:00
* Re - tessellate , even if the polys were just created from tessfaces , this
2011-11-13 15:13:59 +00:00
* is important because it :
2012-10-30 19:20:17 +00:00
* - fill the CD_ORIGINDEX layer
2011-11-13 15:13:59 +00:00
* - gives consistency of tessface between loading from a file and
* converting an edited BMesh back into a mesh ( i . e . it replaces
* quad tessfaces in a loaded mesh immediately , instead of lazily
* waiting until edit mode has been entered / exited , making it easier
* to recognize problems that would otherwise only show up after edits ) .
*/
2012-02-20 00:18:35 +00:00
# ifdef USE_TESSFACE_DEFAULT
2012-02-12 19:11:09 +00:00
BKE_mesh_tessface_calc ( me ) ;
2012-02-20 00:18:35 +00:00
# else
BKE_mesh_tessface_clear ( me ) ;
# endif
2012-07-12 15:36:22 +00:00
2012-08-01 15:32:27 +00:00
me - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
static void direct_link_dverts ( FileData * fd , int count , MDeformVert * mdverts )
{
2011-04-20 12:06:23 +00:00
int i ;
2012-05-17 12:59:34 +00:00
2011-04-20 12:06:23 +00:00
if ( mdverts = = NULL ) {
2002-10-12 11:37:38 +00:00
return ;
2011-04-20 12:06:23 +00:00
}
2012-05-17 12:59:34 +00:00
for ( i = count ; i > 0 ; i - - , mdverts + + ) {
2009-09-15 15:32:09 +00:00
/*convert to vgroup allocation system*/
2011-05-11 09:31:00 +00:00
MDeformWeight * dw ;
2012-05-17 12:59:34 +00:00
if ( mdverts - > dw & & ( dw = newdataadr ( fd , mdverts - > dw ) ) ) {
const ssize_t dw_len = mdverts - > totweight * sizeof ( MDeformWeight ) ;
void * dw_tmp = MEM_mallocN ( dw_len , " direct_link_dverts " ) ;
2011-05-11 09:31:00 +00:00
memcpy ( dw_tmp , dw , dw_len ) ;
2012-05-17 12:59:34 +00:00
mdverts - > dw = dw_tmp ;
2011-05-11 09:31:00 +00:00
MEM_freeN ( dw ) ;
2011-04-20 12:06:23 +00:00
}
2011-05-11 09:31:00 +00:00
else {
2012-05-17 12:59:34 +00:00
mdverts - > dw = NULL ;
mdverts - > totweight = 0 ;
2011-04-20 12:06:23 +00:00
}
2002-10-12 11:37:38 +00:00
}
}
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
{
2012-03-24 06:18:31 +00:00
if ( mdisps ) {
2009-01-06 18:59:03 +00:00
int i ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
for ( i = 0 ; i < count ; + + i ) {
2009-01-06 18:59:03 +00:00
mdisps [ i ] . disps = newdataadr ( fd , mdisps [ i ] . disps ) ;
2012-03-14 06:31:38 +00:00
mdisps [ i ] . hidden = newdataadr ( fd , mdisps [ i ] . hidden ) ;
2012-05-17 12:59:34 +00:00
2012-03-14 03:10:18 +00:00
if ( mdisps [ i ] . totdisp & & ! mdisps [ i ] . level ) {
/* this calculation is only correct for loop mdisps;
2012-04-22 11:54:53 +00:00
* if loading pre - BMesh face mdisps this will be
* overwritten with the correct value in
* bm_corners_to_loops ( ) */
2012-03-14 03:10:18 +00:00
float gridsize = sqrtf ( mdisps [ i ] . totdisp ) ;
2012-05-05 21:28:12 +00:00
mdisps [ i ] . level = ( int ) ( logf ( gridsize - 1.0f ) / ( float ) M_LN2 ) + 1 ;
2012-03-14 03:10:18 +00:00
}
2012-05-17 12:59:34 +00:00
if ( ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) & & ( mdisps [ i ] . disps ) ) {
2010-10-19 22:17:34 +00:00
/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
/* this does swap for data written at write_mdisps() - readfile.c */
2012-09-03 09:03:25 +00:00
BLI_endian_switch_float_array ( * mdisps [ i ] . disps , mdisps [ i ] . totdisp * 3 ) ;
2010-10-19 22:17:34 +00:00
}
2012-03-24 06:18:31 +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
}
2012-05-10 20:33:24 +00:00
static void direct_link_grid_paint_mask ( FileData * fd , int count , GridPaintMask * grid_paint_mask )
{
2012-05-17 12:59:34 +00:00
if ( grid_paint_mask ) {
2012-05-10 20:33:24 +00:00
int i ;
2012-05-17 12:59:34 +00:00
for ( i = 0 ; i < count ; + + i ) {
2012-05-10 20:33:24 +00:00
GridPaintMask * gpm = & grid_paint_mask [ i ] ;
2012-05-17 12:59:34 +00:00
if ( gpm - > data )
2012-05-10 20:33:24 +00:00
gpm - > data = newdataadr ( fd , gpm - > data ) ;
}
}
}
2011-12-28 09:11:11 +00:00
/*this isn't really a public api function, so prototyped here*/
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 ;
2012-05-17 12:59:34 +00:00
data - > layers = newdataadr ( fd , data - > layers ) ;
2012-04-24 10:25:12 +00:00
/* annoying workaround for bug [#31079] loading legacy files with
* no polygons _but_ have stale customdata */
if ( UNLIKELY ( count = = 0 & & data - > layers = = NULL & & data - > totlayer ! = 0 ) ) {
2012-10-31 09:50:24 +00:00
CustomData_reset ( data ) ;
2012-04-24 10:25:12 +00:00
return ;
}
2012-05-17 12:59:34 +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 ] ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( layer - > flag & CD_FLAG_EXTERNAL )
2009-11-25 14:27:50 +00:00
layer - > flag & = ~ CD_FLAG_IN_MEMORY ;
2013-09-13 13:34:10 +00:00
layer - > flag & = ~ CD_FLAG_NOFREE ;
2012-05-17 12:59:34 +00:00
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 ) ;
2012-03-24 06:18:31 +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 ) ;
2012-05-22 22:03:41 +00:00
else if ( layer - > type = = CD_GRID_PAINT_MASK )
2012-05-10 20:33:24 +00:00
direct_link_grid_paint_mask ( fd , count , layer - > data ) ;
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 + + ;
}
}
2012-05-17 12:59:34 +00:00
2011-12-28 09:11:11 +00:00
CustomData_update_typemap ( data ) ;
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
}
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 ) ;
2012-05-17 12:59:34 +00:00
mesh - > mvert = newdataadr ( fd , mesh - > mvert ) ;
mesh - > medge = newdataadr ( fd , mesh - > medge ) ;
mesh - > mface = newdataadr ( fd , mesh - > mface ) ;
mesh - > mloop = newdataadr ( fd , mesh - > mloop ) ;
mesh - > mpoly = newdataadr ( fd , mesh - > mpoly ) ;
mesh - > tface = newdataadr ( fd , mesh - > tface ) ;
mesh - > mtface = newdataadr ( fd , mesh - > mtface ) ;
mesh - > mcol = newdataadr ( fd , mesh - > mcol ) ;
mesh - > dvert = newdataadr ( fd , mesh - > dvert ) ;
mesh - > mloopcol = newdataadr ( fd , mesh - > mloopcol ) ;
mesh - > mloopuv = newdataadr ( fd , mesh - > mloopuv ) ;
mesh - > mtpoly = newdataadr ( fd , mesh - > mtpoly ) ;
2012-04-11 11:52:21 +00:00
mesh - > mselect = newdataadr ( fd , mesh - > mselect ) ;
2012-05-17 12:59:34 +00:00
2010-07-27 06:06:36 +00:00
/* animdata */
2012-05-17 12:59:34 +00:00
mesh - > adt = newdataadr ( fd , mesh - > adt ) ;
2010-02-02 18:24:10 +00:00
direct_link_animdata ( fd , mesh - > adt ) ;
2012-05-17 12:59:34 +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
/* normally direct_link_dverts should be called in direct_link_customdata,
2012-04-22 11:54:53 +00:00
* but for backwards compat in do_versions to work we do it here */
2011-12-04 19:49:35 +00:00
direct_link_dverts ( fd , mesh - > totvert , mesh - > dvert ) ;
2012-05-17 12:59:34 +00:00
2011-12-04 19:49:35 +00:00
direct_link_customdata ( fd , & mesh - > vdata , mesh - > totvert ) ;
direct_link_customdata ( fd , & mesh - > edata , mesh - > totedge ) ;
direct_link_customdata ( fd , & mesh - > fdata , mesh - > totface ) ;
2009-05-26 04:17:47 +00:00
direct_link_customdata ( fd , & mesh - > ldata , mesh - > totloop ) ;
direct_link_customdata ( fd , & mesh - > pdata , mesh - > totpoly ) ;
2013-09-16 06:00:25 +00:00
2012-05-17 12:59:34 +00:00
mesh - > bb = NULL ;
mesh - > edit_btmesh = NULL ;
2008-12-31 17:11:42 +00:00
2013-06-30 22:04:03 +00:00
/* happens with old files */
if ( mesh - > mselect = = NULL ) {
mesh - > totselect = 0 ;
}
2013-10-07 16:48:26 +00:00
if ( mesh - > mloopuv | | mesh - > mtpoly ) {
/* for now we have to ensure texpoly and mloopuv layers are aligned
* in the future we may allow non - aligned layers */
BKE_mesh_cd_validate ( mesh ) ;
}
2006-11-06 01:08:26 +00:00
/* Multires data */
mesh - > mr = newdataadr ( fd , mesh - > mr ) ;
2012-03-24 06:18:31 +00:00
if ( mesh - > mr ) {
2006-11-06 01:08:26 +00:00
MultiresLevel * lvl ;
2007-01-02 19:23:55 +00:00
2006-11-06 01:08:26 +00:00
link_list ( fd , & mesh - > mr - > levels ) ;
2012-05-17 12:59:34 +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
2012-05-17 12:59:34 +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 ) ;
2011-06-27 03:54:22 +00:00
/* If mesh has the same number of vertices as the
2012-04-22 11:54:53 +00:00
* highest multires level , load the current mesh verts
* into multires and discard the old data . Needed
* because some saved files either do not have a verts
* array , or the verts array contains out - of - date
* data . */
2012-03-24 06:18:31 +00:00
if ( mesh - > totvert = = ( ( MultiresLevel * ) mesh - > mr - > levels . last ) - > totvert ) {
if ( mesh - > mr - > verts )
2011-06-27 03:54:22 +00:00
MEM_freeN ( mesh - > mr - > verts ) ;
mesh - > mr - > verts = MEM_dupallocN ( mesh - > mvert ) ;
}
2007-01-02 19:28:54 +00:00
2012-05-21 06:33:32 +00:00
for ( ; lvl ; lvl = lvl - > next ) {
lvl - > verts = newdataadr ( fd , lvl - > verts ) ;
lvl - > faces = newdataadr ( fd , lvl - > faces ) ;
lvl - > edges = newdataadr ( fd , lvl - > edges ) ;
lvl - > colfaces = newdataadr ( fd , lvl - > colfaces ) ;
2006-11-06 01:08:26 +00:00
}
}
2009-06-08 20:08:19 +00:00
2011-06-27 03:54:22 +00:00
/* if multires is present but has no valid vertex data,
2011-11-11 13:09:14 +00:00
* there ' s no way to recover it ; silently remove multires */
2012-03-24 06:18:31 +00:00
if ( mesh - > mr & & ! mesh - > mr - > verts ) {
2011-06-27 03:54:22 +00:00
multires_free ( mesh - > mr ) ;
mesh - > mr = NULL ;
2006-11-06 01:08:26 +00:00
}
2005-07-26 02:44:59 +00:00
2012-03-24 06:18:31 +00:00
if ( ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) & & mesh - > tface ) {
2012-05-21 06:33:32 +00:00
TFace * tf = mesh - > tface ;
2012-02-17 19:21:47 +00:00
int i ;
2012-05-17 12:59:34 +00:00
2012-09-03 09:03:25 +00:00
for ( i = 0 ; i < mesh - > totface ; i + + , tf + + ) {
BLI_endian_switch_uint32_array ( tf - > col , 4 ) ;
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 ;
2012-05-21 06:33:32 +00:00
for ( lt = main - > latt . first ; lt ; lt = lt - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( lt - > id . flag & LIB_NEED_LINK ) {
2012-03-24 06:18:31 +00:00
if ( lt - > adt ) lib_link_animdata ( fd , & lt - > id , lt - > adt ) ;
2006-09-03 12:16:14 +00:00
2012-09-26 20:05:38 +00:00
lt - > ipo = newlibadr_us ( fd , lt - > id . lib , lt - > ipo ) ; // XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
lt - > key = newlibadr_us ( fd , lt - > id . lib , lt - > key ) ;
2006-09-03 12:16:14 +00:00
2012-08-01 15:32:27 +00:00
lt - > id . flag - = LIB_NEED_LINK ;
2006-09-03 12:16:14 +00:00
}
}
}
static void direct_link_latt ( FileData * fd , Lattice * lt )
{
2012-05-17 12:59:34 +00:00
lt - > def = newdataadr ( fd , lt - > def ) ;
2006-09-03 12:16:14 +00:00
2012-05-17 12:59:34 +00:00
lt - > dvert = newdataadr ( fd , lt - > dvert ) ;
2006-09-03 12:16:14 +00:00
direct_link_dverts ( fd , lt - > pntsu * lt - > pntsv * lt - > pntsw , lt - > dvert ) ;
2009-01-02 19:10:35 +00:00
2012-05-17 12:59:34 +00:00
lt - > editlatt = NULL ;
2010-12-13 06:31:49 +00:00
lt - > adt = newdataadr ( fd , lt - > adt ) ;
direct_link_animdata ( fd , lt - > adt ) ;
2006-09-03 12:16:14 +00:00
}
2002-10-12 11:37:38 +00:00
/* ************ READ OBJECT ***************** */
2015-10-08 14:21:11 +02:00
static void lib_link_modifiers__linkModifiers (
void * userData , Object * ob , ID * * idpoin , int cd_flag )
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 ) ;
2015-10-08 21:06:09 +05:00
if ( * idpoin ! = NULL & & ( cd_flag & IDWALK_USER ) ! = 0 ) {
2007-01-18 10:59:23 +00:00
( * idpoin ) - > us + + ;
2015-10-08 14:21:11 +02: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
}
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 ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( ob = main - > object . first ; ob ; ob = ob - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( ob - > id . flag & LIB_NEED_LINK ) {
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 ) ;
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system <<<
2012-05-17 12:59:34 +00:00
ob - > ipo = newlibadr_us ( fd , ob - > id . lib , ob - > ipo ) ;
2009-01-19 02:26:46 +00:00
ob - > action = newlibadr_us ( fd , ob - > id . lib , ob - > action ) ;
2012-09-26 20:05:38 +00:00
// >>> XXX deprecated - old animation system
2004-06-23 18:22:51 +00:00
2012-05-17 12:59:34 +00:00
ob - > parent = newlibadr ( fd , ob - > id . lib , ob - > parent ) ;
ob - > track = newlibadr ( fd , ob - > id . lib , ob - > track ) ;
ob - > poselib = newlibadr_us ( fd , ob - > id . lib , ob - > poselib ) ;
ob - > dup_group = newlibadr_us ( fd , ob - > id . lib , ob - > dup_group ) ;
2006-11-30 15:54:21 +00:00
2012-05-17 12:59:34 +00:00
ob - > proxy = newlibadr_us ( fd , ob - > id . lib , ob - > proxy ) ;
2012-03-24 06:18:31 +00:00
if ( ob - > proxy ) {
2006-11-30 15:54:21 +00:00
/* paranoia check, actually a proxy_from pointer should never be written... */
2012-05-17 12:59:34 +00:00
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 )
2013-03-18 18:25:05 +00:00
printf ( " Proxy lost from object %s lib %s \n " , ob - > id . name + 2 , ob - > id . lib - > name ) ;
2010-04-05 07:20:34 +00:00
else
2013-03-18 18:25:05 +00:00
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 */
2012-05-17 12:59:34 +00:00
ob - > proxy - > proxy_from = ob ;
2006-11-11 16:45:17 +00:00
}
2006-11-30 15:54:21 +00:00
}
2012-05-17 12:59:34 +00:00
ob - > proxy_group = newlibadr ( fd , ob - > id . lib , ob - > proxy_group ) ;
poin = ob - > data ;
ob - > data = newlibadr_us ( fd , ob - > id . lib , ob - > data ) ;
2009-01-19 02:26:46 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > data = = NULL & & poin ! = NULL ) {
if ( ob - > id . lib )
2013-03-18 18:25:05 +00:00
printf ( " Can't find obdata of %s lib %s \n " , ob - > id . name + 2 , ob - > id . lib - > name ) ;
2010-02-19 13:13:21 +00:00
else
2013-03-18 18:25:05 +00:00
printf ( " Object %s lost data. \n " , ob - > id . name + 2 ) ;
2012-05-17 12:59:34 +00:00
ob - > type = OB_EMPTY ;
warn = 1 ;
2012-03-24 06:18:31 +00:00
if ( ob - > pose ) {
2012-05-30 09:27:16 +00:00
/* we can't call #BKE_pose_free() here because of library linking
* freeing will recurse down into every pose constraints ID pointers
* which are not always valid , so for now free directly and suffer
* some leaked memory rather then crashing immediately
* while bad this _is_ an exceptional case - campbell */
#if 0
2012-05-05 16:03:57 +00:00
BKE_pose_free ( ob - > pose ) ;
2012-05-30 09:27:16 +00:00
# else
MEM_freeN ( ob - > pose ) ;
# endif
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
}
2012-05-17 12:59:34 +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
2010-12-06 02:32:16 +00:00
/* When the object is local and the data is library its possible
* the material list size gets out of sync . [ # 22663 ] */
2012-03-24 06:18:31 +00:00
if ( ob - > data & & ob - > id . lib ! = ( ( ID * ) ob - > data ) - > lib ) {
2014-04-27 00:24:11 +10:00
const short * totcol_data = give_totcolp ( ob ) ;
2010-12-06 02:32:16 +00:00
/* Only expand so as not to loose any object materials that might be set. */
2012-05-17 12:59:34 +00:00
if ( totcol_data & & ( * totcol_data > ob - > totcol ) ) {
2010-12-06 02:32:16 +00:00
/* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */
2013-08-14 14:36:43 +00:00
BKE_material_resize_object ( ob , * totcol_data , false ) ;
2010-12-06 02:32:16 +00:00
}
}
2012-05-17 12:59:34 +00:00
ob - > gpd = newlibadr_us ( fd , ob - > id . lib , ob - > gpd ) ;
ob - > duplilist = NULL ;
2012-08-01 15:32:27 +00:00
ob - > id . flag - = LIB_NEED_LINK ;
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. */
2013-02-23 01:33:47 +00:00
lib_link_pose ( fd , main , 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
2012-09-26 20:05:38 +00:00
// XXX deprecated - 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 ) ;
2012-09-26 20:05:38 +00:00
// >>> XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( paf = ob - > effect . first ; paf ; paf = paf - > next ) {
2012-05-17 12:59:34 +00:00
if ( paf - > type = = EFF_PARTICLE ) {
paf - > group = newlibadr_us ( fd , ob - > id . lib , paf - > group ) ;
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
}
2012-12-11 22:00:22 +00:00
}
2012-05-17 12:59:34 +00:00
for ( sens = ob - > sensors . first ; sens ; sens = sens - > next ) {
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < sens - > totlinks ; a + + )
2012-05-17 12:59:34 +00:00
sens - > links [ a ] = newglobadr ( fd , sens - > links [ a ] ) ;
2013-09-04 22:14:14 +00:00
if ( sens - > type = = SENS_MESSAGE ) {
2012-05-21 06:33:32 +00:00
bMessageSensor * ms = sens - > data ;
2012-05-17 12:59:34 +00:00
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
}
}
2012-05-17 12:59:34 +00:00
for ( cont = ob - > controllers . first ; cont ; cont = cont - > next ) {
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < cont - > totlinks ; a + + )
2012-05-17 12:59:34 +00:00
cont - > links [ a ] = newglobadr ( fd , cont - > links [ a ] ) ;
if ( cont - > type = = CONT_PYTHON ) {
bPythonCont * pc = cont - > data ;
pc - > text = newlibadr ( fd , ob - > id . lib , pc - > text ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
cont - > slinks = NULL ;
cont - > totslinks = 0 ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
2012-05-17 12:59:34 +00:00
if ( act - > type = = ACT_SOUND ) {
bSoundActuator * sa = act - > data ;
2002-10-12 11:37:38 +00:00
sa - > sound = newlibadr_us ( fd , ob - > id . lib , sa - > sound ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_GAME ) {
2002-10-12 11:37:38 +00:00
/* bGameActuator *ga= act->data; */
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_CAMERA ) {
bCameraActuator * ca = act - > data ;
2002-10-12 11:37:38 +00:00
ca - > ob = newlibadr ( fd , ob - > id . lib , ca - > ob ) ;
}
2015-07-18 19:02:39 +10:00
/* leave this one, it's obsolete but necessary to read for conversion */
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ADD_OBJECT ) {
bAddObjectActuator * eoa = act - > data ;
2012-03-24 06:18:31 +00:00
if ( eoa ) eoa - > ob = newlibadr ( fd , ob - > id . lib , eoa - > ob ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * oa = act - > data ;
if ( oa = = NULL ) {
2011-05-01 10:14:09 +00:00
init_actuator ( act ) ;
}
else {
2012-05-17 12:59:34 +00:00
oa - > reference = newlibadr ( fd , ob - > id . lib , oa - > reference ) ;
2011-05-01 10:14:09 +00:00
}
2009-06-08 20:08:19 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_EDIT_OBJECT ) {
bEditObjectActuator * eoa = act - > data ;
if ( eoa = = NULL ) {
2002-10-12 11:37:38 +00:00
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
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_SCENE ) {
bSceneActuator * sa = act - > data ;
2002-10-12 11:37:38 +00:00
sa - > camera = newlibadr ( fd , ob - > id . lib , sa - > camera ) ;
sa - > scene = newlibadr ( fd , ob - > id . lib , sa - > scene ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ACTION ) {
bActionActuator * aa = act - > data ;
2015-02-14 02:48:36 +13:00
aa - > act = newlibadr_us ( fd , ob - > id . lib , aa - > act ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_SHAPEACTION ) {
bActionActuator * aa = act - > data ;
2015-02-14 02:48:36 +13:00
aa - > act = newlibadr_us ( fd , ob - > id . lib , aa - > act ) ;
2008-06-18 06:46:49 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_PROPERTY ) {
bPropertyActuator * pa = act - > data ;
2002-10-12 11:37:38 +00:00
pa - > ob = newlibadr ( fd , ob - > id . lib , pa - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_MESSAGE ) {
bMessageActuator * ma = act - > data ;
2002-10-12 11:37:38 +00:00
ma - > toObject = newlibadr ( fd , ob - > id . lib , ma - > toObject ) ;
}
2012-05-17 12:59:34 +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
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_PARENT ) {
2008-04-06 18:30:52 +00:00
bParentActuator * parenta = act - > data ;
parenta - > ob = newlibadr ( fd , ob - > id . lib , parenta - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_STATE ) {
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
/* bStateActuator *statea = act->data; */
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ARMATURE ) {
2009-09-24 21:22:24 +00:00
bArmatureActuator * arma = act - > data ;
arma - > target = newlibadr ( fd , ob - > id . lib , arma - > target ) ;
arma - > subtarget = newlibadr ( fd , ob - > id . lib , arma - > subtarget ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_STEERING ) {
2010-05-31 22:35:22 +00:00
bSteeringActuator * steeringa = act - > data ;
steeringa - > target = newlibadr ( fd , ob - > id . lib , steeringa - > target ) ;
steeringa - > navmesh = newlibadr ( fd , ob - > id . lib , steeringa - > navmesh ) ;
}
2015-01-24 01:59:09 +11:00
else if ( act - > type = = ACT_MOUSE ) {
2014-06-25 15:47:30 -07:00
/* bMouseActuator *moa= act->data; */
}
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
2008-08-14 09:19:41 +00:00
{
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) modifiers_findByType ( ob , eModifierType_Fluidsim ) ;
2012-03-24 06:18:31 +00:00
if ( fluidmd & & fluidmd - > fss )
2008-08-14 09:19:41 +00:00
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
}
2012-05-17 12:59:34 +00:00
2009-07-30 15:00:26 +00:00
{
SmokeModifierData * smd = ( SmokeModifierData * ) modifiers_findByType ( ob , eModifierType_Smoke ) ;
2012-05-17 12:59:34 +00:00
if ( smd & & ( smd - > type = = MOD_SMOKE_TYPE_DOMAIN ) & & smd - > domain ) {
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
}
}
2012-05-17 12:59:34 +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 */
2012-03-24 06:18:31 +00:00
if ( ob - > pd )
2009-12-18 13:08:11 +00:00
lib_link_partdeflect ( fd , & ob - > id , ob - > pd ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > soft )
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
ob - > soft - > effector_weights - > group = newlibadr ( fd , ob - > id . lib , ob - > soft - > effector_weights - > group ) ;
2012-05-17 12:59:34 +00:00
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 ) ;
2013-01-23 05:56:56 +00:00
if ( ob - > rigidbody_constraint ) {
ob - > rigidbody_constraint - > ob1 = newlibadr ( fd , ob - > id . lib , ob - > rigidbody_constraint - > ob1 ) ;
ob - > rigidbody_constraint - > ob2 = newlibadr ( fd , ob - > id . lib , ob - > rigidbody_constraint - > ob2 ) ;
}
2013-12-17 14:42:47 -08:00
{
LodLevel * level ;
for ( level = ob - > lodlevels . first ; level ; level = level - > next ) {
level - > source = newlibadr ( fd , ob - > id . lib , level - > source ) ;
if ( ! level - > source & & level = = ob - > lodlevels . first )
level - > source = ob ;
}
}
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( warn ) {
2008-12-19 00:50:21 +00:00
BKE_report ( fd - > reports , RPT_WARNING , " Warning in console " ) ;
2012-01-05 09:50:07 +00:00
}
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
2012-05-17 12:59:34 +00:00
pose - > chanhash = NULL ;
2010-03-26 10:33:53 +00:00
2005-10-23 10:08:19 +00:00
for ( pchan = pose - > chanbase . first ; pchan ; pchan = pchan - > next ) {
2012-05-17 12:59:34 +00:00
pchan - > bone = NULL ;
pchan - > parent = newdataadr ( fd , pchan - > parent ) ;
pchan - > child = newdataadr ( fd , pchan - > child ) ;
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 ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & pchan - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2009-05-18 02:25:33 +00:00
2012-05-17 12:59:34 +00:00
pchan - > mpath = newdataadr ( fd , pchan - > mpath ) ;
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 ( pchan - > mpath )
direct_link_motionpath ( fd , pchan - > mpath ) ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & pchan - > iktree ) ;
BLI_listbase_clear ( & pchan - > siktree ) ;
2010-11-16 01:19:37 +00:00
2012-03-09 00:41:09 +00:00
/* in case this value changes in future, clamp else we get undefined behavior */
2010-11-16 01:19:37 +00:00
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 ) {
2012-05-21 06:33:32 +00:00
pose - > ikparam = newdataadr ( fd , pose - > ikparam ) ;
2009-09-24 21:22:24 +00:00
}
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 ;
2012-05-17 12:59:34 +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
link_list ( fd , lb ) ;
2012-05-17 12:59:34 +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
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 */
2012-05-17 12:59:34 +00:00
if ( NULL = = modifierType_getInfo ( md - > type ) )
md - > type = eModifierType_None ;
if ( md - > type = = eModifierType_Subsurf ) {
SubsurfModifierData * smd = ( SubsurfModifierData * ) md ;
2006-06-14 13:25:01 +00:00
2011-02-13 10:52:18 +00:00
smd - > emCache = smd - > mCache = NULL ;
2008-01-29 21:01:12 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Armature ) {
ArmatureModifierData * amd = ( ArmatureModifierData * ) md ;
2009-06-08 20:08:19 +00:00
2012-05-17 12:59:34 +00:00
amd - > prevCos = NULL ;
2009-06-08 20:08:19 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Cloth ) {
ClothModifierData * clmd = ( ClothModifierData * ) md ;
2008-01-29 21:01:12 +00:00
clmd - > clothObject = NULL ;
2014-11-17 19:44:42 +01:00
clmd - > hairdata = NULL ;
2008-01-29 21:01:12 +00:00
clmd - > sim_parms = newdataadr ( fd , clmd - > sim_parms ) ;
clmd - > coll_parms = newdataadr ( fd , clmd - > coll_parms ) ;
2012-05-17 12:59:34 +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
2012-03-24 06:18:31 +00:00
if ( clmd - > sim_parms ) {
if ( clmd - > sim_parms - > presets > 10 )
2008-03-20 18:28:40 +00:00
clmd - > sim_parms - > presets = 0 ;
2012-05-17 12:59:34 +00:00
2009-11-18 13:33:52 +00:00
clmd - > sim_parms - > reset = 0 ;
2012-05-17 12:59:34 +00:00
2011-01-06 01:35:07 +00:00
clmd - > sim_parms - > effector_weights = newdataadr ( fd , clmd - > sim_parms - > effector_weights ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ! clmd - > sim_parms - > effector_weights ) {
2011-01-22 03:50:09 +00:00
clmd - > sim_parms - > effector_weights = BKE_add_effector_weights ( NULL ) ;
}
}
2014-08-30 17:54:36 +02:00
2014-09-20 21:05:46 +02:00
clmd - > solver_result = NULL ;
2008-01-29 21:01:12 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Fluidsim ) {
FluidsimModifierData * fluidmd = ( FluidsimModifierData * ) md ;
2008-07-25 18:57:16 +00:00
2012-05-17 12:59:34 +00:00
fluidmd - > fss = newdataadr ( fd , fluidmd - > fss ) ;
2012-03-24 06:18:31 +00:00
if ( fluidmd - > fss ) {
2012-05-17 12:59:34 +00:00
fluidmd - > fss - > fmd = fluidmd ;
2011-09-18 11:08:34 +00:00
fluidmd - > fss - > meshVelocities = NULL ;
}
2008-07-25 18:57:16 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Smoke ) {
SmokeModifierData * smd = ( SmokeModifierData * ) md ;
if ( smd - > type = = MOD_SMOKE_TYPE_DOMAIN ) {
2009-07-30 15:00:26 +00:00
smd - > flow = NULL ;
smd - > coll = NULL ;
2009-07-30 22:11:28 +00:00
smd - > domain = newdataadr ( fd , smd - > domain ) ;
smd - > domain - > smd = smd ;
2012-05-17 12:59:34 +00:00
2009-07-30 15:00:26 +00:00
smd - > domain - > fluid = NULL ;
2013-04-24 17:31:09 +00:00
smd - > domain - > fluid_mutex = BLI_rw_mutex_alloc ( ) ;
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 ;
2012-05-21 06:33:32 +00:00
2009-12-14 19:17:27 +00:00
smd - > domain - > effector_weights = newdataadr ( fd , smd - > domain - > effector_weights ) ;
2012-03-24 06:18:31 +00:00
if ( ! smd - > domain - > effector_weights )
2009-10-08 10:18:14 +00:00
smd - > domain - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2012-05-17 12:59:34 +00:00
2010-11-30 21:31:18 +00:00
direct_link_pointcache_list ( fd , & ( smd - > domain - > ptcaches [ 0 ] ) , & ( smd - > domain - > point_cache [ 0 ] ) , 1 ) ;
2012-05-17 12:59:34 +00:00
2010-11-30 21:31:18 +00:00
/* Smoke uses only one cache from now on, so store pointer convert */
2012-03-24 06:18:31 +00:00
if ( smd - > domain - > ptcaches [ 1 ] . first | | smd - > domain - > point_cache [ 1 ] ) {
if ( smd - > domain - > point_cache [ 1 ] ) {
2011-02-24 13:37:53 +00:00
PointCache * cache = newdataadr ( fd , smd - > domain - > point_cache [ 1 ] ) ;
2012-10-14 13:08:19 +00:00
if ( cache - > flag & PTCACHE_FAKE_SMOKE ) {
/* Smoke was already saved in "new format" and this cache is a fake one. */
}
else {
2011-02-24 13:37:53 +00:00
printf ( " High resolution smoke cache not available due to pointcache update. Please reset the simulation. \n " ) ;
2012-10-14 13:08:19 +00:00
}
2011-02-24 13:37:53 +00:00
BKE_ptcache_free ( cache ) ;
}
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & smd - > domain - > ptcaches [ 1 ] ) ;
2010-11-30 21:31:18 +00:00
smd - > domain - > point_cache [ 1 ] = NULL ;
}
2009-07-30 15:00:26 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( smd - > type = = MOD_SMOKE_TYPE_FLOW ) {
2009-07-30 15:00:26 +00:00
smd - > domain = NULL ;
smd - > coll = NULL ;
smd - > flow = newdataadr ( fd , smd - > flow ) ;
2009-07-30 22:11:28 +00:00
smd - > flow - > smd = smd ;
2012-10-10 13:18:07 +00:00
smd - > flow - > dm = NULL ;
smd - > flow - > verts_old = NULL ;
smd - > flow - > numverts = 0 ;
2009-07-30 15:00:26 +00:00
smd - > flow - > psys = newdataadr ( fd , smd - > flow - > psys ) ;
}
2012-05-17 12:59:34 +00:00
else if ( smd - > type = = MOD_SMOKE_TYPE_COLL ) {
2009-07-30 15:00:26 +00:00
smd - > flow = NULL ;
smd - > domain = NULL ;
smd - > coll = newdataadr ( fd , smd - > coll ) ;
2012-04-28 06:31:57 +00:00
if ( smd - > coll ) {
2012-10-01 15:26:48 +00:00
smd - > coll - > smd = smd ;
2012-10-10 13:18:07 +00:00
smd - > coll - > verts_old = NULL ;
smd - > coll - > numverts = 0 ;
smd - > coll - > dm = NULL ;
2009-10-02 14:40:51 +00:00
}
2012-10-01 15:26:48 +00:00
else {
2009-10-02 14:40:51 +00:00
smd - > type = 0 ;
2012-10-10 13:18:07 +00:00
smd - > flow = NULL ;
smd - > domain = NULL ;
smd - > coll = NULL ;
2012-10-01 15:26:48 +00:00
}
2009-07-30 15:00:26 +00:00
}
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_DynamicPaint ) {
DynamicPaintModifierData * pmd = ( DynamicPaintModifierData * ) md ;
2012-04-28 06:31:57 +00:00
if ( pmd - > canvas ) {
2011-05-24 07:08:58 +00:00
pmd - > canvas = newdataadr ( fd , pmd - > canvas ) ;
pmd - > canvas - > pmd = pmd ;
pmd - > canvas - > dm = NULL ;
2011-06-16 10:41:00 +00:00
pmd - > canvas - > flags & = ~ MOD_DPAINT_BAKING ; /* just in case */
2012-05-17 12:59:34 +00:00
2011-06-16 10:41:00 +00:00
if ( pmd - > canvas - > surfaces . first ) {
DynamicPaintSurface * surface ;
link_list ( fd , & pmd - > canvas - > surfaces ) ;
2012-05-17 12:59:34 +00:00
2011-06-16 10:41:00 +00:00
for ( surface = pmd - > canvas - > surfaces . first ; surface ; surface = surface - > next ) {
surface - > canvas = pmd - > canvas ;
surface - > data = NULL ;
direct_link_pointcache_list ( fd , & ( surface - > ptcaches ) , & ( surface - > pointcache ) , 1 ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ! ( surface - > effector_weights = newdataadr ( fd , surface - > effector_weights ) ) )
2011-06-27 07:30:58 +00:00
surface - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2011-06-16 10:41:00 +00:00
}
}
2011-05-24 07:08:58 +00:00
}
2012-04-28 06:31:57 +00:00
if ( pmd - > brush ) {
2011-10-22 16:16:14 +00:00
pmd - > brush = newdataadr ( fd , pmd - > brush ) ;
pmd - > brush - > pmd = pmd ;
pmd - > brush - > psys = newdataadr ( fd , pmd - > brush - > psys ) ;
pmd - > brush - > paint_ramp = newdataadr ( fd , pmd - > brush - > paint_ramp ) ;
pmd - > brush - > vel_ramp = newdataadr ( fd , pmd - > brush - > vel_ramp ) ;
pmd - > brush - > dm = NULL ;
2011-05-24 07:08:58 +00:00
}
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Collision ) {
CollisionModifierData * collmd = ( CollisionModifierData * ) md ;
2012-06-30 22:49:33 +00:00
#if 0
2008-01-29 21:01:12 +00:00
// 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 ) ;
2012-04-29 15:47:02 +00:00
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 " ) ;
2012-06-30 22:49:33 +00:00
# endif
2008-01-29 21:01:12 +00:00
collmd - > x = NULL ;
collmd - > xnew = NULL ;
collmd - > current_x = NULL ;
collmd - > current_xnew = NULL ;
collmd - > current_v = NULL ;
2011-03-18 15:31:32 +00:00
collmd - > time_x = collmd - > time_xnew = - 1000 ;
2015-07-31 14:00:07 +10:00
collmd - > mvert_num = 0 ;
collmd - > tri_num = 0 ;
2008-05-07 20:42:16 +00:00
collmd - > bvhtree = NULL ;
2015-07-31 14:00:07 +10:00
collmd - > tri = NULL ;
2008-01-29 21:01:12 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Surface ) {
SurfaceModifierData * surmd = ( SurfaceModifierData * ) md ;
2009-04-20 15:06:46 +00:00
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
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Hook ) {
HookModifierData * hmd = ( HookModifierData * ) md ;
hmd - > indexar = newdataadr ( fd , hmd - > indexar ) ;
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_int32_array ( hmd - > indexar , hmd - > totindex ) ;
- 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
}
2015-02-04 07:04:21 +11:00
hmd - > curfalloff = newdataadr ( fd , hmd - > curfalloff ) ;
if ( hmd - > curfalloff ) {
direct_link_curvemapping ( fd , hmd - > curfalloff ) ;
}
2012-03-24 06:18:31 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_ParticleSystem ) {
ParticleSystemModifierData * psmd = ( ParticleSystemModifierData * ) md ;
2011-01-07 17:27:27 +00:00
psmd - > dm = NULL ;
psmd - > psys = newdataadr ( fd , psmd - > psys ) ;
2007-11-27 16:16:47 +00:00
psmd - > flag & = ~ eParticleSystemFlag_psys_updated ;
2011-01-07 17:27:27 +00:00
psmd - > flag | = eParticleSystemFlag_file_loaded ;
2012-03-24 06:18:31 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Explode ) {
ExplodeModifierData * psmd = ( ExplodeModifierData * ) md ;
psmd - > facepa = NULL ;
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_MeshDeform ) {
MeshDeformModifierData * mmd = ( MeshDeformModifierData * ) md ;
mmd - > bindinfluences = newdataadr ( fd , mmd - > bindinfluences ) ;
mmd - > bindoffsets = newdataadr ( fd , mmd - > bindoffsets ) ;
mmd - > bindcagecos = newdataadr ( fd , mmd - > bindcagecos ) ;
mmd - > dyngrid = newdataadr ( fd , mmd - > dyngrid ) ;
mmd - > dyninfluences = newdataadr ( fd , mmd - > dyninfluences ) ;
mmd - > dynverts = newdataadr ( fd , mmd - > dynverts ) ;
mmd - > bindweights = newdataadr ( fd , mmd - > bindweights ) ;
mmd - > bindcos = newdataadr ( fd , mmd - > bindcos ) ;
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2012-09-03 09:03:25 +00:00
if ( mmd - > bindoffsets ) BLI_endian_switch_int32_array ( mmd - > bindoffsets , mmd - > totvert + 1 ) ;
if ( mmd - > bindcagecos ) BLI_endian_switch_float_array ( mmd - > bindcagecos , mmd - > totcagevert * 3 ) ;
if ( mmd - > dynverts ) BLI_endian_switch_int32_array ( mmd - > dynverts , mmd - > totvert ) ;
if ( mmd - > bindweights ) BLI_endian_switch_float_array ( mmd - > bindweights , mmd - > totvert ) ;
if ( mmd - > bindcos ) BLI_endian_switch_float_array ( mmd - > bindcos , mmd - > totcagevert * 3 ) ;
2007-11-04 22:00:24 +00:00
}
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Ocean ) {
OceanModifierData * omd = ( OceanModifierData * ) md ;
2011-11-13 12:17:27 +00:00
omd - > oceancache = NULL ;
omd - > ocean = NULL ;
omd - > refresh = ( MOD_OCEAN_REFRESH_ADD | MOD_OCEAN_REFRESH_RESET | MOD_OCEAN_REFRESH_SIM ) ;
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_Warp ) {
WarpModifierData * tmd = ( WarpModifierData * ) md ;
2011-05-01 15:16:59 +00:00
tmd - > curfalloff = newdataadr ( fd , tmd - > curfalloff ) ;
2012-03-24 06:18:31 +00:00
if ( tmd - > curfalloff )
2011-05-01 15:16:59 +00:00
direct_link_curvemapping ( fd , tmd - > curfalloff ) ;
}
2012-05-17 12:59:34 +00:00
else if ( md - > type = = eModifierType_WeightVGEdit ) {
WeightVGEditModifierData * wmd = ( WeightVGEditModifierData * ) md ;
2011-07-25 15:27:01 +00:00
wmd - > cmap_curve = newdataadr ( fd , wmd - > cmap_curve ) ;
2012-03-24 06:18:31 +00:00
if ( wmd - > cmap_curve )
2011-07-25 15:27:01 +00:00
direct_link_curvemapping ( fd , wmd - > cmap_curve ) ;
}
2013-11-24 07:00:49 +11:00
else if ( md - > type = = eModifierType_LaplacianDeform ) {
LaplacianDeformModifierData * lmd = ( LaplacianDeformModifierData * ) md ;
lmd - > vertexco = newdataadr ( fd , lmd - > vertexco ) ;
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
BLI_endian_switch_float_array ( lmd - > vertexco , lmd - > total_verts * 3 ) ;
}
lmd - > cache_system = NULL ;
}
2015-03-29 04:44:05 +11:00
else if ( md - > type = = eModifierType_CorrectiveSmooth ) {
CorrectiveSmoothModifierData * csmd = ( CorrectiveSmoothModifierData * ) md ;
if ( csmd - > bind_coords ) {
csmd - > bind_coords = newdataadr ( fd , csmd - > bind_coords ) ;
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
BLI_endian_switch_float_array ( ( float * ) csmd - > bind_coords , csmd - > bind_coords_num * 3 ) ;
}
}
/* runtime only */
csmd - > delta_cache = NULL ;
csmd - > delta_cache_num = 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
}
}
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 ;
2004-09-14 19:03:11 +00:00
2011-05-19 06:17:44 +00:00
/* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */
2006-06-02 20:48:22 +00:00
ob - > flag & = ~ OB_FROMGROUP ;
2013-03-26 23:46:54 +00:00
2014-01-20 18:36:00 +06:00
/* This is a transient flag; clear in order to avoid unneeded object update pending from
* time when file was saved .
*/
ob - > recalc = 0 ;
2010-04-26 10:12:03 +00:00
/* loading saved files with editmode enabled works, but for undo we like
2013-03-26 23:46:54 +00:00
* to stay in object mode during undo presses so keep editmode disabled .
*
2014-12-30 21:33:15 +05:00
* Also when linking in a file don ' t allow edit and pose modes .
* See [ # 34776 , # 42780 ] for more information .
*/
2013-03-26 23:46:54 +00:00
if ( fd - > memfile | | ( ob - > id . flag & ( LIB_EXTERN | LIB_INDIRECT ) ) ) {
2015-01-07 15:38:32 +05:00
ob - > mode & = ~ ( OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT ) ;
if ( ! fd - > memfile ) {
ob - > mode & = ~ OB_MODE_POSE ;
}
2013-03-26 23:46:54 +00:00
}
2009-10-03 11:23:31 +00:00
2012-05-17 12:59:34 +00:00
ob - > adt = newdataadr ( fd , ob - > adt ) ;
2009-01-19 02:26:46 +00:00
direct_link_animdata ( fd , ob - > adt ) ;
2012-05-17 12:59:34 +00:00
ob - > pose = newdataadr ( fd , ob - > pose ) ;
2002-10-12 11:37:38 +00:00
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
2012-05-17 12:59:34 +00:00
ob - > mpath = newdataadr ( fd , ob - > mpath ) ;
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 - > mpath )
direct_link_motionpath ( fd , ob - > mpath ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ob - > defbase ) ;
2012-09-26 20:05:38 +00:00
// XXX deprecated - 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 ) ;
2012-09-26 20:05:38 +00:00
// >>> XXX deprecated - old animation system
2012-05-17 12:59:34 +00:00
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 ;
2012-03-24 07:52:14 +00:00
while ( paf ) {
2012-05-17 12:59:34 +00:00
if ( paf - > type = = EFF_PARTICLE ) {
paf - > keys = NULL ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +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 ) ;
2012-05-17 12:59:34 +00:00
2005-07-26 02:44:59 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2005-07-26 02:44:59 +00:00
BLI_addtail ( & ob - > modifiers , wmd ) ;
2012-05-17 12:59:34 +00:00
2005-07-26 02:44:59 +00:00
BLI_remlink ( & ob - > effect , paf ) ;
MEM_freeN ( paf ) ;
2012-05-17 12:59:34 +00:00
2005-07-26 02:44:59 +00:00
paf = next ;
continue ;
2005-07-20 04:14:21 +00:00
}
2012-05-17 12:59:34 +00:00
if ( paf - > type = = EFF_BUILD ) {
2005-07-20 04:14:21 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2005-07-20 04:14:21 +00:00
bmd - > start = baf - > sfra ;
bmd - > length = baf - > len ;
bmd - > randomize = 0 ;
bmd - > seed = 1 ;
2012-05-17 12:59:34 +00:00
2005-07-20 04:14:21 +00:00
BLI_addtail ( & ob - > modifiers , bmd ) ;
2012-05-17 12:59:34 +00:00
2005-07-20 04:14:21 +00:00
BLI_remlink ( & ob - > effect , paf ) ;
MEM_freeN ( paf ) ;
2012-05-17 12:59:34 +00:00
2005-07-20 04:14:21 +00:00
paf = next ;
continue ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
paf = paf - > next ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
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 ) ;
2012-03-24 06:18:31 +00:00
if ( ob - > soft ) {
2012-12-11 22:00:22 +00:00
SoftBody * sb = ob - > soft ;
2005-05-02 13:28:13 +00:00
2012-05-17 12:59:34 +00:00
sb - > bpoint = NULL ; // init pointers so it gets rebuilt nicely
sb - > bspring = NULL ;
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 */
2012-05-17 12:59:34 +00:00
sb - > keys = newdataadr ( fd , sb - > keys ) ;
2005-05-02 13:28:13 +00:00
test_pointer_array ( fd , ( void * * ) & sb - > keys ) ;
2012-03-24 06:18:31 +00:00
if ( sb - > keys ) {
2011-05-23 08:14:29 +00:00
int a ;
2012-05-21 06:33:32 +00:00
for ( a = 0 ; a < sb - > totkey ; a + + ) {
sb - > keys [ a ] = newdataadr ( fd , sb - > keys [ a ] ) ;
2005-05-02 13:28:13 +00:00
}
}
2012-05-17 12:59:34 +00:00
2009-12-14 19:17:27 +00:00
sb - > effector_weights = newdataadr ( fd , sb - > effector_weights ) ;
2012-03-24 06:18:31 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
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
}
2012-05-17 12:59:34 +00:00
ob - > bsoft = newdataadr ( fd , ob - > bsoft ) ;
2005-09-18 13:27:12 +00:00
ob - > fluidsimSettings = newdataadr ( fd , ob - > fluidsimSettings ) ; /* NT */
2013-01-23 05:56:22 +00:00
ob - > rigidbody_object = newdataadr ( fd , ob - > rigidbody_object ) ;
if ( ob - > rigidbody_object ) {
RigidBodyOb * rbo = ob - > rigidbody_object ;
/* must nullify the references to physics sim objects, since they no-longer exist
* ( and will need to be recalculated )
*/
rbo - > physics_object = NULL ;
rbo - > physics_shape = NULL ;
}
2013-01-23 05:56:56 +00:00
ob - > rigidbody_constraint = newdataadr ( fd , ob - > rigidbody_constraint ) ;
if ( ob - > rigidbody_constraint )
ob - > rigidbody_constraint - > physics_constraint = 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
link_list ( fd , & ob - > particlesystem ) ;
2012-04-29 15:47:02 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
for ( prop = ob - > prop . first ; prop ; prop = prop - > next ) {
prop - > poin = newdataadr ( fd , prop - > poin ) ;
if ( prop - > poin = = NULL )
prop - > poin = & prop - > data ;
2002-10-12 11:37:38 +00:00
}
link_list ( fd , & ob - > sensors ) ;
2012-05-17 12:59:34 +00:00
for ( sens = ob - > sensors . first ; sens ; sens = sens - > next ) {
sens - > data = newdataadr ( fd , sens - > data ) ;
sens - > links = newdataadr ( fd , sens - > links ) ;
2002-10-12 11:37:38 +00:00
test_pointer_array ( fd , ( void * * ) & sens - > links ) ;
}
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 ;
2012-03-24 06:18:31 +00:00
}
else if ( ! ob - > state ) {
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
ob - > state = 1 ;
}
2012-05-17 12:59:34 +00:00
for ( cont = ob - > controllers . first ; cont ; cont = cont - > next ) {
cont - > data = newdataadr ( fd , cont - > data ) ;
cont - > links = newdataadr ( fd , cont - > links ) ;
2002-10-12 11:37:38 +00:00
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
}
link_glob_list ( fd , & ob - > actuators ) ;
2012-05-17 12:59:34 +00:00
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
act - > data = newdataadr ( fd , act - > data ) ;
2002-10-12 11:37:38 +00:00
}
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 ;
2012-05-17 12:59:34 +00:00
HookModifierData * hmd = ( HookModifierData * ) modifier_new ( eModifierType_Hook ) ;
2004-09-14 19:03:11 +00:00
hook - > indexar = newdataadr ( fd , hook - > indexar ) ;
2012-03-24 06:18:31 +00:00
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2012-09-03 09:03:25 +00:00
BLI_endian_switch_int32_array ( hook - > indexar , hook - > totindex ) ;
2004-09-14 19:03:11 +00:00
}
2012-05-17 12:59:34 +00:00
/* Do conversion here because if we have loaded
* a hook we need to make sure it gets converted
* and freed , regardless of version .
*/
2011-11-06 16:38:21 +00:00
copy_v3_v3 ( hmd - > cent , hook - > cent ) ;
2005-08-11 02:23:52 +00:00
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 ;
2012-05-17 12:59:34 +00:00
2005-08-11 02:23:52 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2005-08-11 02:23:52 +00:00
MEM_freeN ( hook ) ;
}
2004-09-14 19:03:11 +00:00
2014-01-13 21:57:05 +01:00
ob - > iuser = newdataadr ( fd , ob - > iuser ) ;
if ( ob - > type = = OB_EMPTY & & ob - > empty_drawtype = = OB_EMPTY_IMAGE & & ! ob - > iuser ) {
BKE_object_empty_draw_type_set ( ob , ob - > empty_drawtype ) ;
}
2012-05-17 12:59:34 +00:00
ob - > customdata_mask = 0 ;
ob - > bb = NULL ;
ob - > derivedDeform = NULL ;
ob - > derivedFinal = NULL ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & ob - > gpulamp ) ;
2009-08-25 18:41:36 +00:00
link_list ( fd , & ob - > pc_ids ) ;
2009-08-15 18:58:01 +00:00
2013-08-19 09:25:24 +00:00
/* Runtime curve data */
ob - > curve_cache = NULL ;
2012-03-09 00:41:09 +00:00
/* in case this value changes in future, clamp else we get undefined behavior */
2010-11-16 01:19:37 +00:00
CLAMP ( ob - > rotmode , ROT_MODE_MIN , ROT_MODE_MAX ) ;
2012-03-24 06:18:31 +00:00
if ( ob - > sculpt ) {
2012-05-17 12:59:34 +00:00
ob - > sculpt = MEM_callocN ( sizeof ( SculptSession ) , " reload sculpt session " ) ;
2010-10-02 11:39:11 +00:00
}
2013-12-17 14:42:47 -08:00
link_list ( fd , & ob - > lodlevels ) ;
ob - > currentlod = ob - > lodlevels . first ;
2015-08-10 15:41:28 +02:00
ob - > preview = direct_link_preview_image ( fd , ob - > preview ) ;
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 ;
2013-03-18 18:25:05 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
2014-02-05 13:51:51 +01:00
if ( node - > id = = NULL & & node - > type = = CMP_NODE_R_LAYERS )
2012-05-17 12:59:34 +00:00
node - > id = & scene - > id ;
}
2009-02-04 17:40:50 +00:00
}
2009-08-17 00:39:00 +00:00
static void link_paint ( FileData * fd , Scene * sce , Paint * p )
{
2012-03-24 06:18:31 +00:00
if ( p ) {
2012-05-17 12:59:34 +00:00
p - > brush = newlibadr_us ( fd , sce - > id . lib , p - > brush ) ;
2014-07-21 12:02:05 +02:00
p - > palette = newlibadr_us ( fd , sce - > id . lib , p - > palette ) ;
2012-05-17 12:59:34 +00:00
p - > paint_cursor = NULL ;
2009-08-17 00:39:00 +00:00
}
}
2009-02-04 17:40:50 +00:00
2012-08-19 15:41:56 +00:00
static void lib_link_sequence_modifiers ( FileData * fd , Scene * scene , ListBase * lb )
{
SequenceModifierData * smd ;
for ( smd = lb - > first ; smd ; smd = smd - > next ) {
if ( smd - > mask_id )
smd - > mask_id = newlibadr_us ( fd , scene - > id . lib , smd - > mask_id ) ;
}
}
2014-11-11 19:39:20 +01:00
/* check for cyclic set-scene,
* libs can cause this case which is normally prevented , see ( T # # # # # ) */
# define USE_SETSCENE_CHECK
# ifdef USE_SETSCENE_CHECK
/**
* A version of # BKE_scene_validate_setscene with special checks for linked libs .
*/
static bool scene_validate_setscene__liblink ( Scene * sce , const int totscene )
{
Scene * sce_iter ;
int a ;
if ( sce - > set = = NULL ) return 1 ;
for ( a = 0 , sce_iter = sce ; sce_iter - > set ; sce_iter = sce_iter - > set , a + + ) {
if ( sce_iter - > id . flag & LIB_NEED_LINK ) {
return 1 ;
}
if ( a > totscene ) {
sce - > set = NULL ;
return 0 ;
}
}
return 1 ;
}
# endif
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 ;
2013-04-03 00:00:29 +00:00
FreestyleModuleConfig * fmc ;
2013-03-23 03:00:37 +00:00
FreestyleLineSet * fls ;
2014-11-11 19:39:20 +01:00
# ifdef USE_SETSCENE_CHECK
bool need_check_set = false ;
int totscene = 0 ;
# endif
2006-11-06 01:08:26 +00:00
2012-05-21 06:33:32 +00:00
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( sce - > id . flag & LIB_NEED_LINK ) {
2012-04-22 11:54:53 +00:00
/* Link ID Properties -- and copy this comment EXACTLY for easy finding
* of library blocks that implement this . */
2006-11-17 06:14:15 +00:00
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 ) ;
2012-05-17 12:59:34 +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 ) ;
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 ) ;
2012-01-17 16:31:13 +00:00
link_paint ( fd , sce , & sce - > toolsettings - > uvsculpt - > paint ) ;
2013-12-12 19:01:11 +02:00
if ( sce - > toolsettings - > sculpt )
sce - > toolsettings - > sculpt - > gravity_object =
newlibadr_us ( fd , sce - > id . lib , sce - > toolsettings - > sculpt - > gravity_object ) ;
2014-07-21 12:02:05 +02:00
if ( sce - > toolsettings - > imapaint . stencil )
sce - > toolsettings - > imapaint . stencil =
newlibadr_us ( fd , sce - > id . lib , sce - > toolsettings - > imapaint . stencil ) ;
2014-08-28 16:40:38 +02:00
if ( sce - > toolsettings - > imapaint . clone )
sce - > toolsettings - > imapaint . clone =
newlibadr_us ( fd , sce - > id . lib , sce - > toolsettings - > imapaint . clone ) ;
if ( sce - > toolsettings - > imapaint . canvas )
sce - > toolsettings - > imapaint . canvas =
newlibadr_us ( fd , sce - > id . lib , sce - > toolsettings - > imapaint . canvas ) ;
2008-11-13 18:57:10 +00:00
sce - > toolsettings - > skgen_template = newlibadr ( fd , sce - > id . lib , sce - > toolsettings - > skgen_template ) ;
2014-10-22 16:36:23 +02:00
sce - > toolsettings - > particle . shape_object = newlibadr ( fd , sce - > id . lib , sce - > toolsettings - > particle . shape_object ) ;
2012-05-17 12:59:34 +00:00
for ( base = sce - > base . first ; base ; base = next ) {
next = base - > next ;
2002-10-12 11:37:38 +00:00
/* base->object= newlibadr_us(fd, sce->id.lib, base->object); */
2012-05-17 12:59:34 +00:00
base - > object = newlibadr_us ( fd , sce - > id . lib , base - > object ) ;
2004-10-18 22:39:14 +00:00
2012-05-17 12:59:34 +00:00
if ( base - > object = = NULL ) {
2013-11-29 23:16:13 +06:00
blo_reportf_wrap ( fd - > reports , RPT_WARNING , TIP_ ( " LIB ERROR: object lost from scene: '%s' " ) ,
2012-05-17 10:31:06 +00:00
sce - > id . name + 2 ) ;
2002-10-12 11:37:38 +00:00
BLI_remlink ( & sce - > base , base ) ;
2012-05-17 12:59:34 +00:00
if ( base = = sce - > basact ) sce - > basact = NULL ;
2002-10-12 11:37:38 +00:00
MEM_freeN ( base ) ;
}
}
2012-05-17 12:59:34 +00:00
2012-04-30 16:22:40 +00:00
SEQ_BEGIN ( sce - > ed , seq )
{
2012-05-17 12:59:34 +00:00
if ( seq - > ipo ) seq - > ipo = newlibadr_us ( fd , sce - > id . lib , seq - > ipo ) ;
2011-02-22 16:32:05 +00:00
seq - > scene_sound = NULL ;
2012-03-24 06:18:31 +00:00
if ( seq - > scene ) {
2012-05-17 12:59:34 +00:00
seq - > scene = newlibadr ( fd , sce - > id . lib , seq - > scene ) ;
2012-03-24 06:18:31 +00:00
if ( seq - > scene ) {
2015-03-26 11:35:41 +01:00
seq - > scene_sound = BKE_sound_scene_add_scene_sound_defaults ( sce , seq ) ;
2011-10-10 00:38:32 +00:00
}
2010-03-20 11:15:16 +00:00
}
2012-03-24 06:18:31 +00:00
if ( seq - > clip ) {
2015-10-08 19:42:10 +11:00
seq - > clip = newlibadr_us ( fd , sce - > id . lib , seq - > clip ) ;
2012-03-21 18:02:29 +00:00
}
2012-06-07 18:24:36 +00:00
if ( seq - > mask ) {
2015-10-08 19:42:10 +11:00
seq - > mask = newlibadr_us ( fd , sce - > id . lib , seq - > mask ) ;
2012-08-13 17:25:03 +00:00
}
if ( seq - > scene_camera ) {
seq - > scene_camera = newlibadr ( fd , sce - > id . lib , seq - > scene_camera ) ;
2012-06-07 18:24:36 +00:00
}
2012-03-24 06:18:31 +00:00
if ( seq - > sound ) {
2010-02-07 23:41:17 +00:00
seq - > scene_sound = NULL ;
2012-08-13 17:25:03 +00:00
if ( seq - > type = = SEQ_TYPE_SOUND_HD ) {
2012-06-07 15:49:02 +00:00
seq - > type = SEQ_TYPE_SOUND_RAM ;
2012-08-13 17:25:03 +00:00
}
else {
2012-05-17 12:59:34 +00:00
seq - > sound = newlibadr ( fd , sce - > id . lib , seq - > sound ) ;
2012-08-13 17:25:03 +00:00
}
2008-12-15 05:21:44 +00:00
if ( seq - > sound ) {
seq - > sound - > id . us + + ;
2015-03-26 11:35:41 +01:00
seq - > scene_sound = BKE_sound_add_scene_sound_defaults ( sce , seq ) ;
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
}
2015-06-20 17:09:05 +10:00
BLI_listbase_clear ( & seq - > anims ) ;
2012-08-19 15:41:56 +00:00
lib_link_sequence_modifiers ( fd , sce , & seq - > modifiers ) ;
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
2012-05-17 12:59:34 +00:00
for ( marker = sce - > markers . first ; marker ; marker = marker - > next ) {
2012-03-24 06:18:31 +00:00
if ( marker - > camera ) {
2012-05-17 12:59:34 +00:00
marker - > camera = newlibadr ( fd , sce - > id . lib , marker - > camera ) ;
2009-12-16 19:49:33 +00:00
}
}
2011-11-05 14:26:18 +00:00
# else
( void ) marker ;
2009-12-16 19:49:33 +00:00
# endif
2012-05-17 12:59:34 +00:00
2012-08-08 11:15:40 +00:00
BKE_sequencer_update_muting ( sce - > ed ) ;
BKE_sequencer_update_sound_bounds_all ( sce ) ;
2004-11-21 11:44:50 +00:00
2013-01-23 05:56:22 +00:00
/* rigidbody world relies on it's linked groups */
if ( sce - > rigidbody_world ) {
RigidBodyWorld * rbw = sce - > rigidbody_world ;
if ( rbw - > group )
rbw - > group = newlibadr ( fd , sce - > id . lib , rbw - > group ) ;
2013-01-23 05:56:56 +00:00
if ( rbw - > constraints )
rbw - > constraints = newlibadr ( fd , sce - > id . lib , rbw - > constraints ) ;
2013-01-23 05:56:27 +00:00
if ( rbw - > effector_weights )
rbw - > effector_weights - > group = newlibadr ( fd , sce - > id . lib , rbw - > effector_weights - > group ) ;
2013-01-23 05:56:22 +00:00
}
2012-03-24 06:18:31 +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 ) ;
2013-06-05 19:06:27 +00:00
sce - > nodetree - > id . lib = sce - > id . lib ;
2009-02-04 17:40:50 +00:00
composite_patch ( sce - > nodetree , sce ) ;
}
2006-12-07 14:17:38 +00:00
2012-05-21 06:33:32 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
2012-05-17 12:59:34 +00:00
srl - > mat_override = newlibadr_us ( fd , sce - > id . lib , srl - > mat_override ) ;
srl - > light_override = newlibadr_us ( fd , sce - > id . lib , srl - > light_override ) ;
2013-04-03 00:00:29 +00:00
for ( fmc = srl - > freestyleConfig . modules . first ; fmc ; fmc = fmc - > next ) {
fmc - > script = newlibadr ( fd , sce - > id . lib , fmc - > script ) ;
}
2013-03-23 03:00:37 +00:00
for ( fls = srl - > freestyleConfig . linesets . first ; fls ; fls = fls - > next ) {
fls - > linestyle = newlibadr_us ( fd , sce - > id . lib , fls - > linestyle ) ;
fls - > group = newlibadr_us ( fd , sce - > id . lib , fls - > group ) ;
2010-06-25 22:45:42 +00:00
}
2006-12-07 14:17:38 +00:00
}
2009-04-20 15:06:46 +00:00
/*Game Settings: Dome Warp Text*/
2012-05-17 12:59:34 +00:00
sce - > gm . dome . warptext = newlibadr ( fd , sce - > id . lib , sce - > gm . dome . warptext ) ;
2011-11-20 11:34:25 +00:00
/* Motion Tracking */
2012-05-17 12:59:34 +00:00
sce - > clip = newlibadr_us ( fd , sce - > id . lib , sce - > clip ) ;
2014-11-11 19:39:20 +01:00
# ifdef USE_SETSCENE_CHECK
if ( sce - > set ! = NULL ) {
/* link flag for scenes with set would be reset later,
* so this way we only check cyclic for newly linked scenes .
*/
need_check_set = true ;
}
else {
/* postpone un-setting the flag until we've checked the set-scene */
sce - > id . flag & = ~ LIB_NEED_LINK ;
}
# else
sce - > id . flag & = ~ LIB_NEED_LINK ;
# endif
}
# ifdef USE_SETSCENE_CHECK
totscene + + ;
# endif
}
# ifdef USE_SETSCENE_CHECK
if ( need_check_set ) {
for ( sce = main - > scene . first ; sce ; sce = sce - > id . next ) {
if ( sce - > id . flag & LIB_NEED_LINK ) {
sce - > id . flag & = ~ LIB_NEED_LINK ;
if ( ! scene_validate_setscene__liblink ( sce , totscene ) ) {
printf ( " Found cyclic background scene when linking %s \n " , sce - > id . name + 2 ) ;
}
}
2002-10-12 11:37:38 +00:00
}
}
2014-11-11 19:39:20 +01:00
# endif
2002-10-12 11:37:38 +00:00
}
2014-11-11 19:39:20 +01:00
# undef USE_SETSCENE_CHECK
2002-10-12 11:37:38 +00:00
static void link_recurs_seq ( FileData * fd , ListBase * lb )
{
Sequence * seq ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , lb ) ;
2012-05-17 12:59:34 +00:00
for ( seq = lb - > first ; seq ; seq = seq - > next ) {
2012-03-24 06:18:31 +00:00
if ( seq - > seqbase . first )
2008-12-15 05:21:44 +00:00
link_recurs_seq ( fd , & seq - > seqbase ) ;
2012-05-17 12:59:34 +00:00
}
2002-10-12 11:37:38 +00:00
}
2015-02-11 15:07:04 +01:00
static void direct_link_paint ( FileData * fd , Paint * p )
{
if ( p - > num_input_samples < 1 )
p - > num_input_samples = 1 ;
p - > cavity_curve = newdataadr ( fd , p - > cavity_curve ) ;
if ( p - > cavity_curve )
direct_link_curvemapping ( fd , p - > cavity_curve ) ;
else
2015-02-11 15:27:50 +01:00
BKE_paint_cavity_curve_preset ( p , CURVE_PRESET_LINE ) ;
2015-02-11 15:07:04 +01:00
}
static void direct_link_paint_helper ( FileData * fd , Paint * * paint )
2009-08-17 00:39:00 +00:00
{
2012-05-21 23:32:46 +00:00
/* TODO. is this needed */
2012-05-17 12:59:34 +00:00
( * paint ) = newdataadr ( fd , ( * paint ) ) ;
2015-02-11 15:07:04 +01:00
if ( * paint ) {
direct_link_paint ( fd , * paint ) ;
}
2009-08-17 00:39:00 +00:00
}
2012-08-19 15:41:56 +00:00
static void direct_link_sequence_modifiers ( FileData * fd , ListBase * lb )
{
SequenceModifierData * smd ;
link_list ( fd , lb ) ;
for ( smd = lb - > first ; smd ; smd = smd - > next ) {
if ( smd - > mask_sequence )
smd - > mask_sequence = newdataadr ( fd , smd - > mask_sequence ) ;
if ( smd - > type = = seqModifierType_Curves ) {
CurvesModifierData * cmd = ( CurvesModifierData * ) smd ;
direct_link_curvemapping ( fd , & cmd - > curve_mapping ) ;
}
else if ( smd - > type = = seqModifierType_HueCorrect ) {
HueCorrectModifierData * hcmd = ( HueCorrectModifierData * ) smd ;
direct_link_curvemapping ( fd , & hcmd - > curve_mapping ) ;
}
}
}
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
static void direct_link_view_settings ( FileData * fd , ColorManagedViewSettings * view_settings )
{
view_settings - > curve_mapping = newdataadr ( fd , view_settings - > curve_mapping ) ;
if ( view_settings - > curve_mapping )
direct_link_curvemapping ( fd , view_settings - > curve_mapping ) ;
}
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 ;
2013-01-23 05:56:22 +00:00
RigidBodyWorld * rbw ;
2013-03-23 03:00:37 +00:00
SceneRenderLayer * srl ;
2012-05-17 12:59:34 +00:00
2005-05-29 19:41:03 +00:00
sce - > theDag = NULL ;
Depsgraph: New dependency graph integration commit
This commit integrates the work done so far on the new dependency graph system,
where goal was to replace legacy depsgraph with the new one, supporting loads of
neat features like:
- More granular dependency relation nature, which solves issues with fake cycles
in the dependencies.
- Move towards all-animatable, by better integration of drivers into the system.
- Lay down some basis for upcoming copy-on-write, overrides and so on.
The new system is living side-by-side with the previous one and disabled by
default, so nothing will become suddenly broken. The way to enable new depsgraph
is to pass `--new-depsgraph` command line argument.
It's a bit early to consider the system production-ready, there are some TODOs
and issues were discovered during the merge period, they'll be addressed ASAP.
But it's important to merge, because it's the only way to attract artists to
really start testing this system.
There are number of assorted documents related on the design of the new system:
* http://wiki.blender.org/index.php/User:Aligorith/GSoC2013_Depsgraph#Design_Documents
* http://wiki.blender.org/index.php/User:Nazg-gul/DependencyGraph
There are also some user-related information online:
* http://code.blender.org/2015/02/blender-dependency-graph-branch-for-users/
* http://code.blender.org/2015/03/more-dependency-graph-tricks/
Kudos to everyone who was involved into the project:
- Joshua "Aligorith" Leung -- design specification, initial code
- Lukas "lukas_t" Toenne -- integrating code into blender, with further fixes
- Sergey "Sergey" "Sharybin" -- some mocking around, trying to wrap up the
project and so
- Bassam "slikdigit" Kurdali -- stressing the new system, reporting all the
issues and recording/writing documentation.
- Everyone else who i forgot to mention here :)
2015-05-12 15:05:57 +05:00
sce - > depsgraph = NULL ;
2012-05-17 12:59:34 +00:00
sce - > obedit = NULL ;
sce - > stats = NULL ;
sce - > fps_info = NULL ;
sce - > customdata_mask_modal = 0 ;
2011-03-27 23:11:22 +00:00
sce - > lay_updated = 0 ;
2012-05-17 12:59:34 +00:00
2015-03-26 11:35:41 +01:00
BKE_sound_create_scene ( sce ) ;
2012-05-17 12:59:34 +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 */
2012-05-17 12:59:34 +00:00
sce - > id . us = 1 ;
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( sce - > base ) ) ;
2009-01-19 02:26:46 +00:00
2012-05-17 12:59:34 +00:00
sce - > adt = newdataadr ( fd , sce - > adt ) ;
2009-01-19 02:26:46 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
sce - > basact = newdataadr ( fd , sce - > basact ) ;
2005-08-24 20:37:25 +00:00
sce - > toolsettings = newdataadr ( fd , sce - > toolsettings ) ;
2012-03-24 06:18:31 +00:00
if ( sce - > toolsettings ) {
2015-02-11 15:07:04 +01:00
direct_link_paint_helper ( fd , ( Paint * * ) & sce - > toolsettings - > sculpt ) ;
direct_link_paint_helper ( fd , ( Paint * * ) & sce - > toolsettings - > vpaint ) ;
direct_link_paint_helper ( fd , ( Paint * * ) & sce - > toolsettings - > wpaint ) ;
direct_link_paint_helper ( fd , ( Paint * * ) & sce - > toolsettings - > uvsculpt ) ;
2012-05-17 12:59:34 +00:00
2015-02-11 15:07:04 +01:00
direct_link_paint ( fd , & sce - > toolsettings - > imapaint . paint ) ;
2012-05-17 12:59:34 +00:00
sce - > toolsettings - > imapaint . paintcursor = NULL ;
sce - > toolsettings - > particle . paintcursor = NULL ;
2014-09-09 22:07:55 +10:00
sce - > toolsettings - > particle . scene = NULL ;
sce - > toolsettings - > particle . object = NULL ;
2013-01-09 04:17:53 +00:00
/* in rare cases this is needed, see [#33806] */
if ( sce - > toolsettings - > vpaint ) {
sce - > toolsettings - > vpaint - > vpaint_prev = NULL ;
sce - > toolsettings - > vpaint - > tot = 0 ;
2013-03-26 09:59:43 +00:00
}
2013-01-09 04:17:53 +00:00
if ( sce - > toolsettings - > wpaint ) {
sce - > toolsettings - > wpaint - > wpaint_prev = NULL ;
sce - > toolsettings - > wpaint - > tot = 0 ;
}
2009-01-10 14:19:14 +00:00
}
2006-11-06 01:08:26 +00:00
2012-03-24 06:18:31 +00:00
if ( sce - > ed ) {
2014-11-24 18:18:35 +01:00
ListBase * old_seqbasep = & sce - > ed - > seqbase ;
2006-11-22 19:59:17 +00:00
2012-05-21 06:33:32 +00:00
ed = sce - > ed = newdataadr ( fd , sce - > ed ) ;
2012-05-17 12:59:34 +00:00
ed - > act_seq = newdataadr ( fd , ed - > act_seq ) ;
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 ) ;
2012-05-17 12:59:34 +00:00
2012-04-30 16:22:40 +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 ) ;
2014-11-24 18:18:35 +01:00
2003-04-26 18:01:01 +00:00
/* a patch: after introduction of effects with 3 input strips */
2012-05-17 12:59:34 +00:00
if ( seq - > seq3 = = NULL ) seq - > seq3 = seq - > seq2 ;
seq - > effectdata = newdataadr ( fd , seq - > effectdata ) ;
2015-04-06 10:40:12 -03:00
seq - > stereo3d_format = newdataadr ( fd , seq - > stereo3d_format ) ;
2006-03-07 20:01:12 +00:00
2012-06-07 15:49:02 +00:00
if ( seq - > type & SEQ_TYPE_EFFECT )
2006-03-07 20:01:12 +00:00
seq - > flag | = SEQ_EFFECT_NOT_LOADED ;
2012-05-17 12:59:34 +00:00
2012-06-07 15:49:02 +00:00
if ( seq - > type = = SEQ_TYPE_SPEED ) {
2012-05-17 12:59:34 +00:00
SpeedControlVars * s = seq - > effectdata ;
s - > frameMap = NULL ;
2006-03-07 20:01:12 +00:00
}
2015-04-02 21:05:12 +11:00
seq - > prop = newdataadr ( fd , seq - > prop ) ;
IDP_DirectLinkGroup_OrFree ( & seq - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2012-05-17 12:59:34 +00:00
seq - > strip = newdataadr ( fd , seq - > strip ) ;
2012-03-24 06:18:31 +00:00
if ( seq - > strip & & seq - > strip - > done = = 0 ) {
2014-04-01 11:34:00 +11:00
seq - > strip - > done = true ;
2012-05-17 12:59:34 +00:00
2014-07-20 01:30:29 +10:00
if ( ELEM ( seq - > type , SEQ_TYPE_IMAGE , SEQ_TYPE_MOVIE , SEQ_TYPE_SOUND_RAM , SEQ_TYPE_SOUND_HD ) ) {
2012-05-20 19:49:27 +00:00
seq - > strip - > stripdata = newdataadr ( fd , seq - > strip - > stripdata ) ;
2012-03-24 06:18:31 +00:00
}
else {
2011-02-13 10:52:18 +00:00
seq - > strip - > stripdata = NULL ;
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 ) ;
2012-03-24 06:18:31 +00:00
}
else {
2011-02-13 10:52:18 +00:00
seq - > strip - > crop = NULL ;
2007-12-25 15:31:36 +00:00
}
if ( seq - > flag & SEQ_USE_TRANSFORM ) {
seq - > strip - > transform = newdataadr (
fd , seq - > strip - > transform ) ;
2012-03-24 06:18:31 +00:00
}
else {
2011-02-13 10:52:18 +00:00
seq - > strip - > transform = NULL ;
2007-12-25 15:31:36 +00:00
}
if ( seq - > flag & SEQ_USE_PROXY ) {
seq - > strip - > proxy = newdataadr (
fd , seq - > strip - > proxy ) ;
2011-02-13 10:52:18 +00:00
seq - > strip - > proxy - > anim = NULL ;
2012-03-24 06:18:31 +00:00
}
else {
2011-02-13 10:52:18 +00:00
seq - > strip - > proxy = NULL ;
2007-12-25 15:31:36 +00:00
}
2012-09-04 13:37:53 +00:00
/* need to load color balance to it could be converted to modifier */
seq - > strip - > color_balance = newdataadr ( fd , seq - > strip - > color_balance ) ;
2002-10-12 11:37:38 +00:00
}
2012-08-19 15:41:56 +00:00
direct_link_sequence_modifiers ( fd , & seq - > modifiers ) ;
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 ;
2015-03-10 23:40:39 +11:00
void * poin ;
2008-08-30 14:32:16 +00:00
intptr_t offset ;
2004-11-13 12:55:59 +00:00
2012-05-17 12:59:34 +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 */
2012-03-24 06:18:31 +00:00
if ( ed - > seqbasep = = old_seqbasep ) {
2012-05-17 12:59:34 +00:00
ed - > seqbasep = & ed - > seqbase ;
2006-11-22 19:59:17 +00:00
}
else {
2015-03-10 23:40:39 +11:00
poin = POINTER_OFFSET ( ed - > seqbasep , - offset ) ;
2006-11-22 19:59:17 +00:00
2012-05-17 12:59:34 +00:00
poin = newdataadr ( fd , poin ) ;
if ( poin )
2015-03-10 23:40:39 +11:00
ed - > seqbasep = ( ListBase * ) POINTER_OFFSET ( poin , offset ) ;
2012-05-17 12:59:34 +00:00
else
ed - > seqbasep = & ed - > seqbase ;
2012-12-11 22:00:22 +00:00
}
2004-11-13 12:55:59 +00:00
/* stack */
link_list ( fd , & ( ed - > metastack ) ) ;
2012-05-17 12:59:34 +00:00
for ( ms = ed - > metastack . first ; ms ; ms = ms - > next ) {
ms - > parseq = newdataadr ( fd , ms - > parseq ) ;
2004-11-13 12:55:59 +00:00
2012-03-24 06:18:31 +00:00
if ( ms - > oldbasep = = old_seqbasep )
2006-11-22 19:59:17 +00:00
ms - > oldbasep = & ed - > seqbase ;
else {
2015-03-10 23:40:39 +11:00
poin = POINTER_OFFSET ( ms - > oldbasep , - offset ) ;
2012-05-17 12:59:34 +00:00
poin = newdataadr ( fd , poin ) ;
if ( poin )
2015-03-10 23:40:39 +11:00
ms - > oldbasep = ( ListBase * ) POINTER_OFFSET ( poin , offset ) ;
2012-05-17 12:59:34 +00:00
else
ms - > oldbasep = & ed - > seqbase ;
2006-11-22 19:59:17 +00:00
}
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 ) {
2012-05-17 12:59:34 +00:00
sce - > r . ffcodecdata . properties = newdataadr ( fd , sce - > r . ffcodecdata . properties ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & sce - > r . ffcodecdata . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2008-05-11 20:40:55 +00:00
}
2012-05-17 12:59:34 +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
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 ) ) ;
2015-04-06 10:40:12 -03:00
link_list ( fd , & ( sce - > r . views ) ) ;
2009-12-16 19:49:33 +00:00
2013-08-19 01:48:44 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
2013-03-23 03:00:37 +00:00
link_list ( fd , & ( srl - > freestyleConfig . modules ) ) ;
}
2013-08-19 01:48:44 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
2013-03-23 03:00:37 +00:00
link_list ( fd , & ( srl - > freestyleConfig . linesets ) ) ;
2010-06-25 22:45:42 +00:00
}
2009-10-07 07:18:50 +00:00
2012-05-17 12:59:34 +00:00
sce - > nodetree = newdataadr ( fd , sce - > nodetree ) ;
2012-10-23 12:38:47 +00:00
if ( sce - > nodetree ) {
direct_link_id ( fd , & sce - > nodetree - > id ) ;
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
direct_link_nodetree ( fd , sce - > nodetree ) ;
2012-10-23 12:38:47 +00:00
}
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
direct_link_view_settings ( fd , & sce - > view_settings ) ;
2013-01-23 05:56:22 +00:00
sce - > rigidbody_world = newdataadr ( fd , sce - > rigidbody_world ) ;
rbw = sce - > rigidbody_world ;
if ( rbw ) {
/* must nullify the reference to physics sim object, since it no-longer exist
* ( and will need to be recalculated )
*/
rbw - > physics_world = NULL ;
rbw - > objects = NULL ;
rbw - > numbodies = 0 ;
2013-01-23 05:56:27 +00:00
/* set effector weights */
rbw - > effector_weights = newdataadr ( fd , rbw - > effector_weights ) ;
if ( ! rbw - > effector_weights )
rbw - > effector_weights = BKE_add_effector_weights ( NULL ) ;
2013-01-23 05:56:34 +00:00
/* link cache */
2014-04-01 11:34:00 +11:00
direct_link_pointcache_list ( fd , & rbw - > ptcaches , & rbw - > pointcache , false ) ;
2013-01-23 05:56:34 +00:00
/* make sure simulation starts from the beginning after loading file */
2013-03-05 14:47:49 +00:00
if ( rbw - > pointcache ) {
rbw - > ltime = ( float ) rbw - > pointcache - > startframe ;
}
2013-01-23 05:56:22 +00:00
}
2015-08-10 15:41:28 +02:00
sce - > preview = direct_link_preview_image ( fd , sce - > preview ) ;
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 ;
2012-05-17 12:59:34 +00:00
wm - > id . us = 1 ;
link_list ( fd , & wm - > windows ) ;
2007-12-24 18:53:37 +00:00
2012-05-17 12:59:34 +00:00
for ( win = wm - > windows . first ; win ; win = win - > next ) {
win - > ghostwin = NULL ;
win - > eventstate = NULL ;
win - > curswin = NULL ;
win - > tweak = NULL ;
2014-12-07 00:58:17 +01:00
# ifdef WIN32
win - > ime_data = NULL ;
# endif
2012-05-17 12:59:34 +00:00
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & win - > queue ) ;
BLI_listbase_clear ( & win - > handlers ) ;
BLI_listbase_clear ( & win - > modalhandlers ) ;
BLI_listbase_clear ( & win - > subwindows ) ;
BLI_listbase_clear ( & win - > gesture ) ;
2015-04-06 10:40:12 -03:00
BLI_listbase_clear ( & win - > drawdata ) ;
2012-05-17 12:59:34 +00:00
win - > drawmethod = - 1 ;
win - > drawfail = 0 ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
win - > active = 0 ;
2013-11-27 20:48:07 +01:00
win - > cursor = 0 ;
win - > lastcursor = 0 ;
win - > modalcursor = 0 ;
2015-04-06 10:40:12 -03:00
win - > stereo3d_format = newdataadr ( fd , win - > stereo3d_format ) ;
2015-04-24 11:58:03 -03:00
/* multiview always fallback to anaglyph at file opening
* otherwise quadbuffer saved files can break Blender */
if ( win - > stereo3d_format ) {
win - > stereo3d_format - > display_mode = S3D_DISPLAY_ANAGLYPH ;
}
2007-12-24 18:53:37 +00:00
}
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & wm - > timers ) ;
BLI_listbase_clear ( & wm - > operators ) ;
BLI_listbase_clear ( & wm - > paintcursors ) ;
BLI_listbase_clear ( & wm - > queue ) ;
2009-07-16 22:47:27 +00:00
BKE_reports_init ( & wm - > reports , RPT_STORE ) ;
2008-01-10 18:56:24 +00:00
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & wm - > keyconfigs ) ;
2012-05-17 12:59:34 +00:00
wm - > defaultconf = NULL ;
wm - > addonconf = NULL ;
wm - > userconf = NULL ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & wm - > jobs ) ;
BLI_listbase_clear ( & wm - > drags ) ;
2012-05-17 12:59:34 +00:00
wm - > windrawable = NULL ;
wm - > winactive = NULL ;
wm - > initialized = 0 ;
wm - > op_undo_depth = 0 ;
Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
(see below) or values are even possible to run or change.
This prevents any kind of "destructive" action performed
from user while rendering.
- Locks interface refresh for regions which does have lock
set to truth in their template. Currently it's just a 3D
viewport, but in the future more regions could be considered
unsafe, or we could want to lock different parts of
interface when doing different jobs.
This is needed because 3D viewport could be using or changing
the same data as renderer currently uses, leading to threading
conflict.
Notifiers are still allowed to handle, so render progress is
seen on the screen, but would need to doublecheck on this, in
terms some notifiers could be changing the data.
For now interface locking happens for render job only in case
"Lock Interface" checkbox is enabled.
Other tools like backing would also benefit of this option.
It is possible to mark operator as safe to be used in locked
interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
template flags.
This bit is completely handled by wm_evem_system, not
with operator run routines, so it's still possible to
run operators from drivers and handlers.
Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
2014-01-29 16:07:14 +06:00
wm - > is_interface_locked = 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
2012-05-17 12:59:34 +00:00
for ( wm = main - > wm . first ; wm ; wm = wm - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( wm - > id . flag & LIB_NEED_LINK ) {
2012-05-17 12:59:34 +00:00
for ( win = wm - > windows . first ; win ; win = win - > next )
win - > screen = newlibadr ( fd , NULL , win - > screen ) ;
2012-08-01 15:32:27 +00:00
wm - > id . flag - = LIB_NEED_LINK ;
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
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
/* relink's grease pencil data's refs */
static void lib_link_gpencil ( FileData * fd , Main * main )
{
bGPdata * gpd ;
for ( gpd = main - > gpencil . first ; gpd ; gpd = gpd - > id . next ) {
if ( gpd - > id . flag & LIB_NEED_LINK ) {
gpd - > id . flag - = LIB_NEED_LINK ;
if ( gpd - > adt )
lib_link_animdata ( fd , & gpd - > id , gpd - > adt ) ;
}
}
}
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 ;
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
/* relink animdata */
gpd - > adt = newdataadr ( fd , gpd - > adt ) ;
direct_link_animdata ( fd , gpd - > adt ) ;
2008-07-22 09:53:25 +00:00
/* relink layers */
link_list ( fd , & gpd - > layers ) ;
2012-05-17 12:59:34 +00:00
for ( gpl = gpd - > layers . first ; gpl ; gpl = gpl - > next ) {
2008-07-22 09:53:25 +00:00
/* relink frames */
link_list ( fd , & gpl - > frames ) ;
2012-05-17 12:59:34 +00:00
gpl - > actframe = newdataadr ( fd , gpl - > actframe ) ;
2008-07-22 09:53:25 +00:00
2012-05-17 12:59:34 +00:00
for ( gpf = gpl - > frames . first ; gpf ; gpf = gpf - > next ) {
2008-07-22 09:53:25 +00:00
/* relink strokes (and their points) */
link_list ( fd , & gpf - > strokes ) ;
2012-05-17 12:59:34 +00:00
for ( gps = gpf - > strokes . first ; gps ; gps = gps - > next ) {
gps - > points = newdataadr ( fd , gps - > points ) ;
2008-07-22 09:53:25 +00:00
}
}
}
}
2008-12-29 13:38:08 +00:00
/* ****************** READ SCREEN ***************** */
2004-09-05 13:43:51 +00:00
/* note: file read without screens option G_FILE_NO_UI;
2012-04-22 11:54:53 +00:00
* 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 ;
2012-05-17 12:59:34 +00:00
for ( sc = main - > screen . first ; sc ; sc = sc - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( sc - > id . flag & LIB_NEED_LINK ) {
2012-05-17 12:59:34 +00:00
sc - > id . us = 1 ;
2012-05-21 06:33:32 +00:00
sc - > scene = newlibadr ( fd , sc - > id . lib , sc - > scene ) ;
2015-03-06 14:22:00 +01:00
/* this should not happen, but apparently it does somehow. Until we figure out the cause,
* just assign first available scene */
if ( ! sc - > scene )
sc - > scene = main - > scene . first ;
2012-05-17 12:59:34 +00:00
sc - > animtimer = NULL ; /* saved in rare cases */
2015-07-29 12:52:03 +02:00
sc - > scrubbing = false ;
2008-07-22 09:53:25 +00:00
2012-05-21 06:33:32 +00:00
for ( sa = sc - > areabase . first ; sa ; sa = sa - > next ) {
2002-10-12 11:37:38 +00:00
SpaceLink * sl ;
2008-07-22 09:53:25 +00:00
2012-05-17 12:59:34 +00:00
sa - > full = newlibadr ( fd , sc - > id . lib , sa - > full ) ;
2008-07-22 09:53:25 +00:00
2012-05-17 12:59:34 +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 */
2012-03-24 06:18:31 +00:00
if ( v3d - > bgpic ) {
2012-05-17 12:59:34 +00:00
v3d - > bgpic = newlibadr ( fd , sc - > id . lib , v3d - > bgpic ) ;
2010-01-19 22:44:43 +00:00
BLI_addtail ( & v3d - > bgpicbase , bgpic ) ;
2012-05-17 12:59:34 +00:00
v3d - > bgpic = NULL ;
2010-01-19 22:44:43 +00:00
}
2012-05-17 12:59:34 +00:00
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next ) {
bgpic - > ima = newlibadr_us ( fd , sc - > id . lib , bgpic - > ima ) ;
bgpic - > clip = newlibadr_us ( fd , sc - > id . lib , bgpic - > clip ) ;
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
if ( v3d - > localvd ) {
2012-05-17 12:59:34 +00:00
v3d - > localvd - > camera = newlibadr ( fd , sc - > id . lib , v3d - > localvd - > camera ) ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IPO ) {
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
bDopeSheet * ads = sipo - > ads ;
2004-11-13 12:55:59 +00:00
2010-01-23 03:57:11 +00:00
if ( ads ) {
2012-05-17 12:59:34 +00:00
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
2010-01-23 03:57:11 +00:00
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
sbuts - > pinid = newlibadr ( fd , sc - > id . lib , sbuts - > pinid ) ;
2015-05-04 16:12:12 +10:00
if ( sbuts - > pinid = = NULL ) {
sbuts - > flag & = ~ SB_PIN_CONTEXT ;
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_FILE ) {
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_ACTION ) {
SpaceAction * saction = ( SpaceAction * ) sl ;
bDopeSheet * ads = & saction - > ads ;
2010-01-23 03:57:11 +00:00
if ( ads ) {
2012-05-17 12:59:34 +00:00
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
2010-01-23 03:57:11 +00:00
}
2002-10-12 11:37:38 +00:00
saction - > action = newlibadr ( fd , sc - > id . lib , saction - > action ) ;
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
sima - > image = newlibadr_us ( fd , sc - > id . lib , sima - > image ) ;
2012-07-24 20:33:55 +00:00
sima - > mask_info . mask = newlibadr_us ( fd , sc - > id . lib , sima - > mask_info . mask ) ;
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 !
*/
2012-05-17 12:59:34 +00:00
sima - > gpd = newlibadr_us ( fd , sc - > id . lib , sima - > gpd ) ;
2002-10-12 11:37:38 +00:00
}
2012-06-11 03:03:36 +00:00
else if ( sl - > spacetype = = SPACE_SEQ ) {
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
/* 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 !
*/
sseq - > gpd = newlibadr_us ( fd , sc - > id . lib , sseq - > gpd ) ;
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
images/movies from color space in which file is saved to Blender's linear
space (for float images, byte images are not internally converted, only input
space is stored for such images and used later).
This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
These are different ways to view the image on the same display device.
For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
display gamma.
- RGB curves are user-defined curves which are applying before display
transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
to support other spaces, but it's quite large project which isn't so
much important.
- Legacy Color Management option disabled is emulated by using None display.
It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
2012-09-15 10:05:07 +00:00
2012-06-11 03:03:36 +00:00
}
2012-05-17 12:59:34 +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 ) {
2012-05-17 12:59:34 +00:00
ads - > source = newlibadr ( fd , sc - > id . lib , ads - > source ) ;
ads - > filter_grp = newlibadr ( fd , sc - > id . lib , ads - > filter_grp ) ;
2010-01-23 03:57:11 +00:00
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_TEXT ) {
2002-10-12 11:37:38 +00:00
SpaceText * st = ( SpaceText * ) sl ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
st - > text = newlibadr ( fd , sc - > id . lib , st - > text ) ;
2003-12-14 01:18:09 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_SCRIPT ) {
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 ) {
2012-05-17 12:59:34 +00:00
scpt - > script = newlibadr ( fd , sc - > id . lib , scpt - > script ) ;
2008-03-07 22:39:45 +00:00
if ( scpt - > script ) {
2012-03-28 01:06:43 +00:00
SCRIPT_SET_NULL ( scpt - > script ) ;
2008-03-07 22:39:45 +00:00
}
2008-03-06 21:25:15 +00:00
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
2002-10-12 11:37:38 +00:00
SpaceOops * so = ( SpaceOops * ) sl ;
2012-05-17 12:59:34 +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
2012-03-24 06:18:31 +00:00
if ( so - > treestore ) {
2013-08-03 11:35:09 +00:00
TreeStoreElem * tselem ;
BLI_mempool_iter iter ;
BLI_mempool_iternew ( so - > treestore , & iter ) ;
while ( ( tselem = BLI_mempool_iterstep ( & iter ) ) ) {
2012-05-17 12:59:34 +00:00
tselem - > id = newlibadr ( fd , NULL , tselem - > 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
}
2013-08-03 11:35:09 +00:00
if ( so - > treehash ) {
2013-08-23 20:35:00 +00:00
/* rebuild hash table, because it depends on ids too */
2015-05-11 11:06:35 +10:00
so - > storeflag | = SO_TREESTORE_REBUILD ;
2013-08-03 11:35:09 +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
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
2013-03-18 16:34:57 +00:00
bNodeTreePath * path , * path_next ;
2013-04-17 15:55:10 +00:00
bNodeTree * ntree ;
2009-01-27 17:12:40 +00:00
2013-04-17 15:55:10 +00:00
/* node tree can be stored locally in id too, link this first */
snode - > id = newlibadr ( fd , sc - > id . lib , snode - > id ) ;
snode - > from = newlibadr ( fd , sc - > id . lib , snode - > from ) ;
ntree = nodetree_from_id ( snode - > id ) ;
if ( ntree )
snode - > nodetree = ntree ;
2013-07-08 11:38:11 +00:00
else {
snode - > nodetree = newlibadr_us ( fd , sc - > id . lib , snode - > nodetree ) ;
}
2013-04-17 15:55:10 +00:00
for ( path = snode - > treepath . first ; path ; path = path - > next ) {
if ( path = = snode - > treepath . first ) {
/* first nodetree in path is same as snode->nodetree */
path - > nodetree = snode - > nodetree ;
}
else
2013-07-08 11:38:11 +00:00
path - > nodetree = newlibadr_us ( fd , sc - > id . lib , path - > nodetree ) ;
2013-03-18 16:34:57 +00:00
if ( ! path - > nodetree )
break ;
}
2009-01-27 17:12:40 +00:00
2013-03-18 16:34:57 +00:00
/* remaining path entries are invalid, remove */
for ( ; path ; path = path_next ) {
path_next = path - > next ;
BLI_remlink ( & snode - > treepath , path ) ;
MEM_freeN ( path ) ;
2011-09-05 21:01:50 +00:00
}
2013-03-18 16:34:57 +00:00
/* edittree is just the last in the path,
* set this directly since the path may have been shortened above */
if ( snode - > treepath . last ) {
path = snode - > treepath . last ;
snode - > edittree = path - > nodetree ;
2009-01-27 17:12:40 +00:00
}
2013-03-18 16:34:57 +00:00
else
snode - > edittree = NULL ;
2009-01-27 17:12:40 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_CLIP ) {
SpaceClip * sclip = ( SpaceClip * ) sl ;
2012-06-11 03:03:36 +00:00
2012-05-17 12:59:34 +00:00
sclip - > clip = newlibadr_us ( fd , sc - > id . lib , sclip - > clip ) ;
2012-07-24 20:33:55 +00:00
sclip - > mask_info . mask = newlibadr_us ( fd , sc - > id . lib , sclip - > mask_info . mask ) ;
2011-11-07 12:55:18 +00:00
}
2012-06-11 03:03:36 +00:00
else if ( sl - > spacetype = = SPACE_LOGIC ) {
SpaceLogic * slogic = ( SpaceLogic * ) sl ;
slogic - > gpd = newlibadr_us ( fd , sc - > id . lib , slogic - > gpd ) ;
}
2002-10-12 11:37:38 +00:00
}
}
2012-08-01 15:32:27 +00:00
sc - > id . flag - = LIB_NEED_LINK ;
2002-10-12 11:37:38 +00:00
}
}
}
2014-02-21 10:29:08 +01:00
/* how to handle user count on pointer restore */
typedef enum ePointerUserMode {
2014-08-12 16:03:17 +02:00
USER_IGNORE = 0 , /* ignore user count */
USER_ONE = 1 , /* ensure at least one user (fake also counts) */
USER_REAL = 2 , /* ensure at least one real user (fake user ignored) */
2014-02-21 10:29:08 +01:00
} ePointerUserMode ;
static bool restore_pointer ( ID * id , ID * newid , ePointerUserMode user )
2013-03-18 16:34:57 +00:00
{
2015-01-26 16:03:11 +01:00
if ( STREQ ( newid - > name + 2 , id - > name + 2 ) ) {
2013-03-18 16:34:57 +00:00
if ( newid - > lib = = id - > lib ) {
2014-02-21 10:29:08 +01:00
if ( user = = USER_ONE ) {
2013-03-18 16:34:57 +00:00
if ( newid - > us = = 0 ) {
newid - > us + + ;
}
}
2014-02-21 10:29:08 +01:00
else if ( user = = USER_REAL ) {
2013-03-18 16:34:57 +00:00
id_us_ensure_real ( newid ) ;
}
return true ;
}
}
return false ;
}
2013-01-14 12:02:10 +00:00
/**
* Only for undo files , or to restore a screen after reading without UI . . .
*
* user
2014-08-12 16:03:17 +02:00
* - USER_IGNORE : no usercount change
* - USER_ONE : ensure a user
* - USER_REAL : ensure a real user ( even if a fake one is set )
2013-01-14 12:02:10 +00:00
*/
2014-02-21 10:29:08 +01:00
static void * restore_pointer_by_name ( Main * mainp , ID * id , ePointerUserMode user )
2004-09-05 13:43:51 +00:00
{
2012-03-24 06:18:31 +00:00
if ( id ) {
2013-04-17 15:55:10 +00:00
ListBase * lb = which_libbase ( mainp , GS ( id - > name ) ) ;
if ( lb ) { // there's still risk of checking corrupt mem (freed Ids in oops)
ID * idn = lb - > first ;
2013-03-18 16:34:57 +00:00
2013-04-17 15:55:10 +00:00
for ( ; idn ; idn = idn - > next ) {
if ( restore_pointer ( id , idn , user ) )
2013-03-18 16:34:57 +00:00
break ;
2004-09-05 13:43:51 +00:00
}
2012-05-21 06:33:32 +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
}
2013-07-24 06:51:04 +00:00
static void lib_link_seq_clipboard_pt_restore ( ID * id , Main * newmain )
{
if ( id ) {
/* clipboard must ensure this */
BLI_assert ( id - > newid ! = NULL ) ;
2014-02-21 10:29:08 +01:00
id - > newid = restore_pointer_by_name ( newmain , ( ID * ) id - > newid , USER_ONE ) ;
2013-07-24 06:51:04 +00:00
}
}
2012-02-03 13:08:44 +00:00
static int lib_link_seq_clipboard_cb ( Sequence * seq , void * arg_pt )
{
Main * newmain = ( Main * ) arg_pt ;
2013-07-24 06:51:04 +00:00
lib_link_seq_clipboard_pt_restore ( ( ID * ) seq - > scene , newmain ) ;
lib_link_seq_clipboard_pt_restore ( ( ID * ) seq - > scene_camera , newmain ) ;
lib_link_seq_clipboard_pt_restore ( ( ID * ) seq - > clip , newmain ) ;
lib_link_seq_clipboard_pt_restore ( ( ID * ) seq - > mask , newmain ) ;
lib_link_seq_clipboard_pt_restore ( ( ID * ) seq - > sound , newmain ) ;
2012-02-03 13:08:44 +00:00
return 1 ;
}
static void lib_link_clipboard_restore ( Main * newmain )
{
/* update IDs stored in sequencer clipboard */
2012-08-08 11:15:40 +00:00
BKE_sequencer_base_recursive_apply ( & seqbase_clipboard , lib_link_seq_clipboard_cb , newmain ) ;
2012-02-03 13:08:44 +00:00
}
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 */
2012-09-15 01:52:28 +00:00
void blo_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 ;
2012-05-17 12:59:34 +00:00
2008-12-31 18:52:15 +00:00
/* first windowmanager */
2012-05-17 12:59:34 +00:00
for ( wm = newmain - > wm . first ; wm ; wm = wm - > id . next ) {
2012-03-24 06:18:31 +00:00
for ( win = wm - > windows . first ; win ; win = win - > next ) {
2014-02-21 10:29:08 +01:00
win - > screen = restore_pointer_by_name ( newmain , ( ID * ) win - > screen , USER_ONE ) ;
2008-12-31 18:52:15 +00:00
2012-05-17 12:59:34 +00:00
if ( win - > screen = = NULL )
win - > screen = curscreen ;
win - > screen - > winid = win - > winid ;
2008-12-31 18:52:15 +00:00
}
}
2012-05-17 12:59:34 +00:00
for ( sc = newmain - > screen . first ; sc ; sc = sc - > id . next ) {
Scene * oldscene = sc - > scene ;
2014-02-21 10:29:08 +01:00
sc - > scene = restore_pointer_by_name ( newmain , ( ID * ) sc - > scene , USER_ONE ) ;
2012-05-17 12:59:34 +00:00
if ( sc - > scene = = NULL )
sc - > scene = curscene ;
2010-01-27 15:30:20 +00:00
/* keep cursor location through undo */
copy_v3_v3 ( sc - > scene - > cursor , oldscene - > cursor ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( sa = sc - > areabase . first ; sa ; sa = sa - > next ) {
2004-09-05 13:43:51 +00:00
SpaceLink * sl ;
2012-05-17 12:59:34 +00:00
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 ;
2011-11-02 18:20:53 +00:00
ARegion * ar ;
2004-11-14 12:56:56 +00:00
2012-03-24 06:18:31 +00:00
if ( v3d - > scenelock )
2012-05-17 12:59:34 +00:00
v3d - > camera = NULL ; /* always get from scene */
2010-04-06 01:18:52 +00:00
else
2014-02-21 10:29:08 +01:00
v3d - > camera = restore_pointer_by_name ( newmain , ( ID * ) v3d - > camera , USER_ONE ) ;
2012-05-17 12:59:34 +00:00
if ( v3d - > camera = = NULL )
v3d - > camera = sc - > scene - > camera ;
2014-02-21 10:29:08 +01:00
v3d - > ob_centre = restore_pointer_by_name ( newmain , ( ID * ) v3d - > ob_centre , USER_ONE ) ;
2004-09-05 13:43:51 +00:00
2012-03-24 06:18:31 +00:00
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next ) {
2014-08-12 16:02:44 +02:00
if ( ( bgpic - > ima = restore_pointer_by_name ( newmain , ( ID * ) bgpic - > ima , USER_IGNORE ) ) ) {
id_us_plus ( ( ID * ) bgpic - > ima ) ;
}
if ( ( bgpic - > clip = restore_pointer_by_name ( newmain , ( ID * ) bgpic - > clip , USER_IGNORE ) ) ) {
id_us_plus ( ( ID * ) bgpic - > clip ) ;
}
2004-09-05 13:43:51 +00:00
}
2012-03-24 06:18:31 +00:00
if ( v3d - > localvd ) {
2009-03-13 13:38:41 +00:00
/*Base *base;*/
2012-05-17 12:59:34 +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 */
2012-06-30 22:49:33 +00:00
#if 0 /* XXX regionlocalview ? */
2012-03-24 06:18:31 +00:00
for ( base = sc - > scene - > base . first ; base ; base = base - > next ) {
if ( base - > lay & v3d - > lay ) break ;
2004-11-14 12:56:56 +00:00
}
2012-03-24 06:18:31 +00:00
if ( base = = NULL ) {
2004-11-14 16:06:24 +00:00
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 ;
}
2012-06-30 22:49:33 +00:00
# endif
2004-09-05 13:43:51 +00:00
}
2013-03-09 03:46:30 +00:00
else if ( v3d - > scenelock ) {
v3d - > lay = sc - > scene - > lay ;
}
2012-05-17 12:59:34 +00:00
2005-09-29 19:52:42 +00:00
/* not very nice, but could help */
2012-05-17 12:59:34 +00:00
if ( ( v3d - > layact & v3d - > lay ) = = 0 ) v3d - > layact = v3d - > lay ;
2013-11-22 20:10:26 +11:00
2011-11-02 18:20:53 +00:00
/* free render engines for now */
2012-05-17 12:59:34 +00:00
for ( ar = sa - > regionbase . first ; ar ; ar = ar - > next ) {
2011-11-02 18:20:53 +00:00
RegionView3D * rv3d = ar - > regiondata ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( rv3d & & rv3d - > render_engine ) {
2011-11-02 18:20:53 +00:00
RE_engine_free ( rv3d - > render_engine ) ;
2012-05-17 12:59:34 +00:00
rv3d - > render_engine = NULL ;
2011-11-02 18:20:53 +00:00
}
}
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IPO ) {
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
bDopeSheet * ads = sipo - > ads ;
2004-11-13 12:55:59 +00:00
2010-01-27 23:20:32 +00:00
if ( ads ) {
2014-02-21 10:29:08 +01:00
ads - > source = restore_pointer_by_name ( newmain , ( ID * ) ads - > source , USER_ONE ) ;
2010-01-27 23:20:32 +00:00
if ( ads - > filter_grp )
2014-02-21 10:29:08 +01:00
ads - > filter_grp = restore_pointer_by_name ( newmain , ( ID * ) ads - > filter_grp , USER_IGNORE ) ;
2010-01-25 17:24:04 +00:00
}
2012-07-03 13:47:13 +00:00
/* force recalc of list of channels (i.e. includes calculating F-Curve colors)
* thus preventing the " black curves " problem post - undo
*/
sipo - > flag | = SIPO_TEMP_NEEDCHANSYNC ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
2014-02-21 10:29:08 +01:00
sbuts - > pinid = restore_pointer_by_name ( newmain , sbuts - > pinid , USER_IGNORE ) ;
2015-05-04 16:12:12 +10:00
if ( sbuts - > pinid = = NULL ) {
sbuts - > flag & = ~ SB_PIN_CONTEXT ;
}
2014-05-08 19:44:53 +10:00
/* TODO: restore path pointers: T40046
* ( complicated because this contains data pointers too , not just ID ) */
MEM_SAFE_FREE ( sbuts - > path ) ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_FILE ) {
SpaceFile * sfile = ( SpaceFile * ) sl ;
sfile - > op = NULL ;
2015-09-07 17:20:09 +10:00
sfile - > previews_timer = NULL ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_ACTION ) {
SpaceAction * saction = ( SpaceAction * ) sl ;
2010-01-27 23:20:32 +00:00
2014-02-21 10:29:08 +01:00
saction - > action = restore_pointer_by_name ( newmain , ( ID * ) saction - > action , USER_ONE ) ;
saction - > ads . source = restore_pointer_by_name ( newmain , ( ID * ) saction - > ads . source , USER_ONE ) ;
2012-05-17 12:59:34 +00:00
2010-01-27 23:20:32 +00:00
if ( saction - > ads . filter_grp )
2014-02-21 10:29:08 +01:00
saction - > ads . filter_grp = restore_pointer_by_name ( newmain , ( ID * ) saction - > ads . filter_grp , USER_IGNORE ) ;
2012-06-11 04:13:39 +00:00
/* force recalc of list of channels, potentially updating the active action
* while we ' re at it ( as it can only be updated that way ) [ # 28962 ]
*/
saction - > flag | = SACTION_TEMP_NEEDCHANSYNC ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
2014-02-21 10:29:08 +01:00
sima - > image = restore_pointer_by_name ( newmain , ( ID * ) sima - > image , USER_REAL ) ;
2012-05-17 12:59:34 +00:00
2012-03-26 08:06:13 +00:00
/* this will be freed, not worth attempting to find same scene,
* since it gets initialized later */
sima - > iuser . scene = NULL ;
2012-05-17 12:59:34 +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 . . .
*/
2014-02-21 10:29:08 +01:00
sima - > gpd = restore_pointer_by_name ( newmain , ( ID * ) sima - > gpd , USER_ONE ) ;
sima - > mask_info . mask = restore_pointer_by_name ( newmain , ( ID * ) sima - > mask_info . mask , USER_REAL ) ;
2004-09-05 13:43:51 +00:00
}
2012-06-11 03:03:36 +00:00
else if ( sl - > spacetype = = SPACE_SEQ ) {
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
/* 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 . . .
*/
2014-02-21 10:29:08 +01:00
sseq - > gpd = restore_pointer_by_name ( newmain , ( ID * ) sseq - > gpd , USER_ONE ) ;
2012-06-11 03:03:36 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_NLA ) {
SpaceNla * snla = ( SpaceNla * ) sl ;
bDopeSheet * ads = snla - > ads ;
2010-01-27 23:20:32 +00:00
if ( ads ) {
2014-02-21 10:29:08 +01:00
ads - > source = restore_pointer_by_name ( newmain , ( ID * ) ads - > source , USER_ONE ) ;
2010-01-27 23:20:32 +00:00
if ( ads - > filter_grp )
2014-02-21 10:29:08 +01:00
ads - > filter_grp = restore_pointer_by_name ( newmain , ( ID * ) ads - > filter_grp , USER_IGNORE ) ;
2010-01-25 17:24:04 +00:00
}
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_TEXT ) {
SpaceText * st = ( SpaceText * ) sl ;
2012-05-21 06:33:32 +00:00
2014-02-21 10:29:08 +01:00
st - > text = restore_pointer_by_name ( newmain , ( ID * ) st - > text , USER_ONE ) ;
2012-05-17 12:59:34 +00:00
if ( st - > text = = NULL ) st - > text = newmain - > text . first ;
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_SCRIPT ) {
SpaceScript * scpt = ( SpaceScript * ) sl ;
2008-03-06 21:25:15 +00:00
2014-02-21 10:29:08 +01:00
scpt - > script = restore_pointer_by_name ( newmain , ( ID * ) scpt - > script , USER_ONE ) ;
2008-03-06 21:25:15 +00:00
/*sc->script = NULL; - 2.45 set to null, better re-run the script */
if ( scpt - > script ) {
2012-03-28 01:06:43 +00:00
SCRIPT_SET_NULL ( scpt - > script ) ;
2008-03-06 21:25:15 +00:00
}
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
2004-09-05 13:43:51 +00:00
SpaceOops * so = ( SpaceOops * ) sl ;
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
2014-02-21 10:29:08 +01:00
so - > search_tse . id = restore_pointer_by_name ( newmain , so - > search_tse . id , USER_IGNORE ) ;
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
2012-03-24 06:18:31 +00:00
if ( so - > treestore ) {
2013-08-03 11:35:09 +00:00
TreeStoreElem * tselem ;
BLI_mempool_iter iter ;
BLI_mempool_iternew ( so - > treestore , & iter ) ;
while ( ( tselem = BLI_mempool_iterstep ( & iter ) ) ) {
2015-09-09 16:26:53 +02:00
/* Do not try to restore pointers to drivers/sequence/etc., can crash in undo case! */
if ( TSE_IS_REAL_ID ( tselem ) ) {
tselem - > id = restore_pointer_by_name ( newmain , tselem - > id , USER_IGNORE ) ;
}
else {
tselem - > id = NULL ;
}
Version 1.0 of the new Outliner
The outliner is a hierarchical diagram displaying a list of data in Blender
and its dependencies. The 'databrowse' doesn't really show it, and Oops is
too chaotic still. And most of all, the former two don't offer much tools.
After discussions on irc, Matt came with this design proposal;
http://mke3.net/blender/interface/layout/outliner/
Which is closely followed for the implementation.
The current version only shows all 'library data' in Blender (objects,
meshes, ipos, etc) and not the 'direct data' such as vertex groups or NLA.
I decided to make it inside the Oopw window, as an option. You can find the
option in the "View" pulldown, or directly invoke it with ALT+SHIFT+F9
Here's a quick overview of the Outliner GUI:
- Header pulldown has options what it can show (Visible = in current layers)
- click on triangle arrow to open/close
- press AKEY to open/close all
- Leftmouse click on an item activates; and does based on type a couple of
extra things:
- activates a scene
- selects/activates the Object
- enters editmode (if clicked on Mesh, Curve, etc)
- shows the appropriate Shading buttons (Lamp, Material, Texture)
- sets the IpoWindow to the current IPO
- activates the Ipo-channel in an Action
- Selected and Active objects are drawn in its Theme selection color
- SHIFT+click on Object does extend-select
- Press DOTkey to get the current active data in center of view
TODO;
- rightmouse selection; for indicating operations like delete or duplicate
- showing more data types
- icon (re)design...
- lotsof options as described in Matts paper still...
2004-10-06 18:55:00 +00:00
}
2013-08-03 11:35:09 +00:00
if ( so - > treehash ) {
2013-08-23 20:35:00 +00:00
/* rebuild hash table, because it depends on ids too */
2015-05-11 11:06:35 +10:00
so - > storeflag | = SO_TREESTORE_REBUILD ;
2013-08-03 11:35:09 +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
}
2004-09-05 13:43:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
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
SpaceNode * snode = ( SpaceNode * ) sl ;
2013-03-18 16:34:57 +00:00
bNodeTreePath * path , * path_next ;
2013-04-17 15:55:10 +00:00
bNodeTree * ntree ;
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
2013-04-17 15:55:10 +00:00
/* node tree can be stored locally in id too, link this first */
2014-02-21 10:29:08 +01:00
snode - > id = restore_pointer_by_name ( newmain , snode - > id , USER_ONE ) ;
snode - > from = restore_pointer_by_name ( newmain , snode - > from , USER_IGNORE ) ;
2013-04-17 15:55:10 +00:00
ntree = nodetree_from_id ( snode - > id ) ;
if ( ntree )
snode - > nodetree = ntree ;
else
2014-02-21 10:29:08 +01:00
snode - > nodetree = restore_pointer_by_name ( newmain , ( ID * ) snode - > nodetree , USER_REAL ) ;
2013-04-17 15:55:10 +00:00
for ( path = snode - > treepath . first ; path ; path = path - > next ) {
if ( path = = snode - > treepath . first ) {
/* first nodetree in path is same as snode->nodetree */
path - > nodetree = snode - > nodetree ;
}
else
2014-02-21 10:29:08 +01:00
path - > nodetree = restore_pointer_by_name ( newmain , ( ID * ) path - > nodetree , USER_REAL ) ;
2013-03-18 16:34:57 +00:00
if ( ! path - > nodetree )
break ;
}
2009-01-27 17:12:40 +00:00
2013-03-18 16:34:57 +00:00
/* remaining path entries are invalid, remove */
for ( ; path ; path = path_next ) {
path_next = path - > next ;
BLI_remlink ( & snode - > treepath , path ) ;
MEM_freeN ( path ) ;
2011-09-05 21:01:50 +00:00
}
2013-03-18 16:34:57 +00:00
/* edittree is just the last in the path,
* set this directly since the path may have been shortened above */
if ( snode - > treepath . last ) {
path = snode - > treepath . last ;
snode - > edittree = path - > nodetree ;
2009-01-27 17:12:40 +00:00
}
2013-03-18 16:34:57 +00:00
else
snode - > edittree = NULL ;
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
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_CLIP ) {
SpaceClip * sclip = ( SpaceClip * ) sl ;
2012-06-11 02:23:26 +00:00
2014-02-21 10:29:08 +01:00
sclip - > clip = restore_pointer_by_name ( newmain , ( ID * ) sclip - > clip , USER_REAL ) ;
sclip - > mask_info . mask = restore_pointer_by_name ( newmain , ( ID * ) sclip - > mask_info . mask , USER_REAL ) ;
2012-06-11 02:23:26 +00:00
2011-11-07 12:55:18 +00:00
sclip - > scopes . ok = 0 ;
}
2012-06-11 03:03:36 +00:00
else if ( sl - > spacetype = = SPACE_LOGIC ) {
SpaceLogic * slogic = ( SpaceLogic * ) sl ;
2014-02-21 10:29:08 +01:00
slogic - > gpd = restore_pointer_by_name ( newmain , ( ID * ) slogic - > gpd , USER_ONE ) ;
2012-06-11 03:03:36 +00:00
}
2004-09-05 13:43:51 +00:00
}
}
}
2012-02-03 13:08:44 +00:00
/* update IDs stored in all possible clipboards */
lib_link_clipboard_restore ( newmain ) ;
2004-09-05 13:43:51 +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
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 ;
2012-12-28 10:32:49 +00:00
uiList * ui_list ;
2008-12-26 13:11:04 +00:00
2012-05-17 12:59:34 +00:00
link_list ( fd , & ar - > panels ) ;
2008-12-26 13:11:04 +00:00
2012-05-17 12:59:34 +00:00
for ( pa = ar - > panels . first ; pa ; pa = pa - > next ) {
pa - > paneltab = newdataadr ( fd , pa - > paneltab ) ;
pa - > runtime_flag = 0 ;
pa - > activedata = NULL ;
pa - > type = NULL ;
2008-12-26 13:11:04 +00:00
}
2013-03-26 09:59:43 +00:00
2013-12-17 03:21:55 +11:00
link_list ( fd , & ar - > panels_category_active ) ;
2012-12-28 10:32:49 +00:00
link_list ( fd , & ar - > ui_lists ) ;
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
2012-12-28 10:32:49 +00:00
for ( ui_list = ar - > ui_lists . first ; ui_list ; ui_list = ui_list - > next ) {
ui_list - > type = NULL ;
2013-08-27 15:27:41 +00:00
ui_list - > dyn_data = NULL ;
2013-08-29 12:55:31 +00:00
ui_list - > properties = newdataadr ( fd , ui_list - > properties ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & ui_list - > properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
This commit frees list ui items from their dependencies to Panel, and hence from all the limitations this implied (mostly, the "only one list per panel" one).
It introduces a new (py-extendable and registrable) RNA type, UIList (roughly similar to Panel one), which currently contains only "standard" list's scroll pos and size (but may be expended to include e.g. some filtering data, etc.). This now makes lists completely independent from Panels!
This UIList has a draw_item callback which allows to customize items' drawing from python, that all addons can now use. Incidentally, this also greatly simplifies the C code of this widget, as we do not code any "special case" here anymore!
To make all this work, other changes were also necessary:
* Now all buttons (uiBut struct) have a 'custom_data' void pointer, used currently to store the uiList struct associated with a given uiLayoutListBox.
* DynamicPaintSurface now exposes a new bool, use_color_preview (readonly), saying whether that surface has some 3D view preview data or not.
* UILayout class has now four new (static) functions, to get the actual icon of any RNA object (important e.g. with materials or textures), and to get an enum item's UI name, description and icon.
* UILayout's label() func now takes an optional 'icon_value' integer parameter, which if not zero will override the 'icon' one (mandatory to use "custom" icons as generated for material/texture/... previews).
Note: not sure whether we should add that one to all UILayout's prop funcs?
Note: will update addons using template list asap.
2012-12-28 09:20:16 +00:00
}
Add drag-resize to uiTemplatePreview (mat/tex/etc. preview widget).
This is done by adding a new button type, GRIP, similar to other numbuttons
(scroll, slider, ...), which here controls the preview height.
Then, we add a new DNA struct to be able to save that height in Blend files
(note I choose not to use Panel struct for this, because we would then have the
same limitation we used to have with uiLists, only one preview per panel
and no preview outside panel).
This implies a change to template_preview UI RNA/py API (each preview needs an ID),
but this is backward compatible, as by default datablock type will be used if no ID is
given (which means e.g. all material previews with no ID will have same height).
Reviewers: brecht
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D342
2014-04-02 12:59:48 +02:00
link_list ( fd , & ar - > ui_previews ) ;
2013-08-10 21:17:46 +00:00
if ( spacetype = = SPACE_EMPTY ) {
/* unkown space type, don't leak regiondata */
ar - > regiondata = NULL ;
}
else {
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 - > gpuoffscreen = NULL ;
rv3d - > render_engine = NULL ;
rv3d - > sms = NULL ;
rv3d - > smooth_timer = NULL ;
2015-02-12 18:54:41 +01:00
rv3d - > compositor = NULL ;
2013-08-10 21:17:46 +00:00
}
2012-05-17 12:59:34 +00:00
}
}
ar - > v2d . tab_offset = NULL ;
ar - > v2d . tab_num = 0 ;
ar - > v2d . tab_cur = 0 ;
2012-08-12 01:07:31 +00:00
ar - > v2d . sms = NULL ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & ar - > panels_category ) ;
BLI_listbase_clear ( & ar - > handlers ) ;
BLI_listbase_clear ( & ar - > uiblocks ) ;
2012-05-17 12:59:34 +00:00
ar - > headerstr = NULL ;
ar - > swinid = 0 ;
ar - > type = NULL ;
ar - > swap = 0 ;
2013-12-18 12:02:31 +01:00
ar - > do_draw = 0 ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
ar - > regiontimer = NULL ;
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
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 */
2012-05-04 15:42:49 +00:00
void blo_do_versions_view3d_split_250 ( View3D * v3d , ListBase * regions )
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
{
ARegion * ar ;
2012-05-17 12:59:34 +00:00
for ( ar = regions - > first ; ar ; ar = ar - > next ) {
2012-03-24 06:18:31 +00:00
if ( ar - > regiontype = = RGN_TYPE_WINDOW & & ar - > regiondata = = 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
RegionView3D * rv3d ;
2012-05-17 12:59:34 +00:00
rv3d = ar - > regiondata = MEM_callocN ( sizeof ( RegionView3D ) , " region v3d patch " ) ;
rv3d - > persp = ( char ) v3d - > persp ;
rv3d - > view = ( char ) v3d - > view ;
rv3d - > dist = v3d - > dist ;
2011-10-28 12:40:15 +00:00
copy_v3_v3 ( rv3d - > ofs , v3d - > ofs ) ;
copy_qt_qt ( rv3d - > viewquat , v3d - > viewquat ) ;
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
}
}
2012-05-17 12:59:34 +00:00
2009-09-14 19:12:29 +00:00
/* this was not initialized correct always */
2012-03-24 06:18:31 +00:00
if ( v3d - > twtype = = 0 )
2012-05-17 12:59:34 +00:00
v3d - > twtype = V3D_MANIP_TRANSLATE ;
2015-07-26 00:18:44 +02:00
if ( v3d - > gridsubdiv = = 0 )
v3d - > gridsubdiv = 10 ;
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
}
2013-05-06 11:23:13 +00:00
static bool direct_link_screen ( FileData * fd , bScreen * sc )
2002-10-12 11:37:38 +00:00
{
ScrArea * sa ;
ScrVert * sv ;
ScrEdge * se ;
2013-05-06 11:23:13 +00:00
bool wrong_id = false ;
2005-10-27 13:56:41 +00:00
2002-10-12 11:37:38 +00:00
link_list ( fd , & ( sc - > vertbase ) ) ;
link_list ( fd , & ( sc - > edgebase ) ) ;
link_list ( fd , & ( sc - > areabase ) ) ;
2012-05-17 12:59:34 +00:00
sc - > regionbase . first = sc - > regionbase . last = NULL ;
sc - > context = NULL ;
sc - > mainwin = sc - > subwinactive = 0 ; /* indices */
sc - > swap = 0 ;
2012-09-06 00:33:59 +00:00
2002-10-12 11:37:38 +00:00
/* edges */
2012-05-17 12:59:34 +00:00
for ( se = sc - > edgebase . first ; se ; se = se - > next ) {
se - > v1 = newdataadr ( fd , se - > v1 ) ;
se - > v2 = newdataadr ( fd , se - > v2 ) ;
if ( ( intptr_t ) se - > v1 > ( intptr_t ) se - > v2 ) {
sv = se - > v1 ;
se - > v1 = se - > v2 ;
se - > v2 = sv ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
if ( se - > v1 = = NULL ) {
2013-05-06 11:23:13 +00:00
printf ( " Error reading Screen %s... removing it. \n " , sc - > id . name + 2 ) ;
2013-05-06 12:27:14 +00:00
BLI_remlink ( & sc - > edgebase , se ) ;
2013-05-06 11:23:13 +00:00
wrong_id = true ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
/* areas */
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +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 ) ) ;
2007-12-24 18:53:37 +00:00
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & sa - > handlers ) ;
2012-05-17 12:59:34 +00:00
sa - > type = NULL ; /* spacetype callbacks */
2013-01-30 12:22:02 +00:00
sa - > region_active_win = - 1 ;
2013-08-10 21:17:46 +00:00
/* if we do not have the spacetype registered (game player), we cannot
* free it , so don ' t allocate any new memory for such spacetypes . */
if ( ! BKE_spacetype_exists ( sa - > spacetype ) )
sa - > spacetype = SPACE_EMPTY ;
2012-05-17 12:59:34 +00:00
for ( ar = sa - > 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 , 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 */
2012-03-24 06:18:31 +00:00
if ( sa - > spacedata . first = = NULL ) {
2008-12-14 10:52:48 +00:00
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 */
2012-05-17 12:59:34 +00:00
else if ( sa - > spacetype = = SPACE_VIEW3D )
2012-05-04 15:42:49 +00:00
blo_do_versions_view3d_split_250 ( sa - > spacedata . first , & sa - > regionbase ) ;
2015-02-12 18:54:41 +01:00
2014-08-15 08:39:47 +10:00
/* incase we set above */
sa - > butspacetype = sa - > spacetype ;
2012-05-17 12:59:34 +00:00
for ( sl = sa - > spacedata . first ; sl ; sl = sl - > next ) {
2008-12-19 00:18:16 +00:00
link_list ( fd , & ( sl - > regionbase ) ) ;
2013-08-10 21:17:46 +00:00
/* if we do not have the spacetype registered (game player), we cannot
* free it , so don ' t allocate any new memory for such spacetypes . */
if ( ! BKE_spacetype_exists ( sl - > spacetype ) )
sl - > spacetype = SPACE_EMPTY ;
2012-05-17 12:59:34 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
if ( sl - > spacetype = = SPACE_VIEW3D ) {
2002-10-12 11:37:38 +00:00
View3D * v3d = ( View3D * ) sl ;
2010-01-19 22:44:43 +00:00
BGpic * bgpic ;
2012-05-17 12:59:34 +00:00
2009-12-17 14:38:30 +00:00
v3d - > flag | = V3D_INVALID_BACKBUF ;
2012-05-17 12:59:34 +00:00
link_list ( fd , & v3d - > bgpicbase ) ;
2010-01-19 22:44:43 +00:00
/* should be do_versions except this doesnt fit well there */
2012-03-24 06:18:31 +00:00
if ( v3d - > bgpic ) {
2012-05-17 12:59:34 +00:00
bgpic = newdataadr ( fd , v3d - > bgpic ) ;
2010-01-19 22:44:43 +00:00
BLI_addtail ( & v3d - > bgpicbase , bgpic ) ;
2012-05-17 12:59:34 +00:00
v3d - > bgpic = NULL ;
2010-01-19 22:44:43 +00:00
}
2012-05-17 12:59:34 +00:00
for ( bgpic = v3d - > bgpicbase . first ; bgpic ; bgpic = bgpic - > next )
bgpic - > iuser . ok = 1 ;
2012-03-24 06:18:31 +00:00
if ( v3d - > gpd ) {
2012-05-17 12:59:34 +00:00
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
}
2012-05-17 12:59:34 +00:00
v3d - > localvd = newdataadr ( fd , v3d - > localvd ) ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & v3d - > afterdraw_transp ) ;
BLI_listbase_clear ( & v3d - > afterdraw_xray ) ;
BLI_listbase_clear ( & v3d - > afterdraw_xraytransp ) ;
2012-05-17 12:59:34 +00:00
v3d - > properties_storage = NULL ;
2013-01-22 11:18:41 +00:00
v3d - > defmaterial = NULL ;
2012-05-17 12:59:34 +00:00
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
/* render can be quite heavy, set to solid on load */
2012-03-24 06:18:31 +00:00
if ( v3d - > drawtype = = OB_RENDER )
Blender Internal Render in viewport
Because of our release soon, feature has been added behind the Debug Menu.
CTRL+ALT+D and set it to -1. Or commandline --debug-value -1.
When debug set to -1, you can put the viewport to 'render' mode, just like
for Cycles. Notes for testers: (and please no bugs in tracker for this :)
- It renders without AA, MBlur, Panorama, Sequence, Composite
- Only active render layer gets rendered. Select another layer will re-render.
- But yes: it works for FreeStyle renders!
- Also does great for local view.
- BI is not well suited for incremental renders on view changes. This only
works for non-raytrace scenes, or zoom in ortho or camera mode, or for
Material changes. In most cases a full re-render is being done.
- ESC works to stop the preview render.
- Borders render as well. (CTRL+B)
- Force a refresh with arrow key left/right. A lot of settings don't trigger
re-render yet.
Tech notes:
- FreeStyle is adding a lot of temp objects/meshes in the Main database. This
caused DepsGraph to trigger changes (and redraws). I've prepended the names
for these temp objects with char number 27 (ESC), and made these names be
ignored for tag update checking.
- Fixed some bugs that were noticable with such excessive re-renders, like
for opening file window, quit during renders.
2013-04-16 17:39:20 +00:00
v3d - > drawtype = OB_SOLID ;
2015-02-12 18:54:41 +01:00
if ( v3d - > fx_settings . dof )
v3d - > fx_settings . dof = newdataadr ( fd , v3d - > fx_settings . dof ) ;
if ( v3d - > fx_settings . ssao )
v3d - > fx_settings . ssao = newdataadr ( fd , v3d - > fx_settings . ssao ) ;
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
2012-05-04 15:42:49 +00:00
blo_do_versions_view3d_split_250 ( v3d , & sl - > regionbase ) ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IPO ) {
SpaceIpo * sipo = ( SpaceIpo * ) sl ;
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
2012-05-17 12:59:34 +00:00
sipo - > ads = newdataadr ( fd , sipo - > ads ) ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & sipo - > ghostCurves ) ;
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
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_NLA ) {
SpaceNla * snla = ( SpaceNla * ) sl ;
2009-05-25 13:07:54 +00:00
2012-05-17 12:59:34 +00:00
snla - > ads = newdataadr ( fd , snla - > ads ) ;
2009-05-25 13:07:54 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_OUTLINER ) {
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
2013-08-23 20:35:00 +00:00
/* use newdataadr_no_us and do not free old memory avoiding double
2013-08-07 19:29:15 +00:00
* frees and use of freed memory . this could happen because of a
* bug fixed in revision 58959 where the treestore memory address
* was not unique */
TreeStore * ts = newdataadr_no_us ( fd , soops - > treestore ) ;
2013-08-03 11:35:09 +00:00
soops - > treestore = NULL ;
if ( ts ) {
2013-08-07 19:29:15 +00:00
TreeStoreElem * elems = newdataadr_no_us ( fd , ts - > data ) ;
2013-08-03 11:35:09 +00:00
soops - > treestore = BLI_mempool_create ( sizeof ( TreeStoreElem ) , ts - > usedelem ,
512 , BLI_MEMPOOL_ALLOW_ITER ) ;
if ( ts - > usedelem & & elems ) {
int i ;
for ( i = 0 ; i < ts - > usedelem ; i + + ) {
TreeStoreElem * new_elem = BLI_mempool_alloc ( soops - > treestore ) ;
* new_elem = elems [ i ] ;
}
}
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
/* we only saved what was used */
soops - > storeflag | = SO_TREESTORE_CLEANUP ; // at first draw
}
2013-08-03 11:35:09 +00:00
soops - > treehash = NULL ;
2013-03-15 10:48:48 +00:00
soops - > tree . first = soops - > tree . last = NULL ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_IMAGE ) {
SpaceImage * sima = ( SpaceImage * ) sl ;
2006-01-09 23:52:51 +00:00
2012-05-17 12:59:34 +00:00
sima - > cumap = newdataadr ( fd , sima - > cumap ) ;
2012-03-24 06:18:31 +00:00
if ( 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
direct_link_curvemapping ( fd , sima - > cumap ) ;
2010-04-05 06:52:27 +00:00
2012-05-17 12:59:34 +00:00
sima - > iuser . scene = NULL ;
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 !
2011-04-13 14:40:50 +00:00
* committed : r28002 */
#if 0
2012-05-17 12:59:34 +00:00
sima - > gpd = newdataadr ( fd , sima - > gpd ) ;
2011-04-13 14:40:50 +00:00
if ( sima - > gpd )
direct_link_gpencil ( fd , sima - > gpd ) ;
# endif
2006-01-09 23:52:51 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_NODE ) {
SpaceNode * snode = ( SpaceNode * ) sl ;
2008-07-22 09:53:25 +00:00
2012-03-24 06:18:31 +00:00
if ( snode - > gpd ) {
2012-05-17 12:59:34 +00:00
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
}
2013-03-18 16:34:57 +00:00
link_list ( fd , & snode - > treepath ) ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
snode - > edittree = NULL ;
2015-08-01 17:39:48 +02:00
snode - > iofsd = NULL ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & snode - > linkdrag ) ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
}
else if ( sl - > spacetype = = SPACE_TEXT ) {
SpaceText * st = ( SpaceText * ) sl ;
2013-12-13 00:04:05 +01:00
st - > drawcache = NULL ;
st - > scroll_accum [ 0 ] = 0.0f ;
st - > scroll_accum [ 1 ] = 0.0f ;
2005-12-18 13:46:01 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_TIME ) {
SpaceTime * stime = ( SpaceTime * ) sl ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & stime - > caches ) ;
2010-06-22 14:10:45 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_LOGIC ) {
SpaceLogic * slogic = ( SpaceLogic * ) sl ;
2012-06-11 03:03:36 +00:00
/* XXX: this is new stuff, which shouldn't be directly linking to gpd... */
2012-03-24 06:18:31 +00:00
if ( slogic - > gpd ) {
2012-05-17 12:59:34 +00:00
slogic - > gpd = newdataadr ( fd , slogic - > gpd ) ;
2009-06-16 13:09:36 +00:00
direct_link_gpencil ( fd , slogic - > gpd ) ;
}
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_SEQ ) {
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
SpaceSeq * sseq = ( SpaceSeq * ) sl ;
2012-07-02 08:30:29 +00:00
/* grease pencil data is not a direct data and can't be linked from direct_link*
2012-07-16 23:23:33 +00:00
* functions , it should be linked from lib_link * functions instead
2012-07-02 08:30:29 +00:00
*
* otherwise it ' ll lead to lost grease data on open because it ' ll likely be
* read from file after all other users of grease pencil and newdataadr would
* simple return NULL here ( sergey )
*/
#if 0
2012-03-24 06:18:31 +00:00
if ( sseq - > gpd ) {
2012-05-17 12:59:34 +00:00
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
}
2012-07-02 08:30:29 +00:00
# endif
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
sseq - > scopes . reference_ibuf = NULL ;
sseq - > scopes . zebra_ibuf = NULL ;
sseq - > scopes . waveform_ibuf = NULL ;
sseq - > scopes . sep_waveform_ibuf = NULL ;
sseq - > scopes . vector_ibuf = NULL ;
sseq - > scopes . histogram_ibuf = NULL ;
2008-07-22 09:53:25 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_BUTS ) {
SpaceButs * sbuts = ( SpaceButs * ) sl ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
2009-06-03 23:33:56 +00:00
sbuts - > path = NULL ;
2011-11-08 18:49:12 +00:00
sbuts - > texuser = NULL ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
sbuts - > mainbo = sbuts - > mainb ;
sbuts - > mainbuser = sbuts - > mainb ;
2009-06-03 23:33:56 +00:00
}
2012-05-17 12:59:34 +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 ) ;
2012-03-24 07:52:14 +00:00
//for (cl= sconsole->scrollback.first; cl; cl= cl->next)
2009-07-16 00:50:27 +00:00
// cl->line= newdataadr(fd, cl->line);
2012-07-16 23:23:33 +00:00
/* comma expressions, (e.g. expr1, expr2, expr3) evaluate each expression,
2012-04-22 11:54:53 +00:00
* from left to right . the right - most expression sets the result of the comma
* expression as a whole */
2012-05-17 12:59:34 +00:00
for ( cl = sconsole - > history . first ; cl ; cl = cl_next ) {
cl_next = cl - > next ;
cl - > line = newdataadr ( fd , cl - > line ) ;
2011-01-25 01:51:28 +00:00
if ( cl - > line ) {
/* the allocted length is not written, so reset here */
2012-05-17 12:59:34 +00:00
cl - > len_alloc = cl - > len + 1 ;
2011-01-25 01:51:28 +00:00
}
else {
2010-04-23 09:24:22 +00:00
BLI_remlink ( & sconsole - > history , cl ) ;
MEM_freeN ( cl ) ;
}
}
2009-07-16 00:50:27 +00:00
}
2012-05-17 12:59:34 +00:00
else if ( sl - > spacetype = = SPACE_FILE ) {
SpaceFile * sfile = ( SpaceFile * ) sl ;
2010-03-01 06:23:59 +00:00
/* this sort of info is probably irrelevant for reloading...
* plus , it isn ' t saved to files yet !
*/
2012-05-17 12:59:34 +00:00
sfile - > folders_prev = sfile - > folders_next = NULL ;
sfile - > files = NULL ;
sfile - > layout = NULL ;
sfile - > op = NULL ;
2015-09-07 17:20:09 +10:00
sfile - > previews_timer = NULL ;
2012-05-17 12:59:34 +00:00
sfile - > params = newdataadr ( fd , sfile - > params ) ;
2010-03-01 06:23:59 +00:00
}
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
else if ( sl - > spacetype = = SPACE_CLIP ) {
SpaceClip * sclip = ( SpaceClip * ) sl ;
sclip - > scopes . track_search = NULL ;
sclip - > scopes . track_preview = NULL ;
sclip - > scopes . ok = 0 ;
2013-03-26 09:59:43 +00:00
}
2002-10-12 11:37:38 +00:00
}
2008-01-01 15:53:38 +00:00
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & sa - > actionzones ) ;
2012-05-17 12:59:34 +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 ) ;
2002-10-12 11:37:38 +00:00
}
2013-05-06 11:23:13 +00:00
return wrong_id ;
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
2012-12-27 15:07:19 +00:00
/* check if the library was already read */
2012-05-25 17:13:30 +00:00
for ( newmain = fd - > mainlist - > first ; newmain ; newmain = newmain - > next ) {
2012-03-24 06:18:31 +00:00
if ( newmain - > curlib ) {
if ( BLI_path_cmp ( newmain - > curlib - > filepath , lib - > filepath ) = = 0 ) {
2013-11-29 23:16:13 +06:00
blo_reportf_wrap ( fd - > reports , RPT_WARNING ,
2012-10-26 17:32:50 +00:00
TIP_ ( " Library '%s', '%s' had multiple instances, save and reload! " ) ,
2012-01-05 09:50:07 +00:00
lib - > name , lib - > filepath ) ;
2012-05-17 12:59:34 +00:00
2012-05-25 17:13:30 +00:00
change_idid_adr ( fd - > mainlist , fd , lib , newmain - > curlib ) ;
2012-10-26 17:32:50 +00:00
/* change_idid_adr_fd(fd, lib, newmain->curlib); */
2005-12-14 09:59:22 +00:00
BLI_remlink ( & main - > library , lib ) ;
MEM_freeN ( lib ) ;
2012-05-17 12:59:34 +00:00
2005-12-14 09:59:22 +00:00
return ;
}
}
}
2012-12-27 15:07:19 +00:00
/* make sure we have full path in lib->filepath */
2010-06-02 17:58:28 +00:00
BLI_strncpy ( lib - > filepath , lib - > name , sizeof ( lib - > name ) ) ;
2013-03-05 06:26:10 +00:00
BLI_cleanup_path ( fd - > relabase , lib - > filepath ) ;
2006-01-04 19:05:24 +00:00
2012-12-27 15:07:19 +00:00
// printf("direct_link_library: name %s\n", lib->name);
// printf("direct_link_library: filepath %s\n", lib->filepath);
lib - > packedfile = direct_link_packedfile ( fd , lib - > packedfile ) ;
2005-12-14 09:59:22 +00:00
2003-04-26 18:01:01 +00:00
/* new main */
2013-12-26 17:24:42 +06:00
newmain = BKE_main_new ( ) ;
2012-05-25 17:13:30 +00:00
BLI_addtail ( fd - > mainlist , newmain ) ;
2012-05-17 12:59:34 +00:00
newmain - > curlib = lib ;
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 ;
2012-05-17 12:59:34 +00:00
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
lib - > id . us = 1 ;
2008-02-02 11:19:34 +00:00
}
}
2011-05-18 05:21:44 +00:00
/* Always call this once you have loaded new library data to set the relative paths correctly in relation to the blend file */
2008-02-02 11:19:34 +00:00
static void fix_relpaths_library ( const char * basepath , Main * main )
{
Library * lib ;
/* BLO_read_from_memory uses a blank filename */
2012-05-17 12:59:34 +00:00
if ( basepath = = NULL | | basepath [ 0 ] = = ' \0 ' ) {
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
2011-05-18 05:21:44 +00:00
/* when loading a linked lib into a file which has not been saved,
* there is nothing we can be relative to , so instead we need to make
* it absolute . This can happen when appending an object with a relative
* link into an unsaved blend file . See [ # 27405 ] .
* The remap relative option will make it relative again on save - campbell */
2012-08-29 10:32:38 +00:00
if ( BLI_path_is_rel ( lib - > name ) ) {
2011-09-26 18:51:10 +00:00
BLI_strncpy ( lib - > name , lib - > filepath , sizeof ( lib - > name ) ) ;
2011-05-18 05:21:44 +00:00
}
}
}
else {
2012-05-17 12:59:34 +00:00
for ( lib = main - > library . first ; lib ; lib = lib - > id . next ) {
2011-05-18 05:21:44 +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 */
2012-08-29 10:32:38 +00:00
if ( BLI_path_is_rel ( lib - > name ) ) { /* if this is relative to begin with? */
2011-09-26 18:51:10 +00:00
BLI_strncpy ( lib - > name , lib - > filepath , sizeof ( lib - > name ) ) ;
2011-05-18 05:21:44 +00:00
BLI_path_rel ( lib - > name , basepath ) ;
}
2008-01-31 21:19:40 +00:00
}
2002-10-12 11:37:38 +00:00
}
}
2011-08-01 11:44:20 +00:00
/* ************ READ SPEAKER ***************** */
static void lib_link_speaker ( FileData * fd , Main * main )
{
Speaker * spk ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( spk = main - > speaker . first ; spk ; spk = spk - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( spk - > id . flag & LIB_NEED_LINK ) {
2011-08-01 11:44:20 +00:00
if ( spk - > adt ) lib_link_animdata ( fd , & spk - > id , spk - > adt ) ;
2012-05-17 12:59:34 +00:00
2015-10-08 19:42:10 +11:00
spk - > sound = newlibadr_us ( fd , spk - > id . lib , spk - > sound ) ;
2012-08-01 15:32:27 +00:00
spk - > id . flag - = LIB_NEED_LINK ;
2011-08-01 11:44:20 +00:00
}
}
}
static void direct_link_speaker ( FileData * fd , Speaker * spk )
{
2012-05-17 12:59:34 +00:00
spk - > adt = newdataadr ( fd , spk - > adt ) ;
2011-08-01 11:44:20 +00:00
direct_link_animdata ( fd , spk - > adt ) ;
2012-04-22 11:54:53 +00:00
#if 0
2012-05-17 12:59:34 +00:00
spk - > sound = newdataadr ( fd , spk - > sound ) ;
2012-04-22 11:54:53 +00:00
direct_link_sound ( fd , spk - > sound ) ;
# endif
2011-08-01 11:44:20 +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
2014-11-24 18:18:35 +01:00
/* versioning stuff, if there was a cache, then we enable caching: */
2012-04-28 06:31:57 +00:00
if ( sound - > cache ) {
2011-08-07 11:54:58 +00:00
sound - > flags | = SOUND_FLAGS_CACHING ;
sound - > cache = NULL ;
}
2002-10-12 11:37:38 +00:00
2014-11-24 18:18:35 +01:00
if ( fd - > soundmap ) {
sound - > waveform = newsoundadr ( fd , sound - > waveform ) ;
}
else {
sound - > waveform = NULL ;
}
2015-01-28 19:45:16 +01:00
if ( sound - > spinlock ) {
sound - > spinlock = MEM_mallocN ( sizeof ( SpinLock ) , " sound_spinlock " ) ;
BLI_spin_init ( sound - > spinlock ) ;
}
2014-11-24 18:18:35 +01:00
/* clear waveform loading flag */
sound - > flags & = ~ SOUND_FLAGS_WAVEFORM_LOADING ;
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 ;
2012-05-21 06:33:32 +00:00
for ( sound = main - > sound . first ; sound ; sound = sound - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( sound - > id . flag & LIB_NEED_LINK ) {
sound - > id . flag - = LIB_NEED_LINK ;
2012-09-26 20:05:38 +00:00
sound - > ipo = newlibadr_us ( fd , sound - > id . lib , sound - > ipo ) ; // XXX deprecated - old animation system
2009-08-26 14:19:29 +00:00
2015-03-26 11:35:41 +01:00
BKE_sound_load ( main , sound ) ;
2002-10-12 11:37:38 +00:00
}
}
}
/* ***************** READ GROUP *************** */
static void direct_link_group ( FileData * fd , Group * group )
{
link_list ( fd , & group - > gobject ) ;
2015-08-10 15:41:28 +02:00
group - > preview = direct_link_preview_image ( fd , group - > preview ) ;
2002-10-12 11:37:38 +00:00
}
static void lib_link_group ( FileData * fd , Main * main )
{
2012-05-21 06:33:32 +00:00
Group * group ;
2002-10-12 11:37:38 +00:00
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 ;
2012-05-21 06:33:32 +00:00
for ( group = main - > group . first ; group ; group = group - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( group - > id . flag & LIB_NEED_LINK ) {
group - > id . flag - = LIB_NEED_LINK ;
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
2012-05-17 12:59:34 +00:00
add_us = 0 ;
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
2012-05-21 06:33:32 +00:00
for ( go = group - > gobject . first ; go ; go = go - > next ) {
2002-10-12 11:37:38 +00:00
go - > ob = newlibadr ( fd , group - > id . lib , go - > ob ) ;
2012-03-24 06:18:31 +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... */
2012-05-17 12:59:34 +00:00
add_us = 1 ;
if ( go - > ob - > id . us = = 0 )
go - > ob - > id . us = 1 ;
2005-12-06 15:39:25 +00:00
}
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
if ( add_us ) group - > id . us + + ;
2013-04-03 11:28:42 +00:00
BKE_group_object_unlink ( group , NULL , NULL , NULL ) ; /* removes NULL entries */
2002-10-12 11:37:38 +00:00
}
}
}
2011-11-07 12:55:18 +00:00
/* ***************** READ MOVIECLIP *************** */
2011-12-05 18:57:17 +00:00
static void direct_link_movieReconstruction ( FileData * fd , MovieTrackingReconstruction * reconstruction )
{
2012-05-17 12:59:34 +00:00
reconstruction - > cameras = newdataadr ( fd , reconstruction - > cameras ) ;
2011-12-05 18:57:17 +00:00
}
static void direct_link_movieTracks ( FileData * fd , ListBase * tracksbase )
{
MovieTrackingTrack * track ;
2012-05-17 12:59:34 +00:00
2011-12-05 18:57:17 +00:00
link_list ( fd , tracksbase ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( track = tracksbase - > first ; track ; track = track - > next ) {
2012-05-17 12:59:34 +00:00
track - > markers = newdataadr ( fd , track - > markers ) ;
2011-12-05 18:57:17 +00:00
}
}
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
static void direct_link_moviePlaneTracks ( FileData * fd , ListBase * plane_tracks_base )
{
MovieTrackingPlaneTrack * plane_track ;
link_list ( fd , plane_tracks_base ) ;
for ( plane_track = plane_tracks_base - > first ;
plane_track ;
plane_track = plane_track - > next )
{
int i ;
plane_track - > point_tracks = newdataadr ( fd , plane_track - > point_tracks ) ;
2015-04-22 23:00:41 +05:00
test_pointer_array ( fd , ( void * * ) & plane_track - > point_tracks ) ;
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
for ( i = 0 ; i < plane_track - > point_tracksnr ; i + + ) {
plane_track - > point_tracks [ i ] = newdataadr ( fd , plane_track - > point_tracks [ i ] ) ;
}
plane_track - > markers = newdataadr ( fd , plane_track - > markers ) ;
}
}
2011-11-07 12:55:18 +00:00
static void direct_link_movieclip ( FileData * fd , MovieClip * clip )
{
2012-05-17 12:59:34 +00:00
MovieTracking * tracking = & clip - > tracking ;
2011-12-05 18:57:17 +00:00
MovieTrackingObject * object ;
2011-11-07 12:55:18 +00:00
2012-02-17 08:13:45 +00:00
clip - > adt = newdataadr ( fd , clip - > adt ) ;
2012-05-17 12:59:34 +00:00
if ( fd - > movieclipmap ) clip - > cache = newmclipadr ( fd , clip - > cache ) ;
else clip - > cache = NULL ;
2011-11-07 12:55:18 +00:00
2012-05-17 12:59:34 +00:00
if ( fd - > movieclipmap ) clip - > tracking . camera . intrinsics = newmclipadr ( fd , clip - > tracking . camera . intrinsics ) ;
else clip - > tracking . camera . intrinsics = NULL ;
2011-11-07 12:55:18 +00:00
2011-12-05 18:57:17 +00:00
direct_link_movieTracks ( fd , & tracking - > tracks ) ;
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
direct_link_moviePlaneTracks ( fd , & tracking - > plane_tracks ) ;
2011-12-05 18:57:17 +00:00
direct_link_movieReconstruction ( fd , & tracking - > reconstruction ) ;
2011-11-07 12:55:18 +00:00
2012-05-17 12:59:34 +00:00
clip - > tracking . act_track = newdataadr ( fd , clip - > tracking . act_track ) ;
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
clip - > tracking . act_plane_track = newdataadr ( fd , clip - > tracking . act_plane_track ) ;
2011-11-07 12:55:18 +00:00
2012-05-17 12:59:34 +00:00
clip - > anim = NULL ;
clip - > tracking_context = NULL ;
clip - > tracking . stats = NULL ;
2011-11-07 12:55:18 +00:00
2012-05-17 12:59:34 +00:00
clip - > tracking . stabilization . ok = 0 ;
clip - > tracking . stabilization . rot_track = newdataadr ( fd , clip - > tracking . stabilization . rot_track ) ;
2011-12-05 18:57:17 +00:00
2012-05-03 23:15:01 +00:00
clip - > tracking . dopesheet . ok = 0 ;
2014-02-08 06:07:10 +11:00
BLI_listbase_clear ( & clip - > tracking . dopesheet . channels ) ;
BLI_listbase_clear ( & clip - > tracking . dopesheet . coverage_segments ) ;
2012-05-03 23:15:01 +00:00
2011-12-05 18:57:17 +00:00
link_list ( fd , & tracking - > objects ) ;
2012-05-17 12:59:34 +00:00
2012-05-21 06:33:32 +00:00
for ( object = tracking - > objects . first ; object ; object = object - > next ) {
2011-12-05 18:57:17 +00:00
direct_link_movieTracks ( fd , & object - > tracks ) ;
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
direct_link_moviePlaneTracks ( fd , & object - > plane_tracks ) ;
2011-12-05 18:57:17 +00:00
direct_link_movieReconstruction ( fd , & object - > reconstruction ) ;
}
2011-11-07 12:55:18 +00:00
}
2012-06-10 15:26:50 +00:00
static void lib_link_movieTracks ( FileData * fd , MovieClip * clip , ListBase * tracksbase )
{
MovieTrackingTrack * track ;
for ( track = tracksbase - > first ; track ; track = track - > next ) {
track - > gpd = newlibadr_us ( fd , clip - > id . lib , track - > gpd ) ;
}
}
2013-11-29 23:26:57 +06:00
static void lib_link_moviePlaneTracks ( FileData * fd , MovieClip * clip , ListBase * tracksbase )
{
MovieTrackingPlaneTrack * plane_track ;
for ( plane_track = tracksbase - > first ; plane_track ; plane_track = plane_track - > next ) {
plane_track - > image = newlibadr_us ( fd , clip - > id . lib , plane_track - > image ) ;
}
}
2011-11-07 12:55:18 +00:00
static void lib_link_movieclip ( FileData * fd , Main * main )
{
MovieClip * clip ;
2012-05-21 06:33:32 +00:00
for ( clip = main - > movieclip . first ; clip ; clip = clip - > id . next ) {
2012-08-01 15:32:27 +00:00
if ( clip - > id . flag & LIB_NEED_LINK ) {
2012-06-10 15:26:50 +00:00
MovieTracking * tracking = & clip - > tracking ;
MovieTrackingObject * object ;
2012-02-17 08:13:45 +00:00
if ( clip - > adt )
lib_link_animdata ( fd , & clip - > id , clip - > adt ) ;
2012-05-17 12:59:34 +00:00
clip - > gpd = newlibadr_us ( fd , clip - > id . lib , clip - > gpd ) ;
2012-06-10 15:26:50 +00:00
lib_link_movieTracks ( fd , clip , & tracking - > tracks ) ;
2013-11-29 23:26:57 +06:00
lib_link_moviePlaneTracks ( fd , clip , & tracking - > plane_tracks ) ;
2012-06-10 15:26:50 +00:00
for ( object = tracking - > objects . first ; object ; object = object - > next ) {
lib_link_movieTracks ( fd , clip , & object - > tracks ) ;
}
2012-08-01 15:32:27 +00:00
clip - > id . flag - = LIB_NEED_LINK ;
2011-11-07 12:55:18 +00:00
}
}
}
2012-06-04 16:42:58 +00:00
/* ***************** READ MOVIECLIP *************** */
static void direct_link_mask ( FileData * fd , Mask * mask )
{
MaskLayer * masklay ;
mask - > adt = newdataadr ( fd , mask - > adt ) ;
link_list ( fd , & mask - > masklayers ) ;
for ( masklay = mask - > masklayers . first ; masklay ; masklay = masklay - > next ) {
MaskSpline * spline ;
MaskLayerShape * masklay_shape ;
link_list ( fd , & masklay - > splines ) ;
for ( spline = masklay - > splines . first ; spline ; spline = spline - > next ) {
int i ;
spline - > points = newdataadr ( fd , spline - > points ) ;
for ( i = 0 ; i < spline - > tot_point ; i + + ) {
MaskSplinePoint * point = & spline - > points [ i ] ;
if ( point - > tot_uw )
point - > uw = newdataadr ( fd , point - > uw ) ;
}
}
link_list ( fd , & masklay - > splines_shapes ) ;
for ( masklay_shape = masklay - > splines_shapes . first ; masklay_shape ; masklay_shape = masklay_shape - > next ) {
masklay_shape - > data = newdataadr ( fd , masklay_shape - > data ) ;
2012-09-23 18:50:56 +00:00
if ( masklay_shape - > tot_vert ) {
if ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
BLI_endian_switch_float_array ( masklay_shape - > data ,
masklay_shape - > tot_vert * sizeof ( float ) * MASK_OBJECT_SHAPE_ELEM_SIZE ) ;
}
}
2012-06-04 16:42:58 +00:00
}
masklay - > act_spline = newdataadr ( fd , masklay - > act_spline ) ;
masklay - > act_point = newdataadr ( fd , masklay - > act_point ) ;
}
}
static void lib_link_mask_parent ( FileData * fd , Mask * mask , MaskParent * parent )
{
parent - > id = newlibadr_us ( fd , mask - > id . lib , parent - > id ) ;
}
static void lib_link_mask ( FileData * fd , Main * main )
{
Mask * mask ;
mask = main - > mask . first ;
while ( mask ) {
2012-08-01 15:32:27 +00:00
if ( mask - > id . flag & LIB_NEED_LINK ) {
2012-06-04 16:42:58 +00:00
MaskLayer * masklay ;
if ( mask - > adt )
lib_link_animdata ( fd , & mask - > id , mask - > adt ) ;
for ( masklay = mask - > masklayers . first ; masklay ; masklay = masklay - > next ) {
MaskSpline * spline ;
spline = masklay - > splines . first ;
while ( spline ) {
int i ;
for ( i = 0 ; i < spline - > tot_point ; i + + ) {
MaskSplinePoint * point = & spline - > points [ i ] ;
lib_link_mask_parent ( fd , mask , & point - > parent ) ;
}
lib_link_mask_parent ( fd , mask , & spline - > parent ) ;
spline = spline - > next ;
}
}
2012-08-01 15:32:27 +00:00
mask - > id . flag - = LIB_NEED_LINK ;
2012-06-04 16:42:58 +00:00
}
mask = mask - > id . next ;
}
}
2010-06-25 22:45:42 +00:00
/* ************ READ LINE STYLE ***************** */
2010-07-24 20:37:54 +00:00
static void lib_link_linestyle ( FileData * fd , Main * main )
{
FreestyleLineStyle * linestyle ;
LineStyleModifier * m ;
2014-05-03 18:51:53 +09:00
MTex * mtex ;
int a ;
2010-07-24 20:37:54 +00:00
linestyle = main - > linestyle . first ;
while ( linestyle ) {
2012-08-02 00:10:05 +00:00
if ( linestyle - > id . flag & LIB_NEED_LINK ) {
linestyle - > id . flag - = LIB_NEED_LINK ;
2010-09-18 00:31:22 +00:00
2012-12-11 22:00:22 +00:00
if ( linestyle - > id . properties )
IDP_LibLinkProperty ( linestyle - > id . properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
if ( linestyle - > adt )
lib_link_animdata ( fd , & linestyle - > id , linestyle - > adt ) ;
2010-09-18 00:31:22 +00:00
for ( m = linestyle - > color_modifiers . first ; m ; m = m - > next ) {
2011-07-24 23:29:19 +00:00
switch ( m - > type ) {
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleColorModifier_DistanceFromObject * cm = ( LineStyleColorModifier_DistanceFromObject * ) m ;
cm - > target = newlibadr ( fd , linestyle - > id . lib , cm - > target ) ;
}
break ;
2010-09-18 00:31:22 +00:00
}
2010-07-24 20:37:54 +00:00
}
2013-04-08 04:39:09 +00:00
for ( m = linestyle - > alpha_modifiers . first ; m ; m = m - > next ) {
2011-07-24 23:29:19 +00:00
switch ( m - > type ) {
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleAlphaModifier_DistanceFromObject * am = ( LineStyleAlphaModifier_DistanceFromObject * ) m ;
am - > target = newlibadr ( fd , linestyle - > id . lib , am - > target ) ;
}
break ;
2010-09-18 00:31:22 +00:00
}
2010-07-24 20:37:54 +00:00
}
2013-04-08 04:39:09 +00:00
for ( m = linestyle - > thickness_modifiers . first ; m ; m = m - > next ) {
2011-07-24 23:29:19 +00:00
switch ( m - > type ) {
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleThicknessModifier_DistanceFromObject * tm = ( LineStyleThicknessModifier_DistanceFromObject * ) m ;
tm - > target = newlibadr ( fd , linestyle - > id . lib , tm - > target ) ;
}
break ;
2010-09-18 00:31:22 +00:00
}
2010-07-24 20:37:54 +00:00
}
2014-05-03 18:51:53 +09:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
mtex = linestyle - > mtex [ a ] ;
if ( mtex ) {
mtex - > tex = newlibadr_us ( fd , linestyle - > id . lib , mtex - > tex ) ;
mtex - > object = newlibadr ( fd , linestyle - > id . lib , mtex - > object ) ;
}
}
if ( linestyle - > nodetree ) {
lib_link_ntree ( fd , & linestyle - > id , linestyle - > nodetree ) ;
linestyle - > nodetree - > id . lib = linestyle - > id . lib ;
}
2010-07-24 20:37:54 +00:00
}
linestyle = linestyle - > id . next ;
}
}
static void direct_link_linestyle_color_modifier ( FileData * fd , LineStyleModifier * modifier )
2010-06-25 22:45:42 +00:00
{
2010-07-24 20:37:54 +00:00
switch ( modifier - > type ) {
case LS_MODIFIER_ALONG_STROKE :
{
LineStyleColorModifier_AlongStroke * m = ( LineStyleColorModifier_AlongStroke * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_CAMERA :
{
LineStyleColorModifier_DistanceFromCamera * m = ( LineStyleColorModifier_DistanceFromCamera * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleColorModifier_DistanceFromObject * m = ( LineStyleColorModifier_DistanceFromObject * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
2011-07-24 23:29:19 +00:00
case LS_MODIFIER_MATERIAL :
{
LineStyleColorModifier_Material * m = ( LineStyleColorModifier_Material * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
2015-07-10 21:57:23 +09:00
case LS_MODIFIER_TANGENT :
{
LineStyleColorModifier_Tangent * m = ( LineStyleColorModifier_Tangent * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
case LS_MODIFIER_NOISE :
{
LineStyleColorModifier_Noise * m = ( LineStyleColorModifier_Noise * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
case LS_MODIFIER_CREASE_ANGLE :
{
LineStyleColorModifier_CreaseAngle * m = ( LineStyleColorModifier_CreaseAngle * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
case LS_MODIFIER_CURVATURE_3D :
{
LineStyleColorModifier_Curvature_3D * m = ( LineStyleColorModifier_Curvature_3D * ) modifier ;
m - > color_ramp = newdataadr ( fd , m - > color_ramp ) ;
}
break ;
2010-07-24 20:37:54 +00:00
}
}
static void direct_link_linestyle_alpha_modifier ( FileData * fd , LineStyleModifier * modifier )
{
switch ( modifier - > type ) {
case LS_MODIFIER_ALONG_STROKE :
{
LineStyleAlphaModifier_AlongStroke * m = ( LineStyleAlphaModifier_AlongStroke * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_CAMERA :
{
LineStyleAlphaModifier_DistanceFromCamera * m = ( LineStyleAlphaModifier_DistanceFromCamera * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleAlphaModifier_DistanceFromObject * m = ( LineStyleAlphaModifier_DistanceFromObject * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2011-07-24 23:29:19 +00:00
case LS_MODIFIER_MATERIAL :
{
LineStyleAlphaModifier_Material * m = ( LineStyleAlphaModifier_Material * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2015-07-10 21:57:23 +09:00
case LS_MODIFIER_TANGENT :
{
LineStyleAlphaModifier_Tangent * m = ( LineStyleAlphaModifier_Tangent * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_NOISE :
{
LineStyleAlphaModifier_Noise * m = ( LineStyleAlphaModifier_Noise * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_CREASE_ANGLE :
{
LineStyleAlphaModifier_CreaseAngle * m = ( LineStyleAlphaModifier_CreaseAngle * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_CURVATURE_3D :
{
LineStyleAlphaModifier_Curvature_3D * m = ( LineStyleAlphaModifier_Curvature_3D * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2010-07-24 20:37:54 +00:00
}
}
2010-06-25 22:45:42 +00:00
2010-07-24 20:37:54 +00:00
static void direct_link_linestyle_thickness_modifier ( FileData * fd , LineStyleModifier * modifier )
{
switch ( modifier - > type ) {
case LS_MODIFIER_ALONG_STROKE :
{
LineStyleThicknessModifier_AlongStroke * m = ( LineStyleThicknessModifier_AlongStroke * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_CAMERA :
{
LineStyleThicknessModifier_DistanceFromCamera * m = ( LineStyleThicknessModifier_DistanceFromCamera * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_DISTANCE_FROM_OBJECT :
{
LineStyleThicknessModifier_DistanceFromObject * m = ( LineStyleThicknessModifier_DistanceFromObject * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2011-07-24 23:29:19 +00:00
case LS_MODIFIER_MATERIAL :
{
LineStyleThicknessModifier_Material * m = ( LineStyleThicknessModifier_Material * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2015-07-10 21:57:23 +09:00
case LS_MODIFIER_TANGENT :
{
LineStyleThicknessModifier_Tangent * m = ( LineStyleThicknessModifier_Tangent * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_CREASE_ANGLE :
{
LineStyleThicknessModifier_CreaseAngle * m = ( LineStyleThicknessModifier_CreaseAngle * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
case LS_MODIFIER_CURVATURE_3D :
{
LineStyleThicknessModifier_Curvature_3D * m = ( LineStyleThicknessModifier_Curvature_3D * ) modifier ;
m - > curve = newdataadr ( fd , m - > curve ) ;
direct_link_curvemapping ( fd , m - > curve ) ;
}
break ;
2010-07-24 20:37:54 +00:00
}
2010-06-25 22:45:42 +00:00
}
2012-12-08 22:24:41 +00:00
static void direct_link_linestyle_geometry_modifier ( FileData * UNUSED ( fd ) , LineStyleModifier * UNUSED ( modifier ) )
2011-08-19 14:05:11 +00:00
{
}
2010-07-24 20:37:54 +00:00
static void direct_link_linestyle ( FileData * fd , FreestyleLineStyle * linestyle )
{
2014-05-03 18:51:53 +09:00
int a ;
2010-07-24 20:37:54 +00:00
LineStyleModifier * modifier ;
2010-09-18 00:31:22 +00:00
linestyle - > adt = newdataadr ( fd , linestyle - > adt ) ;
direct_link_animdata ( fd , linestyle - > adt ) ;
2010-07-24 20:37:54 +00:00
link_list ( fd , & linestyle - > color_modifiers ) ;
2013-08-19 01:48:44 +00:00
for ( modifier = linestyle - > color_modifiers . first ; modifier ; modifier = modifier - > next )
2010-07-24 20:37:54 +00:00
direct_link_linestyle_color_modifier ( fd , modifier ) ;
link_list ( fd , & linestyle - > alpha_modifiers ) ;
2013-08-19 01:48:44 +00:00
for ( modifier = linestyle - > alpha_modifiers . first ; modifier ; modifier = modifier - > next )
2010-07-24 20:37:54 +00:00
direct_link_linestyle_alpha_modifier ( fd , modifier ) ;
link_list ( fd , & linestyle - > thickness_modifiers ) ;
2013-08-19 01:48:44 +00:00
for ( modifier = linestyle - > thickness_modifiers . first ; modifier ; modifier = modifier - > next )
2010-07-24 20:37:54 +00:00
direct_link_linestyle_thickness_modifier ( fd , modifier ) ;
2011-08-19 14:05:11 +00:00
link_list ( fd , & linestyle - > geometry_modifiers ) ;
2013-08-19 01:48:44 +00:00
for ( modifier = linestyle - > geometry_modifiers . first ; modifier ; modifier = modifier - > next )
2011-08-19 14:05:11 +00:00
direct_link_linestyle_geometry_modifier ( fd , modifier ) ;
2014-05-03 18:51:53 +09:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
linestyle - > mtex [ a ] = newdataadr ( fd , linestyle - > mtex [ a ] ) ;
}
linestyle - > nodetree = newdataadr ( fd , linestyle - > nodetree ) ;
if ( linestyle - > nodetree ) {
direct_link_id ( fd , & linestyle - > nodetree - > id ) ;
direct_link_nodetree ( fd , linestyle - > nodetree ) ;
}
2010-07-24 20:37:54 +00:00
}
2010-06-25 22:45:42 +00:00
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
2010-12-03 17:05:21 +00:00
static const char * dataname ( short id_code )
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
{
2012-05-21 06:33:32 +00:00
switch ( id_code ) {
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_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 " ;
2011-08-01 11:44:20 +00:00
case ID_SPK : return " Data from SPK " ;
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_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 " ;
2014-07-21 12:02:05 +02:00
case ID_PAL : return " Data from PAL " ;
case ID_PC : return " Data from PCRV " ;
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 " ;
2013-09-11 04:14:27 +00:00
case ID_WM : return " Data from WM " ;
2011-11-07 12:55:18 +00:00
case ID_MC : return " Data from MC " ;
2013-09-11 04:14:27 +00:00
case ID_MSK : return " Data from MSK " ;
2010-06-25 22:45:42 +00:00
case ID_LS : return " Data from LS " ;
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 " ;
}
2010-12-03 17:05:21 +00:00
static BHead * read_data_into_oldnewmap ( FileData * fd , BHead * bhead , const char * allocname )
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
{
bhead = blo_nextbhead ( fd , bhead ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 07:52:14 +00:00
while ( bhead & & bhead - > code = = DATA ) {
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
void * data ;
2010-02-13 13:38:10 +00:00
#if 0
2011-06-09 13:46:34 +00:00
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
2012-05-17 12:59:34 +00:00
short * sp = fd - > filesdna - > structs [ bhead - > SDNAnr ] ;
char * tmp = malloc ( 100 ) ;
2011-06-09 13:46:34 +00:00
allocname = fd - > filesdna - > types [ sp [ 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
strcpy ( tmp , allocname ) ;
2012-05-17 12:59:34 +00:00
data = read_struct ( fd , bhead , tmp ) ;
2010-02-13 13:38:10 +00:00
# else
2012-05-17 12:59:34 +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 ) ;
}
2012-05-17 12:59:34 +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
bhead = blo_nextbhead ( fd , bhead ) ;
}
2012-05-17 12:59:34 +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
return bhead ;
}
2014-03-16 03:24:05 +11:00
static BHead * read_libblock ( FileData * fd , Main * main , BHead * bhead , int flag , ID * * r_id )
2002-10-12 11:37:38 +00:00
{
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02: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
*/
ID * id ;
ListBase * lb ;
2010-12-03 17:05:21 +00:00
const char * allocname ;
2013-05-06 11:38:21 +00:00
bool wrong_id = false ;
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
/* In undo case, most libs and linked data should be kept as is from previous state (see BLO_read_from_memfile).
* However , some needed by the snapshot being read may have been removed in previous one , and would go missing .
* This leads e . g . to desappearing objects in some undo / redo case , see T34446 .
* That means we have to carefully check whether current lib or libdata already exits in old main , if it does
* we merely copy it over into new main area , otherwise we have to do a full read of that bhead . . . */
if ( fd - > memfile & & ELEM ( bhead - > code , ID_LI , ID_ID ) ) {
const char * idname = bhead_id_name ( fd , bhead ) ;
/* printf("Checking %s...\n", idname); */
if ( bhead - > code = = ID_LI ) {
Main * libmain = fd - > old_mainlist - > first ;
/* Skip oldmain itself... */
for ( libmain = libmain - > next ; libmain ; libmain = libmain - > next ) {
/* printf("... against %s: ", libmain->curlib ? libmain->curlib->id.name : "<NULL>"); */
if ( libmain - > curlib & & STREQ ( idname , libmain - > curlib - > id . name ) ) {
Main * oldmain = fd - > old_mainlist - > first ;
/* printf("FOUND!\n"); */
/* In case of a library, we need to re-add its main to fd->mainlist, because if we have later
* a missing ID_ID , we need to get the correct lib it is linked to !
* Order is crucial , we cannot bulk - add it in BLO_read_from_memfile ( ) like it used to be . . . */
BLI_remlink ( fd - > old_mainlist , libmain ) ;
BLI_remlink_safe ( & oldmain - > library , libmain - > curlib ) ;
BLI_addtail ( fd - > mainlist , libmain ) ;
BLI_addtail ( & main - > library , libmain - > curlib ) ;
if ( r_id ) {
* r_id = NULL ; /* Just in case... */
}
return blo_nextbhead ( fd , bhead ) ;
}
/* printf("nothing...\n"); */
}
}
else {
/* printf("... in %s (%s): ", main->curlib ? main->curlib->id.name : "<NULL>", main->curlib ? main->curlib->name : "<NULL>"); */
if ( ( id = BKE_libblock_find_name_ex ( main , GS ( idname ) , idname + 2 ) ) ) {
/* printf("FOUND!\n"); */
/* Even though we found our linked ID, there is no guarantee its address is still the same... */
if ( id ! = bhead - > old ) {
oldnewmap_insert ( fd - > libmap , bhead - > old , id , GS ( id - > name ) ) ;
}
/* No need to do anything else for ID_ID, it's assumed already present in its lib's main... */
if ( r_id ) {
* r_id = NULL ; /* Just in case... */
}
return blo_nextbhead ( fd , bhead ) ;
}
/* printf("nothing...\n"); */
}
}
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 " ) ;
2014-03-16 03:24:05 +11:00
if ( r_id )
* r_id = id ;
2002-10-12 11:37:38 +00:00
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 */
2012-05-17 12:59:34 +00:00
if ( bhead - > code = = ID_ID ) {
lb = which_libbase ( main , GS ( id - > name ) ) ;
2007-04-28 16:15:00 +00:00
}
else {
2012-05-17 12:59:34 +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 ) ;
2012-05-17 12:59:34 +00:00
2003-04-26 18:01:01 +00:00
/* clear first 8 bits */
2012-08-01 15:32:27 +00:00
id - > flag = ( id - > flag & 0xFF00 ) | flag | LIB_NEED_LINK ;
2012-05-17 12:59:34 +00:00
id - > lib = main - > curlib ;
2012-03-24 06:18:31 +00:00
if ( id - > flag & LIB_FAKEUSER ) id - > us = 1 ;
2012-05-17 12:59:34 +00:00
else id - > us = 0 ;
2005-12-21 22:21:43 +00:00
id - > icon_id = 0 ;
2013-09-03 17:24:07 +00:00
id - > flag & = ~ ( LIB_ID_RECALC | LIB_ID_RECALC_DATA | LIB_DOIT ) ;
2012-05-17 12:59:34 +00:00
2003-04-26 18:01:01 +00:00
/* this case cannot be direct_linked: it's just the ID part */
2012-05-17 12:59:34 +00:00
if ( bhead - > code = = ID_ID ) {
2002-10-12 11:37:38 +00:00
return blo_nextbhead ( fd , bhead ) ;
}
2012-05-17 12:59:34 +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 */
2012-05-17 12:59:34 +00:00
allocname = dataname ( GS ( id - > name ) ) ;
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
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 */
2012-05-17 12:59:34 +00:00
bhead = read_data_into_oldnewmap ( fd , bhead , allocname ) ;
2003-04-26 18:01:01 +00:00
/* init pointers direct data */
2012-10-23 12:38:47 +00:00
direct_link_id ( fd , id ) ;
2012-04-28 06:31:57 +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 :
2013-05-06 11:23:13 +00:00
wrong_id = direct_link_screen ( fd , ( bScreen * ) id ) ;
2002-10-12 11:37:38 +00:00
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 ;
2011-08-01 11:44:20 +00:00
case ID_SPK :
direct_link_speaker ( fd , ( Speaker * ) id ) ;
break ;
2002-10-12 11:37:38 +00:00
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 ;
2011-11-07 12:55:18 +00:00
case ID_MC :
direct_link_movieclip ( fd , ( MovieClip * ) id ) ;
break ;
2012-06-04 16:42:58 +00:00
case ID_MSK :
direct_link_mask ( fd , ( Mask * ) id ) ;
break ;
2010-06-25 22:45:42 +00:00
case ID_LS :
direct_link_linestyle ( fd , ( FreestyleLineStyle * ) id ) ;
break ;
2014-07-21 12:02:05 +02:00
case ID_PAL :
direct_link_palette ( fd , ( Palette * ) id ) ;
break ;
case ID_PC :
direct_link_paint_curve ( fd , ( PaintCurve * ) id ) ;
break ;
2002-10-12 11:37:38 +00:00
}
2006-11-17 06:14:15 +00:00
2002-10-12 11:37:38 +00:00
oldnewmap_free_unused ( fd - > datamap ) ;
oldnewmap_clear ( fd - > datamap ) ;
2012-05-17 12:59:34 +00:00
2013-05-06 11:23:13 +00:00
if ( wrong_id ) {
2014-01-15 16:37:03 +01:00
BKE_libblock_free ( main , id ) ;
2013-05-06 11:23:13 +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
{
2012-05-17 12:59:34 +00:00
FileGlobal * fg = read_struct ( fd , bhead , " Global " ) ;
2007-12-24 18:53:37 +00:00
/* copy to bfd handle */
2012-05-17 12:59:34 +00:00
bfd - > main - > subversionfile = fg - > subversion ;
bfd - > main - > minversionfile = fg - > minversion ;
bfd - > main - > minsubversionfile = fg - > minsubversion ;
2013-11-15 17:11:59 +06:00
bfd - > main - > build_commit_timestamp = fg - > build_commit_timestamp ;
2013-11-04 13:21:39 +00:00
BLI_strncpy ( bfd - > main - > build_hash , fg - > build_hash , sizeof ( bfd - > main - > build_hash ) ) ;
2012-05-17 12:59:34 +00:00
bfd - > fileflags = fg - > fileflags ;
bfd - > globalf = fg - > globalf ;
2009-10-20 13:58:53 +00:00
BLI_strncpy ( bfd - > filename , fg - > filename , sizeof ( bfd - > filename ) ) ;
2011-01-02 13:33:32 +00:00
2012-12-19 16:45:47 +00:00
/* error in 2.65 and older: main->name was not set if you save from startup (not after loading file) */
if ( bfd - > filename [ 0 ] = = 0 ) {
if ( fd - > fileversion < 265 | | ( fd - > fileversion = = 265 & & fg - > subversion < 1 ) )
if ( ( G . fileflags & G_FILE_RECOVER ) = = 0 )
BLI_strncpy ( bfd - > filename , bfd - > main - > name , sizeof ( bfd - > filename ) ) ;
/* early 2.50 version patch - filename not in FileGlobal struct at all */
if ( fd - > fileversion < = 250 )
BLI_strncpy ( bfd - > filename , bfd - > main - > name , sizeof ( bfd - > filename ) ) ;
}
2012-12-17 12:35:39 +00:00
2012-03-24 06:18:31 +00:00
if ( G . fileflags & G_FILE_RECOVER )
2009-10-20 16:43:25 +00:00
BLI_strncpy ( fd - > relabase , fg - > filename , sizeof ( fd - > relabase ) ) ;
2006-11-26 21:17:15 +00:00
2012-05-17 12:59:34 +00:00
bfd - > curscreen = fg - > curscreen ;
bfd - > curscene = fg - > curscene ;
2007-12-24 18:53:37 +00:00
MEM_freeN ( fg ) ;
2012-05-17 12:59:34 +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 )
{
2012-05-17 12:59:34 +00:00
bfd - > curscreen = newlibadr ( fd , NULL , bfd - > curscreen ) ;
bfd - > curscene = newlibadr ( fd , NULL , bfd - > curscene ) ;
2004-09-05 13:43:51 +00:00
// this happens in files older than 2.35
2012-05-17 12:59:34 +00:00
if ( bfd - > curscene = = NULL ) {
if ( bfd - > curscreen ) bfd - > curscene = bfd - > curscreen - > scene ;
2004-09-05 13:43:51 +00:00
}
2002-10-12 11:37:38 +00:00
}
2013-08-07 03:44:05 +00:00
static void convert_tface_mt ( FileData * fd , Main * main )
2002-10-12 11:37:38 +00:00
{
2012-05-04 15:42:49 +00:00
Main * gmain ;
2012-05-17 12:59:34 +00:00
2012-05-04 15:42:49 +00:00
/* this is a delayed do_version (so it can create new materials) */
if ( main - > versionfile < 259 | | ( main - > versionfile = = 259 & & main - > subversionfile < 3 ) ) {
//XXX hack, material.c uses G.main all over the place, instead of main
// temporarily set G.main to the current main
gmain = G . main ;
G . main = main ;
2012-05-17 12:59:34 +00:00
2013-12-14 10:48:12 +01:00
if ( ! ( do_version_tface ( main ) ) ) {
2012-10-19 16:43:10 +00:00
BKE_report ( fd - > reports , RPT_WARNING , " Texface conversion problem (see error in console) " ) ;
2012-05-04 15:42:49 +00:00
}
2012-05-17 12:59:34 +00:00
2012-05-04 15:42:49 +00:00
//XXX hack, material.c uses G.main allover the place, instead of main
G . main = gmain ;
2002-10-12 11:37:38 +00:00
}
}
2013-03-17 14:38:58 +00:00
/* initialize userdef with non-UI dependency stuff */
/* other initializers (such as theme color defaults) go to resources.c */
2013-12-03 03:14:09 -02:00
static void do_versions_userdef ( FileData * fd , BlendFileData * bfd )
2013-03-17 14:38:58 +00:00
{
Main * bmain = bfd - > main ;
UserDef * user = bfd - > user ;
if ( user = = NULL ) return ;
2013-03-24 12:13:13 +00:00
if ( MAIN_VERSION_OLDER ( bmain , 266 , 4 ) ) {
bTheme * btheme ;
/* themes for Node and Sequence editor were not using grid color, but back. we copy this over then */
for ( btheme = user - > themes . first ; btheme ; btheme = btheme - > next ) {
copy_v4_v4_char ( btheme - > tnode . grid , btheme - > tnode . back ) ;
copy_v4_v4_char ( btheme - > tseq . grid , btheme - > tseq . back ) ;
}
}
2013-12-03 03:14:09 -02:00
if ( ! DNA_struct_elem_find ( fd - > filesdna , " UserDef " , " WalkNavigation " , " walk_navigation " ) ) {
user - > walk_navigation . mouse_speed = 1.0f ;
user - > walk_navigation . walk_speed = 2.5f ; /* m/s */
user - > walk_navigation . walk_speed_factor = 5.0f ;
user - > walk_navigation . view_height = 1.6f ; /* m */
user - > walk_navigation . jump_height = 0.4f ; /* m */
user - > walk_navigation . teleport_time = 0.2f ; /* s */
}
2013-03-17 14:38:58 +00:00
}
2013-04-12 10:52:47 +00:00
2012-05-04 15:42:49 +00:00
static void do_versions ( FileData * fd , Library * lib , Main * main )
2010-05-01 12:39:06 +00:00
{
2012-05-04 15:42:49 +00:00
/* WATCH IT!!!: pointers from libdata have not been converted */
2012-05-17 12:59:34 +00:00
2013-11-04 13:21:39 +00:00
if ( G . debug & G_DEBUG ) {
2013-11-15 17:11:59 +06:00
char build_commit_datetime [ 32 ] ;
time_t temp_time = main - > build_commit_timestamp ;
2015-05-01 15:52:53 +02:00
struct tm * tm = ( temp_time ) ? gmtime ( & temp_time ) : NULL ;
2013-11-18 02:39:26 +11:00
if ( LIKELY ( tm ) ) {
strftime ( build_commit_datetime , sizeof ( build_commit_datetime ) , " %Y-%m-%d %H:%M " , tm ) ;
}
else {
2015-05-01 15:52:53 +02:00
BLI_strncpy ( build_commit_datetime , " unknown " , sizeof ( build_commit_datetime ) ) ;
2013-11-18 02:39:26 +11:00
}
2013-11-15 17:11:59 +06:00
printf ( " read file %s \n Version %d sub %d date %s hash %s \n " ,
2013-11-04 13:21:39 +00:00
fd - > relabase , main - > versionfile , main - > subversionfile ,
2013-11-15 17:11:59 +06:00
build_commit_datetime , main - > build_hash ) ;
2013-11-04 13:21:39 +00:00
}
2012-05-17 12:59:34 +00:00
2012-05-04 15:42:49 +00:00
blo_do_versions_pre250 ( fd , lib , main ) ;
blo_do_versions_250 ( fd , lib , main ) ;
2013-11-29 23:16:13 +06:00
blo_do_versions_260 ( fd , lib , main ) ;
2014-03-06 04:33:15 +11:00
blo_do_versions_270 ( fd , lib , main ) ;
2013-11-04 19:21:50 +00:00
2005-07-26 18:46:28 +00:00
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
2013-03-17 14:38:58 +00:00
/* WATCH IT 2!: Userdef struct init see do_versions_userdef() above! */
2012-06-04 16:42:58 +00:00
2013-10-08 17:15:49 +00:00
/* don't forget to set version number in BKE_blender.h! */
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 */
2012-03-24 06:18:31 +00:00
if ( main - > versionfile < 250 )
2010-06-19 10:50:23 +00:00
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 ) ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/* No load UI for undo memfiles */
if ( fd - > memfile = = NULL ) {
2013-03-26 09:59:43 +00:00
lib_link_windowmanager ( fd , main ) ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
}
2014-08-12 16:02:44 +02:00
/* DO NOT skip screens here, 3Dview may contains pointers to other ID data (like bgpic)! See T41411. */
lib_link_screen ( fd , main ) ;
2002-10-12 11:37:38 +00:00
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 ) ;
2012-09-26 20:05:38 +00:00
lib_link_ipo ( fd , main ) ; // XXX deprecated... 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 ) ;
2011-08-01 11:44:20 +00:00
lib_link_speaker ( fd , main ) ;
2002-10-12 11:37:38 +00:00
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 ) ;
2014-07-21 12:02:05 +02:00
lib_link_palette ( fd , main ) ;
lib_link_paint_curve ( 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 ) ;
2011-11-07 12:55:18 +00:00
lib_link_movieclip ( fd , main ) ;
2012-06-04 16:42:58 +00:00
lib_link_mask ( fd , main ) ;
2010-07-24 20:37:54 +00:00
lib_link_linestyle ( fd , main ) ;
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
lib_link_gpencil ( fd , main ) ;
2012-06-04 16:42:58 +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 */
2012-05-17 12:59:34 +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
}
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
static void direct_link_keymapitem ( FileData * fd , wmKeyMapItem * kmi )
{
2012-05-17 12:59:34 +00:00
kmi - > properties = newdataadr ( fd , kmi - > properties ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & kmi - > properties , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2012-05-17 12:59:34 +00:00
kmi - > ptr = NULL ;
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
kmi - > flag & = ~ KMI_UPDATE ;
}
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 ;
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
wmKeyMapDiffItem * kmdi ;
2012-12-29 10:24:42 +00:00
bAddon * addon ;
2012-05-17 12:59:34 +00:00
bfd - > user = user = read_struct ( fd , bhead , " user def " ) ;
2013-02-13 16:52:14 +00:00
/* User struct has separate do-version handling */
user - > versionfile = bfd - > main - > versionfile ;
user - > subversionfile = bfd - > main - > subversionfile ;
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 */
2012-05-17 12:59:34 +00:00
bhead = read_data_into_oldnewmap ( fd , bhead , " user def " ) ;
2012-03-24 06:18:31 +00:00
if ( user - > keymaps . first ) {
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
/* backwards compatibility */
user - > user_keymaps = user - > keymaps ;
user - > keymaps . first = user - > keymaps . last = NULL ;
}
2012-05-17 12:59:34 +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 ) ;
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
link_list ( fd , & user - > user_keymaps ) ;
2010-02-26 14:28:29 +00:00
link_list ( fd , & user - > addons ) ;
2013-06-18 18:11:52 +00:00
link_list ( fd , & user - > autoexec_paths ) ;
2015-04-06 10:40:12 -03:00
2012-03-24 06:18:31 +00:00
for ( keymap = user - > user_keymaps . first ; keymap ; keymap = keymap - > next ) {
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
keymap - > modal_items = NULL ;
2012-03-24 02:51:46 +00:00
keymap - > poll = NULL ;
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
keymap - > flag & = ~ KEYMAP_UPDATE ;
2012-05-17 12:59:34 +00:00
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
link_list ( fd , & keymap - > diff_items ) ;
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 , & keymap - > items ) ;
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
2012-03-24 06:18:31 +00:00
for ( kmdi = keymap - > diff_items . first ; kmdi ; kmdi = kmdi - > next ) {
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
kmdi - > remove_item = newdataadr ( fd , kmdi - > remove_item ) ;
kmdi - > add_item = newdataadr ( fd , kmdi - > add_item ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( kmdi - > remove_item )
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
direct_link_keymapitem ( fd , kmdi - > remove_item ) ;
2012-03-24 06:18:31 +00:00
if ( kmdi - > add_item )
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
direct_link_keymapitem ( fd , kmdi - > add_item ) ;
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
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
for ( kmi = keymap - > items . first ; kmi ; kmi = kmi - > next )
KEYMAP REFACTORING
Diff Keymaps
User edited keymaps now no longer override the builtin keymaps entirely, but
rather save only the difference and reapply those changes. This means they can
stay better in sync when the builtin keymaps change. The diff/patch algorithm
is not perfect, but better for the common case where only a few items are changed
rather than entire keymaps The main weakness is that if a builtin keymap item
changes, user modification of that item may need to be redone in some cases.
Keymap Editor
The most noticeable change here is that there is no longer an "Edit" button for
keymaps, all are editable immediately, but a "Restore" buttons shows for keymaps
and items that have been edited. Shortcuts for addons can also be edited in the
keymap editor.
Addons
Addons now should only modify the new addon keyconfiguration, the keymap items
there will be added to the builtin ones for handling events, and not get lost
when starting new files. Example code of register/unregister:
km = wm.keyconfigs.addon.keymaps.new("3D View", space_type="VIEW_3D")
km.keymap_items.new('my.operator', 'ESC', 'PRESS')
km = wm.keyconfigs.addon.keymaps["3D View"]
km.keymap_items.remove(km.keymap_items["my.operator"])
Compatibility
The changes made are not forward compatible, i.e. if you save user preferences
with newer versions, older versions will not have key configuration changes that
were made.
2011-08-05 20:45:26 +00:00
direct_link_keymapitem ( fd , kmi ) ;
- 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
}
2013-03-26 09:59:43 +00:00
2012-12-29 10:24:42 +00:00
for ( addon = user - > addons . first ; addon ; addon = addon - > next ) {
addon - > prop = newdataadr ( fd , addon - > prop ) ;
2013-09-30 13:44:16 +00:00
IDP_DirectLinkGroup_OrFree ( & addon - > prop , ( fd - > flags & FD_FLAGS_SWITCH_ENDIAN ) , fd ) ;
2012-12-29 10:24:42 +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
2012-05-17 12:59:34 +00:00
user - > uifonts . first = user - > uifonts . last = NULL ;
2011-06-24 14:00:15 +00:00
link_list ( fd , & user - > uistyles ) ;
2012-05-17 12:59:34 +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
/* free fd->datamap again */
oldnewmap_free_unused ( fd - > datamap ) ;
oldnewmap_clear ( fd - > datamap ) ;
2012-05-17 12:59:34 +00:00
- The basic layer for Themes in place!
- currently only implemented for 3d window
- create as many themes you like, and name them
- default theme is not editable, and always will be defined at startup
(initTheme)
- saves in .B.blend
- themes for spaces can become local too, so you can set individual
3d windows at theme 'Maya' or so. (to be implemented)
- it uses alpha as well...!
API:
This doesnt use the old method with BFCOLORID blahblah. The API is copied
from OpenGL conventions (naming) as much as possible:
- void BIF_ThemeColor(ScrArea *sa, int colorid)
sets a color... id's are in BIF_resources.h (TH_GRID, TH_WIRE, etc)
- void BIF_ThemeColorShade(ScrArea *sa, int colorid, int offset)
sets a color with offset, no more weird COLORSHADE_LGREY stuff
- void BIF_GetThemeColor3fv(ScrArea *sa, int colorid, float *col)
like opengl, this gives you in *col the three rgb values
- void BIF_GetThemeColor4ubv(ScrArea *sa, int colorid, char *col)
or the one to get 4 bytes
ThemeColor calls for globals (UI etc) can also call NULL for *sa... this
is to be implemented still.
Next step: cleaning up interface.c for all weird colorcalls.
2003-10-17 14:02:08 +00:00
return bhead ;
}
2011-05-18 06:27:32 +00:00
BlendFileData * blo_read_file_internal ( FileData * fd , const char * filepath )
2002-10-12 11:37:38 +00:00
{
2012-05-17 12:59:34 +00:00
BHead * bhead = blo_firstbhead ( fd ) ;
2002-10-12 11:37:38 +00:00
BlendFileData * bfd ;
2012-05-25 17:13:30 +00:00
ListBase mainlist = { NULL , NULL } ;
2012-05-17 12:59:34 +00:00
bfd = MEM_callocN ( sizeof ( BlendFileData ) , " blendfiledata " ) ;
2013-12-26 17:24:42 +06:00
bfd - > main = BKE_main_new ( ) ;
2012-05-25 17:13:30 +00:00
BLI_addtail ( & mainlist , bfd - > main ) ;
fd - > mainlist = & mainlist ;
2006-11-30 21:40:11 +00:00
2012-05-17 12:59:34 +00:00
bfd - > main - > versionfile = fd - > fileversion ;
bfd - > type = BLENFILETYPE_BLEND ;
2011-09-26 18:51:10 +00:00
BLI_strncpy ( bfd - > main - > name , filepath , sizeof ( bfd - > main - > name ) ) ;
2009-08-27 09:52:41 +00:00
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.
Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.
Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.
This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.
Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.
Reviewers: sergey, campbellbarton
Subscribers: Severin, psy-fi
Differential Revision: https://developer.blender.org/D1469
2015-08-27 15:53:23 +02:00
if ( G . background ) {
/* We only read & store .blend thumbnail in background mode
* ( because we cannot re - generate it , no OpenGL available ) .
*/
const int * data = read_file_thumbnail ( fd ) ;
if ( data ) {
const size_t sz = BLEN_THUMB_MEMSIZE ( data [ 0 ] , data [ 1 ] ) ;
bfd - > main - > blen_thumb = MEM_mallocN ( sz , __func__ ) ;
BLI_assert ( ( sz - sizeof ( * bfd - > main - > blen_thumb ) ) = =
( BLEN_THUMB_MEMSIZE_FILE ( data [ 0 ] , data [ 1 ] ) - ( sizeof ( * data ) * 2 ) ) ) ;
bfd - > main - > blen_thumb - > width = data [ 0 ] ;
bfd - > main - > blen_thumb - > height = data [ 1 ] ;
memcpy ( bfd - > main - > blen_thumb - > rect , & data [ 2 ] , sz - sizeof ( * bfd - > main - > blen_thumb ) ) ;
}
}
2012-03-24 07:52:14 +00:00
while ( bhead ) {
2012-04-28 06:31:57 +00:00
switch ( bhead - > code ) {
2002-10-12 11:37:38 +00:00
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 :
2012-05-17 12:59:34 +00:00
bhead = read_global ( bfd , fd , bhead ) ;
2007-12-24 18:53:37 +00:00
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 :
2012-05-17 12:59:34 +00:00
bhead = read_userdef ( bfd , fd , bhead ) ;
- 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
break ;
2002-10-12 11:37:38 +00:00
case ENDB :
bhead = NULL ;
break ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
case ID_ID :
Fix T34446: Make Local on linked mesh object: object gets removed if redo function is used.
Root of the issue is that we do not re-read lib data blocks and ID placholders (ID_ID bheads)
in undo context (in `blo_read_file_internal`), because `BLO_read_from_memfile` copies
lib datablocks and Main data directly from oldmain.
The idea being, linked data do not change from undo/redo.
This is valid as long as linked data was not changed by the undo step - but if some
was deleted or localized, it will be missing from oldmain, leading to data loss
(note that does not only concern objects, all linkable data types can be affected,
at least in theory).
This commit addresses that issue by carefully mixing reuse of needed data from oldmain,
and "normal" re-reading of missing one. Makes us swimming in some rather dark waters,
and gives a rather non-easy-to-follow code, but it seems to work quite well,
and only other solution would be to get rid of that optimization
(not re-reading all libs on undo/redo), which is not acceptable.
Also, thanks to @carlosdp for initial investigation of the issue.
Differential Revision: https://developer.blender.org/D1485
2015-10-12 12:15:05 +02:00
/* Always adds to the most recently loaded ID_LI block, see direct_link_library.
* This is part of the file format definition . */
bhead = read_libblock ( fd , 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 :
2012-05-17 12:59:34 +00:00
bhead - > code = ID_SCR ;
2008-11-27 16:00:59 +00:00
/* deliberate pass on to default */
2002-10-12 11:37:38 +00:00
default :
bhead = read_libblock ( fd , bfd - > main , bhead , LIB_LOCAL , NULL ) ;
}
}
2012-05-17 12:59:34 +00:00
2006-11-25 13:07:28 +00:00
/* do before read_libraries, but skip undo case */
2015-08-28 14:06:01 +02:00
if ( fd - > memfile = = NULL ) {
2006-11-25 13:07:28 +00:00
do_versions ( fd , NULL , bfd - > main ) ;
2015-08-28 14:06:01 +02:00
do_versions_userdef ( fd , bfd ) ;
}
2013-03-17 14:38:58 +00:00
2012-05-25 17:13:30 +00:00
read_libraries ( fd , & mainlist ) ;
2006-12-01 10:12:41 +00:00
2012-05-25 17:13:30 +00:00
blo_join_main ( & mainlist ) ;
2012-05-17 12:59:34 +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)
2014-04-01 11:34:00 +11: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
2015-08-29 16:47:32 +02:00
fd - > mainlist = NULL ; /* Safety, this is local variable, shall not be used afterward. */
2002-10-12 11:37:38 +00:00
return bfd ;
}
/* ************* APPEND LIBRARY ************** */
2012-08-04 19:34:38 +00:00
struct BHeadSort {
2008-01-30 18:18:33 +00:00
BHead * bhead ;
void * old ;
} ;
static int verg_bheadsort ( const void * v1 , const void * v2 )
{
2012-08-04 19:34:38 +00:00
const struct BHeadSort * x1 = v1 , * x2 = v2 ;
2008-01-30 18:18:33 +00:00
2012-05-17 12:59:34 +00:00
if ( x1 - > old > x2 - > old ) return 1 ;
else if ( x1 - > old < x2 - > old ) return - 1 ;
2008-01-30 18:18:33 +00:00
return 0 ;
}
static void sort_bhead_old_map ( FileData * fd )
{
BHead * bhead ;
2012-08-04 19:34:38 +00:00
struct BHeadSort * bhs ;
2012-05-17 12:59:34 +00:00
int tot = 0 ;
2008-01-30 18:18:33 +00:00
2012-05-17 12:59:34 +00:00
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) )
2008-01-30 18:18:33 +00:00
tot + + ;
2012-05-17 12:59:34 +00:00
fd - > tot_bheadmap = tot ;
if ( tot = = 0 ) return ;
2008-01-30 18:18:33 +00:00
2013-02-05 09:42:40 +00:00
bhs = fd - > bheadmap = MEM_mallocN ( tot * sizeof ( struct BHeadSort ) , " BHeadSort " ) ;
2008-01-30 18:18:33 +00:00
2012-05-17 12:59:34 +00:00
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) , bhs + + ) {
bhs - > bhead = bhead ;
bhs - > old = bhead - > old ;
2008-01-30 18:18:33 +00:00
}
2012-08-04 19:34:38 +00:00
qsort ( fd - > bheadmap , tot , sizeof ( struct BHeadSort ) , verg_bheadsort ) ;
2008-01-30 18:18:33 +00:00
}
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 */
2012-03-24 06:18:31 +00:00
if ( fd - > memfile )
2009-10-20 16:43:25 +00:00
return NULL ;
2012-05-17 12:59:34 +00:00
for ( ; bhead ; bhead = blo_prevbhead ( fd , bhead ) ) {
if ( bhead - > code = = ID_LI )
2002-10-12 11:37:38 +00:00
break ;
2012-05-17 12:59:34 +00:00
}
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
2012-08-04 19:34:38 +00:00
struct BHeadSort * bhs , bhs_s ;
2008-01-30 18:18:33 +00:00
2002-10-12 11:37:38 +00:00
if ( ! old )
return NULL ;
2004-06-23 18:22:51 +00:00
2012-05-17 12:59:34 +00:00
if ( fd - > bheadmap = = NULL )
2008-01-30 18:18:33 +00:00
sort_bhead_old_map ( fd ) ;
2012-05-17 12:59:34 +00:00
bhs_s . old = old ;
2012-08-04 19:34:38 +00:00
bhs = bsearch ( & bhs_s , fd - > bheadmap , fd - > tot_bheadmap , sizeof ( struct BHeadSort ) , verg_bheadsort ) ;
2008-01-30 18:18:33 +00:00
2012-03-24 06:18:31 +00:00
if ( bhs )
2008-01-30 18:18:33 +00:00
return bhs - > bhead ;
2008-02-03 18:50:03 +00:00
#if 0
2012-05-17 12:59:34 +00:00
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > old = = old )
2002-10-12 11:37:38 +00:00
return bhead ;
2012-05-17 12:59:34 +00:00
}
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 ;
}
2015-03-11 00:05:14 +11:00
static BHead * find_bhead_from_code_name ( FileData * fd , const short idcode , const char * name )
{
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
char idname_full [ MAX_ID_NAME ] ;
* ( ( short * ) idname_full ) = idcode ;
BLI_strncpy ( idname_full + 2 , name , sizeof ( idname_full ) - 2 ) ;
return BLI_ghash_lookup ( fd - > bhead_idname_hash , idname_full ) ;
# else
2015-03-11 00:05:14 +11:00
BHead * bhead ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > code = = idcode ) {
const char * idname_test = bhead_id_name ( fd , bhead ) ;
if ( STREQ ( idname_test + 2 , name ) ) {
return bhead ;
}
}
else if ( bhead - > code = = ENDB ) {
break ;
}
}
return NULL ;
2015-03-11 00:33:44 +11:00
# endif
2015-03-11 00:05:14 +11:00
}
static BHead * find_bhead_from_idname ( FileData * fd , const char * idname )
{
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
return BLI_ghash_lookup ( fd - > bhead_idname_hash , idname ) ;
# else
2015-03-11 00:05:14 +11:00
return find_bhead_from_code_name ( fd , GS ( idname ) , idname + 2 ) ;
2015-03-11 00:33:44 +11:00
# endif
2015-03-11 00:05:14 +11:00
}
2007-04-28 16:15:00 +00:00
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
}
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
static void expand_doit_library ( void * fdhandle , Main * mainvar , void * old )
2002-10-12 11:37:38 +00:00
{
BHead * bhead ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
FileData * fd = fdhandle ;
2002-10-12 11:37:38 +00:00
ID * id ;
2012-05-17 12:59:34 +00:00
bhead = find_bhead ( fd , old ) ;
2012-03-24 06:18:31 +00:00
if ( bhead ) {
2012-05-17 12:59:34 +00:00
/* from another library? */
if ( bhead - > code = = ID_ID ) {
2002-10-12 11:37:38 +00:00
BHead * bheadlib = find_previous_lib ( fd , bhead ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( bheadlib ) {
2012-05-17 12:59:34 +00:00
Library * lib = read_struct ( fd , bheadlib , " Library " ) ;
2012-05-25 17:13:30 +00:00
Main * ptr = blo_find_main ( fd , lib - > name , fd - > relabase ) ;
2012-05-17 12:59:34 +00:00
2012-12-23 18:41:00 +00:00
if ( ptr - > curlib = = NULL ) {
const char * idname = bhead_id_name ( fd , bhead ) ;
2013-11-29 23:16:13 +06:00
blo_reportf_wrap ( fd - > reports , RPT_WARNING , TIP_ ( " LIB ERROR: Data refers to main .blend file: '%s' from %s " ) ,
2012-12-23 18:41:00 +00:00
idname , mainvar - > curlib - > filepath ) ;
return ;
}
else
2013-03-26 09:59:43 +00:00
id = is_yet_read ( fd , ptr , bhead ) ;
2012-05-17 12:59:34 +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
2012-03-31 00:59:17 +00:00
// if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
2006-11-30 21:40:11 +00:00
/* for outliner dependency only */
2012-05-17 12:59:34 +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-20 19:39:07 +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
2012-07-16 23:23:33 +00:00
* empty without the dupli group referenced . Once you save and reload the group would appear . - Campbell */
2008-03-14 09:46:53 +00:00
/* This crashes files, must look further into it */
2010-12-04 15:45:16 +00:00
/* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
2012-04-22 11:54:53 +00:00
* inserted in the map to be found ! */
2012-06-11 02:23:26 +00:00
2012-06-04 12:01:49 +00:00
/* Update: previously it was checking for id->flag & LIB_PRE_EXISTING, however that does not affect file
* reading . For file reading we may need to insert it into the libmap as well , because you might have
* two files indirectly linking the same datablock , and in that case we need this in the libmap for the
* fd of both those files .
*
* The crash that this check avoided earlier was because bhead - > code wasn ' t properly passed in , making
* change_idid_adr not detect the mapping was for an ID_ID datablock . */
oldnewmap_insert ( fd - > libmap , bhead - > old , id , bhead - > code ) ;
2005-12-16 17:35:38 +00:00
change_idid_adr_fd ( fd , bhead - > old , id ) ;
2012-06-04 12:01:49 +00:00
2010-01-16 22:53:05 +00:00
// commented because this can print way too much
2012-03-31 00:59:17 +00:00
// if (G.debug & 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 {
2012-05-17 12:59:34 +00:00
id = is_yet_read ( fd , mainvar , bhead ) ;
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
2012-04-22 11:54:53 +00:00
* happens which invokes same ID . . . in that case the lookup table needs this entry */
2012-06-04 12:01:49 +00:00
oldnewmap_insert ( fd - > libmap , bhead - > old , id , bhead - > code ) ;
2010-03-22 09:30:00 +00:00
// commented because this can print way too much
2012-03-31 00:59:17 +00:00
// if (G.debug & G_DEBUG) printf("expand: already read %s\n", id->name);
2002-10-12 11:37:38 +00:00
}
}
}
}
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
static void ( * expand_doit ) ( void * , Main * , void * ) ;
2009-01-19 02:26:46 +00:00
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system
2006-06-08 19:26:08 +00:00
static void expand_ipo ( FileData * fd , Main * mainvar , Ipo * ipo )
{
IpoCurve * icu ;
2012-05-17 12:59:34 +00:00
for ( icu = ipo - > curve . first ; icu ; icu = icu - > next ) {
2012-03-24 06:18:31 +00:00
if ( icu - > driver )
2006-06-08 19:26:08 +00:00
expand_doit ( fd , mainvar , icu - > driver - > ob ) ;
}
}
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
static void expand_constraint_channels ( FileData * fd , Main * mainvar , ListBase * chanbase )
{
bConstraintChannel * chan ;
2012-05-17 12:59:34 +00:00
for ( chan = chanbase - > first ; chan ; chan = chan - > next ) {
2009-01-19 02:26:46 +00:00
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 ;
2012-05-17 12:59:34 +00:00
for ( fcm = list - > first ; fcm ; fcm = fcm - > next ) {
2009-11-22 11:15:38 +00:00
/* library data for specific F-Modifier types */
switch ( fcm - > type ) {
case FMODIFIER_TYPE_PYTHON :
{
2012-05-17 12:59:34 +00:00
FMod_Python * data = ( FMod_Python * ) fcm - > data ;
2009-11-22 11:15:38 +00:00
expand_doit ( fd , mainvar , data - > script ) ;
2015-07-18 19:02:39 +10:00
2009-11-22 11:15:38 +00:00
break ;
2015-07-18 19:02:39 +10:00
}
2009-11-22 11:15:38 +00:00
}
}
}
static void expand_fcurves ( FileData * fd , Main * mainvar , ListBase * list )
{
FCurve * fcu ;
2012-05-17 12:59:34 +00:00
for ( fcu = list - > first ; fcu ; fcu = fcu - > next ) {
2009-11-22 11:15:38 +00:00
/* Driver targets if there is a driver */
if ( fcu - > driver ) {
2012-05-17 12:59:34 +00:00
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
2012-05-17 12:59:34 +00:00
for ( dvar = driver - > variables . first ; dvar ; dvar = dvar - > next ) {
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
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 ;
2012-09-26 20:05:38 +00:00
// XXX deprecated - 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 */
2012-05-17 12:59:34 +00:00
for ( ks = list - > first ; ks ; ks = ks - > next ) {
for ( ksp = ks - > paths . first ; ksp ; ksp = ksp - > next ) {
2009-02-11 12:19:42 +00:00
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 */
2012-05-17 12:59:34 +00:00
for ( nlt = adt - > nla_tracks . first ; nlt ; nlt = nlt - > next )
2009-07-06 03:44:44 +00:00
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 )
{
2011-03-29 21:00:42 +00:00
int a ;
2012-05-17 12:59:34 +00:00
2009-01-19 02:26:46 +00:00
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
2012-03-24 06:18:31 +00:00
if ( part - > adt )
2009-07-24 16:41:12 +00:00
expand_animdata ( fd , mainvar , part - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-03-24 06:18:31 +00:00
if ( part - > mtex [ a ] ) {
2011-03-29 21:00:42 +00:00
expand_doit ( fd , mainvar , part - > mtex [ a ] - > tex ) ;
expand_doit ( fd , mainvar , part - > mtex [ a ] - > object ) ;
}
}
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 ;
2012-05-17 12:59:34 +00:00
for ( go = group - > gobject . first ; go ; go = go - > next ) {
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
expand_doit ( fd , mainvar , go - > ob ) ;
}
}
2002-10-12 11:37:38 +00:00
static void expand_key ( FileData * fd , Main * mainvar , Key * key )
{
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , key - > ipo ) ; // XXX deprecated - old animation system
2009-01-22 10:53:22 +00:00
2012-03-24 06:18:31 +00:00
if ( key - > adt )
2009-01-22 10:53:22 +00:00
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 ;
2012-03-24 06:18:31 +00:00
if ( ntree - > adt )
2009-02-20 16:39:39 +00:00
expand_animdata ( fd , mainvar , ntree - > adt ) ;
2009-11-11 09:59:51 +00:00
2012-03-24 06:18:31 +00:00
if ( ntree - > gpd )
2009-11-11 09:59:51 +00:00
expand_doit ( fd , mainvar , ntree - > gpd ) ;
2009-02-20 16:39:39 +00:00
2012-05-17 12:59:34 +00:00
for ( node = ntree - > nodes . first ; node ; node = node - > next ) {
if ( node - > id & & node - > type ! = CMP_NODE_R_LAYERS )
2008-11-12 22:03:11 +00:00
expand_doit ( fd , mainvar , node - > id ) ;
2012-05-17 12:59:34 +00:00
}
2008-11-12 22:03:11 +00:00
}
2002-10-12 11:37:38 +00:00
static void expand_texture ( FileData * fd , Main * mainvar , Tex * tex )
{
expand_doit ( fd , mainvar , tex - > ima ) ;
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , tex - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
2012-03-24 06:18:31 +00:00
if ( tex - > adt )
2009-01-19 02:26:46 +00:00
expand_animdata ( fd , mainvar , tex - > adt ) ;
2008-11-12 22:03:11 +00:00
2012-03-24 06:18:31 +00:00
if ( tex - > nodetree )
2008-11-12 22:03:11 +00:00
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 ) ;
2013-08-08 09:45:59 +00:00
expand_doit ( fd , mainvar , brush - > mask_mtex . tex ) ;
2006-07-31 15:53:03 +00:00
expand_doit ( fd , mainvar , brush - > clone . image ) ;
2014-07-21 12:02:05 +02:00
expand_doit ( fd , mainvar , brush - > paint_curve ) ;
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 ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-03-24 06:18:31 +00:00
if ( ma - > mtex [ a ] ) {
2002-10-12 11:37:38 +00:00
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
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , ma - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
2012-03-24 06:18:31 +00:00
if ( ma - > adt )
2009-01-19 02:26:46 +00:00
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
2012-03-24 06:18:31 +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
expand_nodetree ( fd , mainvar , ma - > nodetree ) ;
2011-05-26 10:25:51 +00:00
2012-03-24 06:18:31 +00:00
if ( ma - > group )
2011-05-26 10:25:51 +00:00
expand_doit ( fd , mainvar , ma - > group ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_lamp ( FileData * fd , Main * mainvar , Lamp * la )
{
int a ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-03-24 06:18:31 +00:00
if ( la - > mtex [ a ] ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , la - > mtex [ a ] - > tex ) ;
expand_doit ( fd , mainvar , la - > mtex [ a ] - > object ) ;
}
}
2009-01-19 02:26:46 +00:00
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , la - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
if ( la - > adt )
expand_animdata ( fd , mainvar , la - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( la - > nodetree )
2011-11-02 18:55:32 +00:00
expand_nodetree ( fd , mainvar , la - > nodetree ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_lattice ( FileData * fd , Main * mainvar , Lattice * lt )
{
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , lt - > ipo ) ; // XXX deprecated - old animation system
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , lt - > key ) ;
2010-12-13 06:31:49 +00:00
if ( lt - > adt )
expand_animdata ( fd , mainvar , lt - > adt ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_world ( FileData * fd , Main * mainvar , World * wrld )
{
int a ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
2012-03-24 06:18:31 +00:00
if ( wrld - > mtex [ a ] ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , wrld - > mtex [ a ] - > tex ) ;
expand_doit ( fd , mainvar , wrld - > mtex [ a ] - > object ) ;
}
}
2009-01-19 02:26:46 +00:00
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , wrld - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
if ( wrld - > adt )
expand_animdata ( fd , mainvar , wrld - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( wrld - > nodetree )
2011-11-02 18:55:32 +00:00
expand_nodetree ( fd , mainvar , wrld - > nodetree ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_mball ( FileData * fd , Main * mainvar , MetaBall * mb )
{
int a ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < mb - > totcol ; a + + ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , mb - > mat [ a ] ) ;
}
2009-08-03 13:09:23 +00:00
2012-03-24 06:18:31 +00:00
if ( mb - > adt )
2009-08-03 13:09:23 +00:00
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 ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < cu - > totcol ; a + + ) {
2002-10-12 11:37:38 +00:00
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 ) ;
2012-12-11 22:00:22 +00:00
expand_doit ( fd , mainvar , cu - > vfontb ) ;
2005-06-17 21:04:27 +00:00
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 ) ;
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , cu - > ipo ) ; // XXX deprecated - 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
2012-03-24 06:18:31 +00:00
if ( cu - > adt )
2009-01-19 02:26:46 +00:00
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 ;
TFace * tf ;
int a , i ;
2005-05-26 13:17:12 +00:00
2012-03-24 06:18:31 +00:00
if ( me - > adt )
2010-07-27 06:06:36 +00:00
expand_animdata ( fd , mainvar , me - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < me - > totcol ; a + + ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , me - > mat [ a ] ) ;
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , me - > key ) ;
expand_doit ( fd , mainvar , me - > texcomesh ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( me - > tface ) {
2012-05-17 12:59:34 +00:00
tf = me - > tface ;
for ( i = 0 ; i < me - > totface ; i + + , tf + + ) {
2012-03-24 06:18:31 +00:00
if ( tf - > tpage )
2006-11-21 16:54:00 +00:00
expand_doit ( fd , mainvar , tf - > tpage ) ;
2012-05-17 12:59:34 +00:00
}
2006-11-21 16:54:00 +00:00
}
2012-07-12 07:30:50 +00:00
if ( me - > mface & & ! me - > mpoly ) {
MTFace * mtf ;
for ( a = 0 ; a < me - > fdata . totlayer ; a + + ) {
layer = & me - > fdata . layers [ a ] ;
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 ) ;
}
}
}
}
else {
MTexPoly * mtp ;
for ( a = 0 ; a < me - > pdata . totlayer ; a + + ) {
layer = & me - > pdata . layers [ a ] ;
if ( layer - > type = = CD_MTEXPOLY ) {
mtp = ( MTexPoly * ) layer - > data ;
for ( i = 0 ; i < me - > totpoly ; i + + , mtp + + ) {
if ( mtp - > tpage )
expand_doit ( fd , mainvar , mtp - > tpage ) ;
}
2012-05-17 12:59:34 +00:00
}
2006-11-21 16:54:00 +00:00
}
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 */
2014-04-11 11:25:41 +10:00
static void expand_constraint_cb ( bConstraint * UNUSED ( con ) , ID * * idpoin , bool UNUSED ( is_reference ) , void * userdata )
2010-02-06 11:50:39 +00:00
{
2012-05-17 12:59:34 +00:00
tConstraintExpandData * ced = ( tConstraintExpandData * ) userdata ;
2010-02-06 11:50:39 +00:00
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 */
2012-05-17 12:59:34 +00:00
ced . fd = fd ;
ced . mainvar = mainvar ;
2010-02-06 11:50:39 +00:00
2014-04-11 11:47:07 +10:00
BKE_constraints_id_loop ( lb , expand_constraint_cb , & ced ) ;
2010-02-06 11:50:39 +00:00
2012-09-26 20:05:38 +00:00
/* deprecated manual expansion stuff */
2012-05-17 12:59:34 +00:00
for ( curcon = lb - > first ; curcon ; curcon = curcon - > next ) {
2007-12-02 18:33:14 +00:00
if ( curcon - > ipo )
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , curcon - > ipo ) ; // XXX deprecated - old animation system
2002-10-12 11:37:38 +00:00
}
}
2012-06-11 02:23:26 +00:00
#if 0 /* Disabled as it doesn't actually do anything except recurse... */
2002-10-12 11:37:38 +00:00
static void expand_bones ( FileData * fd , Main * mainvar , Bone * bone )
{
Bone * curBone ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
for ( curBone = bone - > childbase . first ; curBone ; curBone = curBone - > next ) {
expand_bones ( fd , mainvar , curBone ) ;
}
}
2012-06-11 02:23:26 +00:00
# endif
2002-10-12 11:37:38 +00:00
static void expand_pose ( FileData * fd , Main * mainvar , bPose * pose )
{
bPoseChannel * chan ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( ! pose )
return ;
2012-05-17 12:59:34 +00:00
for ( chan = pose - > chanbase . first ; chan ; chan = chan - > next ) {
2002-10-12 11:37:38 +00:00
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 )
2012-06-11 02:23:26 +00:00
{
2012-03-24 06:18:31 +00:00
if ( arm - > adt )
2009-09-21 06:43:20 +00:00
expand_animdata ( fd , mainvar , arm - > adt ) ;
2012-05-17 12:59:34 +00:00
2012-06-11 02:23:26 +00:00
#if 0 /* Disabled as this currently only recurses down the chain doing nothing */
{
Bone * curBone ;
for ( curBone = arm - > bonebase . first ; curBone ; curBone = curBone - > next ) {
expand_bones ( fd , mainvar , curBone ) ;
}
2002-10-12 11:37:38 +00:00
}
2012-06-11 02:23:26 +00:00
# endif
2002-10-12 11:37:38 +00:00
}
2015-10-08 14:21:11 +02:00
static void expand_object_expandModifiers (
void * userData , Object * UNUSED ( ob ) , ID * * idpoin , int UNUSED ( cd_flag ) )
2005-07-20 18:04:50 +00:00
{
2011-03-31 11:21:21 +00:00
struct { FileData * fd ; Main * mainvar ; } * data = userData ;
2012-05-17 12:59:34 +00:00
FileData * fd = data - > fd ;
Main * mainvar = data - > mainvar ;
2011-03-31 11:21:21 +00:00
expand_doit ( fd , mainvar , * idpoin ) ;
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 )
{
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 ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , ob - > data ) ;
2012-05-17 12:59:34 +00:00
2011-03-31 11:21:21 +00:00
/* expand_object_expandModifier() */
2012-03-24 06:18:31 +00:00
if ( ob - > modifiers . first ) {
2011-03-31 11:21:21 +00:00
struct { FileData * fd ; Main * mainvar ; } data ;
2012-05-17 12:59:34 +00:00
data . fd = fd ;
data . mainvar = mainvar ;
2011-03-31 11:21:21 +00:00
modifiers_foreachIDLink ( ob , expand_object_expandModifiers , ( void * ) & data ) ;
2005-07-20 18:04:50 +00:00
}
2012-05-17 12:59:34 +00:00
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 ) ;
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system (for version patching only)
2009-01-19 02:26:46 +00:00
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 ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +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 ) ;
}
2012-09-26 20:05:38 +00:00
// XXX deprecated - old animation system (for version patching only)
2009-01-19 02:26:46 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > adt )
2009-01-19 02:26:46 +00:00
expand_animdata ( fd , mainvar , ob - > adt ) ;
2012-05-17 12:59:34 +00:00
for ( a = 0 ; a < ob - > totcol ; a + + ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , ob - > mat [ a ] ) ;
}
2004-10-13 17:59:44 +00:00
2012-05-04 15:42:49 +00:00
paf = blo_do_version_give_parteff_245 ( ob ) ;
2006-02-05 19:43:46 +00:00
if ( paf & & paf - > group )
expand_doit ( fd , mainvar , paf - > group ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > dup_group )
2006-02-20 17:44:21 +00:00
expand_doit ( fd , mainvar , ob - > dup_group ) ;
2006-11-30 15:54:21 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > proxy )
2006-11-30 15:54:21 +00:00
expand_doit ( fd , mainvar , ob - > proxy ) ;
2012-03-24 06:18:31 +00:00
if ( ob - > proxy_group )
2006-11-30 15:54:21 +00:00
expand_doit ( fd , mainvar , ob - > proxy_group ) ;
2012-05-17 12:59:34 +00:00
for ( psys = ob - > particlesystem . first ; psys ; psys = 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
expand_doit ( fd , mainvar , psys - > part ) ;
2012-05-17 12:59:34 +00:00
for ( sens = ob - > sensors . first ; sens ; sens = sens - > next ) {
2013-09-04 22:14:14 +00:00
if ( sens - > type = = SENS_MESSAGE ) {
2012-05-17 12:59:34 +00:00
bMessageSensor * ms = sens - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , ms - > fromObject ) ;
}
}
2012-05-17 12:59:34 +00:00
for ( cont = ob - > controllers . first ; cont ; cont = cont - > next ) {
if ( cont - > type = = CONT_PYTHON ) {
bPythonCont * pc = cont - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , pc - > text ) ;
}
}
2012-05-17 12:59:34 +00:00
for ( act = ob - > actuators . first ; act ; act = act - > next ) {
if ( act - > type = = ACT_SOUND ) {
bSoundActuator * sa = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , sa - > sound ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_CAMERA ) {
bCameraActuator * ca = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , ca - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_EDIT_OBJECT ) {
bEditObjectActuator * eoa = act - > data ;
2012-03-24 06:18:31 +00:00
if ( eoa ) {
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , eoa - > ob ) ;
expand_doit ( fd , mainvar , eoa - > me ) ;
}
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_OBJECT ) {
bObjectActuator * oa = act - > data ;
2009-06-08 20:08:19 +00:00
expand_doit ( fd , mainvar , oa - > reference ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ADD_OBJECT ) {
bAddObjectActuator * aoa = act - > data ;
2009-09-24 21:22:24 +00:00
expand_doit ( fd , mainvar , aoa - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_SCENE ) {
bSceneActuator * sa = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , sa - > camera ) ;
expand_doit ( fd , mainvar , sa - > scene ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_2DFILTER ) {
bTwoDFilterActuator * tdfa = act - > data ;
2009-09-24 21:22:24 +00:00
expand_doit ( fd , mainvar , tdfa - > text ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ACTION ) {
bActionActuator * aa = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , aa - > act ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_SHAPEACTION ) {
bActionActuator * aa = act - > data ;
2008-06-18 06:46:49 +00:00
expand_doit ( fd , mainvar , aa - > act ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_PROPERTY ) {
bPropertyActuator * pa = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , pa - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_MESSAGE ) {
bMessageActuator * ma = act - > data ;
2002-10-12 11:37:38 +00:00
expand_doit ( fd , mainvar , ma - > toObject ) ;
}
2012-03-24 06:18:31 +00:00
else if ( act - > type = = ACT_PARENT ) {
2012-05-17 12:59:34 +00:00
bParentActuator * pa = act - > data ;
2009-09-24 21:22:24 +00:00
expand_doit ( fd , mainvar , pa - > ob ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_ARMATURE ) {
bArmatureActuator * arma = act - > data ;
2009-09-24 21:22:24 +00:00
expand_doit ( fd , mainvar , arma - > target ) ;
}
2012-05-17 12:59:34 +00:00
else if ( act - > type = = ACT_STEERING ) {
bSteeringActuator * sta = act - > data ;
2010-05-31 22:35:22 +00:00
expand_doit ( fd , mainvar , sta - > target ) ;
expand_doit ( fd , mainvar , sta - > navmesh ) ;
}
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( ob - > pd & & ob - > pd - > tex )
2008-02-28 11:39:13 +00:00
expand_doit ( fd , mainvar , ob - > pd - > tex ) ;
2013-01-23 05:56:56 +00:00
if ( ob - > rigidbody_constraint ) {
expand_doit ( fd , mainvar , ob - > rigidbody_constraint - > ob1 ) ;
expand_doit ( fd , mainvar , ob - > rigidbody_constraint - > ob2 ) ;
}
2013-12-17 14:42:47 -08:00
if ( ob - > currentlod ) {
LodLevel * level ;
for ( level = ob - > lodlevels . first ; level ; level = level - > next ) {
expand_doit ( fd , mainvar , level - > source ) ;
}
}
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 ;
2013-04-03 00:00:29 +00:00
FreestyleModuleConfig * module ;
2013-03-23 03:00:37 +00:00
FreestyleLineSet * lineset ;
2012-05-17 12:59:34 +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
2012-03-24 06:18:31 +00:00
if ( sce - > adt )
2009-01-19 02:26:46 +00:00
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
2012-03-24 06:18:31 +00:00
if ( sce - > set )
2009-02-17 03:43:56 +00:00
expand_doit ( fd , mainvar , sce - > set ) ;
2012-03-24 06:18:31 +00:00
if ( sce - > nodetree )
2006-02-07 15:50:55 +00:00
expand_nodetree ( fd , mainvar , sce - > nodetree ) ;
2006-12-07 14:17:38 +00:00
2012-05-17 12:59:34 +00:00
for ( srl = sce - > r . layers . first ; srl ; srl = srl - > next ) {
2006-12-07 14:17:38 +00:00
expand_doit ( fd , mainvar , srl - > mat_override ) ;
expand_doit ( fd , mainvar , srl - > light_override ) ;
2013-04-03 00:00:29 +00:00
for ( module = srl - > freestyleConfig . modules . first ; module ; module = module - > next ) {
if ( module - > script )
expand_doit ( fd , mainvar , module - > script ) ;
}
2013-03-23 03:00:37 +00:00
for ( lineset = srl - > freestyleConfig . linesets . first ; lineset ; lineset = lineset - > next ) {
if ( lineset - > group )
expand_doit ( fd , mainvar , lineset - > group ) ;
expand_doit ( fd , mainvar , lineset - > linestyle ) ;
2011-09-15 00:06:49 +00:00
}
2006-12-07 14:17:38 +00:00
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( sce - > r . dometext )
2009-07-20 20:28:29 +00:00
expand_doit ( fd , mainvar , sce - > gm . dome . warptext ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( sce - > gpd )
2009-08-26 12:01:15 +00:00
expand_doit ( fd , mainvar , sce - > gpd ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( sce - > ed ) {
2009-12-18 13:28:03 +00:00
Sequence * seq ;
2012-05-17 12:59:34 +00:00
2012-04-30 16:22:40 +00:00
SEQ_BEGIN ( sce - > ed , seq )
{
2012-03-24 06:18:31 +00:00
if ( seq - > scene ) expand_doit ( fd , mainvar , seq - > scene ) ;
if ( seq - > scene_camera ) expand_doit ( fd , mainvar , seq - > scene_camera ) ;
2014-04-30 09:46:26 +10:00
if ( seq - > clip ) expand_doit ( fd , mainvar , seq - > clip ) ;
if ( seq - > mask ) expand_doit ( fd , mainvar , seq - > mask ) ;
2012-03-24 06:18:31 +00:00
if ( seq - > sound ) expand_doit ( fd , mainvar , seq - > sound ) ;
2009-12-18 13:28:03 +00:00
}
SEQ_END
}
2013-01-23 05:56:22 +00:00
if ( sce - > rigidbody_world ) {
expand_doit ( fd , mainvar , sce - > rigidbody_world - > group ) ;
2013-01-23 05:56:56 +00:00
expand_doit ( fd , mainvar , sce - > rigidbody_world - > constraints ) ;
2013-01-23 05:56:22 +00:00
}
2009-12-18 13:28:03 +00:00
2009-12-16 19:49:33 +00:00
# ifdef DURIAN_CAMERA_SWITCH
{
TimeMarker * marker ;
2012-06-11 02:23:26 +00:00
2012-05-17 12:59:34 +00:00
for ( marker = sce - > markers . first ; marker ; marker = marker - > next ) {
2012-03-24 06:18:31 +00:00
if ( marker - > camera ) {
2009-12-16 19:49:33 +00:00
expand_doit ( fd , mainvar , marker - > camera ) ;
}
}
}
# endif
2012-04-02 13:56:39 +00:00
expand_doit ( fd , mainvar , sce - > clip ) ;
2002-10-12 11:37:38 +00:00
}
static void expand_camera ( FileData * fd , Main * mainvar , Camera * ca )
{
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , ca - > ipo ) ; // XXX deprecated - old animation system
2009-01-19 02:26:46 +00:00
2012-03-24 06:18:31 +00:00
if ( ca - > adt )
2009-01-19 02:26:46 +00:00
expand_animdata ( fd , mainvar , ca - > adt ) ;
2002-10-12 11:37:38 +00:00
}
2011-08-01 11:44:20 +00:00
static void expand_speaker ( FileData * fd , Main * mainvar , Speaker * spk )
{
expand_doit ( fd , mainvar , spk - > sound ) ;
if ( spk - > adt )
expand_animdata ( fd , mainvar , spk - > adt ) ;
}
2002-10-12 11:37:38 +00:00
static void expand_sound ( FileData * fd , Main * mainvar , bSound * snd )
{
2012-09-26 20:05:38 +00:00
expand_doit ( fd , mainvar , snd - > ipo ) ; // XXX deprecated - old animation system
2002-10-12 11:37:38 +00:00
}
2012-02-17 10:54:21 +00:00
static void expand_movieclip ( FileData * fd , Main * mainvar , MovieClip * clip )
{
if ( clip - > adt )
expand_animdata ( fd , mainvar , clip - > adt ) ;
}
2002-10-12 11:37:38 +00:00
2012-07-31 20:54:27 +00:00
static void expand_mask_parent ( FileData * fd , Main * mainvar , MaskParent * parent )
{
if ( parent - > id ) {
expand_doit ( fd , mainvar , parent - > id ) ;
}
}
static void expand_mask ( FileData * fd , Main * mainvar , Mask * mask )
{
MaskLayer * mask_layer ;
if ( mask - > adt )
expand_animdata ( fd , mainvar , mask - > adt ) ;
for ( mask_layer = mask - > masklayers . first ; mask_layer ; mask_layer = mask_layer - > next ) {
MaskSpline * spline ;
for ( spline = mask_layer - > splines . first ; spline ; spline = spline - > next ) {
int i ;
for ( i = 0 ; i < spline - > tot_point ; i + + ) {
MaskSplinePoint * point = & spline - > points [ i ] ;
expand_mask_parent ( fd , mainvar , & point - > parent ) ;
}
expand_mask_parent ( fd , mainvar , & spline - > parent ) ;
}
}
}
2010-06-25 22:45:42 +00:00
static void expand_linestyle ( FileData * fd , Main * mainvar , FreestyleLineStyle * linestyle )
{
2014-05-03 18:51:53 +09:00
int a ;
2010-07-24 20:37:54 +00:00
LineStyleModifier * m ;
2010-06-25 22:45:42 +00:00
2014-05-03 18:51:53 +09:00
for ( a = 0 ; a < MAX_MTEX ; a + + ) {
if ( linestyle - > mtex [ a ] ) {
expand_doit ( fd , mainvar , linestyle - > mtex [ a ] - > tex ) ;
expand_doit ( fd , mainvar , linestyle - > mtex [ a ] - > object ) ;
}
}
if ( linestyle - > nodetree )
expand_nodetree ( fd , mainvar , linestyle - > nodetree ) ;
2010-09-18 00:31:22 +00:00
if ( linestyle - > adt )
expand_animdata ( fd , mainvar , linestyle - > adt ) ;
2010-07-24 20:37:54 +00:00
for ( m = linestyle - > color_modifiers . first ; m ; m = m - > next ) {
if ( m - > type = = LS_MODIFIER_DISTANCE_FROM_OBJECT )
expand_doit ( fd , mainvar , ( ( LineStyleColorModifier_DistanceFromObject * ) m ) - > target ) ;
}
2013-04-08 04:39:09 +00:00
for ( m = linestyle - > alpha_modifiers . first ; m ; m = m - > next ) {
2010-07-24 20:37:54 +00:00
if ( m - > type = = LS_MODIFIER_DISTANCE_FROM_OBJECT )
expand_doit ( fd , mainvar , ( ( LineStyleAlphaModifier_DistanceFromObject * ) m ) - > target ) ;
}
2013-04-08 04:39:09 +00:00
for ( m = linestyle - > thickness_modifiers . first ; m ; m = m - > next ) {
2010-07-24 20:37:54 +00:00
if ( m - > type = = LS_MODIFIER_DISTANCE_FROM_OBJECT )
expand_doit ( fd , mainvar , ( ( LineStyleThicknessModifier_DistanceFromObject * ) m ) - > target ) ;
}
2010-06-25 22:45:42 +00:00
}
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
static void expand_gpencil ( FileData * fd , Main * mainvar , bGPdata * gpd )
{
if ( gpd - > adt )
expand_animdata ( fd , mainvar , gpd - > adt ) ;
}
2015-10-12 14:21:34 +02:00
/**
* Set the callback func used over all ID data found by \ a BLO_expand_main func .
*
* \ param expand_doit_func Called for each ID block it finds .
*/
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
void BLO_main_expander ( void ( * expand_doit_func ) ( void * , Main * , void * ) )
{
expand_doit = expand_doit_func ;
}
2015-10-12 14:21:34 +02:00
/**
* Loop over all ID data in Main to mark relations .
* Set ( id - > flag & LIB_NEED_EXPAND ) to mark expanding . Flags get cleared after expanding .
*
* \ param fdhandle usually filedata , or own handle .
* \ param mainvar the Main database to expand .
*/
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
void BLO_expand_main ( void * fdhandle , Main * mainvar )
2002-10-12 11:37:38 +00:00
{
2006-09-06 09:51:30 +00:00
ListBase * lbarray [ MAX_LIBARRAY ] ;
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
FileData * fd = fdhandle ;
2002-10-12 11:37:38 +00:00
ID * id ;
2014-04-01 11:34:00 +11:00
int a ;
bool do_it = true ;
2012-05-17 12:59:34 +00:00
2012-05-19 13:28:19 +00:00
while ( do_it ) {
2014-04-01 11:34:00 +11:00
do_it = false ;
2012-05-17 12:59:34 +00:00
a = set_listbasepointers ( mainvar , lbarray ) ;
2012-03-24 07:52:14 +00:00
while ( a - - ) {
2013-01-21 06:32:09 +00:00
id = lbarray [ a ] - > first ;
2012-03-24 07:52:14 +00:00
while ( id ) {
2012-08-01 15:32:27 +00:00
if ( id - > flag & LIB_NEED_EXPAND ) {
2012-04-28 06:31:57 +00:00
switch ( GS ( id - > name ) ) {
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 :
2012-04-29 15:47:02 +00:00
expand_lamp ( fd , mainvar , ( Lamp * ) id ) ;
2002-10-12 11:37:38 +00:00
break ;
case ID_KE :
expand_key ( fd , mainvar , ( Key * ) id ) ;
break ;
case ID_CA :
expand_camera ( fd , mainvar , ( Camera * ) id ) ;
break ;
2011-08-01 11:44:20 +00:00
case ID_SPK :
2012-04-29 15:47:02 +00:00
expand_speaker ( fd , mainvar , ( Speaker * ) id ) ;
2011-08-01 11:44:20 +00:00
break ;
2002-10-12 11:37:38 +00:00
case ID_SO :
expand_sound ( fd , mainvar , ( bSound * ) id ) ;
break ;
case ID_AR :
expand_armature ( fd , mainvar , ( bArmature * ) id ) ;
break ;
case ID_AC :
2012-09-26 20:05:38 +00:00
expand_action ( fd , mainvar , ( bAction * ) id ) ; // XXX deprecated - 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 :
2012-09-26 20:05:38 +00:00
expand_ipo ( fd , mainvar , ( Ipo * ) id ) ; // XXX deprecated - 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 ) ;
2010-06-25 22:45:42 +00:00
break ;
2012-02-17 10:54:21 +00:00
case ID_MC :
expand_movieclip ( fd , mainvar , ( MovieClip * ) id ) ;
break ;
2012-07-31 20:54:27 +00:00
case ID_MSK :
expand_mask ( fd , mainvar , ( Mask * ) id ) ;
break ;
2010-06-25 22:45:42 +00:00
case ID_LS :
expand_linestyle ( fd , mainvar , ( FreestyleLineStyle * ) id ) ;
break ;
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
case ID_GD :
expand_gpencil ( fd , mainvar , ( bGPdata * ) id ) ;
break ;
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
2014-04-01 11:34:00 +11:00
do_it = true ;
2012-08-01 15:32:27 +00:00
id - > flag - = LIB_NEED_EXPAND ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
}
2012-05-17 12:59:34 +00:00
id = id - > next ;
2002-10-12 11:37:38 +00:00
}
}
}
}
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/* ***************************** */
2014-02-05 22:36:15 +11:00
static bool object_in_any_scene ( Main * mainvar , Object * ob )
2006-06-02 20:48:22 +00:00
{
Scene * sce ;
2015-10-12 13:46:58 +02:00
for ( sce = mainvar - > scene . first ; sce ; sce = sce - > id . next ) {
if ( BKE_scene_base_find ( sce , ob ) ) {
return true ;
}
2012-05-17 12:59:34 +00:00
}
2015-10-12 13:46:58 +02:00
return false ;
2006-06-02 20:48:22 +00:00
}
2004-12-08 19:08:37 +00:00
2014-02-03 18:55:59 +11:00
static void give_base_to_objects ( Main * mainvar , Scene * sce , Library * lib , const short idcode , const bool is_link , const short active_lay )
2002-10-12 11:37:38 +00:00
{
Object * ob ;
Base * base ;
2014-02-03 18:55:59 +11:00
const bool is_group_append = ( is_link = = false & & idcode = = ID_GR ) ;
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 */
2012-05-21 06:33:32 +00:00
for ( ob = mainvar - > object . first ; ob ; ob = ob - > id . next ) {
if ( ob - > id . flag & LIB_INDIRECT ) {
2012-04-22 11:54:53 +00:00
/* IF below is quite confusing!
* if we are appending , but this object wasnt just added along with a group ,
* then this is already used indirectly in the scene somewhere else and we didnt just append it .
*
* ( ob - > id . flag & LIB_PRE_EXISTING ) = = 0 means that this is a newly appended object - Campbell */
2010-01-07 16:19:38 +00:00
if ( is_group_append = = 0 | | ( ob - > id . flag & LIB_PRE_EXISTING ) = = 0 ) {
2014-04-01 11:34:00 +11:00
bool do_it = false ;
2008-01-18 11:51:46 +00:00
2012-05-17 12:59:34 +00:00
if ( ob - > id . us = = 0 ) {
2014-04-01 11:34:00 +11:00
do_it = true ;
2011-05-19 06:17:44 +00:00
}
2012-03-24 06:18:31 +00:00
else if ( idcode = = ID_GR ) {
2015-03-09 14:23:30 +11:00
if ( ( is_link = = false ) & & ( ob - > id . lib = = lib ) ) {
2012-03-24 06:18:31 +00:00
if ( ( ob - > flag & OB_FROMGROUP ) & & object_in_any_scene ( mainvar , ob ) = = 0 ) {
2014-04-01 11:34:00 +11:00
do_it = true ;
2011-05-21 07:15:36 +00:00
}
}
}
else {
/* when appending, make sure any indirectly loaded objects
* get a base else they cant be accessed at all [ # 27437 ] */
2015-03-09 14:23:30 +11:00
if ( ( is_link = = false ) & & ( ob - > id . lib = = lib ) ) {
2011-06-09 04:28:53 +00:00
/* we may be appending from a scene where we already
* have a linked object which is not in any scene [ # 27616 ] */
2012-03-24 06:18:31 +00:00
if ( ( ob - > id . flag & LIB_PRE_EXISTING ) = = 0 ) {
if ( object_in_any_scene ( mainvar , ob ) = = 0 ) {
2014-04-01 11:34:00 +11:00
do_it = true ;
2011-06-09 04:28:53 +00:00
}
2011-05-21 07:15:36 +00:00
}
2011-05-19 06:17:44 +00:00
}
}
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( do_it ) {
2012-05-17 12:59:34 +00:00
base = MEM_callocN ( sizeof ( Base ) , " add_ext_base " ) ;
2013-01-21 06:32:09 +00:00
BLI_addtail ( & sce - > base , base ) ;
2013-03-24 12:13:13 +00:00
if ( active_lay ) ob - > lay = sce - > lay ;
2012-05-17 12:59:34 +00:00
base - > lay = ob - > lay ;
base - > object = ob ;
base - > flag = ob - > flag ;
2015-03-09 14:23:30 +11:00
CLAMP_MIN ( ob - > id . us , 0 ) ;
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 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 ;
2012-05-17 12:59:34 +00:00
2013-09-03 17:24:07 +00:00
/* give all objects which are tagged a base */
2012-05-17 12:59:34 +00:00
for ( group = mainvar - > group . first ; group ; group = group - > id . next ) {
2013-09-03 17:24:07 +00:00
if ( group - > id . flag & LIB_DOIT ) {
2010-01-07 14:59:22 +00:00
Base * base ;
2013-09-03 18:01:31 +00:00
Object * ob ;
2013-09-03 17:24:07 +00:00
/* any indirect group should not have been tagged */
BLI_assert ( ( group - > id . flag & LIB_INDIRECT ) = = 0 ) ;
2012-05-17 12:59:34 +00:00
2012-05-05 14:03:12 +00:00
/* BKE_object_add(...) messes with the selection */
2013-09-03 18:01:31 +00:00
ob = BKE_object_add_only_object ( mainvar , OB_EMPTY , group - > id . name + 2 ) ;
2012-05-17 12:59:34 +00:00
ob - > type = OB_EMPTY ;
ob - > lay = scene - > lay ;
2010-01-07 14:59:22 +00:00
/* assign the base */
2012-05-17 12:59:34 +00:00
base = BKE_scene_base_add ( scene , ob ) ;
2010-01-07 14:59:22 +00:00
base - > flag | = SELECT ;
base - > object - > flag = base - > flag ;
2013-02-21 19:33:04 +00:00
DAG_id_tag_update ( & ob - > id , OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME ) ;
2012-05-17 12:59:34 +00:00
scene - > basact = base ;
2010-01-07 14:59:22 +00:00
/* assign the group */
2012-05-17 12:59:34 +00:00
ob - > dup_group = group ;
2010-01-07 14:28:00 +00:00
ob - > transflag | = OB_DUPLIGROUP ;
2011-11-06 16:38:21 +00:00
copy_v3_v3 ( ob - > loc , scene - > cursor ) ;
2010-01-07 14:28:00 +00:00
}
}
}
2002-10-12 11:37:38 +00:00
2011-03-13 01:15:14 +00:00
/* returns true if the item was found
2012-04-22 11:54:53 +00:00
* but it may already have already been appended / linked */
2015-10-12 13:46:58 +02:00
static ID * link_named_part ( Main * mainl , FileData * fd , const char * idname , const short idcode )
2002-10-12 11:37:38 +00:00
{
2015-03-11 00:05:14 +11:00
BHead * bhead = find_bhead_from_code_name ( fd , idcode , idname ) ;
ID * id ;
2002-10-12 11:37:38 +00:00
2015-03-11 00:05:14 +11:00
if ( bhead ) {
id = is_yet_read ( fd , mainl , bhead ) ;
if ( id = = NULL ) {
/* not read yet */
read_libblock ( fd , mainl , bhead , LIB_TESTEXT , & id ) ;
if ( id ) {
/* sort by name in list */
ListBase * lb = which_libbase ( mainl , idcode ) ;
id_sort_by_name ( lb , id ) ;
2002-10-12 11:37:38 +00:00
}
}
2015-03-11 00:05:14 +11:00
else {
/* already linked */
if ( G . debug )
printf ( " append: already linked \n " ) ;
oldnewmap_insert ( fd - > libmap , bhead - > old , id , bhead - > code ) ;
if ( id - > flag & LIB_INDIRECT ) {
id - > flag - = LIB_INDIRECT ;
id - > flag | = LIB_EXTERN ;
}
2011-05-26 20:45:19 +00:00
}
2002-10-12 11:37:38 +00:00
}
2015-03-11 00:05:14 +11:00
else {
id = NULL ;
}
2012-05-17 12:59:34 +00:00
2011-05-24 15:02:46 +00:00
/* if we found the id but the id is NULL, this is really bad */
2015-03-11 00:05:14 +11:00
BLI_assert ( ( bhead ! = NULL ) = = ( id ! = NULL ) ) ;
2012-05-17 12:59:34 +00:00
2015-03-11 00:05:14 +11:00
return id ;
2002-10-12 11:37:38 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Simple reader for copy / paste buffers .
*/
2015-10-12 13:46:58 +02:00
void BLO_library_link_all ( Main * mainl , BlendHandle * bh )
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
{
FileData * fd = ( FileData * ) ( bh ) ;
BHead * bhead ;
ID * id = NULL ;
for ( bhead = blo_firstbhead ( fd ) ; bhead ; bhead = blo_nextbhead ( fd , bhead ) ) {
if ( bhead - > code = = ENDB )
break ;
if ( bhead - > code = = ID_OB )
read_libblock ( fd , mainl , bhead , LIB_TESTIND , & id ) ;
if ( id ) {
/* sort by name in list */
ListBase * lb = which_libbase ( mainl , GS ( id - > name ) ) ;
id_sort_by_name ( lb , id ) ;
}
}
}
2015-10-12 13:46:58 +02:00
static ID * link_named_part_ex ( const bContext * C , Main * mainl , FileData * fd , const char * idname , const int idcode , const int flag )
2011-05-26 20:45:19 +00:00
{
2015-10-12 13:46:58 +02:00
ID * id = link_named_part ( mainl , fd , idname , idcode ) ;
2011-05-26 20:45:19 +00:00
2012-03-24 06:18:31 +00:00
if ( id & & ( GS ( id - > name ) = = ID_OB ) ) { /* loose object: give a base */
2012-05-17 12:59:34 +00:00
Scene * scene = CTX_data_scene ( C ) ; /* can be NULL */
2012-03-24 06:18:31 +00:00
if ( scene ) {
2011-05-26 20:45:19 +00:00
Base * base ;
Object * ob ;
2012-05-17 12:59:34 +00:00
2012-04-29 17:11:40 +00:00
base = MEM_callocN ( sizeof ( Base ) , " app_nam_part " ) ;
2011-05-26 20:45:19 +00:00
BLI_addtail ( & scene - > base , base ) ;
2012-05-17 12:59:34 +00:00
ob = ( Object * ) id ;
2014-09-29 14:22:50 +02:00
/* link at active layer (view3d if available in context, else scene one */
2012-03-24 06:18:31 +00:00
if ( ( flag & FILE_ACTIVELAY ) ) {
2011-05-26 20:45:19 +00:00
View3D * v3d = CTX_wm_view3d ( C ) ;
2014-09-29 14:22:50 +02:00
ob - > lay = BKE_screen_view3d_layer_active ( v3d , scene ) ;
2011-05-26 20:45:19 +00:00
}
2012-05-17 12:59:34 +00:00
2014-06-18 16:01:51 +10:00
ob - > mode = OB_MODE_OBJECT ;
2012-05-17 12:59:34 +00:00
base - > lay = ob - > lay ;
base - > object = ob ;
2011-05-26 20:45:19 +00:00
ob - > id . us + + ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( flag & FILE_AUTOSELECT ) {
2011-05-26 20:45:19 +00:00
base - > flag | = SELECT ;
base - > object - > flag = base - > flag ;
/* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
}
}
2002-10-12 11:37:38 +00:00
}
2013-09-03 17:24:07 +00:00
else if ( id & & ( GS ( id - > name ) = = ID_GR ) ) {
/* tag as needing to be instanced */
if ( flag & FILE_GROUP_INSTANCE )
id - > flag | = LIB_DOIT ;
}
2012-05-17 12:59:34 +00:00
2011-05-26 20:45:19 +00:00
return id ;
2002-10-12 11:37:38 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Link a named datablock from an external blend file .
*
* \ param mainl The main database to link from ( not the active one ) .
* \ param bh The blender file handle .
* \ param idname The name of the datablock ( without the 2 char ID prefix ) .
* \ param idcode The kind of datablock to link .
* \ return the appended ID when found .
*/
2015-10-12 13:46:58 +02:00
ID * BLO_library_link_named_part ( Main * mainl , BlendHandle * * bh , const char * idname , const int idcode )
2009-09-12 19:54:39 +00:00
{
2012-05-17 12:59:34 +00:00
FileData * fd = ( FileData * ) ( * bh ) ;
2015-10-12 13:46:58 +02:00
return link_named_part ( mainl , fd , idname , idcode ) ;
2011-05-26 20:45:19 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Link a named datablock from an external blend file .
* Optionally instantiate the object / group in the scene when the flags are set .
*
* \ param C The context , when NULL instantiating object in the scene isn ' t done .
* \ param mainl The main database to link from ( not the active one ) .
* \ param bh The blender file handle .
* \ param idname The name of the datablock ( without the 2 char ID prefix ) .
* \ param idcode The kind of datablock to link .
* \ param flag Options for linking , used for instantiating .
* \ return the appended ID when found .
*/
ID * BLO_library_link_named_part_ex (
const bContext * C , Main * mainl , BlendHandle * * bh ,
const char * idname , const int idcode , const short flag )
2009-09-12 19:54:39 +00:00
{
2012-05-17 12:59:34 +00:00
FileData * fd = ( FileData * ) ( * bh ) ;
2015-10-12 13:46:58 +02:00
return link_named_part_ex ( C , mainl , fd , idname , idcode , flag ) ;
2009-09-12 19:54:39 +00:00
}
2015-10-12 13:46:58 +02:00
static void link_id_part ( FileData * fd , Main * mainvar , ID * id , ID * * r_id )
2002-10-12 11:37:38 +00:00
{
2015-03-11 00:05:14 +11:00
BHead * bhead = find_bhead_from_idname ( fd , id - > name ) ;
if ( bhead ) {
id - > flag & = ~ LIB_READ ;
id - > flag | = LIB_NEED_EXPAND ;
// printf("read lib block %s\n", id->name);
read_libblock ( fd , mainvar , bhead , id - > flag , r_id ) ;
2002-10-12 11:37:38 +00:00
}
}
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
2015-10-12 13:46:58 +02:00
static Main * library_link_begin ( Main * mainvar , FileData * * fd , const char * filepath )
2002-10-12 11:37:38 +00:00
{
2002-12-20 02:08:46 +00:00
Main * mainl ;
2012-05-25 17:13:30 +00:00
( * fd ) - > mainlist = MEM_callocN ( sizeof ( ListBase ) , " FileData.mainlist " ) ;
2012-05-17 12:59:34 +00:00
2015-10-12 13:46:58 +02:00
/* clear for group instantiating tag */
2013-12-30 13:25:27 +11:00
BKE_main_id_tag_listbase ( & ( mainvar - > group ) , false ) ;
2013-09-03 17:24:07 +00:00
2003-04-26 18:01:01 +00:00
/* make mains */
2012-05-25 17:13:30 +00:00
blo_split_main ( ( * fd ) - > mainlist , mainvar ) ;
2012-05-17 12:59:34 +00:00
2003-04-26 18:01:01 +00:00
/* which one do we need? */
2012-05-25 17:13:30 +00:00
mainl = blo_find_main ( * fd , filepath , G . main - > name ) ;
2006-11-26 21:17:15 +00:00
2010-05-05 14:59:22 +00:00
/* needed for do_version */
2012-05-17 12:59:34 +00:00
mainl - > versionfile = ( * fd ) - > fileversion ;
2010-05-05 14:59:22 +00:00
read_file_version ( * fd , mainl ) ;
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
read_file_bhead_idname_map_create ( * fd ) ;
# endif
2006-11-26 21:17:15 +00:00
2009-09-12 19:54:39 +00:00
return mainl ;
}
2015-10-12 14:21:34 +02:00
/**
* Initialize the BlendHandle for linking library data .
*
* \ param mainvar The current main database , e . g . G . main or CTX_data_main ( C ) .
* \ param bh A blender file handle as returned by \ a BLO_blendhandle_from_file or \ a BLO_blendhandle_from_memory .
* \ param filepath Used for relative linking , copied to the \ a lib - > name .
* \ return the library Main , to be passed to \ a BLO_library_append_named_part as \ a mainl .
*/
2015-10-12 13:46:58 +02:00
Main * BLO_library_link_begin ( Main * mainvar , BlendHandle * * bh , const char * filepath )
2009-09-12 19:54:39 +00:00
{
2012-05-17 12:59:34 +00:00
FileData * fd = ( FileData * ) ( * bh ) ;
2015-10-12 13:46:58 +02:00
return library_link_begin ( mainvar , & fd , filepath ) ;
2009-09-12 19:54:39 +00:00
}
2011-08-04 09:47:09 +00:00
/* Context == NULL signifies not to do any scene manipulation */
2015-10-12 13:46:58 +02:00
static void library_link_end ( const bContext * C , Main * mainl , FileData * * fd , int idcode , short flag )
2009-09-12 19:54:39 +00:00
{
2011-01-06 01:35:07 +00:00
Main * mainvar ;
2010-10-07 21:25:05 +00:00
Library * curlib ;
2012-05-17 12:59:34 +00:00
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/* expander now is callback function */
BLO_main_expander ( expand_doit_library ) ;
2010-01-26 14:00:13 +00:00
/* make main consistent */
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
BLO_expand_main ( * fd , mainl ) ;
2012-05-17 12:59:34 +00:00
2003-04-26 18:01:01 +00:00
/* do this when expand found other libs */
2012-05-25 17:13:30 +00:00
read_libraries ( * fd , ( * fd ) - > mainlist ) ;
2010-10-07 21:25:05 +00:00
2012-05-17 12:59:34 +00:00
curlib = mainl - > curlib ;
2009-09-12 19:54:39 +00:00
/* make the lib path relative if required */
2012-03-24 06:18:31 +00:00
if ( flag & FILE_RELPATH ) {
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
}
2012-05-17 12:59:34 +00:00
2012-05-25 17:13:30 +00:00
blo_join_main ( ( * fd ) - > mainlist ) ;
mainvar = ( * fd ) - > mainlist - > first ;
MEM_freeN ( ( * fd ) - > mainlist ) ;
2012-05-17 12:59:34 +00:00
mainl = NULL ; /* blo_join_main free's mainl, cant use anymore */
2008-12-19 16:36:15 +00:00
lib_link_all ( * fd , mainvar ) ;
2014-04-01 11:34:00 +11: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 */
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( C ) {
2012-05-17 12:59:34 +00:00
Scene * scene = CTX_data_scene ( C ) ;
2011-08-04 09:47:09 +00:00
/* give a base to loose objects. If group append, do it for objects too */
2012-03-24 06:18:31 +00:00
if ( scene ) {
2014-02-03 18:55:59 +11:00
const bool is_link = ( flag & FILE_LINK ) ! = 0 ;
2012-05-17 12:59:34 +00:00
if ( idcode = = ID_SCE ) {
2012-03-18 07:38:51 +00:00
/* don't instance anything when linking in scenes, assume the scene its self instances the data */
2011-08-04 09:47:09 +00:00
}
else {
2013-03-24 12:13:13 +00:00
give_base_to_objects ( mainvar , scene , curlib , idcode , is_link , flag & FILE_ACTIVELAY ) ;
2012-05-17 12:59:34 +00:00
2011-08-04 09:47:09 +00:00
if ( flag & FILE_GROUP_INSTANCE ) {
give_base_to_groups ( mainvar , scene ) ;
}
2010-01-07 14:28:00 +00:00
}
2009-08-22 17:11:36 +00:00
}
2011-08-04 09:47:09 +00:00
else {
printf ( " library_append_end, scene is NULL (objects wont get bases) \n " ) ;
}
2011-05-19 06:17:44 +00:00
}
2013-09-03 17:24:07 +00:00
2015-10-12 13:46:58 +02:00
/* clear group instantiating tag */
2013-12-30 13:25:27 +11:00
BKE_main_id_tag_listbase ( & ( mainvar - > group ) , false ) ;
2013-09-03 17:24:07 +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 */
2012-03-24 06:18:31 +00:00
if ( ( * fd ) - > flags & FD_FLAGS_SWITCH_ENDIAN ) {
2012-04-29 17:11:40 +00:00
blo_freefiledata ( * fd ) ;
2008-03-20 04:59:59 +00:00
* fd = NULL ;
2012-12-11 22:00:22 +00:00
}
2009-09-12 19:54:39 +00:00
}
2015-10-12 14:21:34 +02:00
/**
* Finalize the linking process ( among other things , ensures remaining needed intantiation is done ) .
* \ note Do not use \ a bh after calling this function , it may frees it .
*
* \ param C The context , when NULL instantiating object in the scene isn ' t done .
* \ param mainl The main database to link from ( not the active one ) .
* \ param bh The blender file handle .
* \ param idcode The kind of datablock that has been linked .
* \ param flag Options for for instantiating .
*/
2015-10-12 13:46:58 +02:00
void BLO_library_link_end ( const bContext * C , struct Main * mainl , BlendHandle * * bh , int idcode , short flag )
2009-09-12 19:54:39 +00:00
{
2012-05-17 12:59:34 +00:00
FileData * fd = ( FileData * ) ( * bh ) ;
2015-10-12 13:46:58 +02:00
library_link_end ( C , mainl , & fd , idcode , flag ) ;
2012-05-17 12:59:34 +00:00
* bh = ( BlendHandle * ) fd ;
2007-03-16 05:39:30 +00:00
}
2011-05-18 19:42:30 +00:00
void * BLO_library_read_struct ( FileData * fd , BHead * bh , const char * blockname )
2007-03-16 05:39:30 +00:00
{
2011-05-18 19:42:30 +00:00
return read_struct ( fd , bh , blockname ) ;
2007-03-16 05:39:30 +00:00
}
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 ] ;
2012-05-17 12:59:34 +00:00
int a , tot = 0 ;
a = set_listbasepointers ( mainvar , lbarray ) ;
2012-03-24 07:52:14 +00:00
while ( a - - ) {
2011-01-06 01:35:07 +00:00
ID * id ;
2012-05-17 12:59:34 +00:00
for ( id = lbarray [ a ] - > first ; id ; id = id - > next ) {
2002-10-12 11:37:38 +00:00
if ( id - > flag & LIB_READ )
tot + + ;
2012-05-17 12:59:34 +00:00
}
2002-10-12 11:37:38 +00:00
}
return tot ;
}
static void read_libraries ( FileData * basefd , ListBase * mainlist )
{
2012-05-17 12:59:34 +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 ] ;
2014-04-01 11:34:00 +11:00
int a ;
bool do_it = true ;
2012-05-17 12:59:34 +00:00
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
/* expander now is callback function */
BLO_main_expander ( expand_doit_library ) ;
2012-05-19 13:28:19 +00:00
while ( do_it ) {
2014-04-01 11:34:00 +11:00
do_it = false ;
2012-05-17 12:59:34 +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 ;
2012-03-24 07:52:14 +00:00
while ( mainptr ) {
2012-05-17 12:59:34 +00:00
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);
2012-03-24 06:18:31 +00:00
if ( tot ) {
2012-05-17 12:59:34 +00:00
FileData * fd = mainptr - > curlib - > filedata ;
if ( fd = = NULL ) {
2012-12-27 15:07:19 +00:00
2010-01-11 11:59:14 +00:00
/* printf and reports for now... its important users know this */
2012-05-17 12:59:34 +00:00
2012-12-27 15:07:19 +00:00
/* if packed file... */
if ( mainptr - > curlib - > packedfile ) {
PackedFile * pf = mainptr - > curlib - > packedfile ;
2014-10-19 12:49:01 +02:00
blo_reportf_wrap (
basefd - > reports , RPT_INFO , TIP_ ( " Read packed library: '%s', parent '%s' " ) ,
mainptr - > curlib - > name ,
library_parent_filepath ( mainptr - > curlib ) ) ;
2012-12-27 15:07:19 +00:00
fd = blo_openblendermemory ( pf - > data , pf - > size , basefd - > reports ) ;
/* needed for library_append and read_libraries */
BLI_strncpy ( fd - > relabase , mainptr - > curlib - > filepath , sizeof ( fd - > relabase ) ) ;
}
else {
2014-10-19 12:49:01 +02:00
blo_reportf_wrap (
basefd - > reports , RPT_INFO , TIP_ ( " Read library: '%s', '%s', parent '%s' " ) ,
mainptr - > curlib - > filepath ,
mainptr - > curlib - > name ,
library_parent_filepath ( mainptr - > curlib ) ) ;
2012-12-27 15:07:19 +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 */
2012-08-08 18:21:54 +00:00
if ( G . debug_value = = - 666 ) {
2012-05-17 12:59:34 +00:00
while ( fd = = NULL ) {
char newlib_path [ FILE_MAX ] = { 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 " ) ;
2012-05-17 12:59:34 +00:00
2012-03-24 06:18:31 +00:00
if ( scanf ( " %s " , newlib_path ) > 0 ) {
2011-10-19 23:10:54 +00:00
BLI_strncpy ( mainptr - > curlib - > name , newlib_path , sizeof ( mainptr - > curlib - > name ) ) ;
BLI_strncpy ( mainptr - > curlib - > filepath , newlib_path , sizeof ( mainptr - > curlib - > filepath ) ) ;
2013-03-05 06:26:10 +00:00
BLI_cleanup_path ( G . main - > name , mainptr - > curlib - > filepath ) ;
2010-04-23 11:19:06 +00:00
2012-05-17 12:59:34 +00:00
fd = blo_openblenderfile ( mainptr - > curlib - > filepath , basefd - > reports ) ;
2012-09-05 01:42:52 +00:00
2012-03-24 06:18:31 +00:00
if ( fd ) {
2012-09-05 01:42:52 +00:00
fd - > mainlist = mainlist ;
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
}
}
}
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
if ( fd ) {
2012-05-28 10:32:38 +00:00
/* share the mainlist, so all libraries are added immediately in a
* single list . it used to be that all FileData ' s had their own list ,
* but with indirectly linking this meant we didn ' t catch duplicate
* libraries properly */
fd - > mainlist = mainlist ;
2012-05-17 12:59:34 +00:00
fd - > reports = basefd - > reports ;
2009-09-13 03:30:51 +00:00
2002-10-12 11:37:38 +00:00
if ( fd - > libmap )
oldnewmap_free ( fd - > libmap ) ;
2012-05-17 12:59:34 +00:00
2005-12-16 17:35:38 +00:00
fd - > libmap = oldnewmap_new ( ) ;
2005-01-05 10:31:27 +00:00
2012-05-17 12:59:34 +00:00
mainptr - > curlib - > filedata = fd ;
mainptr - > versionfile = fd - > fileversion ;
2007-12-01 14:36:06 +00:00
/* subversion */
read_file_version ( fd , mainptr ) ;
2015-03-11 00:33:44 +11:00
# ifdef USE_GHASH_BHEAD
read_file_bhead_idname_map_create ( fd ) ;
# endif
2002-10-12 11:37:38 +00:00
}
2013-03-09 03:46:30 +00:00
else {
mainptr - > curlib - > filedata = NULL ;
}
2012-05-17 12:59:34 +00:00
if ( fd = = NULL ) {
2013-11-29 23:16:13 +06:00
blo_reportf_wrap ( basefd - > reports , RPT_WARNING , TIP_ ( " Cannot find lib '%s' " ) ,
2012-01-05 09:50:07 +00:00
mainptr - > curlib - > filepath ) ;
2010-01-11 11:59:14 +00:00
}
2002-10-12 11:37:38 +00:00
}
2012-03-24 06:18:31 +00:00
if ( fd ) {
2014-04-01 11:34:00 +11:00
do_it = true ;
2012-05-17 12:59:34 +00:00
a = set_listbasepointers ( mainptr , lbarray ) ;
2012-03-24 07:52:14 +00:00
while ( a - - ) {
2012-05-17 12:59:34 +00:00
ID * id = lbarray [ a ] - > first ;
2012-03-24 07:52:14 +00:00
while ( id ) {
2012-05-17 12:59:34 +00:00
ID * idn = id - > next ;
2012-03-24 06:18:31 +00:00
if ( id - > flag & LIB_READ ) {
2012-05-17 12:59:34 +00:00
ID * realid = NULL ;
2002-10-12 11:37:38 +00:00
BLI_remlink ( lbarray [ a ] , id ) ;
2012-05-17 12:59:34 +00:00
2015-10-12 13:46:58 +02:00
link_id_part ( fd , mainptr , id , & realid ) ;
2010-01-11 12:24:08 +00:00
if ( ! realid ) {
2014-10-19 12:49:01 +02:00
blo_reportf_wrap (
fd - > reports , RPT_WARNING ,
TIP_ ( " LIB ERROR: %s: '%s' missing from '%s', parent '%s' " ) ,
BKE_idcode_to_name ( GS ( id - > name ) ) ,
id - > name + 2 ,
mainptr - > curlib - > filepath ,
library_parent_filepath ( mainptr - > curlib ) ) ;
2010-01-11 12:24:08 +00:00
}
2005-12-16 17:35:38 +00:00
change_idid_adr ( mainlist , basefd , id , realid ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
MEM_freeN ( id ) ;
}
2012-05-17 12:59:34 +00:00
id = idn ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
BLO_expand_main ( fd , mainptr ) ;
2002-10-12 11:37:38 +00:00
}
}
2012-05-17 12:59:34 +00:00
mainptr = mainptr - > next ;
2002-10-12 11:37:38 +00:00
}
}
2005-12-16 17:35:38 +00:00
/* test if there are unread libblocks */
2012-05-17 12:59:34 +00:00
for ( mainptr = mainl - > next ; mainptr ; mainptr = mainptr - > next ) {
a = set_listbasepointers ( mainptr , lbarray ) ;
2012-03-24 07:52:14 +00:00
while ( a - - ) {
2012-05-21 06:33:32 +00:00
ID * id , * idn = NULL ;
for ( id = lbarray [ a ] - > first ; id ; id = idn ) {
idn = id - > next ;
2012-03-24 06:18:31 +00:00
if ( id - > flag & LIB_READ ) {
2002-10-12 11:37:38 +00:00
BLI_remlink ( lbarray [ a ] , id ) ;
2014-10-19 12:49:01 +02:00
blo_reportf_wrap (
basefd - > reports , RPT_WARNING ,
TIP_ ( " LIB ERROR: %s: '%s' unread lib block missing from '%s', parent '%s' " ) ,
BKE_idcode_to_name ( GS ( id - > name ) ) ,
id - > name + 2 ,
mainptr - > curlib - > filepath ,
library_parent_filepath ( mainptr - > curlib ) ) ;
2005-12-16 17:35:38 +00:00
change_idid_adr ( mainlist , basefd , id , NULL ) ;
2012-05-17 12:59:34 +00:00
2002-10-12 11:37:38 +00:00
MEM_freeN ( id ) ;
}
}
}
2005-12-16 17:35:38 +00:00
}
/* do versions, link, and free */
2012-05-17 12:59:34 +00:00
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 ! */
2012-03-24 06:18:31 +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
}
2012-03-24 06:18:31 +00:00
if ( mainptr - > curlib - > filedata )
2005-12-16 17:35:38 +00:00
lib_link_all ( mainptr - > curlib - > filedata , mainptr ) ;
2012-03-24 06:18:31 +00:00
if ( mainptr - > curlib - > filedata ) blo_freefiledata ( mainptr - > curlib - > filedata ) ;
2012-05-17 12:59:34 +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
2011-10-19 23:10:54 +00:00
BlendFileData * blo_read_blendafterruntime ( int file , const 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 ;
2012-05-17 12:59:34 +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 ) ) ;
2012-05-17 12:59:34 +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 ;
2012-05-17 12:59:34 +00:00
fd - > reports = reports ;
bfd = blo_read_file_internal ( fd , " " ) ;
2002-10-12 11:37:38 +00:00
blo_freefiledata ( fd ) ;
2012-05-17 12:59: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
return bfd ;
2002-10-12 11:37:38 +00:00
}