Commit Graph

54 Commits

Author SHA1 Message Date
Campbell Barton f1f7648d4c fix for error setting vector handles to free when both vector handles were selected but not the mid-point.
only one of the handles would be changed to the HD_FREE.

effected curves and fcurves.
2013-10-01 08:18:43 +00:00
Campbell Barton 66f6ace938 fix for action editor view-selected behaving strangely.
- when an fcurve had no selected keyframes, a default fallback value was used which caused view-selected to include frame 1, even when no selected frames were there.

- the vertical axis was always reset, ideally we would center vertically too but the way this operator currently works we only know about the frame range,
  now don't change the vertical scroll when viewing selected since it would always jump to the top of the screen (view-all still acts this way).
2013-07-18 02:59:28 +00:00
Campbell Barton 09c41019a8 use const pointers for file loading and booleans for animation system return values passed as pointers. 2013-03-17 19:13:04 +00:00
Campbell Barton b77eccf801 patch [#33985] Added FModifierEnvelope control_point add remove to API
from Peter Staples (batfinger)
2013-01-31 08:19:11 +00:00
Joshua Leung 654f6c4c4f Bugfix [#32331] Graph editor zoom to selected includes coordinate origin if more
than one curve is displayed

The range calculation used to use a fixed 0-1 range whenever it couldn't find
any values for a particular F-Curve. However, this was then taken by the
aggregation calculation to be used as just another value, leading to problems if
only vertices of a very high-value curve are selected to be included.

Modified the range calculation to ensure that suitable vertices were found
before trying to take the range values returned.
2012-08-18 04:39:15 +00:00
Campbell Barton 0107385f7f code cleanup: ensure macros require ';' endings 2012-08-08 21:20:10 +00:00
Joshua Leung 240babf074 Graph Editor - View All/Selected now includes handles for calculating extents of
F-Curves

It is possible to get the old behaviour (handles excluded) by bringing up the
Operator Properties (F6) while in the Graph Editor (this doesn't work elsewhere
due to the context requirements of this stuff).
2012-05-24 13:52:25 +00:00
Campbell Barton 9892736206 code cleanup: header cleanup and remove some duplicate defines. 2012-05-12 20:39:39 +00:00
Campbell Barton ea13ec1699 Spelling Cleanup 2012-03-01 12:20:18 +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
Campbell Barton 4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Campbell Barton 5bbd0decfd fix [#28765] keyframe handles do not move with curves in graph editor when hidden, resulting in bad curves.
hide handles wasn't properly respected by transform function testhandles_fcurve().
2011-09-29 05:03:21 +00:00
Joerg Mueller bd6ca0570e 3D Audio GSoC:
Implemented basic audio animation.

* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
Joshua Leung e3842d1ca4 Bugfix [#26505] zoom in selected keys on graph editor
Not really a "bug", but it was on my todo anyways. Based on patch
[#26508] by Campbell, with a few modifications including extending
this to the Action/DopeSheet editor too.
2011-03-17 10:02:37 +00:00
Nathan Letwory 22638e22ea doxygen: blenkernel under core as module. 2011-02-18 13:05:18 +00:00
Campbell Barton 263830f000 Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,.
Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into.
2010-12-03 17:05:21 +00:00
Campbell Barton b45c3363fd fix for some pedantic warnings. 2010-12-03 01:52:28 +00:00
Joshua Leung f713761039 Keyframing Operators: Improved Error Messages
* Keyframing operators now use the reports system for displaying all its error messages. 
- The benefit of this is that users no longer need to check the console for error messages if keyframing fails.
- Unfortunately, reports are not currently viewable in any space/view in Blender, so...

* Added a temporary operator (UI_OT_reports_to_textblock), which can be accessed in the UI from the button which appears in place of the icon when more than one report exists. This dumps the current list of reports to a textblock "Recent Reports", from which they can be viewed. 

This isn't really nice, but at least we now have a way to view these again, which makes debugging some things a pain.

* Bugfix #24606 - when trying to add keyframes to F-Curves with F-Modifiers already which alter the curve significantly enough that the keyframes will have no effect, there are now warnings which aim to alleviate any confusion.
2010-11-17 12:02:36 +00:00
Nathan Letwory 82209cdc86 Reorganisation of COLLADA import code. Classes have been split into their own files.
No functional changes.

Where necessary extern "C" {} blocks have been added.
2010-10-05 00:05:14 +00:00
Campbell Barton adae794233 py/rna remove functions now all work in a similar way.
- some remove() functions took an int argument rather then the item to remove.
- disallow None argument.
- raise an error if the item isnt in the collection.
2010-08-24 06:40:28 +00:00
Campbell Barton 75410037fd - correct some spelling errors.
- remove FreeCamera struct (wasnt used)
- remove world color alpha values (not used anywhre).
2010-07-20 10:41:08 +00:00
Campbell Barton ee0a217be3 python function to remove drivers.
eg:
 bpy.context.object.driver_remove("location")

ANIM_remove_driver now accepts -1 as an index for removing all drivers from one path.
2010-04-11 09:13:37 +00:00
Joshua Leung 618b459e8b F-Modifier Goodies (as requested by @ndy):
* Copy/Paste operators for F-Modifiers
Available in Graph and NLA Editors. Use the Copy/Paste buttons beside the 'Add Modifier' buttons.

Copy copies all the modifiers of the ACTIVE F-Curve or Strip depending on the editor.
Paste pastes modifiers from the buffer to all the selected F-Curves or Strips, adding the new modifiers to the ends of each list.

* 'Stepped Interpolation' F-Modifier
This modifier holds each interpolated value from the F-Curve for several frames without changing the timing. 

This allows to preview motions 'on-twos' for example without altering the timing, or having to go through setting heaps of keyframes. In this case, Andy wanted to use this for CG <-> StopMo.
2010-03-18 13:04:46 +00:00
Campbell Barton 081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Brecht Van Lommel ec7df03c86 Warning fixes, one actual bug found in sequencer sound wave drawing. Also
changed some malloc to MEM_mallocN while trying to track down a memory leak.
2010-02-08 13:55:31 +00:00
Matt Ebb de56a63849 Fix [#20773] NODE ANIMATION: Animating node values broken
Now the compositing node tree will update on frame change if any of the 
nodes are animated.

This doesn't work for playback (i.e. alt a), that's better off waiting until we 
have some kind of frame caching system.
2010-01-27 05:42:17 +00:00
Joshua Leung a9861e3381 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
Joshua Leung 5a3ac3ceeb Assorted F-Curve/Keyframe API stuff (for use with some Sequencer editing):
* Added function for F-Curves to find the F-Curves in a given list which affect some named data, such as bones, nodes, or sequence strips.

* Added a BezTriple offsetting callback to be used with the F-Curve+Keyframe loopers in use for many of the keyframe editing tools.
2009-12-22 10:14:13 +00:00
Campbell Barton 567ee32f14 - fcurve modifiers.new()/remove()/active
- renamed .add() to .new() for rna collection functions since they dont add an existing item.
- remove 'name' as an argument from the new driver target function, better to keep the api minimal and let scripters use the data api for editing values after.
- added some api functions to keep rna api from becoming a mess.
2009-11-16 11:11:16 +00:00
Campbell Barton c9d2186561 - sequencer speed effect back using fcurves, still needs manual reloading to refresh.
- added a function id_data_find_fcurve() to get the fcurve without RNA vars. Aligorith: this could be made to use a path rather then a property name.
2009-11-14 14:58:19 +00:00
Arystanbek Dyussenov 6c4388e3b0 - fixed enum syntax in BKE_fcurve.h and ED_keyframing.h to make g++ happy
- exporting addEditBone from armature module for COLLADA importer
2009-10-27 16:13:50 +00:00
Joseph Eagar 1ec44f3bb2 compile fix 2009-09-19 01:05:16 +00:00
Joshua Leung 8ab24bb2c2 2.5 - Pose Enhancement Tools
This commit restores the 'Relax Pose' tool, and also introduces two others: 'Push Pose' and 'Pose Breakdowner'.
Be aware that this commit is just the initial starting point, with some parts yet to be done.

A short description of these tools follows:
* Relax Pose (Alt-E) - makes the current pose more like the poses on either side of it
* Push Pose (Ctrl-E) - exaggerates the current pose
* Breakdowner (Shift-E)[not working yet] - when this works, it will allow for interactive selection of a good in-between pose to act as a breakdown. 

Todo's:
* Connect up the 'percentage' slider in the operator settings to allow these effects to be dialed in/out, exaggerating/relaxing/moveing-between-keyframes by varying degrees until the desired effect is reached.
* Allow these effects to be interactively dialed in/out. The idea is to use the mouse to interactively set the percentage slider value initially, then use the percentage slider to tweak later.
* Figure out why breakdown breaks down
2009-09-19 00:18:42 +00:00
Joshua Leung 5f5ddb0014 NLA SoC: Little optimisation + Drawing bugfix
* Text labels on NLA-Strips should now draw properly for most short-strips now. Previously, the padding on the text was a bit too extreme, so for very short strips (less than 4 frames or so), the text was often pushed down into the bottom-right corner of view.

* Optimised the keyframe-highlighting code for buttons a bit. Replaced the custom linear-search with the binary-search used when inserting keyframes (and for the 3d-view keyframe-indicator). There should be some theoretical improvements due to this at least...
2009-07-08 12:30:09 +00:00
Joshua Leung 28d371d117 NLA SoC: Assorted fixes
* Made NLA Editing functions more aware of transitions. 
- A transition can only be added between a pair of action-clips. Previous, two transitions could be added next to each other, which has undefined behaviour
- Deleting a strip with transition(s) on either side will remove the transitions too. Feedback welcome on this
- The 'type' setting for NLA-Strips is no longer editable. This was dangerous as it could result in transitions with undefined behaviour (though nothing would happen).

* Menus for adding F-Modifiers now only show relevant modifiers (i.e. 'Invalid' is not included in the list, and 'Cycles' doesn't need to be shown for NLA since we've got repeat)

* Function Generator and Noise F-Modifiers now have complete GUI's. A few settings were missed during the porting process.

* F-Modifier buttons now have their source-ID's included in the RNA Pointers used. This didn't get them animateable directly, but is a step closer.
2009-07-03 01:10:46 +00:00
Joshua Leung f3c47a66b0 NLA SoC: Separating out F-Modifier API
* F-Modifier API is now in its own file in blenkernel
* Renamed and refactored these so that they're no dependent on F-Curves, since all they really used was the fcu->modifiers list
* Added missing license blocks to a few files
2009-07-02 05:25:14 +00:00
Joshua Leung 8ffb1dacad NLA SoC: Bugfix for Deleting Keyframes
When an F-Curve doesn't contain any keyframes anymore but it still exists, the F-Curve's value is not recalculated and flushed anymore if the F-Curve's value will not change. That is, if the F-Curve doesn't have any other data, i.e. drivers or generator-modifiers, which would still change its value, it wouldn't be recalculated to have a value of zero. 

This solves the problem of deleting all scale keyframes, whereby objects/bones would appear to 'vanish'
2009-06-19 04:58:40 +00:00
Joshua Leung a87bc73d32 NLA SoC: Transition Strips + Strip Adding Operators + Bugfixes
== Transitions ==
Transition strips are now able to be created + evaluated. Transitions allow for interpolation between the endpoints of two adjacent strips in the same track (i.e. two strips which occur in the same track one after the other, but with a gap between them). 

- The current behaviour when only one endpoint affects some setting is non-optimal, since it appears somewhat inconsistently extend/replace values...
- Transform code needs a few fixes still to deal with these


== Strip Adding Operators ==
* New strips referencing Actions can be added using the Shift-A hotkey while in the strips-area. You must have a track selected first though.  
The new strip will get added, starting from the current frame, in the selected track(s) only if there is enough space to do so. Otherwise, the new strip gets added at the top of the stack in a new track.

* New transition strips can be added with the Shift-T hotkey while in the strips area. You must have two adjacent strips selected for this to work.

== New Backend Methods ==
* Recoded the strip/track adding API to be more flexible
* Added a new method for testing whether F-Curve has any modifiers of with certain attributes. Will be used in a later bugfix...

== Bugfixes ==
- Fixed bug with strip-blending which caused the blending modes to be useless.
- NLA buttons now use proper poll callbacks instead of defining checks
- Commented out missing operator in menus, silencing warnings in console
- Removed obsolete/incorrect comments
2009-06-19 04:45:56 +00:00
Joshua Leung e295cfd4d5 NLA Branch: Setting up evaluation system for action strips
* Refactored F-Curve Modifier stack evaluation into functions which can be reused for F-Curve Modifiers on NLA-Strips 
* Started setting up temporary accumulation buffer system for use when evaluating strips
2009-05-15 13:23:03 +00:00
Joshua Leung e4e70bfb91 2.5 - Bugfixes
* Loading files saved with 2.5 works again now without crashing. Was crashing when trying to load Grease Pencil data (even though there was none)
* Fixed some msvc compiler warnings in own code
2009-05-04 10:24:53 +00:00
Joshua Leung 2e93dc4037 F-Curve Modifiers: Time-Modifying F-Modifiers Cleanup
Time-Modifying F-Curve Modifiers now get special callbacks to allow them to specify what frame they need to be evaluated on, instead of forcing a re-evaluation of the preceeding curve + modifier-stack. This should be more robust than the old way in general.

It still remains to be seen if some tweaks to this are still needed, as the full consequences of the propogation of modified time-spaces have yet to be fully explored. 

For now though, evaluation works by finding the last modifier on the stack which modifies time, and asks it what time it modifies the given time to. This modified time is used to evaluate the F-Curve data only. The modifier stack gets evaluated using the original time instead.
2009-05-03 13:00:59 +00:00
Joshua Leung 332e001989 Drivers: "Scripted Expression" drivers (i.e. PyDrivers) work again
Now it is possible to write a Python Expression using the variable names for driver targets (see mockup from initial commit) to substitute the appropriate values into the expression.

In the __global__ namespace for PyDriver evaluation, the following modules are available:
* __builtins__ - i.e. the builtin Python functions
* bpy - new Python API
* math or m - math module

For example:
Consider a driver with three targets, named: A, B, C
Now, you could write an expression like:
   C if A < 5 else B
or even:
   2*C if A < 5 or A > 20 else m.PI*B

Of course, you don't have to have three targets, the above was just an example.

TODO:
* Bring back way to load pydrivers.py
* Blender.Noise equivalent would be nice to have

P.S.  I hope I haven't made any terrible Python API coding errors here (i.e. mem leaks, etc.)
2009-04-20 09:17:43 +00:00
Joshua Leung 079304d199 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
Brecht Van Lommel 3906a62cc1 2.5: Added basic insert/remove keyframes from UI buttons.
- I key over a button inserts a keyframe.
- Alt+I removes a keyframe.
- With right mouse button a menu with these options pops up.
- Buttons are colored green if the property is animated, yellow
  if it is on a keyframe. I followed the colors from the UI
  mockups, but the flicker on keyframes seems too distracting in
  practice?

- This only works for properties on the ID itself at the moment,
  path callbacks need to be filled in for all structs but mesh
  still.
- It doesn't work when you're over a related label, that needs to
  be made to work.
- I made it insert keyframes outside of any keyingset. Not sure
  how this is supposed to integrate?
2009-04-03 23:30:32 +00:00
Joshua Leung 43d4e3fa7e Graph Editor: F-Curves which can only take integral values are now drawn stair-stepped using the sampling code. 2009-03-18 10:58:18 +00:00
Joshua Leung ae0f349346 F-Curve Modifiers: Basic GUI for Generator Modifier working
* Currently, this only works for the 'Expanded polynomial' mode, but this will be expanded to include the other modes too. Now you can modify the values and interactively see the graph in the view change. 

* Disabled the backdrops (modifier 'panels') temporarily, as ROUNDBOX UI elements currently swallow all events, which is not good.

Note: the code here still uses the old-style UI definition code since the new stuff is still under heavy construction.
2009-03-16 11:11:44 +00:00
Joshua Leung 329aa658c9 F-Curve Modifiers: Groundwork for getting these working
- Completed cleaning up the drawing code so that F-Curves with modifiers now get drawn to reflect this.
- Added a temporary operator to add modifiers (hotkey Ctrl-Shift-M)
2009-03-15 10:39:02 +00:00
Joshua Leung d9c9108a6e Graph Editor: Added operator to 'bake' keyframe-based F-Curves to be composed of samples.
This operator can be activated using the 'Alt-C' hotkey for now, and operates on selected + editable F-Curves. This is currently still highly experimental, and does crash

I've implemented this as a way to test out the FPoints/samples code, which will be used to provide better support of the dense F-Curves which result from importing Mocap/BVH data. These should use considerably less memory + have a few additional benefits over keyframes when they're working in a stable fashion.
2009-03-01 11:27:31 +00:00
Joshua Leung 6f2d5b8e8a Graph Editor: Restoring 'View All' (HomeKey) and Auto-Set Preview Range ('Ctrl Alt P') 2009-02-10 10:42:04 +00:00
Joshua Leung 595983cd28 Animato: Added base-code for converting the ugly old bitflag settings
Only object layers have been done for now. The implementation of this should provide a good indicator for how this should be done. Unforunately, the code for animating layer visibility is not that straightforward, since scene->base->layer (not set) settings need to be synchronised with the object->layer (set by Animato) settings.
2009-01-29 09:40:49 +00:00