|
@@ -24,6 +24,7 @@ import { AdvancedDynamicTextureInstrumentation } from "babylonjs-gui/2D/adtInstr
|
|
import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
|
|
import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
|
|
import { CustomPropertyGridComponent } from '../customPropertyGridComponent';
|
|
import { CustomPropertyGridComponent } from '../customPropertyGridComponent';
|
|
import { ButtonLineComponent } from '../../../lines/buttonLineComponent';
|
|
import { ButtonLineComponent } from '../../../lines/buttonLineComponent';
|
|
|
|
+import { TextInputLineComponent } from '../../../lines/textInputLineComponent';
|
|
|
|
|
|
interface ITexturePropertyGridComponentProps {
|
|
interface ITexturePropertyGridComponentProps {
|
|
texture: BaseTexture,
|
|
texture: BaseTexture,
|
|
@@ -73,12 +74,17 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
|
|
extension = ".env";
|
|
extension = ".env";
|
|
}
|
|
}
|
|
|
|
|
|
- (texture as CubeTexture).updateURL(url, extension, () => this.forceUpdate());
|
|
|
|
|
|
+ (texture as CubeTexture).updateURL(url, extension, () => this.foreceRefresh());
|
|
} else {
|
|
} else {
|
|
- (texture as Texture).updateURL(url, null, () => this.forceUpdate());
|
|
|
|
|
|
+ (texture as Texture).updateURL(url, null, () => this.foreceRefresh());
|
|
}
|
|
}
|
|
|
|
|
|
}, undefined, true);
|
|
}, undefined, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreceRefresh() {
|
|
|
|
+ this.forceUpdate();
|
|
|
|
+ (this.refs["textureLine"] as TextureLineComponent).updatePreview();
|
|
}
|
|
}
|
|
|
|
|
|
render() {
|
|
render() {
|
|
@@ -113,13 +119,21 @@ export class TexturePropertyGridComponent extends React.Component<ITextureProper
|
|
}
|
|
}
|
|
extension = url[index] + extension;
|
|
extension = url[index] + extension;
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ url = "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let textureUrl = (url.substring(0, 4) === "data" || url.substring(0, 4) === "blob") ? "" : url;
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className="pane">
|
|
<div className="pane">
|
|
<LineContainerComponent globalState={this.props.globalState} title="PREVIEW">
|
|
<LineContainerComponent globalState={this.props.globalState} title="PREVIEW">
|
|
- <TextureLineComponent texture={texture} width={256} height={256} globalState={this.props.globalState} />
|
|
|
|
- <FileButtonLineComponent label="Replace texture" onClick={(file) => this.updateTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
|
|
|
|
|
|
+ <TextureLineComponent ref="textureLine" texture={texture} width={256} height={256} globalState={this.props.globalState} />
|
|
|
|
+ <FileButtonLineComponent label="Load texture from file" onClick={(file) => this.updateTexture(file)} accept=".jpg, .png, .tga, .dds, .env" />
|
|
|
|
+ <TextInputLineComponent label="URL" value={textureUrl} lockObject={this.props.lockObject} onChange={url => {
|
|
|
|
+ (texture as Texture).updateURL(url);
|
|
|
|
+ this.foreceRefresh();
|
|
|
|
+ }} />
|
|
</LineContainerComponent>
|
|
</LineContainerComponent>
|
|
<CustomPropertyGridComponent globalState={this.props.globalState} target={texture}
|
|
<CustomPropertyGridComponent globalState={this.props.globalState} target={texture}
|
|
lockObject={this.props.lockObject}
|
|
lockObject={this.props.lockObject}
|