Skip to content

Commit eae85a3

Browse files
authored
Merge pull request #14 from MetacityTools/dev
Releasing 0.3.0
2 parents 6278482 + d2297a3 commit eae85a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1269
-933
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,23 @@ The project is in active development. The roadmap is as follows:
3131
- [ ] Hide and show models
3232
- [ ] Viewer - Details TBA
3333

34-
### v0.3.1
34+
### v0.3.1 - 👨‍💻 In progress
3535

36+
- [ ] Projecting models onto models (2D onto 3D) - ✨WIP https://github.com/vojtatom/geometry
37+
- [ ] Styling???
3638
- [ ] Loading points and lines from SHP
3739
- [ ] Extract Utils to separate SDK form metacity editors
3840

39-
### v0.3.2 - 👨‍💻 In progress
41+
### v0.3.0 - ✅ Released
4042

41-
- [ ] Projecting models onto models (2D onto 3D) - ✨WIP https://github.com/vojtatom/geometry
42-
- [ ] Project export
43-
- [ ] Styling???
43+
- [x] Remove the conversion process and support switching between transform and table mode
44+
- [x] add create/remove modifiers for hierarchy
45+
- [x] move hierarchy to Editor Context
46+
- [x] Project export and import
47+
- [x] Hierarchy - matadata convert
48+
- [x] Join Models, serialize
49+
- [x] Export
50+
- [x] Import
4451

4552
### v0.2.1 - ✅ Released
4653

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "metacity-studio",
33
"private": true,
4-
"version": "0.2.1",
4+
"version": "0.3.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

studio/src/bananagl/models/model.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,15 @@ export class Model extends Renderable {
1717
return this._shader;
1818
}
1919

20-
set shader(shader: Shader) {
21-
this._shader = shader;
20+
get data() {
21+
return this.data_;
2222
}
2323

2424
set data(data: { [name: string]: any }) {
25-
for (const name in data) {
26-
const value = data[name];
27-
if (value === this.data_[name]) continue;
28-
this.data_[name] = value;
29-
}
25+
this.data_ = data;
3026
}
3127

32-
get data() {
33-
return this.data_;
28+
set shader(shader: Shader) {
29+
this._shader = shader;
3430
}
3531
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface Selectable {
2-
select(submodelIDs: number[]): void;
3-
deselect(submodelIDs: number[]): void;
2+
select(submodelIDs: Set<number>): void;
3+
deselect(submodelIDs: Set<number>): void;
44
}

studio/src/bananagl/picking/picker.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class Picker {
4646

4747
traceRect(rect: RectSelector) {
4848
const objects = this.scene.objects;
49+
const selection: { object: Pickable; primitiveIndices: number[] }[] = [];
4950

5051
for (let objectIndex = 0; objectIndex < objects.length; objectIndex++) {
5152
const object = objects[objectIndex];
@@ -60,14 +61,15 @@ export class Picker {
6061

6162
const hits = bvh.traceRect(rect);
6263
if (hits.length > 0)
63-
return {
64+
selection.push({
6465
object: object as Pickable,
6566
primitiveIndices: hits,
66-
};
67+
});
6768

6869
rect.untransform();
6970
}
70-
return null;
71+
72+
return selection;
7173
}
7274

7375
private traceObject(ray: Ray, object: Pickable) {

studio/src/components/Editor/Canvas/CanvasView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { useRenderer, useScene } from '@utils/utils';
55

66
import * as GL from '@bananagl/bananagl';
77

8+
import { Button } from '@elements/Button';
9+
810
import { Controls } from './Controls';
911
import { Help } from './Help';
1012
import { Settings } from './Settings';
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { DirectionControls } from './ControlsDirection';
2+
import { ModeControls } from './ControlsMode';
23
import { ProjectionControls } from './ControlsProjection';
34
import { SelectionControls } from './ControlsSelect';
45
import { ShaderControls } from './ControlsShader';
56

67
export function Controls() {
78
return (
8-
<div className="absolute m-4 space-x-2 left-0 top-0 z-40 flex flex-row">
9-
<ProjectionControls />
10-
<DirectionControls />
11-
<ShaderControls />
12-
<SelectionControls />
13-
</div>
9+
<>
10+
<div className="absolute m-4 space-x-2 left-0 top-0 z-0 flex flex-row">
11+
<ProjectionControls />
12+
<DirectionControls />
13+
<ShaderControls />
14+
<SelectionControls />
15+
</div>
16+
<div className="absolute mt-4 space-x-2 right-0 top-0 z-0 flex flex-row">
17+
<ModeControls />
18+
</div>
19+
</>
1420
);
1521
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
import { VscJson, VscMove } from 'react-icons/vsc';
3+
4+
import * as GL from '@bananagl/bananagl';
5+
6+
import { EditingMode, useEditingMode } from '@editor/Context/EditorContext';
7+
8+
import { MenuButton, MenuGroup } from '@elements/MenuButton';
9+
10+
export function ModeControls() {
11+
const [mode, setMode] = useEditingMode();
12+
13+
const [projection, setProjection] = React.useState<GL.ProjectionType>(
14+
GL.ProjectionType.ORTHOGRAPHIC
15+
);
16+
17+
return (
18+
<MenuGroup column>
19+
<MenuButton
20+
onClick={() => setMode(EditingMode.Transform)}
21+
tipTitle="Transfomr Editing Mode"
22+
active={mode === EditingMode.Transform}
23+
column
24+
>
25+
<VscMove className="text-2xl" />
26+
</MenuButton>
27+
<MenuButton
28+
onClick={() => setMode(EditingMode.Table)}
29+
tipTitle="Metadata Editing Mode"
30+
active={mode === EditingMode.Table}
31+
column
32+
>
33+
<VscJson className="text-2xl" />
34+
</MenuButton>
35+
</MenuGroup>
36+
);
37+
}

studio/src/components/Editor/Canvas/ControlsSelect.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function SelectionControls() {
99
const [select] = useSelection();
1010

1111
const deselect = () => {
12-
select(null);
12+
select(new Map());
1313
};
1414

1515
return (

studio/src/components/Editor/Context/EditorContext.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
export enum EditingStage {
3+
export enum EditingMode {
44
Transform,
55
Table,
66
}
@@ -10,14 +10,14 @@ interface EditorContextProps {
1010
setProcessing: React.Dispatch<React.SetStateAction<boolean>>;
1111
loadingStatus: string;
1212
setLoadingStatus: React.Dispatch<React.SetStateAction<string>>;
13-
editingStage: EditingStage;
14-
setEditingStage: React.Dispatch<React.SetStateAction<EditingStage>>;
13+
editingMode: EditingMode;
14+
setEditingMode: React.Dispatch<React.SetStateAction<EditingMode>>;
1515
}
1616

1717
const context = React.createContext<EditorContextProps>({} as EditorContextProps);
1818

1919
export function EditorContext(props: { children: React.ReactNode }) {
20-
const [editingStage, setEditingStage] = React.useState<EditingStage>(EditingStage.Transform);
20+
const [editingMode, setEditingMode] = React.useState<EditingMode>(EditingMode.Transform);
2121
const [loadingStatus, setLoadingStatus] = React.useState<string>('');
2222
const [processing, setProcessing] = React.useState(false);
2323

@@ -28,8 +28,8 @@ export function EditorContext(props: { children: React.ReactNode }) {
2828
setProcessing,
2929
loadingStatus,
3030
setLoadingStatus,
31-
editingStage,
32-
setEditingStage,
31+
editingMode,
32+
setEditingMode,
3333
}}
3434
>
3535
{props.children}
@@ -51,10 +51,7 @@ export function useLoadingStatus(): [string, React.Dispatch<React.SetStateAction
5151
return [loadingStatus, setLoadingStatus];
5252
}
5353

54-
export function useEditingStage(): [
55-
EditingStage,
56-
React.Dispatch<React.SetStateAction<EditingStage>>
57-
] {
58-
const { editingStage, setEditingStage } = useEditorContext();
59-
return [editingStage, setEditingStage];
54+
export function useEditingMode(): [EditingMode, React.Dispatch<React.SetStateAction<EditingMode>>] {
55+
const { editingMode, setEditingMode } = useEditorContext();
56+
return [editingMode, setEditingMode];
6057
}

0 commit comments

Comments
 (0)