Skip to content
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
72 changes: 72 additions & 0 deletions editor/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,78 @@ hr {
margin-top: 15px;
}

.TextureParametersDialog-content {
min-width: 480px;
}

.TextureParametersDialog-split {
display: flex;
gap: 20px;
}

.TextureParametersDialog-preview {
flex: 0 0 auto;
}

.TextureParametersDialog-preview canvas {
border: 1px solid #888;
background: #000;
display: block;
max-width: 100%;
height: auto;
}

.TextureParametersDialog-form {
flex: 1 1 auto;
min-width: 0;
}

@media all and ( max-width: 600px ) {

.TextureParametersDialog-content {
min-width: 0;
width: 90vw;
}

.TextureParametersDialog-split {
flex-direction: column;
}

.TextureParametersDialog-preview {
align-self: center;
max-width: 100%;
}

}

.TextureParametersDialog-groupHeading {
margin: 12px 0 6px;
padding-bottom: 2px;
border-bottom: 1px solid #ccc;
font-weight: bold;
text-transform: uppercase;
font-size: 11px;
color: #666;
}

.TextureParametersDialog-groupHeading:first-child {
margin-top: 0;
}

@media ( prefers-color-scheme: dark ) {

.TextureParametersDialog-groupHeading {
border-bottom-color: #444;
color: #888;
}

}

.TextureSettingsButton {
padding: 0 4px;
line-height: 16px;
}

@media ( prefers-color-scheme: dark ) {

.Dialog-content {
Expand Down
30 changes: 29 additions & 1 deletion editor/js/Sidebar.Material.MapProperty.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import * as THREE from 'three';

import { UICheckbox, UIDiv, UINumber, UIRow, UIText } from './libs/ui.js';
import { UIButton, UICheckbox, UIDiv, UINumber, UIRow, UIText } from './libs/ui.js';
import { UITexture } from './libs/ui.three.js';
import { SetMaterialMapCommand } from './commands/SetMaterialMapCommand.js';
import { SetMaterialValueCommand } from './commands/SetMaterialValueCommand.js';
import { SetMaterialRangeCommand } from './commands/SetMaterialRangeCommand.js';
import { SetMaterialVectorCommand } from './commands/SetMaterialVectorCommand.js';
import { SetTextureParametersCommand } from './commands/SetTextureParametersCommand.js';
import { TextureParametersDialog } from './TextureParametersDialog.js';

function SidebarMaterialMapProperty( editor, property, name ) {

Expand All @@ -20,6 +22,10 @@ function SidebarMaterialMapProperty( editor, property, name ) {
const map = new UITexture( editor ).onChange( onMapChange );
container.add( map );

const settings = new UIButton( '⚙' ).setClass( 'TextureSettingsButton' ).setMarginRight( '4px' ).onClick( onSettingsClick );
settings.setDisabled( true );
container.add( settings );

const mapType = property.replace( 'Map', '' );

const colorMaps = [ 'map', 'emissiveMap', 'sheenColorMap', 'specularColorMap', 'envMap' ];
Expand Down Expand Up @@ -110,6 +116,26 @@ function SidebarMaterialMapProperty( editor, property, name ) {

}

async function onSettingsClick() {

const texture = map.getValue();
if ( texture === null ) return;

const dialog = new TextureParametersDialog( editor, texture );

try {

const parameters = await dialog.show();
editor.execute( new SetTextureParametersCommand( editor, texture, parameters ) );

} catch ( e ) {

// Edit cancelled

}

}

function onMapChange( texture ) {

if ( texture !== null ) {
Expand All @@ -124,6 +150,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {
}

enabled.setDisabled( false );
settings.setDisabled( texture === null );

onChange();

Expand Down Expand Up @@ -193,6 +220,7 @@ function SidebarMaterialMapProperty( editor, property, name ) {

enabled.setValue( material[ property ] !== null );
enabled.setDisabled( map.getValue() === null );
settings.setDisabled( map.getValue() === null );

if ( intensity !== undefined ) {

Expand Down
114 changes: 114 additions & 0 deletions editor/js/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function Strings( config ) {
'command/SetScene': 'تنظیم صحنه',
'command/SetScriptValue': 'تنظیم مقدار اسکریپت',
'command/SetShadowValue': 'تنظیم مقدار سایه',
'command/SetTextureParameters': 'تنظیم پارامترهای تکسچر',
'command/SetUuid': 'تنظیم UUID',
'command/SetValue': 'تنظیم مقدار',

Expand Down Expand Up @@ -427,6 +428,24 @@ function Strings( config ) {

'dialog/gltf/title': 'Import glTF',
'dialog/gltf/asScene': 'Import glTF as root scene',
'dialog/texture/title': 'Texture Parameters',
'dialog/texture/group/preview': 'Preview',
'dialog/texture/group/mapping': 'Mapping',
'dialog/texture/group/filtering': 'Filtering',
'dialog/texture/group/transform': 'Transform',
'dialog/texture/group/color': 'Color',
'dialog/texture/mapping': 'Mapping',
'dialog/texture/wrapS': 'Wrap S',
'dialog/texture/wrapT': 'Wrap T',
'dialog/texture/magFilter': 'Mag Filter',
'dialog/texture/minFilter': 'Min Filter',
'dialog/texture/anisotropy': 'Anisotropy',
'dialog/texture/offset': 'Offset',
'dialog/texture/repeat': 'Repeat',
'dialog/texture/center': 'Center',
'dialog/texture/rotation': 'Rotation',
'dialog/texture/premultiplyAlpha': 'Premultiply Alpha',
'dialog/texture/colorSpace': 'Color Space',
'dialog/ok': 'OK',
'dialog/cancel': 'Cancel'

Expand Down Expand Up @@ -464,6 +483,7 @@ function Strings( config ) {
'command/SetScene': 'Set Scene',
'command/SetScriptValue': 'Set Script Value',
'command/SetShadowValue': 'Set Shadow Value',
'command/SetTextureParameters': 'Set Texture Parameters',
'command/SetUuid': 'Set UUID',
'command/SetValue': 'Set Value',

Expand Down Expand Up @@ -856,6 +876,24 @@ function Strings( config ) {

'dialog/gltf/title': 'Import glTF',
'dialog/gltf/asScene': 'Import glTF as root scene',
'dialog/texture/title': 'Texture Parameters',
'dialog/texture/group/preview': 'Preview',
'dialog/texture/group/mapping': 'Mapping',
'dialog/texture/group/filtering': 'Filtering',
'dialog/texture/group/transform': 'Transform',
'dialog/texture/group/color': 'Color',
'dialog/texture/mapping': 'Mapping',
'dialog/texture/wrapS': 'Wrap S',
'dialog/texture/wrapT': 'Wrap T',
'dialog/texture/magFilter': 'Mag Filter',
'dialog/texture/minFilter': 'Min Filter',
'dialog/texture/anisotropy': 'Anisotropy',
'dialog/texture/offset': 'Offset',
'dialog/texture/repeat': 'Repeat',
'dialog/texture/center': 'Center',
'dialog/texture/rotation': 'Rotation',
'dialog/texture/premultiplyAlpha': 'Premultiply Alpha',
'dialog/texture/colorSpace': 'Color Space',
'dialog/ok': 'OK',
'dialog/cancel': 'Cancel'

Expand Down Expand Up @@ -894,6 +932,7 @@ function Strings( config ) {
'command/SetScene': 'Planter le décor',
'command/SetScriptValue': 'Définir la valeur du script',
'command/SetShadowValue': 'Set Shadow Value',
'command/SetTextureParameters': 'Définir les paramètres de la texture',
'command/SetUuid': 'Définir l’UUID',
'command/SetValue': 'Définir la valeur',

Expand Down Expand Up @@ -1286,6 +1325,24 @@ function Strings( config ) {

'dialog/gltf/title': 'Importer glTF',
'dialog/gltf/asScene': 'Importer glTF comme scène racine',
'dialog/texture/title': 'Paramètres de la texture',
'dialog/texture/group/preview': 'Aperçu',
'dialog/texture/group/mapping': 'Mapping',
'dialog/texture/group/filtering': 'Filtrage',
'dialog/texture/group/transform': 'Transformation',
'dialog/texture/group/color': 'Couleur',
'dialog/texture/mapping': 'Mapping',
'dialog/texture/wrapS': 'Wrap S',
'dialog/texture/wrapT': 'Wrap T',
'dialog/texture/magFilter': 'Filtre d’agrandissement',
'dialog/texture/minFilter': 'Filtre de réduction',
'dialog/texture/anisotropy': 'Anisotropie',
'dialog/texture/offset': 'Décalage',
'dialog/texture/repeat': 'Répétition',
'dialog/texture/center': 'Centre',
'dialog/texture/rotation': 'Rotation',
'dialog/texture/premultiplyAlpha': 'Pré-multiplier alpha',
'dialog/texture/colorSpace': 'Espace colorimétrique',
'dialog/ok': 'OK',
'dialog/cancel': 'Annuler'

Expand Down Expand Up @@ -1324,6 +1381,7 @@ function Strings( config ) {
'command/SetScene': '设置布景',
'command/SetScriptValue': '设置脚本值',
'command/SetShadowValue': '设置阴影值',
'command/SetTextureParameters': '设置纹理参数',
'command/SetUuid': '设置 UUID',
'command/SetValue': '设定值',

Expand Down Expand Up @@ -1716,6 +1774,24 @@ function Strings( config ) {

'dialog/gltf/title': '导入 glTF',
'dialog/gltf/asScene': '将 glTF 导入为根场景',
'dialog/texture/title': '纹理参数',
'dialog/texture/group/preview': '预览',
'dialog/texture/group/mapping': '映射',
'dialog/texture/group/filtering': '过滤',
'dialog/texture/group/transform': '变换',
'dialog/texture/group/color': '颜色',
'dialog/texture/mapping': '映射',
'dialog/texture/wrapS': '环绕 S',
'dialog/texture/wrapT': '环绕 T',
'dialog/texture/magFilter': '放大过滤器',
'dialog/texture/minFilter': '缩小过滤器',
'dialog/texture/anisotropy': '各向异性',
'dialog/texture/offset': '偏移',
'dialog/texture/repeat': '重复',
'dialog/texture/center': '中心',
'dialog/texture/rotation': '旋转',
'dialog/texture/premultiplyAlpha': '预乘 Alpha',
'dialog/texture/colorSpace': '颜色空间',
'dialog/ok': '确定',
'dialog/cancel': '取消'

Expand Down Expand Up @@ -1754,6 +1830,7 @@ function Strings( config ) {
'command/SetScene': 'セットシーン',
'command/SetScriptValue': 'スクリプト値の設定',
'command/SetShadowValue': 'Set Shadow Value',
'command/SetTextureParameters': 'テクスチャパラメータの設定',
'command/SetUuid': 'UUIDの設定',
'command/SetValue': '値の設定',

Expand Down Expand Up @@ -2146,6 +2223,24 @@ function Strings( config ) {

'dialog/gltf/title': 'glTFをインポート',
'dialog/gltf/asScene': 'glTFをルートシーンとしてインポート',
'dialog/texture/title': 'テクスチャパラメータ',
'dialog/texture/group/preview': 'プレビュー',
'dialog/texture/group/mapping': 'マッピング',
'dialog/texture/group/filtering': 'フィルタリング',
'dialog/texture/group/transform': '変換',
'dialog/texture/group/color': 'カラー',
'dialog/texture/mapping': 'マッピング',
'dialog/texture/wrapS': 'ラップ S',
'dialog/texture/wrapT': 'ラップ T',
'dialog/texture/magFilter': '拡大フィルター',
'dialog/texture/minFilter': '縮小フィルター',
'dialog/texture/anisotropy': '異方性',
'dialog/texture/offset': 'オフセット',
'dialog/texture/repeat': 'リピート',
'dialog/texture/center': '中心',
'dialog/texture/rotation': '回転',
'dialog/texture/premultiplyAlpha': 'プリマルチプライアルファ',
'dialog/texture/colorSpace': '色空間',
'dialog/ok': 'OK',
'dialog/cancel': 'キャンセル'

Expand Down Expand Up @@ -2183,6 +2278,7 @@ function Strings( config ) {
'command/SetScene': '장면 설정',
'command/SetScriptValue': '스크립트 값 설정',
'command/SetShadowValue': '그림자 값 설정',
'command/SetTextureParameters': '텍스처 매개변수 설정',
'command/SetUuid': 'UUID 설정',
'command/SetValue': '값 설정',

Expand Down Expand Up @@ -2575,6 +2671,24 @@ function Strings( config ) {

'dialog/gltf/title': 'glTF 가져오기',
'dialog/gltf/asScene': 'glTF를 루트 씬으로 가져오기',
'dialog/texture/title': '텍스처 매개변수',
'dialog/texture/group/preview': '미리보기',
'dialog/texture/group/mapping': '매핑',
'dialog/texture/group/filtering': '필터링',
'dialog/texture/group/transform': '변환',
'dialog/texture/group/color': '색상',
'dialog/texture/mapping': '매핑',
'dialog/texture/wrapS': '랩 S',
'dialog/texture/wrapT': '랩 T',
'dialog/texture/magFilter': '확대 필터',
'dialog/texture/minFilter': '축소 필터',
'dialog/texture/anisotropy': '이방성',
'dialog/texture/offset': '오프셋',
'dialog/texture/repeat': '반복',
'dialog/texture/center': '중심',
'dialog/texture/rotation': '회전',
'dialog/texture/premultiplyAlpha': '알파 미리 곱하기',
'dialog/texture/colorSpace': '색 공간',
'dialog/ok': '확인',
'dialog/cancel': '취소'
}
Expand Down
Loading