Explorar o código

Tiny adjustments to scene recorder

David `Deltakosh` Catuhe %!s(int64=5) %!d(string=hai) anos
pai
achega
b8115d2ca6

+ 1 - 0
inspector/src/components/actionTabs/actionTabs.scss

@@ -494,6 +494,7 @@ $line-padding-left: 2px;
                         margin: 5px 10px 5px 10px;
                         margin: 5px 10px 5px 10px;
                         color:white;
                         color:white;
                         padding: 4px 5px;
                         padding: 4px 5px;
+                        font-size: 13px;
                         opacity: 0.9;
                         opacity: 0.9;
                         cursor: pointer;
                         cursor: pointer;
                         text-align: center;
                         text-align: center;

+ 17 - 0
inspector/src/components/actionTabs/tabs/toolsTabComponent.tsx

@@ -29,6 +29,9 @@ import { TextLineComponent } from '../lines/textLineComponent';
 import { FileMultipleButtonLineComponent } from '../lines/fileMultipleButtonLineComponent';
 import { FileMultipleButtonLineComponent } from '../lines/fileMultipleButtonLineComponent';
 import { OptionsLineComponent } from '../lines/optionsLineComponent';
 import { OptionsLineComponent } from '../lines/optionsLineComponent';
 import { MessageLineComponent } from '../lines/messageLineComponent';
 import { MessageLineComponent } from '../lines/messageLineComponent';
+import { FileButtonLineComponent } from '../lines/fileButtonLineComponent';
+import { SceneRecorder } from 'babylonjs';
+import { IndentedTextLineComponent } from '../lines/indentedTextLineComponent';
 
 
 const GIF = require('gif.js.optimized')
 const GIF = require('gif.js.optimized')
 
 
@@ -265,6 +268,15 @@ export class ToolsTabComponent extends PaneComponent {
         this.forceUpdate();
         this.forceUpdate();
     }
     }
 
 
+    applyDelta(file: File) {
+        Tools.ReadFile(file, (data) => {
+            SceneRecorder.ApplyDelta(data, this.props.scene);
+            this.props.globalState.recorder.cancel();
+
+            this.forceUpdate();
+        });
+    }
+
     render() {
     render() {
         const scene = this.props.scene;
         const scene = this.props.scene;
 
 
@@ -328,8 +340,13 @@ export class ToolsTabComponent extends PaneComponent {
                     }
                     }
                     {
                     {
                         this.props.globalState.recorder.isRecording &&
                         this.props.globalState.recorder.isRecording &&
+                        <IndentedTextLineComponent value={"Record in progress"}/>                        
+                    }
+                    {
+                        this.props.globalState.recorder.isRecording &&
                         <ButtonLineComponent label="Generate delta file" onClick={() => this.exportReplay()} />
                         <ButtonLineComponent label="Generate delta file" onClick={() => this.exportReplay()} />
                     }
                     }
+                    <FileButtonLineComponent label={`Apply delta file`} onClick={(file) => this.applyDelta(file)} accept=".json" />
                 </LineContainerComponent>
                 </LineContainerComponent>
                 <LineContainerComponent globalState={this.props.globalState} title="SCENE IMPORT">
                 <LineContainerComponent globalState={this.props.globalState} title="SCENE IMPORT">
                     <FileMultipleButtonLineComponent label="Import animations" accept="gltf" onClick={(evt: any) => this.importAnimations(evt)} />
                     <FileMultipleButtonLineComponent label="Import animations" accept="gltf" onClick={(evt: any) => this.importAnimations(evt)} />

+ 0 - 4
src/Misc/sceneRecorder.ts

@@ -42,7 +42,6 @@ export class SceneRecorder {
         let deltaJSON: any = {};
         let deltaJSON: any = {};
 
 
         for (var node in newJSON) {
         for (var node in newJSON) {
-            console.log("Processing " + node);
             this._compareCollections(node, this._savedJSON[node], newJSON[node], deltaJSON);
             this._compareCollections(node, this._savedJSON[node], newJSON[node], deltaJSON);
         }
         }
 
 
@@ -150,9 +149,6 @@ export class SceneRecorder {
     }
     }
 
 
     private _compareCollections(key: string, original: any[], current: any[], deltaJSON: any) {
     private _compareCollections(key: string, original: any[], current: any[], deltaJSON: any) {
-        console.log(original, typeof original);
-        console.log(current, typeof current);
-
         // Same ?
         // Same ?
         if (original === current) {
         if (original === current) {
             return;
             return;