Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
9f6d3a9c
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9f6d3a9c
编写于
10月 15, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: added more checks for prevention of setting textures to UV-less objects.
Warnings are way too verbose for the moment.
上级
edc4f719
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
87 addition
and
20 deletion
+87
-20
editor/js/ui/Sidebar.Properties.Material.js
editor/js/ui/Sidebar.Properties.Material.js
+87
-20
未找到文件。
editor/js/ui/Sidebar.Properties.Material.js
浏览文件 @
9f6d3a9c
...
...
@@ -218,6 +218,7 @@ Sidebar.Properties.Material = function ( signals ) {
//
var
selected
=
null
;
var
selectedHasUvs
=
false
;
var
canvas
=
document
.
createElement
(
'
canvas
'
);
var
context
=
canvas
.
getContext
(
'
2d
'
);
...
...
@@ -240,7 +241,15 @@ Sidebar.Properties.Material = function ( signals ) {
material
=
new
materials
[
materialClass
.
getValue
()
]();
selected
.
material
=
material
;
material
.
map
=
dummyTexture
;
if
(
selectedHasUvs
)
{
material
.
map
=
dummyTexture
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
...
...
@@ -276,47 +285,95 @@ Sidebar.Properties.Material = function ( signals ) {
if
(
material
.
map
!==
undefined
)
{
material
.
map
=
materialMapEnabled
.
getValue
()
===
true
?
materialMap
.
getValue
()
:
dummyTexture
;
material
.
needsUpdate
=
true
;
if
(
selectedHasUvs
)
{
material
.
map
=
materialMapEnabled
.
getValue
()
===
true
?
materialMap
.
getValue
()
:
dummyTexture
;
material
.
needsUpdate
=
true
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
/*
if ( material.lightMap !== undefined ) {
material.lightMap = materialLightMapEnabled.getValue() === true ? materialLightMap.getValue() : null;
material.needsUpdate = true;
if ( selectedHasUvs ) {
material.lightMap = materialLightMapEnabled.getValue() === true ? materialLightMap.getValue() : null;
material.needsUpdate = true;
} else {
console.warn( "Can't set texture, model doesn't have texture coordinates" );
}
}
*/
if
(
material
.
bumpMap
!==
undefined
)
{
material
.
bumpMap
=
materialBumpMapEnabled
.
getValue
()
===
true
?
materialBumpMap
.
getValue
()
:
null
;
material
.
bumpScale
=
materialBumpScale
.
getValue
();
material
.
needsUpdate
=
true
;
if
(
selectedHasUvs
)
{
material
.
bumpMap
=
materialBumpMapEnabled
.
getValue
()
===
true
?
materialBumpMap
.
getValue
()
:
null
;
material
.
bumpScale
=
materialBumpScale
.
getValue
();
material
.
needsUpdate
=
true
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
if
(
material
.
normalMap
!==
undefined
)
{
material
.
normalMap
=
materialNormalMapEnabled
.
getValue
()
===
true
?
materialNormalMap
.
getValue
()
:
null
;
material
.
needsUpdate
=
true
;
if
(
selectedHasUvs
)
{
material
.
normalMap
=
materialNormalMapEnabled
.
getValue
()
===
true
?
materialNormalMap
.
getValue
()
:
null
;
material
.
needsUpdate
=
true
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
if
(
material
.
specularMap
!==
undefined
)
{
material
.
specularMap
=
materialSpecularMapEnabled
.
getValue
()
===
true
?
materialSpecularMap
.
getValue
()
:
null
;
material
.
needsUpdate
=
true
;
if
(
selectedHasUvs
)
{
material
.
specularMap
=
materialSpecularMapEnabled
.
getValue
()
===
true
?
materialSpecularMap
.
getValue
()
:
null
;
material
.
needsUpdate
=
true
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
if
(
material
.
envMap
!==
undefined
)
{
material
.
envMap
=
materialEnvMapEnabled
.
getValue
()
===
true
?
materialEnvMap
.
getValue
()
:
null
;
material
.
reflectivity
=
materialReflectivity
.
getValue
();
material
.
needsUpdate
=
true
;
if
(
selectedHasUvs
)
{
material
.
envMap
=
materialEnvMapEnabled
.
getValue
()
===
true
?
materialEnvMap
.
getValue
()
:
null
;
material
.
reflectivity
=
materialReflectivity
.
getValue
();
material
.
needsUpdate
=
true
;
}
else
{
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
}
...
...
@@ -397,6 +454,7 @@ Sidebar.Properties.Material = function ( signals ) {
if
(
object
&&
object
.
material
)
{
selected
=
object
;
selectedHasUvs
=
object
.
geometry
.
faceVertexUvs
[
0
].
length
>
0
;
container
.
setDisplay
(
''
);
...
...
@@ -437,15 +495,23 @@ Sidebar.Properties.Material = function ( signals ) {
if
(
material
.
map
!==
undefined
)
{
if
(
material
.
map
!==
null
)
{
if
(
selectedHasUvs
)
{
if
(
material
.
map
!==
null
)
{
materialMapEnabled
.
setValue
(
true
);
materialMap
.
setValue
(
material
.
map
);
}
else
{
materialMapEnabled
.
setValue
(
false
);
materialMap
.
setValue
(
dummyTexture
);
materialMapEnabled
.
setValue
(
true
);
materialMap
.
setValue
(
material
.
map
);
}
}
else
{
materialMapEnabled
.
setValue
(
false
);
materialMap
.
setValue
(
dummyTexture
);
console
.
warn
(
"
Can't set texture, model doesn't have texture coordinates
"
);
}
...
...
@@ -560,6 +626,7 @@ Sidebar.Properties.Material = function ( signals ) {
}
else
{
selected
=
null
;
selectedHasUvs
=
false
;
container
.
setDisplay
(
'
none
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录