Skip to content

Commit

Permalink
Merge pull request #12951 from carolhmj/NME-bugs
Browse files Browse the repository at this point in the history
Fix some NME bugs.
  • Loading branch information
sebavan authored Sep 5, 2022
2 parents 25eda29 + a98cd21 commit 560b825
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ export class PerturbNormalBlock extends NodeMaterialBlock {

state._emitUniformFromString(this._tangentSpaceParameterName, "vec2");

const normalSamplerName = (this.normalMapColor.connectedPoint!._ownerBlock as TextureBlock).samplerName;
let normalSamplerName = null;
if (this.normalMapColor.connectedPoint) {
normalSamplerName = (this.normalMapColor.connectedPoint!._ownerBlock as TextureBlock).samplerName;
}
const useParallax = this.viewDirection.isConnected && ((this.useParallaxOcclusion && normalSamplerName) || (!this.useParallaxOcclusion && this.parallaxHeight.isConnected));

const replaceForParallaxInfos = !this.parallaxScale.isConnectedToInputBlock
Expand Down
18 changes: 13 additions & 5 deletions packages/dev/sharedUiComponents/src/components/MessageDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styles from "./MessageDialog.modules.scss";
export interface MessageDialogProps {
message: string;
isError: boolean;
onClose?: () => void;
}

export const MessageDialog: React.FC<MessageDialogProps> = (props) => {
Expand All @@ -17,16 +18,23 @@ export const MessageDialog: React.FC<MessageDialogProps> = (props) => {
setIsError(props.isError);
}, [props]);

const onClick = () => {
setMessage("");
if (props.onClose) {
props.onClose();
}
};

if (!message) {
return null;
}

return (
<div className={ClassNames({ "dialog-container": true }, styles)}>
<div className={ClassNames({ dialog: true }, styles)}>
<div className={ClassNames({ "dialog-message": true }, styles)}>{message}</div>
<div className={ClassNames({ "dialog-buttons": true }, styles)}>
<div className={ClassNames({ "dialog-button-ok": true, error: isError }, styles)} onClick={() => setMessage("")}>
<div className={styles["dialog-container"]}>
<div className={styles["dialog"]}>
<div className={styles["dialog-message"]}>{message}</div>
<div className={styles["dialog-buttons"]}>
<div className={ClassNames({ "dialog-button-ok": true, error: isError }, styles)} onClick={onClick}>
OK
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/nodeEditor/src/graphEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ export class GraphEditor extends React.Component<IGraphEditorProps, IGraphEditor

<LogComponent globalState={this.props.globalState} />
</div>
<MessageDialog message={this.state.message} isError={this.state.isError} />
<MessageDialog message={this.state.message} isError={this.state.isError} onClose={() => this.setState({ message: "" })} />
<div className="blocker">Node Material Editor runs only on desktop</div>
<div className="wait-screen hidden">Processing...please wait</div>
</Portal>
Expand Down

0 comments on commit 560b825

Please sign in to comment.