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

Fix some NME bugs. #12951

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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