Skip to content

Commit af10490

Browse files
authored
Merge pull request #498 from kdvalin/rc/2.4.0
Release Canidate 2.4.0 changes
2 parents 82a7b0c + dda389f commit af10490

31 files changed

Lines changed: 1101 additions & 51 deletions

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
# api keys
1515
/src/keys
1616

17-
# doc scripts
18-
GenerateDocsWindows.bat
19-
2017
# misc
2118
.DS_Store
2219
.env*

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ The Engaging Computing Group develops new technologies to enable learners—yout
99
## Status
1010
[![CircleCI](https://circleci.com/gh/engaging-computing/MYR.svg?style=shield)](https://circleci.com/gh/engaging-computing/MYR)
1111

12-
## Change Log - 2.3.0 -> 2.3.1
13-
- Updated VR/AR buttons to be spaced out
14-
- Fixed bug where colorshift would always choose white for it's initial color
15-
- Updated autocompelete to put cursor in between parenthesis instead of after
16-
- Fixed a bug where a pushable entity would not be able to be pushed (`makePushable`)
12+
## Change Log - 2.3.1 -> 2.4.0
13+
- Added ability to import custom GLTF models into a scene
14+
- Added a keyboard shortcut information menu
15+
- Added a slider for setting the movement speed in a scene
1716

1817

1918
## Acknowledgments

docs/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

img/c.mtl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Blender MTL File: 'None'
2+
# Material Count: 1
3+
4+
newmtl None
5+
Ns 500
6+
Ka 0.8 0.8 0.8
7+
Kd 0.8 0.8 0.8
8+
Ks 0.8 0.8 0.8
9+
d 1
10+
illum 2

img/c.obj

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Blender v2.90.1 OBJ File: ''
2+
# www.blender.org
3+
mtllib c.mtl
4+
o Cube_Cube.001
5+
v -1.000000 -1.000000 1.000000
6+
v -0.446396 1.000000 1.000000
7+
v -1.000000 -1.000000 -1.000000
8+
v -1.000000 1.000000 -1.000000
9+
v 1.000000 -1.000000 1.000000
10+
v 0.377481 1.000000 0.032235
11+
v 1.000000 -1.000000 -1.000000
12+
v 1.000000 2.114706 -1.681411
13+
vt 0.375000 0.000000
14+
vt 0.625000 0.000000
15+
vt 0.625000 0.250000
16+
vt 0.375000 0.250000
17+
vt 0.625000 0.500000
18+
vt 0.375000 0.500000
19+
vt 0.625000 0.750000
20+
vt 0.375000 0.750000
21+
vt 0.625000 1.000000
22+
vt 0.375000 1.000000
23+
vt 0.125000 0.500000
24+
vt 0.125000 0.750000
25+
vt 0.875000 0.500000
26+
vt 0.875000 0.750000
27+
vn -0.9814 0.1358 0.1358
28+
vn -0.1309 -0.1309 -0.9827
29+
vn 0.9583 0.1865 0.2166
30+
vn 0.3156 0.2283 0.9210
31+
vn 0.0000 -1.0000 0.0000
32+
vn -0.2081 0.9379 0.2777
33+
usemtl None
34+
s off
35+
f 1/1/1 2/2/1 4/3/1 3/4/1
36+
f 3/4/2 4/3/2 8/5/2 7/6/2
37+
f 7/6/3 8/5/3 6/7/3 5/8/3
38+
f 5/8/4 6/7/4 2/9/4 1/10/4
39+
f 3/11/5 7/6/5 5/8/5 1/12/5
40+
f 8/5/6 4/13/6 2/14/6 6/7/6

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "myr",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"private": false,
55
"engines": {
66
"node": "12.18.2"

src/actions/sceneActions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export function setNameDesc(payload) {
9292
return { type: types.SET_NAME_DESC, payload };
9393
}
9494

95+
export function updateMoveSpeed(speed) {
96+
return { type: types.UPDATE_MOVE_SPEED, speed };
97+
}
98+
9599
export default {
96100
nameScene,
97101
loadScene,
@@ -112,5 +116,6 @@ export default {
112116
removeCollectionID,
113117
toggleDefaultLight,
114118
toggleCastShadow,
115-
toggleLightIndicator
116-
};
119+
toggleLightIndicator,
120+
updateMoveSpeed
121+
};

src/components/editor/Editor.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import React, { Component } from "react";
22
import AceEditor from "react-ace";
33
import "brace/mode/javascript";
44
import "brace/theme/github";
5+
import "brace/ext/searchbox";
56
import "brace/ext/language_tools";
6-
import customCompleter from "./customCompleter.js";
77

8-
import "brace/ext/searchbox";
8+
import customCompleter from "./customCompleter.js";
9+
import KeyboardShortcut from "./KeyboardShortcut.js";
10+
import { browserType } from "../../utils/browserType";
911

1012
/**
1113
* Editor is a React Component that creat the Ace Editor in the DOM.
1214
*/
13-
1415
class Editor extends Component {
1516
componentWillUnmount() {
1617
// Updates state in reducer before closing editor
@@ -52,29 +53,32 @@ class Editor extends Component {
5253
"esversion": 6
5354
}]);
5455
}
55-
56+
5657
/**
5758
* Creates the editor in the DOM
5859
*/
5960
render() {
6061
return (
61-
<AceEditor
62-
editorProps={{
63-
$blockScrolling: Infinity,
64-
}}
65-
height="94vh"
66-
mode="javascript"
67-
name="ace-editor"
68-
// eslint-disable-next-line
69-
ref="aceEditor"
70-
theme="github"
71-
value={this.props.text}
72-
width="100%"
73-
wrapEnabled={true}
74-
enableBasicAutocompletion={false}
75-
enableLiveAutocompletion={true}
76-
onLoad={this.onLoad}
77-
/>
62+
<div>
63+
<AceEditor
64+
editorProps={{
65+
$blockScrolling: Infinity,
66+
}}
67+
height="90vh"
68+
mode="javascript"
69+
name="ace-editor"
70+
// eslint-disable-next-line
71+
ref="aceEditor"
72+
theme="github"
73+
value={this.props.text}
74+
width="100%"
75+
wrapEnabled={true}
76+
enableBasicAutocompletion={false}
77+
enableLiveAutocompletion={true}
78+
onLoad={this.onLoad}
79+
/>
80+
{ browserType() === "desktop" ? <KeyboardShortcut/> : null }
81+
</div>
7882
);
7983
}
8084
}
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
import React from "react";
2+
import {
3+
Button,
4+
ButtonBase,
5+
Icon,
6+
Tooltip,
7+
Popover,
8+
} from "@material-ui/core";
9+
import "../../css/KeyboardShortcut.css";
10+
11+
const general = [
12+
{
13+
shortcut: ["Ctrl/⌘", "S"],
14+
description: "Save scene"
15+
},
16+
{
17+
shortcut: ["Ctrl/⌘", "Shift", "S"],
18+
description: "Save scene as"
19+
},
20+
{
21+
shortcut: ["Ctrl/⌘", "Enter"],
22+
description: "Render scene"
23+
},
24+
];
25+
26+
const editor = [
27+
{
28+
shortcut: ["Ctrl/⌘", "/"],
29+
description: "Comment current or selected line of code"
30+
},
31+
{
32+
shortcut: ["Alt/Option", "Up"],
33+
description: "Move current line of code up 1 line"
34+
},
35+
{
36+
shortcut: ["Alt/Option", "Down"],
37+
description: "Move current line of code down 1 line"
38+
},
39+
{
40+
shortcut: ["Alt/⌘", "D"],
41+
description: "Delete current line of code"
42+
}
43+
];
44+
45+
const scene = [
46+
{
47+
shortcut: ["W"],
48+
description: "Move forwards"
49+
},
50+
{
51+
shortcut: ["S"],
52+
description: "Move backwards"
53+
},
54+
{
55+
shortcut: ["A"],
56+
description: "Move left"
57+
},
58+
{
59+
shortcut: ["D"],
60+
description: "Move right"
61+
},
62+
{
63+
shortcut: ["Space"],
64+
description: "Move up"
65+
},
66+
{
67+
shortcut: ["Shift"],
68+
description: "Move down"
69+
},
70+
];
71+
72+
class KeyboardShortcut extends React.Component {
73+
constructor(props){
74+
super(props);
75+
this.state = {
76+
open: false,
77+
anchorEl: null
78+
};
79+
}
80+
81+
shortcutHelper = (data) => {
82+
let shortcuts = [];
83+
data.shortcut.forEach((key,i)=>{
84+
shortcuts.push(<kbd>{key}</kbd>);
85+
if(i < data.shortcut.length-1){
86+
shortcuts.push(" + ");
87+
}
88+
});
89+
return (<p>{shortcuts} {data.description}</p>);
90+
};
91+
92+
handleClick = (event) =>{
93+
this.setState({
94+
open: true,
95+
anchorEl: event.target});
96+
};
97+
98+
handleClose = () => {
99+
this.setState({
100+
open: false,
101+
anchorEl: null});
102+
};
103+
104+
render(){
105+
return(
106+
<div>
107+
<Tooltip title="Keyboard Shortcut">
108+
<Button
109+
variant="contained"
110+
size="small"
111+
color="primary"
112+
onClick={this.handleClick}>
113+
<Icon className="material-icons">keyboard</Icon>
114+
</Button>
115+
</Tooltip>
116+
<Popover
117+
id="simple-popover"
118+
anchorEl={this.state.anchorEl}
119+
anchorOrigin={{
120+
vertical:"top",
121+
horizontal: "left",
122+
}}
123+
transformOrigin={{
124+
vertical: "bottom",
125+
hotizontal: "left"
126+
}}
127+
open={this.state.open}
128+
onClose={this.handleClose}>
129+
<div className="keyboard-shortcut">
130+
<ButtonBase
131+
style={{ position: "absolute", right: 15, top: 15 }}
132+
onClick={this.handleClose} >
133+
<Icon className="material-icons">clear</Icon>
134+
</ButtonBase >
135+
<section className="right">
136+
<p className="title">General Commands</p>
137+
{
138+
general.map(e => {return this.shortcutHelper(e);})
139+
}
140+
</section>
141+
<section className="right">
142+
<p className="title">Editor Commands</p>
143+
{
144+
editor.map(e => {return this.shortcutHelper(e);})
145+
}
146+
</section>
147+
<section className="right">
148+
<p className="title">Scene Controls</p>
149+
{
150+
scene.map(e => {return this.shortcutHelper(e);})
151+
}
152+
</section>
153+
</div>
154+
<p className="note">⌘: Command key for macOS user</p>
155+
</Popover>
156+
</div>
157+
);
158+
}
159+
}
160+
161+
export default KeyboardShortcut;

src/components/editor/customCompleter.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import myrReference from "../../myr/reference.js";
22
import myrTextures from "../structural/Textures.js";
3+
import myrModels from "../structural/Models.js";
34

45
export const customCompleter = {
56
getCompletions: function (editor, session, pos, prefix, callback) {
@@ -40,6 +41,11 @@ export const customCompleter = {
4041
"group()"
4142
];
4243

44+
let model = myrModels();
45+
let Model = [...model.ModelPack.keys(),
46+
"group()"
47+
];
48+
4349
let reference = myrReference();
4450
let keyWords = [...reference.geometry.map(obj => obj.name + "()"),
4551
...reference.transformations.map(obj => obj.name + "()"),
@@ -241,6 +247,15 @@ export const customCompleter = {
241247
score: 3
242248
};
243249
}));
250+
251+
callback(null, Model.map(function (word) {
252+
return {
253+
caption: word,
254+
value: word,
255+
meta: "model",
256+
score: 3
257+
};
258+
}));
244259
}
245260
};
246261

0 commit comments

Comments
 (0)