initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var i in t){var o=t[i];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),i=function d(e,t,i){var o=Object.getOwnPropertyDescriptor(e,t);if(void 0===o){var a=Object.getPrototypeOf(e);return null===a?void 0:d(a,t,i)}if("value"in o&&o.writable)return o.value;var n=o.get;if(void 0!==n)return n.call(i)},o=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},a=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=e(require("path")),r=e(require("../atom-react/core/react-editor")),u=e(require("./views/editor")),l=e(require("./models/animation-model")),s=e(require("../common/tree-view-helper")),c=e(require("./audio/multi-audio-playback")),AnimationEditor=function(e){function AnimationEditor(e){a(this,AnimationEditor),i(Object.getPrototypeOf(AnimationEditor.prototype),"constructor",this).call(this,e,!1);var t=this.getUiState();this.layout=t?t:[];var o=r.getProjectRoot(e);this.animationModel=new l(this,o),this.animationModel.audio=new c(this.animationModel,o)}return o(AnimationEditor,e),t(AnimationEditor,{serialize:{value:function(){return this.saveUiState(this.layout),i(Object.getPrototypeOf(AnimationEditor.prototype),"serialize",this).call(this)}},dispose:{value:function(){this.saveUiState(this.layout),i(Object.getPrototypeOf(AnimationEditor.prototype),"dispose",this).call(this),this.animationModel.dispose(),this.animationModel.audio.dispose()}},onPaneActivated:{value:function(){var e=this;setTimeout(function(){e.container.childNodes[0]&&e.container.childNodes[0].focus()},1)}},focus:{value:function(){this.container.childNodes[0]&&this.container.childNodes[0].focus()}},onPaneDeactivated:{value:function(){}},getReactClass:{value:function(){return u}},saveFile:{value:function(e){return AnimationEditor.isValidDirectory(e)?(this.animationModel.saveFile(e),this.animationModel.backup(),!0):(alert('You must save animations under the "animations" folder.'),!1)}},reload:{value:function(){this.animationModel.reloadFile(this.uri)}},getSaveDialogOptions:{value:function(){return{title:"Animation Save As",filters:AnimationEditor.getDialogFilter()}}}},{createNewFile:{value:function(){var e=s.getFolderPathWithDirectory(s.getFolderPathOfSelection(),"animations");if(!e)return void alert("You must have a valid project loaded in order to create a new animation.");var t=atom.getCurrentWindow(),i=require("remote"),o=i.require("dialog");o.showSaveDialog(t,{title:"New Animation",defaultPath:e,filters:AnimationEditor.getDialogFilter()},function(e){e&&(AnimationEditor.isValidDirectory(e)?(l.createNewFile(e),atom.workspace.open(e)):alert('You must save animations under the "animations" folder.'))})}},isValidDirectory:{value:function(e){var t=n.normalize("/animations/");return e.includes(t)?!0:!1}},getDialogFilter:{value:function(){return[{name:"Animation",extensions:["keys"]}]}}}),AnimationEditor}(r);atom.deserializers.add(AnimationEditor),module.exports=AnimationEditor;

View File

@@ -0,0 +1 @@
"use strict";function e(e){for(var t=2*o+e.length,r=s.createBuffer(e.numberOfChannels,t,e.sampleRate),n=0;n<e.numberOfChannels;n++){for(var i=e.getChannelData(n),a=new Float32Array(2*o+i.length),u=0,c=0;o>c;c++)a[u]=0,u++;for(var c=0;c<i.length;c++)a[u]=i[c],u++;for(var c=0;o>c;c++)a[u]=0,u++;r.copyToChannel(a,n)}return r}function t(e){for(var t=new Float32Array(e.length),r=s.createBuffer(1,e.length,e.sampleRate),n=-o,i=0;i<e.length;i++)t[i]=n,n++;return r.getChannelData(0).set(t),r}var r=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},s=new AudioContext,o=44100,i=function(){function i(e){var t=void 0===arguments[1]?!1:arguments[1];n(this,i),this.url=e,this.reverse=t,this.scriptNode=s.createScriptProcessor(256,1,1),this.scriptNode.onaudioprocess=this.processAudio.bind(this),this._currentTime=0,this.started=!1,this.callbacks=[]}return r(i,{bufferTime:{get:function(){return o/this.buffer.sampleRate}},currentTime:{get:function(){return this._currentTime},set:function(e){this.stop(),this.createNodes(),this.sourceNode.start(0,e+this.bufferTime),this.counterNode.start(0,e+this.bufferTime),this.started=!0,this._currentTime=e,this.playbackRate=1}},playbackRate:{set:function(e){this.sourceNode.playbackRate.value=e,this.counterNode.playbackRate.value=e},get:function(){return this.sourceNode.playbackRate.value}},getSamples:{value:function(e){this.originalBufferArray?e(this.originalBufferArray,this.sampleRate):this.callbacks.push(e)}},processAudio:{value:function(e){var t=e.inputBuffer.getChannelData(0),r=t[t.length-1]||0;this._currentTime=this.duration*r/this.numSamples,this.onCurrentTime&&this.onCurrentTime(this._currentTime)}},play:{value:function(){this.started=!0,this.sourceNode.start(),this.counterNode.start()}},stop:{value:function(){this.started&&(this.sourceNode.stop(),this.counterNode.stop()),this.started=!1}},createNodes:{value:function(){this.sourceNode&&this.counterNode&&(this.sourceNode.disconnect(),this.counterNode.disconnect()),this.sourceNode=s.createBufferSource(),this.sourceNode.buffer=this.buffer,this.sourceNode.connect(s.destination),this.counterNode=s.createBufferSource(),this.counterNode.buffer=this.counterBuffer,this.counterNode.connect(this.scriptNode),this.scriptNode.connect(s.destination)}},dispose:{value:function(){this.stop(),this.scriptNode.onaudioprocess=null,this.sourceNode&&this.counterNode&&(this.sourceNode.disconnect(),this.counterNode.disconnect()),this.scriptNode.disconnect(),this.scriptNode=null,this.sourceNode=null,this.counterNode=null,this.disposed=!0}},onLoad:{value:function(r,n){var o=this;s.decodeAudioData(r.response,function(r){if(o.duration=r.length/r.sampleRate,o.sampleRate=r.sampleRate,o.numSamples=r.length,o.buffer=e(r),o.counterBuffer=t(o.buffer),o.originalBufferArray=r.getChannelData(0),o.reverse){o._currentTime=o.duration;for(var s=0;s<o.buffer.numberOfChannels;s++)Array.prototype.reverse.call(o.buffer.getChannelData(s))}o.disposed||(o.createNodes(),n())})}},load:{value:function(e){var t=new XMLHttpRequest;t.open("GET",this.url,!0),t.responseType="arraybuffer",t.onload=this.onLoad.bind(this,t,e),t.send()}}}),i}();module.exports=i;

View File

@@ -0,0 +1 @@
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},i=function(){function t(t,i){for(var a in i){var e=i[a];e.configurable=!0,e.value&&(e.writable=!0)}Object.defineProperties(t,i)}return function(i,a,e){return a&&t(i.prototype,a),e&&t(i,e),i}}(),a=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},e=t(require("./pid-audio-controller.js")),s=t(require("path")),n=function(){function t(i,n,o){a(this,t),this.model=i,this.handleDown=!1,this.wasInRange=!1,this.startTime=o.time/this.model.state.keyframes.framerate;var h=s.resolve(n,"audio",o.value.AudioEvent.file);this.audio=new e(h),this.audio.load(this.onLoaded.bind(this))}return i(t,{startUpdateLoop:{value:function(){this.doUpdate=!0,this.lastUpdate=(new Date).getTime(),this.update()}},stopUpdateLoop:{value:function(){this.doUpdate=!1}},target:{get:function(){var t=this.model.uiState.currentKeyframe/this.model.state.keyframes.framerate;return t-this.startTime}},isInRange:{get:function(){return this.target>-.5&&this.target<this.audio.duration+.5}},onLoaded:{value:function(){this.loaded=!0,this.startUpdateLoop()}},onToggleTimeScrub:{value:function(t){this.handleDown=t,this.loaded&&(t&&this.isInRange?(this.wasInRange=!0,this.audio.playAtTime(this.target),this.audio.reset()):(this.wasInRange=!1,this.audio.stop()))}},onTogglePlay:{value:function(t){this.isPlaying=t,this.loaded&&(this.lastTarget=this.target,t&&this.isInRange?(this.wasInRange=!0,this.audio.playAtTime(this.target)):t||(this.wasInRange=!1,this.audio.stop(this.target)))}},onTimeScrub:{value:function(){if(this.loaded&&this.handleDown){var t=this.isInRange;t&&!this.wasInRange?(this.audio.playAtTime(this.target),this.audio.reset()):!t&&this.wasInRange&&this.audio.stop(),this.wasInRange=t}}},onDataChanged:{value:function(){if(this.loaded&&this.isPlaying){var t=this.isInRange;t&&!this.wasInRange?this.audio.playAtTime(this.target):!t&&this.wasInRange?this.audio.stop():t&&this.lastTarget>this.target&&this.audio.playAtTime(this.target),this.lastTarget=this.target,this.wasInRange=t}}},update:{value:function(){if(this.doUpdate){requestAnimationFrame(this.update.bind(this));var t=(new Date).getTime();if(t-this.lastUpdate<100)return;this.lastUpdate=t,this.handleDown&&this.isInRange&&this.wasInRange?this.audio.target=this.target:this.audio&&this.audio.reset()}}},dispose:{value:function(){this.stopUpdateLoop(),this.audio.dispose(),this.audio=null,this.model=null}}}),t}();module.exports=n;

View File

@@ -0,0 +1 @@
"use strict";var i=function(i){return i&&i.__esModule?i["default"]:i},n=function(){function i(i,n){for(var e in n){var o=n[e];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(i,n)}return function(n,e,o){return e&&i(n.prototype,e),o&&i(n,o),n}}(),e=function(i,n){if(!(i instanceof n))throw new TypeError("Cannot call a class as a function")},o=i(require("./audio-playback")),t=function(){function i(n,o){e(this,i),this.model=n,this.root=o,this.playbacks=[],this.rebuild(),this.onPropsChangedBind=this.onPropsChanged.bind(this),this.onDataChangedBind=this.onDataChanged.bind(this),this.onTogglePlayBind=this.onTogglePlay.bind(this),this.onToggleTimeScrubBind=this.onToggleTimeScrub.bind(this),this.onTimeScrubBind=this.onTimeScrub.bind(this),this.model.on("onpropertieschanged",this.onPropsChangedBind),this.model.on("ondatachanged",this.onDataChangedBind),this.model.on("toggle-play",this.onTogglePlayBind),this.model.on("toggle-time-scrub",this.onToggleTimeScrubBind),this.model.on("drag-keyframe",this.onTimeScrubBind)}return n(i,{onToggleTimeScrub:{value:function(i){this.playbacks.forEach(function(n){n.onToggleTimeScrub(i)})}},onTogglePlay:{value:function(i){this.playbacks.forEach(function(n){n.onTogglePlay(i)})}},onTimeScrub:{value:function(){this.playbacks.forEach(function(i){i.onTimeScrub()})}},onDataChanged:{value:function(){this.playbacks.forEach(function(i){i.onDataChanged()})}},rebuild:{value:function(){var i=this;this.playbacks.forEach(function(i){i.dispose()}),this.playbacks=[],this.map={};var n=this.model.getLayersOfType("Audio Event");n.forEach(function(n){n.visible&&!n.locked&&(i.map[n.id]=[],n.keyframes.forEach(function(e){if(e.value.AudioEvent.file&&e.value.AudioEvent.file.length>0){var t=new o(i.model,i.root,e);i.playbacks.push(t),i.map[n.id][e.time]=t}}))})}},onPropsChanged:{value:function(){this.rebuild()}},dispose:{value:function(){this.playbacks.forEach(function(i){i.dispose()}),this.model.removeListener("ondatachanged",this.onDataChangedBind),this.model.removeListener("toggle-play",this.onTogglePlayBind),this.model.removeListener("toggle-time-scrub",this.onToggleTimeScrubBind),this.model.removeListener("time-scrub",this.onTimeScrubBind),this.playbacks=[]}}}),i}();module.exports=t;

View File

@@ -0,0 +1 @@
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},i=function(){function t(t,i){for(var e in i){var n=i[e];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(t,i)}return function(i,e,n){return e&&t(i.prototype,e),n&&t(i,n),i}}(),e=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},n=t(require("node-pid-controller")),u=t(require("./two-way-controller")),o=function(){function t(i){e(this,t),this.pid=new n(5,1,.02,!1),this._target=0,this.pid.setTarget(this._target),this.audio=new u(i),this.isPlaying=!1}return i(t,{load:{value:function(t){var i=this;this.audio.load(function(){i.isPlaying=!0,t()})}},playAtTime:{value:function(t){var i=void 0===arguments[1]?1:arguments[1];this.audio.playAtTime(t,i)}},stop:{value:function(){this.isPlaying=!1,this.audio.stop()}},target:{set:function(t){var i=this.audio.currentTime-t,e=this.pid.update(i);this.audio.playbackRate=e}},zeroPid:{value:function(){this.pid.update(0)}},currentTime:{set:function(t){this.audio.currentTime=t},get:function(){return this.audio.currentTime}},duration:{get:function(){return this.audio.duration}},getSamples:{value:function(t){return this.audio.getSamples(t)}},reset:{value:function(){this.pid.reset()}},dispose:{value:function(){this.audio.dispose(),this.audio=null,this.pid=null}}}),t}();module.exports=o;

View File

@@ -0,0 +1 @@
"use strict";var r=function(r){return r&&r.__esModule?r["default"]:r},t=function(){function r(r,t){for(var e in t){var i=t[e];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(r,t)}return function(t,e,i){return e&&r(t.prototype,e),i&&r(t,i),t}}(),e=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},i=r(require("./audio-controller")),n=r(require("async")),s={FORWARD:0,REVERSE:1},o=function(){function r(t){e(this,r),this.forward=new i(t),this.reverse=new i(t,!0),this.direction=s.FORWARD,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this._currentTime=0}return t(r,{duration:{get:function(){return this.forward.duration}},currentTime:{get:function(){return this._currentTime},set:function(r){this._currentTime=r,this.reverse.currentTime=this.forward.duration-r,this.forward.currentTime=r,this.direction===s.REVERSE?this.forward.stop():this.reverse.stop()}},playbackRate:{set:function(r){this._playbackRate=r,r>=0&&this.direction===s.REVERSE?(this.direction=s.FORWARD,this.forward.currentTime=this._currentTime,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this.reverse.onCurrentTime=null,this.reverse.stop()):0>r&&this.direction===s.FORWARD&&(this.direction=s.REVERSE,this.reverse.currentTime=this.forward.duration-this._currentTime,this.reverse.onCurrentTime=this.onCurrentTime.bind(this),this.forward.onCurrentTime=null,this.forward.stop()),this.direction===s.FORWARD?this.forward.playbackRate=r:this.direction===s.REVERSE&&(this.reverse.playbackRate=-r)},get:function(){return this._playbackRate}},load:{value:function(r){var t=this;n.parallel([function(r){t.forward.load(r)},function(r){t.reverse.load(r)}],r)}},stop:{value:function(){var r=void 0===arguments[0]?0:arguments[0];this.currentTime=r,this.forward.stop(),this.reverse.stop()}},onCurrentTime:{value:function(r){this.direction===s.REVERSE?this._currentTime=this.forward.duration-r:this._currentTime=r}},playAtTime:{value:function(r){var t=void 0===arguments[1]?1:arguments[1];this._currentTime=r||0,this._playbackRate=t,this.direction===s.REVERSE&&(this.direction=s.FORWARD,this.forward.onCurrentTime=this.onCurrentTime.bind(this),this.reverse.onCurrentTime=null,this.reverse.stop()),this.forward.currentTime=this._currentTime,this.forward.playbackRate=this._playbackRate}},dispose:{value:function(){this.forward.onCurrentTime=null,this.forward.dispose(),this.reverse.onCurrentTime=null,this.reverse.dispose(),this.forward=null,this.reverse=null}}}),r}();module.exports=o;

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var o in t){var n=t[o];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=require("animation-utilities").THREE,n=require("atom").CompositeDisposable,r=require("path"),i=require("animation-utilities"),a=i.JiboConfig,s=i.RobotInfo,d=i.visualize,u=new a,l=require("./dof-controller"),c=require("../views/three-debug.js"),h=function(){function i(e){t(this,i),this.animationModel=e,this.baseTexture=r.resolve(__dirname,"../../../","node_modules/animation-content/animations/textures/"),this.baseTextureURL=this.baseTexture+"/JiBO_eye_customizer_",this.baseBGURL=this.baseTexture+"/JiBO_BG_",this.disposable=new n}return e(i,{dispose:{value:function(){this.disposable.dispose()}},toTextureURL:{value:function(e){return this.baseTextureURL+this.getPaddedValueString(e)+".png"}},toBGTextureURL:{value:function(e){return this.baseBGURL+this.getPaddedValueString(e)+".png"}},onMouseDown:{value:function(e){this.container.focus(),this.onMouseChange(e)}},onMouseChange:{value:function(){this.renderer&&(this.animationModel.keyframeSelection.isMultiSelect()||!this.animationModel.isLayerOfTypeSelected("Body")?(this.container.childNodes[1].pointerEvents="none",this.container.childNodes[1].style.cursor="not-allowed"):(this.container.childNodes[1].pointerEvents="",this.container.childNodes[1].style.cursor="pointer"))}},_getThreeColorFromConfig:{value:function(e){var t=atom.config.get("jibo-sdk."+e);return new o.Color(t.red/255,t.green/255,t.blue/255)}},_updateBackgroundColor:{value:function(){var e=this._getThreeColorFromConfig("AnimationEditorBackgroundColor");this.renderer.setBackgroundColor(e.r,e.g,e.b,1)}},_updateGridColor:{value:function(){this.renderer.setGrid(.05,6,this._getThreeColorFromConfig("AnimationEditorGridColor"))}},getPaddedValueString:{value:function(e){var t=10>e?"0":"";return t+e}},setCamera:{value:function(e){var t=this,n=.35,r=.5,i=new o.Vector3(0,0,.15);this.renderer.scene._controls.reset();var a={front:function(){t.renderer.setCamera(new o.Vector3(r,0,n),i,45)},back:function(){t.renderer.setCamera(new o.Vector3(-r,0,n),i,45)},left:function(){t.renderer.setCamera(new o.Vector3(0,r,n),i,45)},right:function(){t.renderer.setCamera(new o.Vector3(0,-r,n),i,45)}};a[e]()}},initialize:{value:function(e,t){var n=this;this.container=e,e.addEventListener("mousemove",this.onMouseChange.bind(this),!0),e.addEventListener("mousedown",this.onMouseDown.bind(this),!0),e.addEventListener("mouseup",this.onMouseChange.bind(this),!0),s.createInfo(u,function(r){d.createRobotRenderer(r,e,d.DisplayType.BODY,function(i){if(i){n.renderer=i,n.robotInfo=r,n.dofValues=r.getDefaultDOFValues(),n.debug=new c(n.renderer.scene.getScene()),i.setCamera(new o.Vector3(.5,0,.35),new o.Vector3(0,0,.15),45),n.dofController=l.createWithRenderer(n.renderer,e,l.ControllerType.BODY,r),n.dofController.setDOFValues(n.dofValues),n.listenForChanges();var a=i.scene.getScene(),s=new o.AxisHelper(1);s.position.z+=.01,a.add(s),n._updateBackgroundColor(),n.disposable.add(atom.config.observe("jibo-sdk.AnimationEditorBackgroundColor",function(){n._updateBackgroundColor()})),n._updateGridColor(),n.disposable.add(atom.config.observe("jibo-sdk.AnimationEditorGridColor",function(){n._updateGridColor()})),t(null)}})})}},listenForChanges:{value:function(){var e=this,t=this;this.dofController.on(l.EventType.DOF_VALUES_CHANGED,function(o,n){var r=e.animationModel.getLayersOfType("Body");0!==r.length&&"Body"===e.animationModel.getSelectedLayer().type&&(n.topSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Head:n.topSection_r/Math.PI*180}),n.middleSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Torso:n.middleSection_r/Math.PI*180}),n.bottomSection_r&&t.animationModel.updateSelectedLayerPropertiesRelative({Pelvis:n.bottomSection_r/Math.PI*180}))}),this.dofController.on(l.EventType.DOF_SELECTION_CHANGED,function(e,t){1!==t.length}),this.dofController.on(l.EventType.DOF_MANIPULATION_ENDED,function(){t.animationModel.addRedoUndoEntry()})}},updateDofValues:{value:function(e){this.dofValues=e,this.dofController&&this.dofController.setDOFValues(this.dofValues)}},update:{value:function(){this.renderer&&this.renderer.display(this.dofValues)}}}),i}();module.exports=h;

View File

@@ -0,0 +1 @@
"use strict";var e=require("animation-utilities"),t=e.MouseCoordinateWrangler,n=e.THREE,r={DOF_VALUES_CHANGED:"DOF_VALUES_CHANGED",DOF_SELECTION_CHANGED:"DOF_SELECTION_CHANGED",DOF_MANIPULATION_ENDED:"DOF_MANIPULATION_ENDED"},o={BODY:"BODY"},s=function(e,t,n,r){if(n!==o.BODY)throw new Error("DOFController: unsupported controller type: "+n);return new u(e,t,n,r)},i="topSection_r",l="middleSection_r",a="bottomSection_r",u=function(e,t,o,s){this.renderer=e,this.scene=e.scene,this.controllerType=o,this.robotInfo=s,this.renderer.setGrid(.1,4,new n.Color(.2,.2,.2)),this.dofValues={};for(var u=s.getDOFNames(),d=0;d<u.length;d++)this.dofValues[u[d]]=0;this.selectedDOFs=[],this.eventListeners={},this.eventListeners[r.DOF_VALUES_CHANGED]=[],this.eventListeners[r.DOF_SELECTION_CHANGED]=[],this.eventListeners[r.DOF_MANIPULATION_ENDED]=[],this.lockingMode=!1;var c=this,D=!1,v=null,E=!1,O=!1,f=!1,p=function(t){if(3===t.which)return!1;var n=!t.altKey&&!t.metaKey&&!t.ctrlKey;return n?e.scene._controls.enabled=!1:e.scene._controls.enabled=!0,n},F=function(e,t){e.preventDefault(),e.stopPropagation();var n;if(t){if(null!==c.getSelectedDOFs()&&c.getSelectedDOFs().length>0){n=c.getSelectedDOFs()[0],O=!0;var o=.5*e.movementX*Math.PI/180,s=c.dofValues[n]+o,u={};u[n]=s,e.shiftKey&&(n===l&&(u[i]=c.dofValues[i]-o),n===a&&(u[l]=c.dofValues[l]-o)),c.setDOFValues(u),c._fireEvent(r.DOF_VALUES_CHANGED,u)}}else n=h(e,v,c.scene.getScene(),c.scene.getCamera()),n&&(c.setSelectedDOFs([n]),c._fireEvent(r.DOF_SELECTION_CHANGED,c.getSelectedDOFs()))},_=function(e){return f?void(E&&p(e)&&F(e,!0)):(e.preventDefault(),void e.stopPropagation())},g=function(){f&&(f=!1,E&&(O&&(O=!1,c._fireEvent(r.DOF_MANIPULATION_ENDED)),null!==c.getSelectedDOFs()&&c.getSelectedDOFs().length>0&&(c.setSelectedDOFs([]),c._fireEvent(r.DOF_SELECTION_CHANGED,c.getSelectedDOFs()))))},m=function(e){f=!0,E&&p(e)&&F(e,!1)};this.detachFromContainer=function(e){(void 0===e||e===!0)&&c.renderer.detachFromContainer(),null!==v&&(v.removeEventListener("mousemove",_,D),v.removeEventListener("mouseup",g,D),v.removeEventListener("mouseleave",g,D),v.removeEventListener("mousedown",m,D),O&&(O=!1,c._fireEvent(r.DOF_MANIPULATION_ENDED)),null!==c.getSelectedDOFs()&&c.getSelectedDOFs().length>0&&(c.setSelectedDOFs([]),c._fireEvent(r.DOF_SELECTION_CHANGED,c.getSelectedDOFs())),E=!1,v=null)},this.attachToContainer=function(e,t){c.detachFromContainer(t),v=void 0!==e?e:null,null!==v&&((void 0===t||t===!0)&&c.renderer.attachToContainer(v),v.addEventListener("mousemove",_,D),v.addEventListener("mouseup",g,D),v.addEventListener("mouseleave",g,D),v.addEventListener("mousedown",m,D),E=!0)},this.dispose=function(e){c.detachFromContainer(!1),null!==c.renderer&&((void 0===e||e===!0)&&c.renderer.dispose(),c.renderer=null),c.scene=null,c.robotInfo=null,c.eventListeners=null},this.attachToContainer(t,!1)};u.prototype.getDOFValues=function(){return this.dofValues},u.prototype.setDOFValues=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)this.dofValues[t[n]]=e[t[n]];this.renderer.display(this.dofValues)},u.prototype.getSelectedDOFs=function(){return this.selectedDOFs},u.prototype.setSelectedDOFs=function(e){this.selectedDOFs=e},u.prototype.on=function(e,t){var n=this.eventListeners[e];if(void 0===n)throw new Error("DOFController: unsupported event type: "+e);n.push(t)},u.prototype.setLockingMode=function(e){this.lockingMode=e},u.prototype._fireEvent=function(e){var t=this.eventListeners[e];if(void 0===t)throw new Error("DOFController: unsupported event type: "+e);for(var n=[this],r=1;r<arguments.length;r++)n.push(arguments[r]);for(var o=0;o<t.length;o++)t[o].apply(null,n)};var d={};d[i]=["headMeshMesh","maskMeshMesh","screenMeshBillboardMesh"],d[l]=["torsoMeshMesh"],d[a]=["pelvisMeshMesh","lightringMeshMesh"];var c={};!function(){for(var e=Object.keys(d),t=0;t<e.length;t++)for(var n=d[e[t]],r=0;r<n.length;r++)c[n[r]]=e[t]}();var h=function(e,r,o,s){var i=t.getLocalCoordinatesNDCCentered(e,r),l=new n.Raycaster;l.linePrecision=.01,l.setFromCamera(i,s);var a=l.intersectObject(o,!0);if(a.length>0){var u=c[a[0].object.name];return u||null}return null};module.exports.EventType=r,module.exports.ControllerType=o,module.exports.createWithRenderer=s;

View File

@@ -0,0 +1 @@
"use strict";var t=function(){function t(t,e){for(var n in e){var i=e[n];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(t,e)}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),e=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=require("animation-utilities").THREE,i=function(){function i(t,n,o,s,a){e(this,i),this.renderer=t,this.element=n,this.animationModel=s,this.spheres=[],this.scene=t.scene.getScene();var h=a?"overlay_textureSubRootBn":"eyeSubRootBn";this.rootBone=this.scene.getObjectByName(h),this.onMouseDownBind=this.onMouseDown.bind(this),this.onMouseUpBind=this.onMouseUp.bind(this),this.onRotateBind=this.onRotate.bind(this),this.element.addEventListener("mousedown",this.onMouseDownBind),this.element.addEventListener("mouseup",this.onMouseUpBind)}return t(i,{setProps:{value:function(t){this.lastAngle=t.Rotate}},getIntersectionAtHeight:{value:function(t,e,i){var o=new n.Vector3;o.set(t/this.element.clientWidth*2-1,2*-(e/this.element.clientHeight)+1,.5);var s=this.renderer.scene.getCamera();return o.unproject(s),o.z=i,o}},onRotate:{value:function(){this.startedManipulation=!0;var t=this.getMouseAngle(),e=t-this.tempInitialAngle,n=(this.tempInitialRotation+e)/Math.PI*180-this.lastAngle;n>120||-120>n?(this.lastAngle=(this.tempInitialRotation+e)/Math.PI*180-n,this.tempInitialRotation=this.lastAngle*Math.PI/180,this.tempInitialAngle=this.getMouseAngle()):this.lastAngle=(this.tempInitialRotation+e)/Math.PI*180,this.animationModel.updateSelectedLayerPropertiesRelative({Rotate:this.lastAngle})}},onMouseUp:{value:function(){this.element.removeEventListener("mousemove",this.onMouseMoveBind),this.element.removeEventListener("mousemove",this.onRotateBind),this.sphere=void 0,this.startedManipulation&&(this.startedManipulation=!1,this.animationModel.addRedoUndoEntry())}},getMouseAngle:{value:function(){var t=this.getIntersectionAtHeight(event.offsetX,event.offsetY,0),e=new n.Vector2(1,0),i=new n.Vector2(this.rootBone.position.x,this.rootBone.position.y),o=new n.Vector2(t.x,t.y),s=o.sub(i).normalize();return s.y<0?2*Math.PI-Math.acos(e.dot(s)):Math.acos(e.dot(s))}},onMouseDown:{value:function(){this.initialMouseAngle=this.getMouseAngle(),this.initialRotation=this.rootBone.rotation.z,this.tempInitialAngle=this.initialMouseAngle,this.tempInitialRotation=this.initialRotation,this.element.addEventListener("mousemove",this.onRotateBind)}},dispose:{value:function(){this.element.removeEventListener("mousedown",this.onMouseDownBind),this.element.removeEventListener("mouseup",this.onMouseUpBind),this.disposed=!0}},scaleSpheres:{value:function(){}}}),i}();module.exports=i;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var i in t){var s=t[i];s.configurable=!0,s.value&&(s.writable=!0)}Object.defineProperties(e,t)}return function(t,i,s){return i&&e(t.prototype,i),s&&e(t,s),t}}(),t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=require("animation-utilities"),s=i.THREE,o=i.MouseCoordinateWrangler,n=require("jibo-keyframes").conversion,r=function(){function i(e,s,o,n,r){t(this,i),this.renderer=e,this.element=s,this.robotInfo=o,this.animationModel=n,this.prefix=r?"overlay_vertexJoint":"vertexJoint",this.vertices={},this.vertexToPropMap={},this.spheres={};var a=e.scene.getScene(),h=r?"overlay_textureSubRootBn":"eyeSubRootBn";this.rootBone=a.getObjectByName(h);for(var c=1;10>c;c++){var u=""+this.prefix+c,v=a.getObjectByName(u);this.vertices[u]=v,this.createSphere(v),this.vertexToPropMap[u]="Vertex "+c}this.onMouseDownBind=this.onMouseDown.bind(this),this.onMouseUpBind=this.onMouseUp.bind(this),this.onMouseMoveBind=this.onMouseMove.bind(this),this.element.addEventListener("mousedown",this.onMouseDownBind),this.element.addEventListener("mouseup",this.onMouseUpBind)}return e(i,{scaleSpheres:{value:function(){var e=this;Object.keys(this.spheres).forEach(function(t){var i=e.spheres[t];i.scale.x=1/e.rootBone.scale.x,i.scale.y=1/e.rootBone.scale.y})}},createSphere:{value:function(e){var t=new s.SphereGeometry(.0018,32,32),i=new s.MeshLambertMaterial({color:0,emissive:3355545}),o=new s.Mesh(t,i);o.position.x=e.position.x,o.position.y=e.position.y,o.position.z=e.position.z,this.scaleSpheres(),o.name=e.name,this.vertices[e.name]&&(this.spheres[e.name]=o,this.vertices[e.name]=e,e.parent.add(o))}},setIntersectedObject:{value:function(e){var t=this.renderer.scene.getScene(),i=this.renderer.scene.getCamera(),n=o.getLocalCoordinatesNDCCentered(e,this.element),r=new s.Raycaster;r.setFromCamera(n,i);for(var a=r.intersectObject(t,!0),h=0;h<a.length;h++)if(this.vertices[a[h].object.name])return this.sphere=a[h].object,void(this.vertex=this.vertices[a[h].object.name])}},getIntersectionAtHeight:{value:function(e,t,i){var o=new s.Vector3;o.set(e/this.element.clientWidth*2-1,2*-(t/this.element.clientHeight)+1,.5);var n=this.renderer.scene.getCamera();return o.unproject(n),o.z=i,o}},onMouseMove:{value:function(e){this.startedManipulation=!0;var t=this.getIntersectionAtHeight(e.offsetX,e.offsetY,0);t=this.rootBone.worldToLocal(t.clone());var i=t.sub(this.initMousePosition),s=this.vertexToPropMap[this.vertex.name],o={};o[s]={x:n.toPixelsX(this.initSpherePosition.x+i.x),y:n.toPixelsY(this.initSpherePosition.y+i.y)},this.animationModel.updateSelectedLayerPropertiesRelative(o)}},setProps:{value:function(e){for(var t=1;10>t;t++){var i=e["Vertex "+t],s=""+this.prefix+t,o=this.spheres[s];o.position.x=n.toMetersX(i.x),o.position.y=n.toMetersY(i.y)}this.scaleSpheres()}},onMouseUp:{value:function(){this.sphere=void 0,this.vertex=void 0,this.element.removeEventListener("mousemove",this.onMouseMoveBind),this.startedManipulation&&(this.startedManipulation=!1,this.animationModel.addRedoUndoEntry())}},onMouseDown:{value:function(e){this.setIntersectedObject(e),this.vertex&&this.sphere&&(this.initSpherePosition=this.sphere.position.clone(),this.initMousePosition=this.rootBone.worldToLocal(this.getIntersectionAtHeight(e.offsetX,e.offsetY,0)),this.element.addEventListener("mousemove",this.onMouseMoveBind))}},dispose:{value:function(){var e=this;this.element.removeEventListener("mousedown",this.onMouseDownBind),this.element.removeEventListener("mouseup",this.onMouseUpBind),Object.keys(this.spheres).forEach(function(t){var i=e.spheres[t];i.parent&&i.parent.remove(i)}),this.disposed=!0}}}),i}();module.exports=r;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var n in t){var i=t[n];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(e,t)}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),n=function O(e,t,n){var i=Object.getOwnPropertyDescriptor(e,t);if(void 0===i){var r=Object.getPrototypeOf(e);return null===r?void 0:O(r,t,n)}if("value"in i&&i.writable)return i.value;var o=i.get;if(void 0!==o)return o.call(n)},i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=e(require("jibo-keyframes")),u=require("events").EventEmitter,a=require("animation-utilities"),l=a.JiboConfig,c=a.LEDOutput,s=a.animate,f=a.body,p=a.TimelineBuilder,d=a.RobotInfo,b=e(require("../../toolbar/run-configuration")),v=e(require("url")),y=function(e){function u(){r(this,u),n(Object.getPrototypeOf(u.prototype),"constructor",this).call(this),this.builder=null,this.instance=null}return i(u,e),t(u,{play:{value:function(e){var t=this;d.createInfo(new l,function(n){p.createTimeline(n,function(i){var r="ws:"+v.parse(b.host).hostname+":8282",u=new f.BodyPosVelOutput(i.getClock(),n,r,!0,33);i.getModalityDelegate(s.MODALITY_NAME).addOutput(u,null);var a=new c(i.getClock(),n,r,!0,33);i.getModalityDelegate(s.MODALITY_NAME).addOutput(a,null);var l=s.createAnimationUtilities(i,n),d=o.keysObjToAnimObject(e);t.builder=l.createAnimationBuilderFromData(d),t.builder.on("STOPPED",function(){p.disposeTimeline(i,!0),t.builder.eventHandlers={},t.builder=null,t.instance=null,t.emit("stopped")}),t.instance=t.builder.play()})})}},stop:{value:function(){this.instance&&this.instance.stop()}}}),u}(u);module.exports=new y;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var o in t){var n=t[o];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=require("jibo-keyframes").conversion,n=function(){function n(e,o,i){t(this,n),this.renderer=e,this.animationModel=o,this.layerType=i?"Overlay":"Eye";var a=i?"overlay_textureSubRootBn":"eyeSubRootBn",r=e.scene.getScene();this.rootBone=r.getObjectByName(a),this.prefix=i?"overlay_vertexJoint":"vertexJoint",this.vertices={};for(var s=1;10>s;s++){var h=""+this.prefix+s,l=r.getObjectByName(h);this.vertices[h]=l}this.onDataChangedBind=this.onDataChanged.bind(this),this.animationModel.on("ondatachanged",this.onDataChangedBind),this.onDataChanged()}return e(n,{onDataChanged:{value:function(){var e=this,t=this.animationModel.evaluateAllLayersFiltered(function(t){return t.type===e.layerType})[this.layerType];t=t?t:this.animationModel.getDefaultPropsForLayerType(this.layerType);for(var n=1;10>n;n++){var i=t["Vertex "+n],a=""+this.prefix+n,r=this.vertices[a];r.position.x=o.toMetersX(i.x),r.position.y=o.toMetersY(i.y)}this.rootBone.position.x=o.toMetersX(t.Translate.x),this.rootBone.position.y=o.toMetersY(t.Translate.y),this.rootBone.scale.x=t.Scale.x,this.rootBone.scale.y=t.Scale.y,this.rootBone.rotation.z=t.Rotate*Math.PI/180}},dispose:{value:function(){this.animationModel.removeListener("ondatachanged",this.onDataChangedBind)}}}),n}();module.exports=n;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},a=e(require("react"));module.exports=a.createClass({displayName:"mode-select",getInitialState:function(){return{mode:"str",disabled:!0}},render:function(){var e="btn selected",s="btn",n={};return this.props.disabled&&(n.disabled=!0),a.createElement("div",{className:"eye-mode"},a.createElement("div",{className:"btn-group",style:{margin:5}},a.createElement("button",t({},n,{tabIndex:300,className:"str"===this.state.mode?e:s,onClick:this.onClick.bind(this,"str")}),a.createElement("i",{className:"fa fa-arrows"})),a.createElement("button",t({},n,{tabIndex:301,className:"vertex"===this.state.mode?e:s,onClick:this.onClick.bind(this,"vertex")}),a.createElement("i",{className:"fa fa-crosshairs"})),a.createElement("button",t({},n,{tabIndex:302,className:"rotation"===this.state.mode?e:s,onClick:this.onClick.bind(this,"rotation")}),a.createElement("i",{className:"fa fa-undo"}))))},onClick:function(e){this.state.mode=e,this.setState(this.state),this.props.onSelect(e)}});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),s=e(require("./keyframe-slot")),r=t.createClass({displayName:"LayerView",getInitialState:function(){var e=this;return this.props.animationModel.on("onpropertieschanged",function(){e.forceUpdate()}),{}},shouldComponentUpdate:function(e){return this.props.latestHash!==e.latestHash||this.props.totalFrames!==e.totalFrames||"undefined"!=typeof e.upserted||"undefined"!=typeof e.selected},render:function(){for(var e={width:this.props.totalWidth,height:40,opacity:this.props.locked?.4:1},r=[],a=0,i=0;a<this.props.totalFrames;){var o=this.props.keyframesExceeded&&"Body"===this.props.type?this.props.keyframesExceeded[a]:!1,p=a%5===0,n=this.props.animationModel.keyframeSelection.isSelected(this.props.layerId,a),d=void 0;"undefined"!=typeof this.props.upserted&&this.props.upserted===a&&(d=this.props.upserted),i<this.props.keyframes.length&&this.props.keyframes[i].time===a?(r.push(t.createElement(s,{animationModel:this.props.animationModel,key:a,keyframeIndex:a,layerId:this.props.layerId,exists:!0,exceedsLimit:o,marker:p,selected:n,upserted:d})),i++):r.push(t.createElement(s,{animationModel:this.props.animationModel,key:a,keyframeIndex:a,layerId:this.props.layerId,exceedsLimit:o,marker:p,selected:n})),a++}return t.createElement("div",{style:e,className:"animation-channel"},t.createElement("div",{className:"animation-channel-keyframes"},r))}});module.exports=r;

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),s=require("atom").CompositeDisposable,n=e(require("../../../common/directory-tree-view")),a=e(require("path")),i=e(require("../../../common/get-asset-packs"));module.exports=t.createClass({displayName:"choose-texture-modal",onChoose:function(){var e=this.state.currentAssetPack,t=a.join(e.root,"animations","textures"),s=a.relative(t,this.state.currentTexture);s="project"===this.state.currentAssetPack.id?a.join("animations","textures",s):a.join("node_modules",this.state.currentAssetPack.id,"animations","textures",s),this.props.onChoose(s),this.props.onClose()},onCancel:function(){this.props.onClose()},getInitialState:function(){return{currentAssetPack:{id:"project"},currentTexture:"",filter:"",key:0}},onAssetPackSelected:function(e){this.setState({currentAssetPack:e})},onSelected:function(e){console.log(e),this.setState({currentTexture:e})},getPanelHeading:function(e){return t.createElement("div",{className:"panel-heading",style:{padding:"0px",width:"100%",height:30}},t.createElement("p",{style:{textAlign:"center",marginTop:"4px",marginBottom:"4px"}},e))},render:function(){for(var e=this,s=i(this.props.root),o=void 0,r=[],c=0;c<s.length;c++){var l=s[c],m="list-item";this.state.currentAssetPack.id===l.id&&(this.state.currentAssetPack=l,o=l,m+=" selected"),r.push(t.createElement("li",{className:m,onClick:this.onAssetPackSelected.bind(this,l)},t.createElement("span",null,l.name)))}return t.createElement("div",{className:"asset-selector-modal",ref:"modal"},t.createElement("div",{className:"panel-heading",style:{padding:"0px"}},t.createElement("h2",{style:{textAlign:"center",marginTop:"6px",marginBottom:"6px"}},"Choose a Texture File")),t.createElement("label",{style:{marginLeft:10}},"Search"),t.createElement("atom-text-editor",{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10},mini:!0}),t.createElement("div",{className:"contents"},t.createElement("div",{className:"list-contents"},this.getPanelHeading("Asset Pack"),t.createElement("div",{className:"list-group asset-pack",ref:"assetPackList"},r)),t.createElement("div",{className:"list-contents"},this.getPanelHeading("Texture File"),t.createElement("div",{className:"asset-list"},t.createElement(n,{uri:a.resolve(o.root,"animations","textures"),onChosen:function(t){e.onSelected(t),e.onChoose()},onSelected:this.onSelected,extension:[".png",".jpg","jpeg"],filter:this.state.filter}))),t.createElement("div",{className:"preview-contents"},this.getPanelHeading("Preview"),t.createElement("div",{className:"asset-preview"},t.createElement("img",{key:this.state.key++,controls:!0,style:{width:"100%",padding:15},src:this.state.currentTexture})))),t.createElement("div",{className:"btn-group"},t.createElement("button",{className:"btn",onClick:this.onChoose},"Choose"),t.createElement("button",{className:"btn",onClick:this.onCancel},"Cancel")))},onLeft:function(){var e=t.findDOMNode(this.refs.assetPackList);e.focus()},onRight:function(){var e=t.findDOMNode(this.refs.schemaList);e.focus()},componentDidMount:function(){var e=this,n=t.findDOMNode(this.refs.editor);setTimeout(function(){n.focus(),e.disposable=new s,e.disposable.add(atom.commands.add(e.getDOMNode(),{"jibo-sdk:escape":e.onCancel})),e.disposable=atom.commands.add(n,"jibo-sdk:confirm",function(){e.onChoose()})},100);var a=n.getModel();a.onDidChange(function(){e.setState({filter:a.getText()})})},componentWillUnmount:function(){this.disposable.dispose()}});

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),i=e(require("./settings.js")),a=e(require("../../animation-editor/remote/play-keys-remote")),o=t.createClass({displayName:"PlaybackControlsView",getInitialState:function(){return{showSettings:!1,isPreviewing:!1}},onPlayPause:function(){this.props.animationModel.togglePlay()},onStepForward:function(){this.props.animationModel.stepTimeForward()},onStepBackward:function(){this.props.animationModel.stepTimeBackward()},onGoToNextKeyframe:function(){this.props.animationModel.goToNextKeyframe()},onGoToPrevKeyframe:function(){this.props.animationModel.goToPrevKeyframe()},onSettings:function(){this.setState({showSettings:!0})},onSettingsFinished:function(){this.setState({showSettings:!1})},onPlayPreview:function(){var e=this;this.setState({isPreviewing:!0}),a.play(this.props.animationModel.state.keyframes),a.once("stopped",function(){e.setState({isPreviewing:!1})})},onStopPreview:function(){a.stop(),this.setState({isPreviewing:!1})},render:function(){var e=this.props.animationModel.isPlaying()?t.createElement("i",{className:"fa fa-pause",onClick:this.onPlayPause}):t.createElement("i",{className:"fa fa-play",onClick:this.onPlayPause}),a={marginLeft:(this.props.timelineWidth-297)/2},o=this.state.showSettings?t.createElement(i,{onFinished:this.onSettingsFinished,animationModel:this.props.animationModel}):void 0,n=this.state.isPreviewing?t.createElement("i",{ref:"stopPreview",className:"fa fa-stop",onClick:this.onStopPreview}):t.createElement("i",{ref:"playPreview",className:"fa fa-play-circle",onClick:this.onPlayPreview});return t.createElement("div",{style:a,className:"animation-editor-playback-controls"},t.createElement("i",{className:"fa fa-fast-backward",onClick:this.onGoToPrevKeyframe}),t.createElement("i",{className:"fa fa-step-backward",onClick:this.onStepBackward}),e,t.createElement("i",{className:"fa fa-step-forward",onClick:this.onStepForward}),t.createElement("i",{className:"fa fa-fast-forward",onClick:this.onGoToNextKeyframe}),n,t.createElement("i",{className:"fa fa-gear",onClick:this.onSettings}),o)},componentDidMount:function(){var e=t.findDOMNode(this.refs.playPreview);this.disposable=atom.tooltips.add(e,{title:"Play Robot Preview"})},componentWillUnmount:function(){this.disposable.dispose()}});module.exports=o;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),o=e(require("fs")),i=e(require("path")),n=e(require("normalize-path")),r=e(require("../../../common/modals/choose-audio-modal")),s=e(require("../../../atom-react/mixins/modal-mixin")),a=t.createClass({displayName:"AudioInput",mixins:[s],getInitialState:function(){var e={file:this.props.content.file};return e},componentWillReceiveProps:function(e){e.content.file!==this.state.file&&(this.setState({file:e.content.file}),this.refs.audioEditor.getDOMNode().getModel().setText(e.content.file))},getRoot:function(){return i.resolve(this.props.projectRoot,"audio")},getUri:function(){var e=this.state.file.split("://");if(1===e.length){var t=i.resolve(this.props.projectRoot,"audio",this.state.file);return t}if(2===e.length){var t=i.resolve(this.props.projectRoot,"node_modules",e[0],"audio",e[1]);return t}},render:function(){var e={};try{o.statSync(this.getUri())}catch(i){e={disabled:!0}}var n=e.disabled?t.createElement("div",{className:"error-messages"},"No audio file by that name"):null;return t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"block"},t.createElement("div",{className:"fileBlock"},t.createElement("button",{style:{"float":"right"},className:"btn",onClick:this.onChoose},"..."),t.createElement("atom-text-editor",{ref:"audioEditor",mini:!0},this.state.file)),n,t.createElement("br",null)))},onChoose:function(){var e=this;this.createModal(t.createElement(r,{root:this.getRoot(),uri:this.getUri(),onChoose:function(o){o=n(o);var i=t.findDOMNode(e.refs.audioEditor);i.getModel().setText(o),e.setState({file:o}),e.props.onChange({file:o})},onClose:function(){e.destroyModal()}}))},componentDidMount:function(){var e=this,o=t.findDOMNode(this.refs.audioEditor),i=o.getModel();i.onDidChange(function(){e.setState({file:i.getText()})}),this.disposable=atom.commands.add(o,"core:confirm",function(){e.props.onChange({file:e.state.file})})},componentWillUnmount:function(){this.disposable&&this.disposable.dispose()}});module.exports=function(e,o,i){return t.createElement(a,{onChange:e,content:o,projectRoot:i})};

View File

@@ -0,0 +1 @@
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("react")),i=t(require("region")),s=t(require("./utils/common")),h=t(require("./utils/validate"));module.exports=e.createClass(Object.assign({displayName:"HueSpectrum",getDefaultProps:function(){return{height:300,width:30,pointerSize:3,defaultColor:require("./defaultColor")}},getInitialState:function(){return{h:0}},componentDidUpdate:function(){},componentDidMount:function(){this.updateDragPositionIf()},updateDragPositionIf:function(){this.props.height||this.setState({})},render:function(){this.hsv=this.toColorValue(this.state.value||this.props.value||this.props.defaultValue||this.props.defaultColor),360!=this.state.h||this.hsv.h||(this.hsv.h=360);var t=Object.assign({},this.props.style);this.props.height&&(t.height=this.props.height),this.props.width&&(t.width=this.props.width);var i={height:this.props.pointerSize},s=this.getDragPosition();return null!=s&&(i.top=s,i.display="block"),e.createElement("div",{className:"cp-hue-spectrum",style:t,onMouseDown:this.onMouseDown},e.createElement("div",{className:"cp-hue-drag",style:i},e.createElement("div",{className:"inner"})))},getDragPosition:function(t){if(t=t||this.hsv,!this.props.height&&!this.isMounted())return null;var e=this.props.height||i.fromDOM(this.getDOMNode()).getHeight(),s=this.props.pointerSize,h=Math.round(t.h*e/360),r=Math.round(s/2);return h-r},updateColor:function(t){t=h(t),this.hsv.h=360*t.y/t.height,0!=this.hsv.h&&(this.state.h=this.hsv.h),this.state.h=0!=this.hsv.h?this.hsv.h:0},toStringValue:require("./utils/toStringValue")},s));

View File

@@ -0,0 +1 @@
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("react")),r=t(require("region")),i=require("./utils/color").fromRatio,o=t(require("./utils/common")),s=t(require("./utils/validate"));module.exports=e.createClass(Object.assign({displayName:"SaturationSpectrum",getDefaultProps:function(){return{height:300,width:300,pointerSize:7,defaultColor:require("./defaultColor")}},getInitialState:function(){return{pointerTop:null,pointerLeft:null}},componentDidUpdate:function(){},componentDidMount:function(){this.updateDragPositionIf()},updateDragPositionIf:function(){this.props.height&&this.props.width||this.setState({})},getDragPosition:function(t){t=t||this.hsv;var e=this.props.width,i=this.props.height,o=e&&i;if(!o&&!this.isMounted())return null;var s;o||(s=r.fromDOM(this.getDOMNode()),i=i||s.getHeight(),e=e||s.getWidth());var a=t.s*e,n=i-t.v*i,u=this.props.pointerSize,l=Math.floor(u/2);return this.props.value&&this.state.mouseDown,{left:a-l,top:n-l}},prepareBackgroundColor:function(t){var e=t,r=i({h:e.h%360/360,s:1,v:1});return r.toRgbString()},prepareProps:function(t,e){var r=Object.assign({},t),i=e.value||r.value||r.defaultValue||r.defaultColor;return r.color=i,this.hsv=this.toColorValue(i),r.style=this.prepareStyle(r),r.className=this.prepareClassName(r),r},prepareClassName:function(t){var e=t.className||"";return e+=" cp-saturation-spectrum"},prepareStyle:function(t){var e=t.style||{};return t.height&&(e.height=t.height),t.width&&(e.width=t.width),e.backgroundColor=this.prepareBackgroundColor(this.hsv),e},render:function(){var t=this.p=this.prepareProps(this.props,this.state),r={width:this.props.pointerSize,height:this.props.pointerSize},i=this.getDragPosition();return i&&(r.top=i.top,r.left=i.left,r.display="block"),e.createElement("div",{className:t.className,style:t.style,onMouseDown:this.onMouseDown},e.createElement("div",{className:"cp-saturation-white"},e.createElement("div",{className:"cp-saturation-black"})),e.createElement("div",{className:"cp-saturation-drag",style:r},e.createElement("div",{className:"inner"})))},getSaturationForPoint:function(t){return t.x/t.width},getColorValueForPoint:function(t){return(t.height-t.y)/t.height},updateColor:function(t){t=s(t),this.hsv.s=this.getSaturationForPoint(t),this.hsv.v=this.getColorValueForPoint(t)},toStringValue:require("./utils/toStringValue")},o));

View File

@@ -0,0 +1 @@
"use strict";module.exports="red";

View File

@@ -0,0 +1 @@
"use strict";function e(){}var t=function(e){return e&&e.__esModule?e["default"]:e},a=t(require("react")),n=require("./utils/color").toHsv,r=t(require("./HueSpectrum")),i=t(require("./SaturationSpectrum")),u=a.createClass({displayName:"ColorPicker",getDefaultProps:function(){return{defaultColor:require("./defaultColor"),saturationWidth:300,saturationHeight:300,hueHeight:null,hueWidth:30,hueMargin:10}},getInitialState:function(){return{value:this.props.defaultValue}},prepareClassName:function(e){var t=e.className||"";return t+=" cp"},prepareProps:function(e){return e.className=this.prepareClassName(e),e},render:function(){var e=this.prepareProps(Object.assign({},this.props)),t=this.props.hueStyle||{};t.marginLeft=this.props.hueMargin;var n=e.value?this.toColorValue(this.props.value):null,u=n?null:this.toColorValue(this.state.value||e.defaultValue||e.defaultColor),s={onDrag:this.handleSaturationDrag,onChange:this.handleSaturationChange,onMouseDown:this.handleSaturationMouseDown,height:e.saturationHeight,width:e.saturationWidth,inPicker:!0},o={onDrag:this.handleHueDrag,onChange:this.handleHueChange,height:e.hueHeight||e.saturationHeight,width:e.hueWidth,inPicker:!0,style:t};return this.state.dragHue&&((n||u).h=this.state.dragHue),n?(s.value=Object.assign({},n),o.value=Object.assign({},n)):(s.defaultValue=Object.assign({},u),o.defaultValue=Object.assign({},u)),a.createElement("div",e,a.createElement(i,s),a.createElement(r,o))},toColorValue:function(e){return"string"==typeof e?n(e):e},toStringValue:require("./utils/toStringValue"),handleChange:function(t){this.state.dragHue=null,t=Object.assign({},t);var a=this.toStringValue(t);(this.props.onChange||e)(a,t)},handleSaturationChange:function(e){this.handleChange(e)},handleHueChange:function(e){this.handleChange(e)},handleHueDrag:function(e){this.handleDrag(e)},handleSaturationDrag:function(e){this.handleDrag(e)},handleDrag:function(t){this.props.value||this.setState({value:t}),(this.props.onDrag||e)(this.toStringValue(t),t)},handleSaturationMouseDown:function(e){this.setState({dragHue:e.h})}});u.HueSpectrum=r,u.SaturationSpectrum=i,module.exports=u;

View File

@@ -0,0 +1 @@
"use strict";function o(o){return i(o)}function t(t){var n=o(t).toHsl().h;return o({h:n,s:100,l:50,a:1})}function n(o){return i.fromRatio(o)}function r(t,n){return n>1&&(n/=100),t=o(t).toRgb(),t.a=n,o(t)}function e(t){return o(t).toHsv()}var u=function(o){return o&&o.__esModule?o["default"]:o},i=u(require("tinycolor2"));"undefined"!=typeof window&&(window.tinycolor=i);var f={toColor:o,toPure:t,fromRatio:n,toAlpha:r,toHsv:e};"undefined"!=typeof window&&(window.color=f),module.exports=f;

View File

@@ -0,0 +1 @@
"use strict";function t(){}var i=function(t){return t&&t.__esModule?t["default"]:t},e=i(require("region")),n=i(require("drag-helper")),o=require("./color").toHsv;module.exports={toColorValue:function(t){return"string"==typeof t?o(t):{h:t.h,s:t.s,v:t.v,a:t.a}},onMouseDown:function(t){t.preventDefault();var i=e.fromDOM(this.getDOMNode()),o=this.getEventInfo(t,i);n(t,{scope:this,constrainTo:i,onDragStart:function(t,e){e.initialPoint=o,e.minLeft=0,e.maxLeft=i.width,this.handleDragStart(t)},onDrag:function(t,e){var n=this.getEventInfo(t,i);this.updateColor(n),this.handleDrag(t,e)},onDrop:function(t,e){var n=this.getEventInfo(t,i);this.updateColor(n),this.handleDrop(t,e)}}),this.updateColor(o),this.handleMouseDown(t,{initialPoint:o})},handleMouseDown:function(i,e){(this.props.onMouseDown||t).apply(this,this.getColors()),this.handleDrag(i,e)},handleUpdate:function(t,i){var e=i.diff||{top:0,left:0},n=i.initialPoint;if(n){var o,s;s=n.x+e.left,o=n.y+e.top,s=Math.max(s,i.minLeft),s=Math.min(s,i.maxLeft),this.state.top=o,this.state.left=s,this.state.mouseDown={x:s,y:o,width:n.width,height:n.height}}this.props.inPicker||this.props.value||this.setState({value:this.hsv})},handleDragStart:function(){},handleDrag:function(i,e){this.handleUpdate(i,e),(this.props.onDrag||t).apply(this,this.getColors())},handleDrop:function(i,e){this.handleUpdate(i,e),this.state.mouseDown=!1,(this.props.onChange||t).apply(this,this.getColors())},getColors:function(){var t=this.props.inPicker?this.hsv:this.toStringValue(this.hsv),i=[t];return this.props.inPicker||i.push(Object.assign({},this.hsv)),i},getEventInfo:function(t,i){i=i||e.fromDOM(this.getDOMNode());var n=t.clientX-i.left,o=t.clientY-i.top;return{x:n,y:o,width:i.getWidth(),height:i.getHeight()}}};

View File

@@ -0,0 +1 @@
"use strict";var t=require("./color").toColor;module.exports=function(o){return o=t(Object.assign({},o)),1==o.toRgb().a?o.toHexString():o.toRgbString()};

View File

@@ -0,0 +1 @@
"use strict";module.exports=function(t){var e=t.height,r=t.width;return t.x<0&&(t.x=0),t.x>=r&&(t.x=r),t.y<0&&(t.y=0),t.y>=e&&(t.y=e),t};

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),a=t.createClass({displayName:"EventInput",getInitialState:function(){for(var e={name:this.props.content.name,payload:this.props.content.payload},t=atom.grammars.getGrammars(),a=0;a<t.length;a++){var n=t[a];if("JSON"===n.name){e.jsonGrammar=n;break}}return e},componentWillReceiveProps:function(e){(e.content.name!==this.state.name||e.content.payload!==this.state.payload)&&(this.setState({payload:e.content.payload,name:e.content.name}),this.refs.payloadEditor.getDOMNode().getModel().setText(e.content.payload),this.refs.nameEditor.getDOMNode().getModel().setText(e.content.name))},componentDidMount:function(){var e=this,a=t.findDOMNode(this.refs.payloadEditor),n=a.getModel();void 0!==this.state.jsonGrammar&&n.setGrammar(this.state.jsonGrammar);var o=t.findDOMNode(this.refs.nameEditor),r=o.getModel();n.onDidChange(function(){e.setState({payload:n.getText()}),e.props.onChange({name:r.getText(),payload:n.getText()})}),r.onDidChange(function(){e.setState({name:r.getText()}),e.props.onChange({name:r.getText(),payload:n.getText()})})},render:function(){var e="";if(this.state.payload.length>0)try{JSON.parse(this.state.payload)}catch(a){e="Not valid JSON:\n"+a}return t.createElement("div",{className:"event-editor",style:{width:"100%"}},t.createElement("div",{style:{display:"flex",clear:"both",marginTop:15,marginBottom:15}},t.createElement("div",{style:{fontSize:14,marginRight:15}},"Name"),t.createElement("atom-text-editor",{mini:!0,ref:"nameEditor",style:{width:"100%"}},this.state.name)),t.createElement("div",{style:{fontSize:14,marginRight:15,marginBottom:5}},"Payload"),t.createElement("atom-text-editor",{ref:"payloadEditor",style:{height:250,width:"100%"}},this.state.payload),t.createElement("div",{className:"error-messages"},e))}});module.exports=function(e,n){return t.createElement(a,{onChange:e,content:n})};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),n=e(require("../../../atom-react/mixins/modal-mixin")),o=e(require("path")),a=e(require("fs")),i=e(require("../modals/choose-texture-modal")),r=e(require("normalize-path")),s=t.createClass({displayName:"TextureInput",mixins:[n],getInitialState:function(){var e=this.getDisplayValue(this.props.content);return{content:this.props.content,displayValue:e}},componentWillReceiveProps:function(e){var t=e.content,n=this.getDisplayValue(t);this.setState({content:t,displayValue:n}),this.refs.editor.getDOMNode().getModel().setText(n)},render:function(){var e={};try{a.statSync(this.getUri())}catch(n){e={disabled:!0}}var o=e.disabled?t.createElement("div",{className:"error-messages"},"No texture file by that name"):null;return t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"block"},t.createElement("div",{className:"fileBlock"},t.createElement("button",{style:{"float":"right"},className:"btn",onClick:this.onChoose},"..."),t.createElement("atom-text-editor",{onBlur:this.onBlur,ref:"editor",mini:!0},this.state.displayValue)),o,t.createElement("br",null)))},getUri:function(){return o.resolve(this.props.projectRoot,this.state.content)},getDisplayValue:function(e){var t=e.split("/");if("node_modules"===t[0]){var n=t[1],a=o.join("node_modules",n,"animations","textures");return a=r(o.relative(a,e)),n+"://"+a}var a=o.join("animations","textures");return a=o.relative(a,e),r(a)},getDataValue:function(e){var t=e.split("://");if(1===t.length){var n=o.join("animations","textures",e);return r(n)}if(2===t.length){var n=o.join("node_modules",t[0],"animations","textures",t[1]);return r(n)}return""},onChoose:function(){var e=this;this.createModal(t.createElement(i,{root:this.props.projectRoot,uri:this.getUri(),onChoose:function(t){var n=r(t),o=e.getDisplayValue(n);e.setState({content:n,displayValue:o}),e.props.onChange(n),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()},onClose:function(){e.destroyModal()}}))},onBlur:function(){this.props.onChange(this.state.content),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()},componentWillUnmount:function(){this.disposable.dispose()},componentDidMount:function(){var e=this,n=t.findDOMNode(this.refs.editor),o=n.getModel();o.onDidChange(function(){e.setState({content:e.getDataValue(o.getText()),displayValue:o.getText()})}),this.disposable=atom.commands.add(n,"core:confirm",function(){e.props.onChange(e.state.content),document.querySelector("atom-pane.pane.active .animation-editor").childNodes[0].focus()})}});module.exports=function(e,n,o,a){return t.createElement(s,{key:100,content:n,onChange:e,projectRoot:o,animationPath:a})};

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),o=e(require("../../../atom-react/mixins/modal-mixin")),n=e(require("path")),i=e(require("fs")),s=e(require("normalize-path")),r=e(require("../../../common/directory-tree-view")),a=t.createClass({displayName:"VideoChooserModal",getInitialState:function(){return{uri:this.props.uri,filter:""}},onSelected:function(e){this.state.uri=s(e),this.setState(this.state)},onChosen:function(e){this.state.uri=s(e),this.onChoose()},onChoose:function(){this.props.onChoose(this.state.uri),this.props.onClose()},render:function(){return t.createElement("div",{className:"block"},t.createElement("div",{className:"panel-heading"},t.createElement("h1",{style:{textAlign:"center"}},"Choose a Video")),t.createElement("label",{style:{marginLeft:10}},"Search"),t.createElement("atom-text-editor",{ref:"editor",style:{marginLeft:10,marginRight:10,marginBottom:10},mini:!0}),t.createElement("div",null,t.createElement("div",{className:"inline-block",style:{height:600,overflowY:"auto",overflowX:"hidden"}},t.createElement(r,{uri:this.props.root,onChosen:this.onChosen,onSelected:this.onSelected,extension:[".m4v",".mp4",".mov"],filter:this.state.filter}))),t.createElement("hr",null),t.createElement("div",{className:"btn-group"},t.createElement("button",{className:"btn",onClick:this.onChoose},"Choose"),t.createElement("button",{className:"btn",onClick:this.props.onClose},"Close")))},componentDidMount:function(){var e=this,o=t.findDOMNode(this.refs.editor),n=o.getModel();n.onDidChange(function(){e.state.filter=n.getText(),e.setState(e.state)}),this.onSelected(this.props.uri)}}),l=t.createClass({displayName:"VideoInput",mixins:[o],getInitialState:function(){return{content:this.props.content}},componentWillReceiveProps:function(e){this.setState({content:e.content}),this.refs.editor.getDOMNode().getModel().setText(e.content)},render:function(){var e={};try{i.statSync(this.getUri())}catch(o){e={disabled:!0}}var n=e.disabled?t.createElement("div",{className:"error-messages"},"No video file by that name"):null;return t.createElement("div",{style:{width:"100%"}},t.createElement("div",{className:"block"},t.createElement("div",{className:"fileBlock"},t.createElement("button",{style:{"float":"right"},className:"btn",onClick:this.onChoose},"..."),t.createElement("atom-text-editor",{onBlur:this.onBlur,ref:"editor",mini:!0},this.state.content)),n,t.createElement("br",null)))},getUri:function(){var e=n.resolve(this.props.projectRoot,this.state.content);return e},onChoose:function(){var e=this;this.createModal(t.createElement(a,{root:this.props.projectRoot,uri:this.getUri(),onChoose:function(o){var i=n.relative(e.props.projectRoot,o);e.state.content=s(i);var r=t.findDOMNode(e.refs.editor);r.getModel().setText(e.state.content),e.setState(e.state),e.props.onChange(e.state.content)},onClose:function(){e.destroyModal()}}))},onBlur:function(){this.props.onChange(this.state.content)},componentWillUnmount:function(){this.disposable.dispose()},componentDidMount:function(){var e=this,o=t.findDOMNode(this.refs.editor),n=o.getModel();n.onDidChange(function(){e.setState({content:n.getText()})}),this.disposable=atom.commands.add(o,"core:confirm",function(){e.props.onChange(e.state.content)})}});module.exports=function(e,o,n,i){return t.createElement(l,{key:100,content:o,onChange:e,projectRoot:n,animationPath:i})};

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),s=t.createClass({displayName:"SettingsItem",onFocus:function(){this.getDOMNode().childNodes[2].select()},render:function(){return t.createElement("div",null,t.createElement("label",null,this.props.label),t.createElement("br",null),t.createElement("input",{ref:"input",style:{width:122},onFocus:this.onFocus,className:"native-key-bindings",tabIndex:this.props.tabIndex,type:this.props.type,step:this.props.step,onMouseDown:this.props.onMouseDown,onChange:this.props.onChange,value:this.props.value,min:this.props.min}))}});module.exports=s;

View File

@@ -0,0 +1 @@
"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=t(require("react")),s=t(require("./settings-item")),i=require("atom").CompositeDisposable,a=e.createClass({displayName:"SettingsView",getInitialState:function(){return{duration:this.props.animationModel.state.keyframes.duration,scale:this.props.animationModel.state.keyframes.scale,lastScale:this.props.animationModel.state.keyframes.scale}},componentDidMount:function(){var t=this;this.getDOMNode().childNodes[1].childNodes[0].childNodes[2].focus(),this.disposables=new i,this.disposables.add(atom.commands.add(this.getDOMNode().childNodes[1].childNodes[1],{"jibo-sdk:confirm":function(){t.onFinished()}}))},componentWillUnmount:function(){this.disposables.dispose()},onFinished:function(){if(this.state.duration!==this.props.animationModel.state.keyframes.duration)this.props.animationModel.setDuration(this.state.duration,!0,!0),this.props.animationModel.addRedoUndoEntry(),this.props.onFinished();else if(this.state.scale!==this.props.animationModel.state.keyframes.scale){if(0==this.state.scale)return this.setState({scale:this.state.lastScale}),void this.props.onFinished();this.setState({lastScale:this.state.scale}),this.props.animationModel.setScale(this.state.scale),this.props.animationModel.setDuration(this.state.duration,!1,!0),this.props.animationModel.setKeyframes(),this.props.animationModel.addRedoUndoEntry(),this.props.onFinished()}else this.props.onFinished()},onDurationChange:function(t){if(/^\d+$/.test(t.target.value)){var e=parseInt(t.target.value);this.setState({duration:e})}},onScaleChange:function(t){var e=t.target.value;this.setState({scale:e})},onMouseDown:function(){if(this.state.duration!==this.props.animationModel.state.keyframes.duration)this.props.animationModel.setDuration(this.state.duration,!0,!0),this.props.animationModel.addRedoUndoEntry();else if(this.state.scale!==this.props.animationModel.state.keyframes.scale){if(0==this.state.scale)return void this.setState({scale:this.state.lastScale});this.setState({lastScale:this.state.scale}),this.props.animationModel.setScale(this.state.scale);var t=this.props.animationModel.setDuration(this.state.duration,!1,!0);this.props.animationModel.setKeyframes(),this.props.animationModel.addRedoUndoEntry(),this.setState({duration:t})}},onKeyPress:function(t){13===t.keyCode?this.onFinished():27===t.keyCode&&this.props.onFinished()},render:function(){var t=e.createElement(s,{label:"Animation Duration",type:"number",step:"0.01",tabIndex:1,onMouseDown:this.onMouseDown,onChange:this.onDurationChange,value:this.state.duration,min:1}),i=e.createElement(s,{label:"Scale",type:"number",step:"0.01",tabIndex:2,onMouseDown:this.onMouseDown,onChange:this.onScaleChange,value:this.state.scale,min:0});return e.createElement("div",{className:"animation-settings native-key-bindings"},e.createElement("div",{onMouseDown:this.onFinished,className:"settings-mousetrap"}),e.createElement("div",{className:"settings-container",onKeyUp:this.onKeyPress,style:{height:"auto"}},t,i))}});module.exports=a;

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var i in t){var n=t[i];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=require("animation-utilities").THREE,n=function(){function n(e){t(this,n),this.scene=e,this.debugObjects={}}return e(n,{removeIfExists:{value:function(e){this.debugObjects[e]&&(this.scene.remove(this.debugObjects[e]),delete this.debugObjects[e])}},addByName:{value:function(e,t){this.removeIfExists(e),this.debugObjects[e]=t,this.scene.add(t)}},coerceIfMatrix:{value:function(e){return e instanceof i.Matrix4?(new i.Vector3).setFromMatrixPosition(e):e.clone()}},info:{value:function(e,t){t=t||"",console.log(""+t+" name: "+e.name+" ( "+e.position.x+", "+e.position.y+", "+e.position.z+" )");for(var i=0;i<e.children.length;i++)this.info(e.children[i],t+" ")}},cube:{value:function o(e,t,n,s){var r=new i.BoxGeometry(n,n,n),a=new i.MeshBasicMaterial({color:s}),o=new i.Mesh(r,a),c=this.coerceIfMatrix(t);o.position.x=c.x,o.position.y=c.y,o.position.z=c.z,this.addByName(e,o)}},axis:{value:function s(e,t,n){var s=new i.AxisHelper(n);s.applyMatrix(t),this.addByName(e,s)}},bounds:{value:function(e,t,n){var o=new i.BoundingBoxHelper(t,n);o.update(),this.addByName(e,o)}},wireframes:{value:function(e,t,n){try{var o=new i.WireframeHelper(t,n);this.addByName(e,o)}catch(s){console.log("edges error: "+s)}}},clear:{value:function(){for(var e in this.debugObjects)this.scene.remove(this.debugObjects[e]);this.debugObjects={}}}}),n}();module.exports=n;

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),i=e(require("../../atom-react/components/jibo-combo-box")),a=t.createClass({displayName:"TimeNotchesView",onNewLayer:function(e){this.props.animationModel.addLayer(e.value),document.querySelector(".active .animation-editor").childNodes[0].focus()},render:function(){for(var e=this.props.animationModel.state.keyframes.duration,a=this.props.animationModel.state.keyframes.framerate,n=this.props.animationModel.state.keyframes.duration/a,o=this.props.animationModel.uiState.currentKeyframe,s=[],r=Math.floor(this.props.totalFrames/5)+1,l=0;r>l;l++)s.push(t.createElement("span",{key:l,className:"animation-timeline-notch"},5*l));var m=22,d={container:{width:Math.max(5*r*18+this.props.labelWidth+20,this.props.width),height:m,position:"absolute",marginTop:this.props.offset.y,background:"#363636",borderBottom:"thin solid #444444",zIndex:10},indicator:{marginLeft:18*o,height:20,display:null===this.props.animationModel.getSelectedLayer()?"none":"inline-block"},displayAnchor:{width:this.props.labelWidth-13,marginRight:13,height:m,"float":"left",position:"relative"},display:{width:this.props.labelWidth,paddingRight:13,height:m-1,position:"absolute",marginLeft:this.props.offset.x,background:"#363636",zIndex:2},notches:{width:18*r*5,height:m,"float":"left",marginLeft:270},miniLine:{height:4,width:2,opacity:.7,position:"absolute",marginTop:18,marginLeft:7,background:"red"}},c=this.props.animationModel.getKeyframeInfo(),p=Object.keys(c.layerTypes),h=[],u=this.props.animationModel.getLayersOfType("Video");p.forEach(function(e){"Video"===e&&u.length>0||h.push({label:e,display:function(){return t.createElement("i",{className:"fa fa-plus-square",style:{fontSize:17}})},value:e})});var f=h[0];return t.createElement("div",{style:d.container,className:"animation-timeline-notches-container"},t.createElement("div",{style:this.displayAnchor},t.createElement("div",{style:d.display,className:"time-display"},t.createElement("div",{style:{"float":"left"},className:"new-layer"},t.createElement(i,{hideButton:!0,data:h,init:f,onSelected:this.onNewLayer})),t.createElement("span",{className:"frames"},o," of ",e,", "),t.createElement("span",{className:"frame-rate"},a,"fps, "),t.createElement("span",{className:"seconds"},n.toFixed(1),"s"))),t.createElement("div",{style:d.notches,className:"animation-timeline-notches"},t.createElement("div",{style:d.indicator,className:"animation-timeline-indicator",onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},t.createElement("div",{className:"animation-timeline-indicator-handle"},t.createElement("div",{style:d.miniLine}))),s))},onMouseDown:function(){this.props.animationModel.emit("toggle-time-scrub",!0),this.onMouseUpBind=this.onMouseUp.bind(this),document.addEventListener("mouseup",this.onMouseUpBind)},onMouseUp:function(){this.props.animationModel.emit("toggle-time-scrub",!1),document.removeEventListener("mouseup",this.onMouseUpBind)}});module.exports=a;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=function(){function e(e,t){for(var i in t){var o=t[i];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),i=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=e(require("react")),a=e(require("../../../ffmpeg/ffmpeg")),r=e(require("path")),s=e(require("fs")),h=e(require("async")),l=require("events").EventEmitter,d="win32"===process.platform?process.env.HOMEPATH:process.env.HOME,f=r.resolve(d,".jibo","temp"),u=void 0,c=void 0,p={},m=function(e){function n(e){o(this,n),this.uri=e,this.fileName=r.parse(this.uri).base,this.folderPath=r.resolve(f,this.fileName),this.imageCache={},this.isLoaded=!1,s.existsSync(f)||s.mkdirSync(f)}return i(n,e),t(n,{_getImageKey:{value:function(e){return this.folderPath+e}},_loadImage:{value:function(e,t,i){var o=new Image;p[this._getImageKey(t)]=o,o.onload=function(){i()};var n=r.resolve(this.folderPath,"image"+e+".png");o.src=n+"?"+t}},_loadImages:{value:function(e,t,i){var o=this;try{a(this.uri).on("filenames",function(){}).on("end",function(){for(var e=[],n=0;n<t.length;n++)e.push(o._loadImage.bind(o,n+1,t[n]));h.parallel(e,function(){i()})}).on("error",function(e){console.log(e)}).screenshots({timestamps:e,folder:this.folderPath,filename:"image%i.png",size:this.imageWidth+"x"+this.imageHeight})}catch(n){console.log(n)}}},load:{value:function(e){var t=this;if(this.isLoaded)return void(e&&e());try{!function(){var i=(new Date).getTime();a.ffprobe(t.uri,function(o,n){if(n){t.ratio=n.streams[0].coded_height/n.streams[0].coded_width,t.imageWidth=Math.min(n.streams[0].coded_width,500),t.imageHeight=Math.round(t.imageWidth*t.ratio),t.duration=n.streams[0].duration,t.frameRate=parseInt(n.streams[0].avg_frame_rate.split("/")[0],10),t.count=t.duration*t.frameRate;for(var a=[],r=[],s=[],l=1,d=0;d<Math.min(t.duration,15);d+=1/t.frameRate)r.push(d),s.push(l),r.length===t.frameRate&&(a.push(t._loadImages.bind(t,r,s)),r=[],s=[]),l++;r.length>0&&a.push(t._loadImages.bind(t,r,s)),h.series(a,function(){var o=(new Date).getTime()-i;console.log("Video of "+t.duration+" seconds toolk "+o),e()})}})}()}catch(i){console.log(i)}}},getImage:{value:function(e){return p[this._getImageKey(e)]}}}),n}(l);module.exports=n.createClass({displayName:"layout-child",getInitialState:function(){return this.onDataChangedBind=this.onDataChanged.bind(this),this.dataMap={},{}},render:function(){return u&&c&&this.setStyle(),n.createElement("div",{className:"video-container",ref:"content",style:{width:"100%",height:"100%",display:"inline-block"},src:this.props.videoSource,preload:"auto"})},setStyle:function(){var e=u.getImage(c);if(e){var t=1/u.ratio;if(e.style.position="relative",t<this.props.width/this.props.height){var i=this.props.height,o=t*this.props.height,n=.5*(this.props.width-o);e.style.height=i+"px",e.style.width=o+"px",e.style.left=n+"px",e.style.top=""}else{var i=this.props.width/t,o=this.props.width,n=.5*(this.props.height-i);e.style.height=i+"px",e.style.width=o+"px",e.style.top=n+"px",e.style.left=""}}},componentWillUnmount:function(){this.props.animationModel.removeListener("ondatachanged",this.onDataChangedBind)},loadVideos:function(e){for(var t=this,i=this.props.animationModel,o=i.getLayersOfType("Video")[0].keyframes,n=[],a=o.length-1;a>=0;a--){var s=o[a].value.Video;if(""!==s){var l=r.resolve(this.props.projectRoot,s);this.dataMap[l]||!function(){var e=new m(l);t.dataMap[l]=e,n.push(function(t){e.load(t)})}()}}n.length>0&&h.parallel(n,e)},componentDidMount:function(){var e=this;this.content=n.findDOMNode(this.refs.content),this.loadVideos(function(){e.onDataChanged()}),this.props.animationModel.on("ondatachanged",this.onDataChangedBind)},setChild:function(){var e=u.getImage(c);if(e){for(;this.content.firstChild;)this.content.removeChild(this.content.firstChild);this.content.appendChild(e),this.setStyle(u)}},onDataChanged:function(){var e=this.props.animationModel,t=e.getLayersOfType("Video");if(0!==t.length){this.loadVideos();for(var i=e.uiState.currentKeyframe,o=t[0].keyframes,n=void 0,a=o.length-1;a>=0;a--)if(i>=o[a].time){n=o[a];break}if(n){u=void 0;var s=n.value.Video;if(""!==s){var h=r.resolve(this.props.projectRoot,s);u=this.dataMap[h];var l=(i-n.time)/this.props.animationModel.state.keyframes.framerate;c=Math.round(u.count*l/u.duration),this.setChild()}}else for(;this.content.firstChild;)this.content.removeChild(this.content.firstChild)}}});

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),n=e(require("../controllers/animation-controller")),o=e(require("lodash")),i=e(require("path")),r=e(require("../../atom-react/components/jibo-combo-box")),a=[{label:"Front",display:"front",value:"front"},{label:"Back",display:"back",value:"back"},{label:"Left",display:"left",value:"left"},{label:"Right",display:"right",value:"right"}],s=t.createClass({displayName:"layout-child",componentWillMount:function(){this.controller=new n(this.props.animationModel),this.lastWidth=this.props.width,this.lastHeight=this.props.height,this.requestAnimationID=window.requestAnimationFrame(this.updateLoop.bind(this))},updateLoop:function(){if(this.controller.renderer){var e=this.props.animationModel.evaluateAllDOFLayers();e=o.extend({},o.cloneDeep(this.controller.robotInfo.getDefaultDOFValues()),o.cloneDeep(e));for(var t in e){var n=e[t];("eyeTextureInfixBn_r"===t||"overlayTextureInfixBn_r"===t||"screenBGTextureInfixBn_r"===t)&&(n="file://"+i.resolve(this.props.animationModel.projectRoot,n)),e[t]=n}this.controller.updateDofValues(e),this.controller.update()}this.requestAnimationID=window.requestAnimationFrame(this.updateLoop.bind(this))},componentDidMount:function(){var e=t.findDOMNode(this.refs.preview);this.controller.initialize(e,function(){}),e.addEventListener("contextmenu",function(e){return"CANVAS"===e.target.tagName?(e.preventDefault(),e.stopPropagation(),!1):!0},!1)},componentWillUnmount:function(){this.requestAnimationID&&window.cancelAnimationFrame(this.requestAnimationID),this.controller.dispose()},onMouseDown:function(){return!1},onMouseDownCapture:function(){return!1},onChangeCamera:function(e){this.controller.setCamera(e.value)},onBackgroundColor:function(){},onReset:function(){this.controller.setCamera(a[0].value)},render:function(){this.controller&&this.controller.renderer&&(this.lastWidth!==this.props.width||this.lastHeight!==this.props.height)&&(this.controller.renderer.scene.handleResize(),this.lastWidth=this.props.width,this.lastHeight=this.props.height);var e={reset:{position:"absolute",marginLeft:90,marginTop:10},comboBox:{position:"absolute",margin:10}};return t.createElement("div",{tabIndex:1,ref:"preview",className:"animation-preview"},t.createElement("div",{className:"block",style:e.reset},t.createElement("button",{className:"btn icon icon-sync inline-block-tight",onClick:this.onReset},"Reset")),t.createElement("div",{style:e.comboBox},t.createElement(r,{data:a,init:a[0],onSelected:this.onChangeCamera})))}});module.exports=s;