利用者:Koilz/2.66.00 code review NLA Editor

提供: wiki
< 利用者:Koilz
2013年3月25日 (月) 01:09時点におけるwiki>Koilzによる版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

13.03.16: NLA Editor

Nla Editor: None Linear Animation Editor.

these are some idears.


13.03.20: problems

make new action from current action

  • this can be done.

auto sync length

  • bool switch: auto sync length.
  • bool switch: sync all strips with same action.
  • problems with strips being to big.

blend interpolation

  • not sure how it does it at the moment. but will need support for multiple strips.

change object

  • should be ok.

smooth transition

  • not sure about this yet. todo with transition between strips.


13.03.21: what do people do

  • first usually, make an animation on the timeline, then freeze it.
  • edit strip.
  • duplicate strip.
  • rename strip.
  • bool switch: auto sync length.
  • bool switch: sync all strips with same action.
  • make new strip action from strip action.
  • copy object[A].action to object[B].action then delete object[A].action.
  • auto snap enum.
  • folder feature, dont know what for: (00:00 youtube /watch?v=IBRqmeErOHU)
  • its better for repetative game animations. or loop, like bird wings. or loop background animation.
  • blend is used to blend animations. walk + duck = walk to duck walk. (5:00 & 9:00 & 10:20: youtube /watch?v=x2kkOROZPvE)
  • repeats good.
  • copy paste.
  • mabey good to add code to move keyframe point in nlastrip tweak mode, like dopesheet editor.


13.03.16: Nla Editor vs Composer

With composers X is time. Y can have multiple modes.

Y Main

  • Y is usually a sound effect, like a type of synth, for example a cat or dog sound.
  • Moving the data block to the different track would change the sound of the notes.

Y Edit

  • Composers usually have edit mode also, if its a MIDI, this is change the pitch of the notes.
  • If its a raw sound signal, sometimes you can draw the signal.
  • In this mode will not see any other data block.

NlaStrips are animation keyframes in a block.

Nla Editor in Main mode doesnt require an Y property.

  • Sometimmes you may want to overlap animations or just move them about.
  • So its better to keep it free from Y.
  • Though it shouldnt be ruled out, mabey it code have different Main_modes.


13.03.16: NlaTest

I made two NlaStrips by by adding keyingsets then pressing freeze to turn them into NlaStrips.

Then i duplicated them.

NlaTest.PNG

NlaTracks

  • NlaTrack
  • NlaTrack.001
  • NlaTrack.002
  • NlaTrack.003

NlaStrips

  • A
  • A.001
  • A.002
  • A.003
  • A..
  • B
  • B.001
  • B.002
  • B.003
  • B..

Actions

  • CubeAction
  • CubeAction.001

Actions are the keyframes.

Transitional strips to process outer keyframes.


13.03.20: NlaStrips

The NlaStrips have Actions.

NlaTrack > NlaStrip > Action > Keyframes

When you duplicate the Strip it uses the same action.

To edit the keyframes of a NlaStrip enter Tweak Mode (TAB).

If you modify the action keyframes of one strip the other strips are modified.


13.03.20: Sync Action Length

You can sync the NlaStrip length with: Header: Edit: Sync Action Length.

This will set strip length for the strips selected.


13.03.20: copy set new NlaStrip Action

Make a NlaStrip Action unique (copy set).

  • Properties: Animation Data: Brows Action to be linked.
  • select the action you want to copy.
  • this will add the action.keyframes to the timeline.
  • press Properties: Animation Data: [+].
  • this will make a new action with the same keyframes.
  • press snowflake.


13.03.20: no track

K nlades.PNG


13.03.20: auto sync length

auto sync length

  • bool switch: auto sync length.
  • bool switch: sync all strips with same action.
  • problems with strips being to big.

bool switch: auto sync length.

comes with problems.

after editing if the strip maybe too big.

so two options, jump track, or be passive, this would be a bool switch.

if passive the track would be processed like an overlapping action.


13.03.20: stack interpolation

i think this is how to process multiple propeties.

this would be after each fcurve interpolation.

K stack.PNG


13.03.20: Blend

Not sure about this yet.

This is when keyframes Blend/interpolation.

Automaticly setup when NlaStrips overlap.

When blend is used on an NlaStrip, the NlaTrack becomes dominate.

So the next strip must be on the same track (mabey loop bug).


13.03.22: mesh blend

NLA Editor: Properties: Active Strip

Extrapolation and Blend, this is for mesh blending.

By default its on Replace.

Add will usually make the mesh bigger because there are two meshes it add them together.

Subtract will shrink the mesh.

Playback Settings:

Reversed, will play the strip backwards.


13.03.22: blend

lets say im auto blending these.

K nla blend.PNG

[ cube up ] bottom_left to bottom_right.

[cuberight] bottom_right to top_right.

with [ cube up ] blend starts at bottom and goes to top. 0 - 1.

with [cuberight] blend starts at top and goes to bottom. 1 - 0.

the auto blend creates a curve motion.


13.03.22: blend replace

K nla blend rep.PNG

move

  • 2 keyframes
  • Time 00.00 - 20.00
  • X Location 0.0 - 5.0
  • Y Location 0.0 - 0.0
  • Z Location 0.0 - 0.0
  • Auto Blend In/Out: off
  • Blend In: 0.000
  • Blend Out: 0.000

top

  • 2 keyframes
  • Time 05.00 - 15.00
  • Z location 3.0 - 3.0
  • Auto Blend In/Out: off
  • Blend In: 5.000
  • Blend Out: 5.000

time

  • at time 0, 'move' has 1.0 influence.
  • at time 5, 'top' starts to blend in.
  • at time 10, 'top' replaces 'move'. 'top' has 1.0 influence, 'move' has 0.0 influence.
  • at time 15, 'top' blends out and 'move' has 1.0 influence.


13.03.22: tweak blend tab

the nlastrip_action and nla_blend tabs would be shown in tweak mode (TAB).

K nla des2.PNG

nla00: the tracks would show strips for all objects in the scene.

with this one, be easier to change strip object.

nla01: object seperated version.


13.03.24: Auto blend

These work good.

K nla auto blend.PNG

The second one, 'left' is blending 'right' and 'right.001' at the same time.


:::::::: code ::::::::

13.03.16: c data

Note that keyframes and drivers are Fcurves (AnimData.drivers).

  • Fcurves have a funny IO using ChannelDrivers and rna_path.
  • BezTriple is the keyframe array.

Heres some branches not all.

----------------------------------------------------------------
AnimData
	bAction		*action;		// bAction 			action			/* active action - acts as the 'tweaking track' for the NLA */
													/* temp-storage for the 'real' active action (i.e. the one used before the tweaking-action */
													/* took over to be edited in the Animation Editors) */
	bAction 	*tmpact;		// bAction 			temp action
	ListBase 	nla_tracks;		// NlaTracks			tracks			/* nla-tracks */
	NlaStrip 	*actstrip;		// NlaStrip			strip			/* active NLA-strip (only set/used during tweaking, so no need to worry about dangling pointers) */

bAction
	ListBase	curves;    		// FCurve			curves			/* function-curves (FCurve) */
	ListBase 	groups;    		// bActionGroup			groups			/* groups of function-curves (bActionGroup) */

NlaTrack
	struct NlaTrack *next, *prev;		// NlaTrack*			next, prev
	ListBase 	strips;			// bActionStrips		strips			/* bActionStrips in this track */
	char 		name[64];		// char				name

NlaStrip
	struct NlaStrip *next, *prev;		// NlaStrip*			next, prev
	ListBase 	strips;            	// (NlaStrip,bActionStrips)	strips			/* 'Child' strips (used for 'meta' strips) */
	bAction 	*act;               	// bAction*			act			/* Action that is referenced by this strip (strip is 'user' of the action) */
	ListBase 	fcurves;        	// FCurve			fcurves			/* F-Curves for controlling this strip's influence and timing */    // TODO: move out?

	char 		name[64];              	// char				name			/* User-Visible Identifier for Strip */
	float 		influence;            	// float			influence		/* Influence of strip */
	float 		strip_time;          	// float			strip_time		/* Current 'time' within action being used (automatically evaluated, but can be overridden) */
	float 		start, end;          	// float			start, end		/* extents of the strip */
	float 		actstart, actend;     	// float			actstart, actend	/* range of the action to use */
	float 		repeat;               	// float			repeat			/* The number of times to repeat the action range (only when no F-Curves) */
	float 		scale;                	// float			scale			/* The amount the action range is scaled by (only when no F-Curves) */

	float 		blendin, blendout;    	// float			blendin, blendout	/* strip blending length (only used when there are no F-Curves) */
	short 		blendmode;            	// short			blendmode		/* strip blending mode (layer-based mixing) */
----------------------------------------------------------------
----------------------------------------------------------------
source/blender/makesdna/DNA_anim_types.h
	FModifier
	FMod_Generator
	FMod_FunctionGenerator
	FCM_EnvelopeData
	FMod_Envelope
	FMod_Cycles
	FMod_Python
	FMod_Limits
	FMod_Noise
	FMod_Stepped
	DriverTarget
	DriverVar
	ChannelDriver
	FPoint
	FCurve
	AnimMapPair
	AnimMapper
	NlaStrip
	NlaTrack
	KS_Path
	KeyingSet
	AnimOverride
	AnimData
	IdAdtTemplate
	
source/blender/makesdna/DNA_action_types.h
	bMotionPathVert
	bMotionPath
	bAnimVizSettings
	bPoseChannel
	bPose
	bIKParam
	bItasc
	bActionGroup
	bAction
	bDopeSheet
	SpaceAction
	bActionChannel
----------------------------------------------------------------

Python

----------------------------------------------------------------

bpy.data.objects['Cube'].animation_data.nla_tracks['NlaTrack'].
bpy.data.objects['Cube'].animation_data.nla_tracks['NlaTrack'].strips['A.002'].

--------

>>> bpy.data.objects['Cube'].animation_data.nla_tracks['NlaTrack'].strips['A.002'].action
bpy.data.actions['CubeAction']

>>> bpy.data.actions['CubeAction'].fcurves[0].color
Color((0.0, 0.0, 0.0))

>>> bpy.data.actions['CubeAction'].fcurves[0].keyframe_points[0].co
Vector((7.0, -3.0))

>>> bpy.data.actions['CubeAction'].fcurves[0].keyframe_points[0].handle_left
Vector((2.05462646484375, -3.0))

>>> bpy.data.actions['CubeAction'].fcurves[0].keyframe_points[0].handle_right
Vector((11.94537353515625, -3.0))

--------

'CubeAction' has 3 keyframes.

>>> bpy.data.actions['CubeAction'].fcurves[1].keyframe_points[0].co
Vector((7.0, 0.0))

>>> bpy.data.actions['CubeAction'].fcurves[1].keyframe_points[1].co
Vector((20.0, 0.0))

>>> bpy.data.actions['CubeAction'].fcurves[1].keyframe_points[2].co
Vector((59.0, 0.0))

>>> bpy.data.actions['CubeAction'].fcurves[1].keyframe_points[3].co
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
IndexError: bpy_prop_collection[index]: index 3 out of range, size 3

----------------------------------------------------------------


13.03.19: python data

----------------------------------------------------------------

objects
	nla_tracks
		strips
			action
				group
					channels
						keyframe_points
action
	group
		channels
			keyframe_points

----------------------------------------------------------------

----------------------------------------------------------------

# object track strip action
>>> bpy.data.objects['Cube'].animation_data.nla_tracks['NlaTrack'].strips['A'].action
bpy.data.actions['CubeAction']

# first keyframe position
>>> bpy.data.actions['CubeAction'].frame_range[0]
7.0

# last keyframe position
>>> bpy.data.actions['CubeAction'].frame_range[1]
59.0

# channels
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8]
bpy.data.actions['CubeAction.002']...FCurve

channels are keying sets like LocRotScale
so channel[8] is 'Z Scale'

# type
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].type
'KEYFRAME'

# keyframe extrapolation
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].extrapolation
'CONSTANT'

# keyframe points
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1]
bpy.data.actions['CubeAction.002']...Keyframe

# point interpolation
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].interpolation
'BEZIER'

# point position
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].co
Vector((221.0, 1.0))

# point handle left
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].handle_left
Vector((202.65066528320312, 1.0))

# point handle right
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].handle_right
Vector((239.34933471679688, 1.0))

# point selected
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].select_control_point
True

# point handle selected
>>> bpy.data.actions['CubeAction.002'].groups['LocRotScale'].channels[8].keyframe_points[1].select_left_handle
True

----------------------------------------------------------------


13.03.19: c operators

// space_ops.c
----------------------------------------------------------------
	/* view */
	NLA_OT_properties
	
	/* channels */
	NLA_OT_channels_click
	NLA_OT_tracks_add
	NLA_OT_delete_tracks
	
	/* select */
	NLA_OT_click_select
	NLA_OT_select_border
	NLA_OT_select_all_toggle
	NLA_OT_select_leftright
	
	/* view */
	NLA_OT_view_all
	NLA_OT_view_selected
	
	/* edit */
	NLA_OT_tweakmode_enter
	NLA_OT_tweakmode_exit					// nla_edit.c
		ot->exec = nlaedit_disable_tweakmode_exec;	// nla_edit.c
		ot->poll = nlaop_poll_tweakmode_on;		// nla_edit.c
	NLA_OT_actionclip_add
	NLA_OT_transition_add
	NLA_OT_soundclip_add
	NLA_OT_meta_add
	NLA_OT_meta_remove
	NLA_OT_duplicate					// nla_edit.c
		ot->exec = nlaedit_duplicate_exec;		// nla_edit.c
		ot->poll = nlaop_poll_tweakmode_off;		// nla_edit.c
	NLA_OT_delete
	NLA_OT_split
	NLA_OT_mute_toggle
	NLA_OT_swap
	NLA_OT_move_up
	NLA_OT_move_down
	NLA_OT_action_sync_length				// nla_edit.c
		ot->exec = nlaedit_sync_actlen_exec;		// nla_edit.c
		ot->poll = ED_operator_nla_active;		// nla_edit.c
	NLA_OT_apply_scale
	NLA_OT_clear_scale
	NLA_OT_snap
	NLA_OT_fmodifier_add
	NLA_OT_fmodifier_copy
	NLA_OT_fmodifier_paste
----------------------------------------------------------------