Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node editor #6334

Merged
merged 41 commits into from May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
158a4fe
First scafolding
deltakosh Mar 5, 2019
7d0a962
First exploration
deltakosh Mar 6, 2019
9e801eb
Lint + doc
deltakosh Mar 6, 2019
3be0abf
first large block: fog
deltakosh Mar 8, 2019
66af496
Merge branch 'master' into node-material
deltakosh Mar 8, 2019
c1160fc
Associated with #6012
deltakosh Mar 8, 2019
d1c533a
Adding support for swizzles
deltakosh Mar 9, 2019
aedf18d
Merge branch 'master' into node-material
deltakosh Mar 9, 2019
29bbb60
Migrate NodeMaterial to PushMaterial
deltakosh Mar 9, 2019
667d2ae
Move defines under block responsibility
deltakosh Mar 10, 2019
f979ff6
Added inputs as properties
deltakosh Mar 10, 2019
3939850
added support for transform in texture block
deltakosh Mar 10, 2019
280f3d1
Linting
deltakosh Mar 10, 2019
621c179
Start optimizer block
deltakosh Mar 11, 2019
4b5648c
InstancesBlock step1
deltakosh Mar 11, 2019
a7ded67
Merge branch 'master' into node-material
deltakosh Mar 12, 2019
9686890
- instancesBlock
deltakosh Mar 12, 2019
3fd33d7
ImageProcessingBlock
deltakosh Mar 12, 2019
543dbef
morphsTargetBlock
deltakosh Mar 13, 2019
974d6d4
Fix #6054
deltakosh Mar 14, 2019
412ce47
Nightly
deltakosh Mar 14, 2019
c08da92
Merge master
deltakosh Mar 21, 2019
3b9fc84
Starting blocks for nodeEditor
deltakosh Mar 21, 2019
2c6e569
nodeEditor initial build
deltakosh Mar 21, 2019
06bd3aa
update to master
May 3, 2019
1e47fab
node editor
May 3, 2019
a660a0c
inspector
May 3, 2019
cce8c8a
make node material props public
May 3, 2019
d125830
working again
May 3, 2019
297e9b6
dist typings
May 3, 2019
23ee06a
no more build errors
May 3, 2019
c4de10a
add some docs
May 3, 2019
ca18c6d
remove texture
May 3, 2019
1cd595a
more dosc
May 3, 2019
c03e0c5
building success
May 10, 2019
4403387
fix dist merge conflicts
May 10, 2019
fa1a7ec
revert dist
May 10, 2019
dfb7251
merge latest
May 10, 2019
0ac8b69
add package.json and readme for node editor required for build
May 10, 2019
ae6cd82
add css
May 11, 2019
d7f425f
casing causing ci failure
May 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,389 changes: 1,388 additions & 1 deletion Playground/babylon.d.txt

Large diffs are not rendered by default.

57 changes: 55 additions & 2 deletions Tools/Config/config.json
Expand Up @@ -45,7 +45,8 @@
"loaders",
"serializers",
"gui",
"inspector"
"inspector",
"nodeEditor"
],
"es6modules": [
"core",
Expand All @@ -56,7 +57,8 @@
"serializers",
"gui",
"inspector",
"viewer"
"viewer",
"nodeEditor"
],
"lintModules": [
"core",
Expand Down Expand Up @@ -580,6 +582,57 @@
}
}
},
"nodeEditor": {
"libraries": [
{
"output": "babylon.nodeEditor.js",
"entry": "./legacy/legacy.ts"
}
],
"build": {
"ignoreInTestMode": true,
"mainFolder": "./nodeEditor/",
"uncheckedLintImports": [
"react",
"react-dom",
"re-resizable",
"glTF"
],
"umd": {
"packageName": "babylonjs-node-editor",
"webpackRoot": "NODEEDITOR",
"processDeclaration": {
"filename": "babylon.nodeEditor.module.d.ts",
"moduleName": "NODEEDITOR",
"importsToRemove": [],
"classMap": {
"babylonjs": "BABYLON",
"react": "React",
"@babylonjs/core": "BABYLON",
"@fortawesome": false,
"react-contextmenu": false
}
}
},
"es6": {
"webpackBuild": true,
"buildDependencies": [
"node_modules/re-resizable/lib/index.es5.js",
"Tools/**/*"
],
"packageName": "@babylonjs/node-editor",
"readme": "dist/preview release/nodeEditor/readme-es6.md",
"packagesFiles": [
"babylon.nodeEditor.max.js",
"babylon.nodeEditor.max.js.map",
"babylon.nodeEditor.module.d.ts",
"readme.md"
],
"typings": "babylon.nodeEditor.module.d.ts",
"index": "babylon.nodeEditor.max.js"
}
}
},
"viewer": {
"libraries": [
{
Expand Down
75 changes: 37 additions & 38 deletions bower.json
@@ -1,39 +1,38 @@
{
"name": "babylonjs",
"description": "Babylon.js is a complete JavaScript framework for building 3D games with HTML 5 and WebGL",
"main": "./dist/babylon.2.5.js",
"homepage": "https://www.babylonjs.com",
"repository": {
"type": "git",
"url": "git://github.com/BabylonJS/Babylon.js.git"
},
"authors": [
"David Catuhe",
"David Rousset"
],
"keywords": [
"3D",
"WebGL",
"WebAudio",
"Shaders",
"Realtime"
],
"license": "Apache-2.0",
"ignore": [
"**/.*",
"node_modules",
"Babylon",
"Exporters",
"Loaders",
"Previous releases",
"/Tools",
"gulpfile.js",
"package.json",
"babylon.2.1*.*",
"*.md",
"*.yml",
"cannon.js",
"Oimo.js",
"poly2tri.js"
]
}
"name": "babylonjs",
"description": "Babylon.js is a complete JavaScript framework for building 3D games with HTML 5 and WebGL",
"main": "./dist/babylon.js",
"homepage": "https://www.babylonjs.com",
"repository": {
"type": "git",
"url": "git://github.com/BabylonJS/Babylon.js.git"
},
"authors": [
"David Catuhe"
],
"keywords": [
"3D",
"WebGL",
"WebAudio",
"Shaders",
"Realtime"
],
"license": "Apache-2.0",
"ignore": [
"**/.*",
"node_modules",
"Babylon",
"Exporters",
"Loaders",
"Previous releases",
"/Tools",
"gulpfile.js",
"package.json",
"babylon.2.1*.*",
"*.md",
"*.yml",
"cannon.js",
"Oimo.js",
"poly2tri.js"
]
}
27 changes: 27 additions & 0 deletions dist/preview release/nodeEditor/package.json
@@ -0,0 +1,27 @@
{
"author": {
"name": "David CATUHE"
},
"name": "babylonjs-node-editor",
"description": "The Babylon.js node material editor.",
"version": "4.1.0-alpha.0",
"repository": {
"type": "git",
"url": "https://github.com/BabylonJS/Babylon.js.git"
},
"license": "Apache-2.0",
"dependencies": {
"babylonjs": "4.1.0-alpha.0"
},
"files": [
"babylon.nodeEditor.max.js.map",
"babylon.nodeEditor.max.js",
"babylon.nodeEditor.js",
"babylon.nodeEditor.module.d.ts",
"readme.md",
"package.json"
],
"engines": {
"node": "*"
}
}
1 change: 1 addition & 0 deletions dist/preview release/nodeEditor/readme-es6.md
@@ -0,0 +1 @@
Node Editor es6
1 change: 1 addition & 0 deletions dist/preview release/nodeEditor/readme.md
@@ -0,0 +1 @@
Node Editor
1 change: 1 addition & 0 deletions dist/preview release/what's new.md
Expand Up @@ -11,6 +11,7 @@
- Added support for `ShadowGenerator` ([Deltakosh](https://github.com/deltakosh/))
- Added support for scene normalization ([Deltakosh](https://github.com/deltakosh/))
- Added support for texture creation and assignments per material ([Deltakosh](https://github.com/deltakosh/))
- Node material editor ([Deltakosh](https://github.com/deltakosh/)/[TrevorDev](https://github.com/TrevorDev))

### Tools
- Added `Color3.toHSV()`, `Color3.toHSVToRef()` and `Color3.HSVtoRGBToRef()` ([Deltakosh](https://github.com/deltakosh/))
Expand Down
4 changes: 2 additions & 2 deletions inspector/README.md
Expand Up @@ -9,13 +9,13 @@ Call the method `show` of the scene debugLayer:
```
scene.debugLayer.show();
```
This method will retrieve dynamically the library `inspector.js`, download it and add
This method will retrieve dynamically the library `babylon.inspector.bundle.js`, download it and add
it to the html page.

### Offline method
If you don't have access to internet, the inspector should be imported manually in your HTML page :
```
<script src="babylon.inspector.js" />
<script src="babylon.inspector.bundle.js" />
```
Then, call the method `show` of the scene debugLayer:
```
Expand Down
79 changes: 46 additions & 33 deletions inspector/src/components/actionTabs/actionTabsComponent.tsx
Expand Up @@ -15,15 +15,15 @@ import { GlobalState } from "../../components/globalState";
require("./actionTabs.scss");

interface IActionTabsComponentProps {
scene: Scene,
scene?: Scene,
noCommands?: boolean,
noHeader?: boolean,
noExpand?: boolean,
noClose?: boolean,
popupMode?: boolean,
onPopup?: () => void,
onClose?: () => void,
globalState: GlobalState
globalState?: GlobalState
}

export class ActionTabsComponent extends React.Component<IActionTabsComponentProps, { selectedEntity: any, selectedIndex: number }> {
Expand All @@ -36,53 +36,66 @@ export class ActionTabsComponent extends React.Component<IActionTabsComponentPro

let initialIndex = 0;

const validationResutls = this.props.globalState.validationResults;
if (validationResutls) {
if (validationResutls.issues.numErrors || validationResutls.issues.numWarnings) {
initialIndex = 3;
if(this.props.globalState){
const validationResutls = this.props.globalState.validationResults;
if (validationResutls) {
if (validationResutls.issues.numErrors || validationResutls.issues.numWarnings) {
initialIndex = 3;
}
}
}


this.state = { selectedEntity: null, selectedIndex: initialIndex }
}

componentWillMount() {
this._onSelectionChangeObserver = this.props.globalState.onSelectionChangedObservable.add((entity) => {
this.setState({ selectedEntity: entity, selectedIndex: 0 });
});

this._onTabChangedObserver = this.props.globalState.onTabChangedObservable.add(index => {
this.setState({ selectedIndex: index });
});
if(this.props.globalState){
this._onSelectionChangeObserver = this.props.globalState.onSelectionChangedObservable.add((entity) => {
this.setState({ selectedEntity: entity, selectedIndex: 0 });
});

this._onTabChangedObserver = this.props.globalState.onTabChangedObservable.add(index => {
this.setState({ selectedIndex: index });
});
}
}

componentWillUnmount() {
if (this._onSelectionChangeObserver) {
this.props.globalState.onSelectionChangedObservable.remove(this._onSelectionChangeObserver);
}
if(this.props.globalState){
if (this._onSelectionChangeObserver) {
this.props.globalState.onSelectionChangedObservable.remove(this._onSelectionChangeObserver);
}

if (this._onTabChangedObserver) {
this.props.globalState.onTabChangedObservable.remove(this._onTabChangedObserver);
if (this._onTabChangedObserver) {
this.props.globalState.onTabChangedObservable.remove(this._onTabChangedObserver);
}
}
}

changeSelectedTab(index: number) {
this.props.globalState.onTabChangedObservable.notifyObservers(index);
if(this.props.globalState){
this.props.globalState.onTabChangedObservable.notifyObservers(index);
}
}

renderContent() {
return (
<TabsComponent selectedIndex={this.state.selectedIndex} onSelectedIndexChange={(value) => this.changeSelectedTab(value)}>
<PropertyGridTabComponent
title="Properties" icon={faFileAlt} scene={this.props.scene} selectedEntity={this.state.selectedEntity}
globalState={this.props.globalState}
onSelectionChangedObservable={this.props.globalState.onSelectionChangedObservable}
onPropertyChangedObservable={this.props.globalState.onPropertyChangedObservable} />
<DebugTabComponent title="Debug" icon={faBug} scene={this.props.scene} globalState={this.props.globalState} />
<StatisticsTabComponent title="Statistics" icon={faChartBar} scene={this.props.scene} globalState={this.props.globalState} />
<ToolsTabComponent title="Tools" icon={faWrench} scene={this.props.scene} globalState={this.props.globalState} />
</TabsComponent>
)
if(this.props.globalState && this.props.scene){
return (
<TabsComponent selectedIndex={this.state.selectedIndex} onSelectedIndexChange={(value) => this.changeSelectedTab(value)}>
<PropertyGridTabComponent
title="Properties" icon={faFileAlt} scene={this.props.scene} selectedEntity={this.state.selectedEntity}
globalState={this.props.globalState}
onSelectionChangedObservable={this.props.globalState.onSelectionChangedObservable}
onPropertyChangedObservable={this.props.globalState.onPropertyChangedObservable} />
<DebugTabComponent title="Debug" icon={faBug} scene={this.props.scene} globalState={this.props.globalState} />
<StatisticsTabComponent title="Statistics" icon={faChartBar} scene={this.props.scene} globalState={this.props.globalState} />
<ToolsTabComponent title="Tools" icon={faWrench} scene={this.props.scene} globalState={this.props.globalState} />
</TabsComponent>
)
}else{
return null;
}
}

onClose() {
Expand All @@ -105,7 +118,7 @@ export class ActionTabsComponent extends React.Component<IActionTabsComponentPro
<div id="actionTabs">
{
!this.props.noHeader &&
<HeaderComponent title="INSPECTOR" handleBack={true} noClose={this.props.noClose} noExpand={this.props.noExpand} noCommands={this.props.noCommands} onClose={() => this.onClose()} onPopup={() => this.onPopup()} onSelectionChangedObservable={this.props.globalState.onSelectionChangedObservable} />
<HeaderComponent title="INSPECTOR" handleBack={true} noClose={this.props.noClose} noExpand={this.props.noExpand} noCommands={this.props.noCommands} onClose={() => this.onClose()} onPopup={() => this.onPopup()} onSelectionChangedObservable={this.props.globalState ? this.props.globalState.onSelectionChangedObservable : undefined} />
}
{this.renderContent()}
</div>
Expand All @@ -128,7 +141,7 @@ export class ActionTabsComponent extends React.Component<IActionTabsComponentPro
<Resizable id="actionTabs" minWidth={300} maxWidth={600} size={{ height: "100%" }} minHeight="100%" enable={{ top: false, right: false, bottom: false, left: true, topRight: false, bottomRight: false, bottomLeft: false, topLeft: false }}>
{
!this.props.noHeader &&
<HeaderComponent title="INSPECTOR" handleBack={true} noClose={this.props.noClose} noExpand={this.props.noExpand} noCommands={this.props.noCommands} onClose={() => this.onClose()} onPopup={() => this.onPopup()} onSelectionChangedObservable={this.props.globalState.onSelectionChangedObservable} />
<HeaderComponent title="INSPECTOR" handleBack={true} noClose={this.props.noClose} noExpand={this.props.noExpand} noCommands={this.props.noCommands} onClose={() => this.onClose()} onPopup={() => this.onPopup()} onSelectionChangedObservable={this.props.globalState ? this.props.globalState.onSelectionChangedObservable : undefined} />
}
{this.renderContent()}
</Resizable>
Expand Down
Expand Up @@ -4,7 +4,7 @@ import { faChevronDown } from '@fortawesome/free-solid-svg-icons';
import { GlobalState } from '../../components/globalState';

interface ILineContainerComponentProps {
globalState: GlobalState;
globalState?: GlobalState;
title: string;
children: any[] | any;
closed?: boolean;
Expand Down Expand Up @@ -55,13 +55,13 @@ export class LineContainerComponent extends React.Component<ILineContainerCompon
}

componentDidMount() {
if (!this.props.globalState.selectedLineContainerTitle) {
if (this.props.globalState && !this.props.globalState.selectedLineContainerTitle) {
return;
}

if (this.props.globalState.selectedLineContainerTitle === this.props.title) {
if (this.props.globalState && this.props.globalState.selectedLineContainerTitle === this.props.title) {
setTimeout(() => {
this.props.globalState.selectedLineContainerTitle = "";
this.props.globalState!.selectedLineContainerTitle = "";
});

this.setState({ isExpanded: true, isHighlighted: true });
Expand Down