Skip to content

Commit 2ac37c6

Browse files
Loading and Saving snippets (BabylonJS#8409)
* loading1 * pending observer changes * whats new * Fixing naming * Fixing bug Co-authored-by: Alejandro Toledo <[email protected]>
1 parent 6cdd271 commit 2ac37c6

File tree

12 files changed

+930
-475
lines changed

12 files changed

+930
-475
lines changed

dist/preview release/what's new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Added HDR texture filtering tools to the sandbox ([Sebavan](https://github.com/sebavan/))
99
- Reflection probes can now be used to give accurate shading with PBR ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
1010
- Added editing of PBR materials, Post processes and Particle fragment shaders in the node material editor ([Popov72](https://github.com/Popov72))
11-
- Added Curve editor to manage selected entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
11+
- Added Curve editor to manage entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
1212
- Added support in `ShadowGenerator` for fast fake soft transparent shadows ([Popov72](https://github.com/Popov72))
1313
- Added support for **thin instances** for faster mesh instances. [Doc](https://doc.babylonjs.com/how_to/how_to_use_thininstances) ([Popov72](https://github.com/Popov72))
1414

inspector/src/components/actionTabs/tabs/propertyGrids/animations/animationCurveEditorComponent.tsx

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { TargetedAnimation } from 'babylonjs/Animations/animationGroup';
1818
import { EditorControls } from './editorControls';
1919
import { SelectedCoordinate } from './animationListTree';
2020
import { LockObject } from '../lockObject';
21+
import { GlobalState } from '../../../../globalState';
2122
import { Nullable } from 'babylonjs/types';
2223
import { Observer } from 'babylonjs/Misc/observable';
2324

@@ -29,6 +30,7 @@ interface IAnimationCurveEditorComponentProps {
2930
scene: Scene;
3031
entity: IAnimatable | TargetedAnimation;
3132
lockObject: LockObject;
33+
globalState: GlobalState;
3234
}
3335

3436
interface ICanvasAxis {
@@ -68,6 +70,7 @@ export class AnimationCurveEditorComponent extends React.Component<
6870
selectedCoordinate: number;
6971
}
7072
> {
73+
private _snippetUrl = 'https://snippet.babylonjs.com';
7174
// Height scale *Review this functionaliy
7275
private _heightScale: number = 100;
7376
// Canvas Length *Review this functionality
@@ -692,6 +695,18 @@ export class AnimationCurveEditorComponent extends React.Component<
692695
case Animation.ANIMATIONTYPE_VECTOR2:
693696
type = Vector2.Zero();
694697
break;
698+
case Animation.ANIMATIONTYPE_QUATERNION:
699+
type = Quaternion.Zero();
700+
break;
701+
case Animation.ANIMATIONTYPE_COLOR3:
702+
type = new Color3(0, 0, 0);
703+
break;
704+
case Animation.ANIMATIONTYPE_COLOR4:
705+
type = new Color4(0, 0, 0, 0);
706+
break;
707+
case Animation.ANIMATIONTYPE_SIZE:
708+
type = new Size(0, 0);
709+
break;
695710
}
696711
return type;
697712
}
@@ -789,12 +804,12 @@ export class AnimationCurveEditorComponent extends React.Component<
789804
if (this.state !== undefined) {
790805
let emptyTangents = keyframes.map((kf, i) => {
791806
if (i === 0) {
792-
kf.outTangent = 0;
807+
kf.outTangent = this.returnZero(valueType);
793808
} else if (i === keyframes.length - 1) {
794-
kf.inTangent = 0;
809+
kf.inTangent = this.returnZero(valueType);
795810
} else {
796-
kf.inTangent = 0;
797-
kf.outTangent = 0;
811+
kf.inTangent = this.returnZero(valueType);
812+
kf.outTangent = this.returnZero(valueType);
798813
}
799814
return kf;
800815
});
@@ -1410,6 +1425,8 @@ export class AnimationCurveEditorComponent extends React.Component<
14101425
setNotificationMessage={(message: string) => {
14111426
this.setState({ notification: message });
14121427
}}
1428+
globalState={this.props.globalState}
1429+
snippetServer={this._snippetUrl}
14131430
/>
14141431

14151432
<div
@@ -1475,17 +1492,15 @@ export class AnimationCurveEditorComponent extends React.Component<
14751492
);
14761493
})}
14771494

1478-
<svg>
1479-
<rect
1480-
onClick={(e) => this.moveFrameTo(e)}
1481-
x='0%'
1482-
y='91%'
1483-
width='105%'
1484-
height='10%'
1485-
fill='#222'
1486-
style={{ cursor: 'pointer' }}
1487-
></rect>
1488-
</svg>
1495+
<rect
1496+
onClick={(e) => this.moveFrameTo(e)}
1497+
x='0%'
1498+
y='91%'
1499+
width='105%'
1500+
height='10%'
1501+
fill='#222'
1502+
style={{ cursor: 'pointer' }}
1503+
></rect>
14891504

14901505
{this.state.frameAxisLength.map((f, i) => (
14911506
<svg key={i} x='0' y='96%'>

0 commit comments

Comments
 (0)