Commit Graph

136 Commits

Author SHA1 Message Date
Campbell Barton 9149e89421 Merge branch 'master' into blende2.8 2018-12-17 10:25:40 +11:00
Campbell Barton 98f43ba3e4 Cleanup: use bit-shifted flag definitions in DNA 2018-12-17 09:55:47 +11:00
Campbell Barton 55e719ec35 Merge branch 'master' into blender2.8 2018-11-14 17:21:34 +11:00
Campbell Barton d7f55c4ff5 Cleanup: comment block tabs 2018-11-14 17:10:56 +11:00
Alexander Gavrilov 798cdaeeb6 Implement an Armature constraint that mimics the modifier.
The main use one can imagine for this is adding tweak controls to
parts of a model that are already deformed by multiple other major
bones. It is natural to expect such locations to deform as if the
tweaks aren't there by default; however currently there is no easy
way to make a bone follow multiple other bones.

This adds a new constraint that implements the math behind the Armature
modifier, with support for explicit weights, bone envelopes, and dual
quaternion blending. It can also access bones from multiple armatures
at the same time (mainly because it's easier to code it that way.)

This also fixes dquat_to_mat4, which wasn't used anywhere before.

Differential Revision: https://developer.blender.org/D3664
2018-11-06 10:56:08 +03:00
Alexander Gavrilov e5b18390fa Shrinkwrap: implement the use of smooth normals in constraint & modifier.
- Use smooth normals to displace in Above Surface mode.
- Add an option to align an axis to the normal in the constraint.

I've seen people request the alignment feature, and it seems useful.
For the actual aligning I use the damped track logic.

In order to conveniently keep mesh data needed for normal
computation together, a new data structure is introduced.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D3762
2018-10-17 17:55:34 +03:00
Alexander Gavrilov e38a0b3748 Shrinkwrap Constraint: implement projection features from the modifier.
Allow raycasting in two directions and culling front or back faces.

Also implement a new Invert Cull option in both constraint and
modifier that can be used to aim for faces aligned with the project
axis direction when raycasting both ways.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D3737
2018-10-01 15:47:03 +03:00
Alexander Gavrilov 3378782eee Implement additional modes for Shrinkwrap to a surface.
In addition to the original map to surface and Keep Above Surface,
add modes that only affect vertices that are inside or outside
the object. This is inspired by the Limit Distance constraint,
and can be useful for crude collision detection in rigs.

The inside/outside test works based on face normals and may not be
completely reliable near 90 degree or sharper angles in the target.

Reviewers: campbellbarton, mont29

Differential Revision: https://developer.blender.org/D3717
2018-09-26 16:52:58 +03:00
Brecht Van Lommel 253dce07d7 Merge branch 'master' into blender2.8 2018-09-24 17:42:52 +02:00
Brecht Van Lommel 0cff044d84 Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3719
2018-09-24 17:28:40 +02:00
Alexander Gavrilov 2aa26de378 Use full transformation of B-Bone segments in Copy Transforms.
Currently constraints can only read the location along the
spline. This obviously limits opportunities for complex bone
interactions in rigs.

This patch exposes access to rotation and scale as well in
Copy Transforms. However, due to the way how things work,
this data cannot be smoothly interpolated, and abruptly
changes when switching to the next segment.

Reviewers: aligorith

Differential Revision: https://developer.blender.org/D3545
2018-08-13 20:37:53 +03:00
Alexander Gavrilov 47af343b61 Implement multiplicative Copy Scale and make it the new default.
Scale is a multiplicative quantity, so adding it doesn't make sense.
However, for backward compatibility reasons, and in case somebody
actually desires the old additive behavior, the old way remains as
an option.

Without this change the only way to properly combine scale is via
parenting or the complicated Transformation constraint.

The new mode is turned on by a flag for file compatibility, but the
RNA option is reversed so that the new behavior feels more default.

Reviewers: aligorith

Differential Revision: https://developer.blender.org/D3558
2018-08-13 19:57:15 +03:00
Alexander Gavrilov a5aeca4a64 Fix dependency graph for constraints depending on B-Bone shape.
Some constraints have an option to take the final bezier shape of
the target B-Bone into account. This shape usually depends on two
other bones in addition to the target itself, so the graph should
include the relevant dependencies.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D3591
2018-08-13 19:02:49 +03:00
Campbell Barton 06a1a66a9b Merge branch 'master' into blender2.8 2018-06-17 17:10:19 +02:00
Campbell Barton 78fbd146f3 Cleanup: trailing space for DNA headers 2018-06-17 17:04:09 +02:00
Campbell Barton bfe1d0e0dc Merge branch 'master' into blender2.8 2018-06-01 18:26:42 +02:00
Campbell Barton 75fc1c3507 Cleanup: trailing whitespace (comment blocks)
Strip unindented comment blocks - mainly headers to avoid conflicts.
2018-06-01 18:19:39 +02:00
Bastien Montagne 0fb5a39baf Static Override: add insertion for modifiers and one constraints, fix editing of inserted items in collections.
Now insertable collection items have a flag to say they are 'local' (and
hence can be freely edited).
2018-05-02 18:14:19 +02:00
Dalai Felinto 159806140f Removing Blender Game Engine from Blender 2.8
Folders removed entirely:
* //extern/recastnavigation
* //intern/decklink
* //intern/moto
* //source/blender/editors/space_logic
* //source/blenderplayer
* //source/gameengine

This includes DNA data and any reference to the BGE code in Blender itself.
We are bumping the subversion.

Pending tasks:
* Tile/clamp code in image editor draw code.
* Viewport drawing code (so much of this will go away because of BI removal
  that we can wait until then to remove this.
2018-04-17 17:51:28 +02:00
Campbell Barton 99520e3f92 Cleanup: use 'e' prefix for enum typedefs
Convention was only followed loosely,
apply to DNA where changes aren't likely to conflict.

(Skipped ModifierType for eg).
2017-10-17 13:49:20 +11:00
Kévin Dietrich 753edafcb7 Alembic: store a pointer to the object reader in the cache modifiers and
constraints.

This avoids traversing the archive everytime object data is needed and
gives an overall consistent ~2x speedup here with files containing
between 136 and 500 Alembic objects. Also this somewhat nicely de-
duplicates code between data creation (upon import) and data streaming
(modifiers and constraints).

The only worying part is what happens when a CacheFile is deleted and/or
has its path changed. For now, we traverse the whole scene and for each
object using the CacheFile we free the pointer and NULL-ify it (see
BKE_cachefile_clean), but at some point this should be re-considered and
make use of the dependency graph.
2016-10-29 12:23:09 +02:00
Kévin Dietrich 61050f75b1 Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.

A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.

Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.

Reviewers: sergey, campbellbarton, mont29

Reviewed By: sergey, campbellbarton, mont29

Differential Revision: https://developer.blender.org/D2060
2016-08-06 10:58:13 +02:00
Joshua Leung 49aeee5a3d Bendy Bones: Advanced B-Bones for Easier + Simple Rigging
This commit/patch/branch brings a bunch of powerful new options for B-Bones and
for working with B-Bones, making it easier for animators to create their own
rigs, using fewer bones (which also means hopefully lighter + faster rigs ;)
This functionality was first demoed by Daniel at BConf15

Some highlights from this patch include:
* You can now directly control the shape of B-Bones using a series of properties
  instead of being restricted to trying to indirectly control them through the
  neighbouring bones.  See the "Bendy Bones" panel...

* B-Bones can be shaped in EditMode to define a "curved rest pose" for the bone.
  This is useful for things like eyebrows and mouths/eyelids

* You can now make B-Bones use custom bones as their reference bone handles,
  instead of only using the parent/child bones. To do so, enable the
  "Use Custom Reference Handles" toggle. If none are specified, then the BBone will
  only use the Bendy Bone properties.

* Constraints Head/Tail option can now slide along the B-Bone shape, instead of
  just linearly interpolating between the endpoints of the bone.

For more details, see:
* http://aligorith.blogspot.co.nz/2016/05/bendy-bones-dev-update.html
* http://aligorith.blogspot.co.nz/2016/05/an-in-depth-look-at-how-b-bones-work.html



-- Credits --
Original Idea: Daniel M Lara (pepeland)
Original Patch/Research: Jose Molina
Additional Development + Polish: Joshua Leung (aligorith)
Testing/Feedback: Daniel M Lara (pepeland), Juan Pablo Bouza (jpbouza)
2016-05-18 03:19:06 +12:00
Joshua Leung f0361fcf54 Pataz-Gooseberry Request: Limits on Volume Preservation for Spline IK
This commit adds a new type of volume preservation mode to Spline IK
which makes it possible to set limits on the minimum and maximum
scaling of bone "fatness".

* The old volume preseving mode has been kept but renamed, to avoid
  breaking old rigs. "Volume Presevation" uses the new method, while
  "Inverse Preservation" is the old one.

* The code and settings for this new xz scale mode are directly lifted
  from the improved Stretch To constraint
2015-01-13 18:06:53 +13:00
Lukas Tönne f9cbb908a3 Integrated limits for volume preservation in stretch-to constraints.
Currently the volume variation feature in stretch constraints is
unlimited. This has to be compensated by riggers by adding scale limit
constraints, but these are unaware of the stretch orientation and can
lead to flipping. Also the stretch calculation itself is not working
properly and can lead to collapsing volume.

The patch fixes this with several modifications:
- Interpret the volume variation factor as exponent, which works better
  with large values for artistic purposes.
- Add integrated limits to the volume "bulge" factor, so secondary
  constraints for compensation become unnecessary
- Add a smoothness factor to make limits less visible.

Eventually a generic volume preservation constraint would be nicer,
because multiple constraints currently implement volume variation of
their own. This feature could actually work very nicely independent from
other constraint features.

Differential Revision: https://developer.blender.org/D826
2014-10-13 19:58:53 +02:00
Sergey Sharybin 157fc43369 Implement option to parent object to undistorted position of 2D track 2014-07-24 21:01:19 +06:00
Bastien Montagne 912151763d Followup to rB8714ae09f894: better not have several RNA properties affect a single DNA one. 2014-04-28 13:25:14 +02:00
Bastien Montagne 8714ae09f8 Fix T39563: Tiny unit-display problem in constraint panels.
There is no good solution here, since RNA props can only have one type/unit.
Tried to find the less worse one - have different RNA props for same DNA value
(a bit like the angle/length for camera lens).

Also fixed two other issues with Transform conctraint:
* Angle were still in degrees (yes, another backward-compatibility breacking).
* Scale was absolute, unlike loc/rot.

Also cleaned up a bit the code, replaced some magic numbers by proper enums, ...
2014-04-07 12:17:01 +02:00
Campbell Barton e492fad130 shrink-wrap constraint, improve and remove some limitations.
- ability to change the space the axis is projected in (so you can choose worldspace or -space, was always local-space before).
- support projecting on a negative axis, without this some very simple clamping is not possible if the direction happened not to be positive.
- add distance limit (same as modifier), without this single meshes surrounding an object would make the constraint impossible to use in some cases (it would snap to the wrong side).

note: this removes the ability to project on multiple axes at once but this option only added up directions and didnt project on multiple axes as you might expect.
2013-09-07 12:59:16 +00:00
Campbell Barton f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
Campbell Barton 589ada7f0c code cleanup: correct spelling 2012-09-28 06:45:20 +00:00
Campbell Barton aa49ca25d5 incorrect spelling in comments 2012-09-26 20:05:38 +00:00
Campbell Barton b96c622015 style cleanup 2012-08-11 22:12:32 +00:00
Sergey Sharybin 9f30c7147c Frame matching methods for follow track constraint
This is needed in cases when using blender camera with different
resolution than original footage. Behaves in the same way as
background picture framing.
2012-08-09 16:57:02 +00:00
Bastien Montagne 558721ab59 More spell checking. 2012-07-04 15:04:38 +00:00
Sergey Sharybin fb278a501e Ensure enums in DNA files has got explicit values
See http://wiki.blender.org/index.php/Dev:Doc/CodeStyle#Macros.2C_Enums.2C_Inline_functions
2012-06-15 14:11:05 +00:00
Joshua Leung 8489e100dc Naming + Style tweaks for newly added flag for Action Constraint
Old names used could conflict with other things too easily in future
2012-06-12 11:54:31 +00:00
Bastien Montagne 2127e62c9b "Fix" for [#30704] Action Constraint mapping bug
Feature request rather than a real bug: allow constrained bone to use "object" part of the linked action, in addition to "same-named bone" part.
2012-06-12 06:22:23 +00:00
Dalai Felinto dfa307f73f constraints names are not matching (rna and constraint.c). doing rna->constraint.c 2012-06-08 21:04:48 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Sergey Sharybin 51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
Sergey Sharybin cd84a43334 Camera tracking: added depth object to Follow Track constraint
If this object is defined, object with Follow Track constraint would be
projected into surface of this depth object.
If object is not set or there's no projection onto it, projection plane
calculated based on original object position would be used.

This allows to make cheap facial mocap.
2012-01-04 17:20:08 +00:00
Sergey Sharybin 3c6e818b22 Object tracking integration
This commits merges object tracking implementation from tomato branch.

Summarized changes from branch:

- Added list of objects to be tracked. Default there's only one object called
  "Camera" which is used for solving camera motion. Other objects can be added
  and each of them will have it;s own list of tracks. Only one object can be used
  for camera solving at this moment.
- Added new constraint called "Object Tracking" which makes oriented object be
  moving in the save way as solved object motion.
- Scene orientation tools can be used for orienting object to bundles.
- Object has got scale to define "depth" in camera space.
- All tools which works with list of tracks or reconstruction data now
  gets that lists from active editing object.
- All objects and their tracking data are available via python api.
- Improvements in witness cameras workflow,
2011-12-30 18:06:02 +00:00
Campbell Barton ca629d5ccc minor dna header cleanup 2011-12-30 07:25:49 +00:00
Sergey Sharybin c2ae77e5bd Merging r42896 through r42944 from trunk into soc-2911-tomato 2011-12-28 18:31:32 +00:00
Campbell Barton 0b00bb236c make MOD_dynamicpaint.c use more typical gpl2+ text and some formatting edits in DNA 2011-12-28 11:08:38 +00:00
Sergey Sharybin 8a9d901c81 Camera tracking: add camera to follow track and object solver constraint
Object used to be parented to active camera which isn't very convenient when
working with witness cameras.

Now parent camera can be specified in constraint (if it's not specified, active camera is used)
2011-12-15 20:38:23 +00:00
Sergey Sharybin ba16e7d631 Object tracking: object with object solver constraint is now parented to scene's camera
Made Object Solver operator parent object to scene's camera. Behavior is pretty much
familiar to Child Of constraint -- it stores inverted transformation matrix which gives
constant offset in parent's space.
Current files would open incorrect, to make object aligned well again, just press
"Set Inverse" button in Object Solver constraint.
Fixed orientation operators so now they should work in all cases.
Also changed behavior of Set Origin operator which now sets origin to the median
point of all selected tracks/
2011-12-15 16:09:57 +00:00
Sergey Sharybin 9355cc5c39 Object tracking; initial commit
This commit implements basis stuff needed for object tracking,
use case isn't perfect now, interface also should be cleaned a bit.

- Added list of objects to be tracked. Default there's only one object called
  "Camera" which is used for solving camera motion. Other objects can be added
  and each of them will have it;s own list of tracks. Only one object can be used
  for camera solving at this moment.
- Added new constraint called "Object Tracking" which makes oriented object be
  moving in the save way as solved object motion.
- Scene orientation tools can be used for orienting object to bundles.
- All tools which works with list of tracks or reconstruction data now
  gets that lists from active editing object.
- All objects and their tracking data are available via python api.
2011-12-05 18:57:17 +00:00
Campbell Barton 31ff21d735 add define for deprecated DNA struct members: DNA_DEPRECATED,
this means use of deprecated struct members gives a warning.

- makesdna.c preprocessor skips this.
- DNA_DEPRECATED_ALLOW is used so readfile.c can do versioning without warnings.
- this exposes some use of deprecated struct members, will deal with this after.
2011-12-04 06:05:48 +00:00