Преглед изворни кода

Examples: Remove timeliner demo.

Mugen87 пре 4 година
родитељ
комит
64760fb300

+ 0 - 1
examples/files.js

@@ -359,7 +359,6 @@ var files = {
 		"physics_ammo_volume"
 	],
 	"misc": [
-		"misc_animation_authoring",
 		"misc_animation_groups",
 		"misc_animation_keys",
 		"misc_boxselection",

+ 0 - 272
examples/js/animation/TimelinerController.js

@@ -1,272 +0,0 @@
-console.warn( "THREE.TimelinerController: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation." );
-/**
- * Controller class for the Timeliner GUI.
- *
- * Timeliner GUI library (required to use this class):
- *
- * 		../libs/timeliner_gui.min.js
- *
- * Source code:
- *
- * 		https://github.com/tschw/timeliner_gui
- * 		https://github.com/zz85/timeliner (fork's origin)
- */
-
-THREE.TimelinerController = function TimelinerController( scene, trackInfo, onUpdate ) {
-
-	this._scene = scene;
-	this._trackInfo = trackInfo;
-
-	this._onUpdate = onUpdate;
-
-	this._mixer = new THREE.AnimationMixer( scene );
-	this._clip = null;
-	this._action = null;
-
-	this._tracks = {};
-	this._propRefs = {};
-	this._channelNames = [];
-
-};
-
-THREE.TimelinerController.prototype = {
-
-	constructor: THREE.TimelinerController,
-
-	init: function () {
-
-		var tracks = [],
-			trackInfo = this._trackInfo;
-
-		for ( var i = 0, n = trackInfo.length; i !== n; ++ i ) {
-
-			var spec = trackInfo[ i ];
-
-			tracks.push( this._addTrack( spec.type, spec.propertyPath, spec.initialValue, spec.interpolation ) );
-
-		}
-
-		this._clip = new THREE.AnimationClip( 'editclip', 0, tracks );
-		this._action = this._mixer.clipAction( this._clip ).play();
-
-	},
-
-	setDisplayTime: function ( time ) {
-
-		this._action.time = time;
-		this._mixer.update( 0 );
-
-		this._onUpdate();
-
-	},
-
-	setDuration: function ( duration ) {
-
-		this._clip.duration = duration;
-
-	},
-
-	getChannelNames: function () {
-
-		return this._channelNames;
-
-	},
-
-	getChannelKeyTimes: function ( channelName ) {
-
-		return this._tracks[ channelName ].times;
-
-	},
-
-	setKeyframe: function ( channelName, time ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ), // eslint-disable-line no-undef
-			values = track.values,
-			stride = track.getValueSize(),
-			offset = index * stride;
-
-		if ( index < 0 ) {
-
-			// insert new keyframe
-
-			index = ~ index;
-			offset = index * stride;
-
-			var nTimes = times.length + 1,
-				nValues = values.length + stride;
-
-			for ( var i = nTimes - 1; i !== index; -- i ) {
-
-				times[ i ] = times[ i - 1 ];
-
-			}
-
-			for ( var i = nValues - 1, e = offset + stride - 1; i !== e; -- i ) {
-
-				values[ i ] = values[ i - stride ];
-
-			}
-
-		}
-
-		times[ index ] = time;
-		this._propRefs[ channelName ].getValue( values, offset );
-
-	},
-
-	delKeyframe: function ( channelName, time ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ); // eslint-disable-line no-undef
-
-		// we disallow to remove the keyframe when it is the last one we have,
-		// since the animation system is designed to always produce a defined
-		// state
-
-		if ( times.length > 1 && index >= 0 ) {
-
-			var nTimes = times.length - 1,
-				values = track.values,
-				stride = track.getValueSize(),
-				nValues = values.length - stride;
-
-			// note: no track.getValueSize when array sizes are out of sync
-
-			for ( var i = index; i !== nTimes; ++ i ) {
-
-				times[ i ] = times[ i + 1 ];
-
-			}
-
-			times.pop();
-
-			for ( var offset = index * stride; offset !== nValues; ++ offset ) {
-
-				values[ offset ] = values[ offset + stride ];
-
-			}
-
-			values.length = nValues;
-
-		}
-
-	},
-
-	moveKeyframe: function ( channelName, time, delta, moveRemaining ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ); // eslint-disable-line no-undef
-
-		if ( index >= 0 ) {
-
-			var endAt = moveRemaining ? times.length : index + 1,
-				needsSort = times[ index - 1 ] <= time ||
-					! moveRemaining && time >= times[ index + 1 ];
-
-			while ( index !== endAt ) times[ index ++ ] += delta;
-
-			if ( needsSort ) this._sort( track );
-
-		}
-
-	},
-
-	serialize: function () {
-
-		var result = {
-				duration: this._clip.duration,
-				channels: {}
-			},
-
-			names = this._channelNames,
-			tracks = this._tracks,
-
-			channels = result.channels;
-
-		for ( var i = 0, n = names.length; i !== n; ++ i ) {
-
-			var name = names[ i ],
-				track = tracks[ name ];
-
-			channels[ name ] = {
-
-				times: track.times,
-				values: track.values
-
-			};
-
-		}
-
-		return result;
-
-	},
-
-	deserialize: function ( structs ) {
-
-		var names = this._channelNames,
-			tracks = this._tracks,
-
-			channels = structs.channels;
-
-		this.setDuration( structs.duration );
-
-		for ( var i = 0, n = names.length; i !== n; ++ i ) {
-
-			var name = names[ i ],
-				track = tracks[ name ],
-				data = channels[ name ];
-
-			this._setArray( track.times, data.times );
-			this._setArray( track.values, data.values );
-
-		}
-
-		// update display
-		this.setDisplayTime( this._mixer.time );
-
-	},
-
-	_sort: function ( track ) {
-
-		var times = track.times, order = THREE.AnimationUtils.getKeyframeOrder( times );
-
-		this._setArray( times, THREE.AnimationUtils.sortedArray( times, 1, order ) );
-
-		var values = track.values,
-			stride = track.getValueSize();
-
-		this._setArray( values, THREE.AnimationUtils.sortedArray( values, stride, order ) );
-
-	},
-
-	_setArray: function ( dst, src ) {
-
-		dst.length = 0;
-		dst.push.apply( dst, src );
-
-	},
-
-	_addTrack: function ( type, prop, initialValue, interpolation ) {
-
-		var track = new type( prop, [ 0 ], initialValue, interpolation );
-
-		// data must be in JS arrays so it can be resized
-		track.times = Array.prototype.slice.call( track.times );
-		track.values = Array.prototype.slice.call( track.values );
-
-		this._channelNames.push( prop );
-		this._tracks[ prop ] = track;
-
-		// for recording the state:
-		this._propRefs[ prop ] =
-				new THREE.PropertyBinding( this._scene, prop );
-
-		return track;
-
-	}
-
-};

Разлика између датотеке није приказан због своје велике величине
+ 0 - 44
examples/js/libs/timeliner_gui.min.js


+ 0 - 20
examples/jsm/animation/TimelinerController.d.ts

@@ -1,20 +0,0 @@
-import {
-	Scene
-} from '../../../src/Three';
-
-export class TimelinerController {
-
-	constructor( scene: Scene, trackInfo: object[], onUpdate: () => void );
-
-	delKeyframe( channelName: string, time: number ): void;
-	deserialize( structs: object ): void;
-	getChannelKeyTimes(): number[];
-	getChannelNames(): string[];
-	init(): void;
-	moveKeyframe( channelName: string, time: number, delta: number, moveRemaining: boolean ): void;
-	serialize(): object;
-	setDisplayTime( time: number ): void;
-	setDuration( duration: number ): void;
-	setKeyframe( channelName: string, time: number ): void;
-
-}

+ 0 - 279
examples/jsm/animation/TimelinerController.js

@@ -1,279 +0,0 @@
-import {
-	AnimationClip,
-	AnimationMixer,
-	AnimationUtils,
-	PropertyBinding
-} from "../../../build/three.module.js";
-/**
- * Controller class for the Timeliner GUI.
- *
- * Timeliner GUI library (required to use this class):
- *
- * 		../libs/timeliner_gui.min.js
- *
- * Source code:
- *
- * 		https://github.com/tschw/timeliner_gui
- * 		https://github.com/zz85/timeliner (fork's origin)
- */
-
-var TimelinerController = function TimelinerController( scene, trackInfo, onUpdate ) {
-
-	this._scene = scene;
-	this._trackInfo = trackInfo;
-
-	this._onUpdate = onUpdate;
-
-	this._mixer = new AnimationMixer( scene );
-	this._clip = null;
-	this._action = null;
-
-	this._tracks = {};
-	this._propRefs = {};
-	this._channelNames = [];
-
-};
-
-TimelinerController.prototype = {
-
-	constructor: TimelinerController,
-
-	init: function () {
-
-		var tracks = [],
-			trackInfo = this._trackInfo;
-
-		for ( var i = 0, n = trackInfo.length; i !== n; ++ i ) {
-
-			var spec = trackInfo[ i ];
-
-			tracks.push( this._addTrack( spec.type, spec.propertyPath, spec.initialValue, spec.interpolation ) );
-
-		}
-
-		this._clip = new AnimationClip( 'editclip', 0, tracks );
-		this._action = this._mixer.clipAction( this._clip ).play();
-
-	},
-
-	setDisplayTime: function ( time ) {
-
-		this._action.time = time;
-		this._mixer.update( 0 );
-
-		this._onUpdate();
-
-	},
-
-	setDuration: function ( duration ) {
-
-		this._clip.duration = duration;
-
-	},
-
-	getChannelNames: function () {
-
-		return this._channelNames;
-
-	},
-
-	getChannelKeyTimes: function ( channelName ) {
-
-		return this._tracks[ channelName ].times;
-
-	},
-
-	setKeyframe: function ( channelName, time ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ), // eslint-disable-line no-undef
-			values = track.values,
-			stride = track.getValueSize(),
-			offset = index * stride;
-
-		if ( index < 0 ) {
-
-			// insert new keyframe
-
-			index = ~ index;
-			offset = index * stride;
-
-			var nTimes = times.length + 1,
-				nValues = values.length + stride;
-
-			for ( var i = nTimes - 1; i !== index; -- i ) {
-
-				times[ i ] = times[ i - 1 ];
-
-			}
-
-			for ( var i = nValues - 1, e = offset + stride - 1; i !== e; -- i ) {
-
-				values[ i ] = values[ i - stride ];
-
-			}
-
-		}
-
-		times[ index ] = time;
-		this._propRefs[ channelName ].getValue( values, offset );
-
-	},
-
-	delKeyframe: function ( channelName, time ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ); // eslint-disable-line no-undef
-
-		// we disallow to remove the keyframe when it is the last one we have,
-		// since the animation system is designed to always produce a defined
-		// state
-
-		if ( times.length > 1 && index >= 0 ) {
-
-			var nTimes = times.length - 1,
-				values = track.values,
-				stride = track.getValueSize(),
-				nValues = values.length - stride;
-
-			// note: no track.getValueSize when array sizes are out of sync
-
-			for ( var i = index; i !== nTimes; ++ i ) {
-
-				times[ i ] = times[ i + 1 ];
-
-			}
-
-			times.pop();
-
-			for ( var offset = index * stride; offset !== nValues; ++ offset ) {
-
-				values[ offset ] = values[ offset + stride ];
-
-			}
-
-			values.length = nValues;
-
-		}
-
-	},
-
-	moveKeyframe: function ( channelName, time, delta, moveRemaining ) {
-
-		var track = this._tracks[ channelName ],
-			times = track.times,
-			index = Timeliner.binarySearch( times, time ); // eslint-disable-line no-undef
-
-		if ( index >= 0 ) {
-
-			var endAt = moveRemaining ? times.length : index + 1,
-				needsSort = times[ index - 1 ] <= time ||
-					! moveRemaining && time >= times[ index + 1 ];
-
-			while ( index !== endAt ) times[ index ++ ] += delta;
-
-			if ( needsSort ) this._sort( track );
-
-		}
-
-	},
-
-	serialize: function () {
-
-		var result = {
-				duration: this._clip.duration,
-				channels: {}
-			},
-
-			names = this._channelNames,
-			tracks = this._tracks,
-
-			channels = result.channels;
-
-		for ( var i = 0, n = names.length; i !== n; ++ i ) {
-
-			var name = names[ i ],
-				track = tracks[ name ];
-
-			channels[ name ] = {
-
-				times: track.times,
-				values: track.values
-
-			};
-
-		}
-
-		return result;
-
-	},
-
-	deserialize: function ( structs ) {
-
-		var names = this._channelNames,
-			tracks = this._tracks,
-
-			channels = structs.channels;
-
-		this.setDuration( structs.duration );
-
-		for ( var i = 0, n = names.length; i !== n; ++ i ) {
-
-			var name = names[ i ],
-				track = tracks[ name ],
-				data = channels[ name ];
-
-			this._setArray( track.times, data.times );
-			this._setArray( track.values, data.values );
-
-		}
-
-		// update display
-		this.setDisplayTime( this._mixer.time );
-
-	},
-
-	_sort: function ( track ) {
-
-		var times = track.times, order = AnimationUtils.getKeyframeOrder( times );
-
-		this._setArray( times, AnimationUtils.sortedArray( times, 1, order ) );
-
-		var values = track.values,
-			stride = track.getValueSize();
-
-		this._setArray( values, AnimationUtils.sortedArray( values, stride, order ) );
-
-	},
-
-	_setArray: function ( dst, src ) {
-
-		dst.length = 0;
-		dst.push.apply( dst, src );
-
-	},
-
-	_addTrack: function ( type, prop, initialValue, interpolation ) {
-
-		var track = new type( prop, [ 0 ], initialValue, interpolation );
-
-		// data must be in JS arrays so it can be resized
-		track.times = Array.prototype.slice.call( track.times );
-		track.values = Array.prototype.slice.call( track.values );
-
-		this._channelNames.push( prop );
-		this._tracks[ prop ] = track;
-
-		// for recording the state:
-		this._propRefs[ prop ] =
-				new PropertyBinding( this._scene, prop );
-
-		return track;
-
-	}
-
-};
-
-export { TimelinerController };

+ 0 - 166
examples/misc_animation_authoring.html

@@ -1,166 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - animation authoring</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<link type="text/css" rel="stylesheet" href="main.css">
-	</head>
-	<body>
-
-		<div id="info">
-		"W" translate | "E" rotate | "R" scale | "+" increase size | "-" decrease size<br />
-		Press "Q" to toggle world/local space, hold down "Ctrl" to snap to grid
-		</div>
-
-		<script src="js/libs/timeliner_gui.min.js"></script>
-
-		<script type="module">
-
-			import * as THREE from '../build/three.module.js';
-
-			import { TransformControls } from './jsm/controls/TransformControls.js';
-			import { TimelinerController } from './jsm/animation/TimelinerController.js';
-
-			var camera, scene, renderer, control;
-
-			init();
-			render();
-
-			function init() {
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				document.body.appendChild( renderer.domElement );
-
-				//
-
-				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 3000 );
-				camera.position.set( 1000, 500, 1000 );
-				camera.lookAt( 0, 200, 0 );
-
-				scene = new THREE.Scene();
-				scene.add( new THREE.GridHelper( 1000, 10, 0x888888, 0x444444 ) );
-
-				var light = new THREE.DirectionalLight( 0xffffff, 2 );
-				light.position.set( 1, 1, 1 );
-				scene.add( light );
-
-
-				var texture = new THREE.TextureLoader().load( 'textures/crate.gif', render );
-				texture.mapping = THREE.UVMapping;
-				texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
-
-				var geometry = new THREE.BoxBufferGeometry( 200, 200, 200 );
-				var material = new THREE.MeshLambertMaterial( { map: texture } );
-
-				control = new TransformControls( camera, renderer.domElement );
-				control.addEventListener( 'change', render );
-
-				var mesh = new THREE.Mesh( geometry, material );
-				mesh.name = "MyBox";
-				scene.add( mesh );
-
-				control.attach( mesh );
-				scene.add( control );
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-				window.addEventListener( 'keydown', function ( event ) {
-
-					switch ( event.keyCode ) {
-
-						case 81: // Q
-							control.setSpace( control.space === "local" ? "world" : "local" );
-							break;
-
-						case 17: // Ctrl
-							control.setTranslationSnap( 100 );
-							control.setRotationSnap( THREE.MathUtils.degToRad( 15 ) );
-							break;
-
-						case 87: // W
-							control.setMode( "translate" );
-							break;
-
-						case 69: // E
-							control.setMode( "rotate" );
-							break;
-
-						case 82: // R
-							control.setMode( "scale" );
-							break;
-
-						case 187:
-						case 107: // +, =, num+
-							control.setSize( control.size + 0.1 );
-							break;
-
-						case 189:
-						case 109: // -, _, num-
-							control.setSize( Math.max( control.size - 0.1, 0.1 ) );
-							break;
-
-					}
-
-				} );
-
-				window.addEventListener( 'keyup', function ( event ) {
-
-					switch ( event.keyCode ) {
-
-						case 17: // Ctrl
-							control.setTranslationSnap( null );
-							control.setRotationSnap( null );
-							break;
-
-					}
-
-				} );
-
-				var trackInfo = [
-
-					{
-						type: THREE.VectorKeyframeTrack,
-						propertyPath: 'MyBox.position',
-						initialValue: [ 0, 0, 0 ],
-						interpolation: THREE.InterpolateSmooth
-					},
-
-					{
-						type: THREE.QuaternionKeyframeTrack,
-						propertyPath: 'MyBox.quaternion',
-						initialValue: [ 0, 0, 0, 1 ],
-						interpolation: THREE.InterpolateLinear
-
-					}
-
-				];
-
-				new Timeliner( new TimelinerController( scene, trackInfo, render ) );
-
-			}
-
-			function onWindowResize() {
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-				render();
-
-			}
-
-			function render() {
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-		<script>if ( typeof TESTING !== 'undefined' ) { setTimeout(() => { var a = document.querySelectorAll( 'body > div' ); a[1].style.display = 'none'; }, 750); }</script>
-	</body>
-</html>

BIN
examples/screenshots/misc_animation_authoring.jpg


+ 0 - 1
utils/modularize.js

@@ -9,7 +9,6 @@ var files = [
 	{ path: 'animation/CCDIKSolver.js', dependencies: [], ignoreList: [ 'SkinnedMesh' ] },
 	{ path: 'animation/MMDAnimationHelper.js', dependencies: [ { name: 'CCDIKSolver', path: 'animation/CCDIKSolver.js' }, { name: 'MMDPhysics', path: 'animation/MMDPhysics.js' } ], ignoreList: [ 'AnimationClip', 'Audio', 'Camera', 'SkinnedMesh' ] },
 	{ path: 'animation/MMDPhysics.js', dependencies: [], ignoreList: [ 'SkinnedMesh' ] },
-	{ path: 'animation/TimelinerController.js', dependencies: [], ignoreList: [] },
 
 	{ path: 'cameras/CinematicCamera.js', dependencies: [ { name: 'BokehShader', path: 'shaders/BokehShader2.js' }, { name: 'BokehDepthShader', path: 'shaders/BokehShader2.js' } ], ignoreList: [] },
 

Неке датотеке нису приказане због велике количине промена