Jump to: Board index » General » Fusion

Editing Spline from Animation Modifier

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

dave smith

  • Posts: 12
  • Joined: Sun Nov 16, 2014 10:08 pm

Editing Spline from Animation Modifier

PostTue Dec 09, 2014 11:41 am

Hi,
I'm sure this is dead easy.

How do you enable a spline created from a modifier applied to a property to be editable like a regular animation spline.
In my case I've applied a midi extractor to the Y offset of a 3d object in transform 3d.
cube3d > transform3d

but I can't do anything with it - tweak the keyframes etc.
the checkbox is enabled for the spline but unlike a regular animation control in the spline window the checkbox stays grey instead of red and the the y Offset control in the transform 3d is blue instead of green.

thanks for any advice
Offline
User avatar

Thomas Milde

  • Posts: 130
  • Joined: Tue Aug 28, 2012 11:27 am
  • Location: Augsburg, Germany

Re: Editing Spline from Animation Modifier

PostTue Dec 09, 2014 12:03 pm

Not having Fusion in front of me right now this is just a wild guess:

Did you "connect" the Y-offset to the other tool? Then you shouldn't be able to edit the keyframes, since the values are taken from the other tool.
Is there a possibility to bake the values and then disconnect again?
Offline
User avatar

Blazej Floch

  • Posts: 173
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: Editing Spline from Animation Modifier

PostTue Dec 09, 2014 12:21 pm

Two options:
1.)Bake modifiers in order to manipulate them.
- Make sure your render ranges are set to
- Right click the Header of the Tool in the tool properties view.
- Select Script->Bake Animation

Cons: Not able to change the modifier anymore.

2.) Add an offset to the modifier.
- Instead of using the MIDI Extractor modifier directly use either an Calculation (1D inputs) or an Offset (2D inputs) modifier
- Then set the MidiExtractor to the FirstOperand and you will be able to add handanimated values.

You can always add an calulaction without deleting the originial if you connect it somewhere else.
E.g. Create an temporary node (whatever has similar inputs), right click an arbitrary input and connect the original MidiExtractor (Connect To->...). Then replace the original Input with a calculation. Reconnect the FirstOperand with the (temporary) MidiExtractor (Connect To->...). Delete the temporary tool.

Edit:
3.) Another option would be to use simple expressions. But you'd always need an input to store the original Modifer value.
E.g. create a Custom Input with the UserControls script. Connect the MidiExtractor Modifier with that. Use a simple expression to reference and manipulate this value.
Offline

dave smith

  • Posts: 12
  • Joined: Sun Nov 16, 2014 10:08 pm

Re: Editing Spline from Animation Modifier

PostTue Dec 09, 2014 12:47 pm

Ok guys that great :D
went down the baking animation route
For anybody else who comes unstuck - just need to make sure that you right click the transform 3d > scripts > bake animation in the flow window
Before I was trying it on the y offset control in the spline window and got a 'nothing to bake' warning.

The baking creates a keyframe on everyframe apart from manually deleting the extras is there any way of just baking for the main points? (you can increase the number of steps but that only takes you so far)
so for example where the green points are
Image
Offline

Eric Westphal

  • Posts: 121
  • Joined: Thu Nov 20, 2014 1:59 pm

Re: Editing Spline from Animation Modifier

PostMon Dec 15, 2014 1:06 pm

Hi Dave.

After baking, you could open the SplineEditor,
select all points,
RMB and select 'Reduce Points'.

In your case, this should deliver pretty good results.

You might have to set your Keyframes to Linear though,
by selecting them and pressing Shift-L.

Cheers.

Eric.
Offline

Eric Westphal

  • Posts: 121
  • Joined: Thu Nov 20, 2014 1:59 pm

Re: Editing Spline from Animation Modifier

PostTue Dec 16, 2014 12:29 pm

Hi Dave.

This is a slightly modified version of the BakeAnimation Script.
It will reduce static Keyframes (i.e. subsequent keyframes with exactly the same value).

Code: Select all
------------------------------------------------------------------------------
-- Bake Animation, Revision: 3.1
--
-- tool script
--
-- This tool script is used to 'bake' the animation of any animated control into
-- a single value per frame. When run, a dialog listing all controls driven by a
-- path, spline or modifier will appear. Select the control you want to bake, as
-- well as the interval you want to use. An interval of 1 is default, representing
-- one value per frame.
--
-- When you select OK, Fusion will obtain the value of that control at each frame,
-- and apply it to a new path or polyline as appropriate. It will then replace the
-- old animation or modifier applied to the control with the newly created path or
-- spline.
--
-- You could use this script to convert the output of a Shake modifier to a path for
-- hand tweaking, or to obtain an editable spline of the Unsteady size of a
-- tracker....

-- written by : Isaac Guenard (izyk@eyeonline.com)
-- written    : June 6th, 2003
-- updated : May 21th, 2008
-- changes : updated for 5
-- fixed: INPI_DataType is now INPS_DataType, so script was incorrectly including image, mask, particle and 3d datatype inputs
-- fixed: Inputs like Transform3DOp.Transform.Z were not handled correctly, causing the script to fail.
-- added: Script now supports simple expressions.

-- updated : May 6th, 2008
-- fixed : Moved Undo and Locking so they only get called when the comp does something. No longer leaves the composition locked when run on a tool with no bakable inputs.
-- change: Turned all output to Message Box output instead of Console output.
-- change: optimisation (less GetAttrs() calls)
-- added:  some simple console feedback on what's done
------------------------------------------------------------------------------


if not tool then
   tool = composition.ActiveTool
   if not tool then
      composition:AskUser("Tool Script Error", {
         {"description", "Text", Lines=5, Default="This is a tool script, you must select a tool in the flow to run this script", ReadOnly=true, Wrap=true},
      })

      do return end
   end
end



-- We can't bake DT_Image or DT_Mask (and possibly others...)
unbakeable = { Image = true, Mask = true, Particles = true, DataType3D = true }
 
-- Generate a list of inputs that are animated
inputs = {}
input_id = {}
for key,inp in pairs(tool:GetInputList()) do
   if inp:GetConnectedOutput() or inp:GetExpression() then
      if not unbakeable[inp:GetAttrs().INPS_DataType] then
         table.insert(inputs, inp.Name)
         table.insert(input_id, inp.ID)
      end
   end
end

if #inputs == 0 then
   composition:AskUser("Nothing to Bake", {
   {"description", "Text", Lines=5, Default="This tool has no inputs which can be baked by this script.", ReadOnly=true, Wrap=true},
   })

   do return end
end

-- Ask the user which input, and how often to set keyframes
settings = composition:AskUser("Bake Animation", {
   { "Input", "Dropdown", Options = inputs },
   { "Step", "Slider", Integer = true, Default = 1, Min = 1, Max = 10},
   {"DoReduce", Name = "Reduce Static Keyframes", "Checkbox", Default = 1}
   })

if settings then
   composition:Lock()
   composition:StartUndo("Bake Animation")
   
   local inpname = input_id[settings.Input+1]
   local inp = tool[inpname]
   local inpattrs = inp:GetAttrs()
      
   -- Get the range to process from render range
   local compattrs = composition:GetAttrs()
   local from = compattrs.COMPN_RenderStart
   local to = compattrs.COMPN_RenderEnd
   local step = settings.Step
   
   -- Record keyframes into a table for later use
   local keyframes = {}
   print("Recording "..(to-from+1)/step.." keyframes from "..inp.Name.."...")
   for i=from,to,step do
      keyframes[i] = inp[i]
   end

   -- Create an appropriate modifier.
   -- We assume BezierSpline unless it's a DT_Point, then we use a Path
   
   if inpattrs.INPS_DataType == "Point" then
      modifier = Path({})
   else
      modifier = BezierSpline({})
   end
   
   if tool[inpname]:GetExpression() then
      tool[inpname]:SetExpression(nil)
   end
   
   -- Now connect it up.  This removes the old modifier
   tool[inpname] = modifier

   -- Now set the keyframes back in
   print("Baking keyframes...")
   for i=from,to,step do
      if  settings.DoReduce == 1 then
         if keyframes[i] ~= keyframes[i-1] then
            --make sure to set the previous KF first
            inp[i-1] = keyframes[i-1]
            -- set the new KF
            inp[i] = keyframes[i]
         end
      else
         inp[i] = keyframes[i]
      end
   end
   print("Done.")
   
   composition:EndUndo(true)
   composition:Unlock()
end



Cheers.

Eric.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 4 guests