Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
49a44b1c
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,发现更多精彩内容 >>
提交
49a44b1c
编写于
7月 28, 2017
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Multi material code clean up.
上级
e6260569
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
55 addition
and
52 deletion
+55
-52
editor/js/Editor.js
editor/js/Editor.js
+15
-5
editor/js/Sidebar.Material.js
editor/js/Sidebar.Material.js
+40
-47
未找到文件。
editor/js/Editor.js
浏览文件 @
49a44b1c
...
...
@@ -351,7 +351,11 @@ Editor.prototype = {
var
material
=
object
.
material
;
if
(
Array
.
isArray
(
material
)
==
true
)
material
=
material
[
slot
];
if
(
Array
.
isArray
(
material
)
)
{
material
=
material
[
slot
];
}
return
material
;
...
...
@@ -359,10 +363,16 @@ Editor.prototype = {
setObjectMaterial
:
function
(
object
,
slot
,
newMaterial
)
{
var
material
=
object
.
material
;
if
(
Array
.
isArray
(
object
.
material
)
)
{
object
.
material
[
slot
]
=
newMaterial
;
}
else
{
object
.
material
=
newMaterial
;
}
if
(
Array
.
isArray
(
material
)
==
true
)
material
[
slot
]
=
newMaterial
;
else
object
.
material
=
newMaterial
;
},
//
...
...
editor/js/Sidebar.Material.js
浏览文件 @
49a44b1c
...
...
@@ -24,7 +24,7 @@ Sidebar.Material = function ( editor ) {
var
materialSlotRow
=
new
UI
.
Row
();
materialSlotRow
.
add
(
new
UI
.
Text
(
'
Material
Slot
'
).
setWidth
(
'
90px
'
)
);
materialSlotRow
.
add
(
new
UI
.
Text
(
'
Slot
'
).
setWidth
(
'
90px
'
)
);
var
materialSlotSelect
=
new
UI
.
Select
().
setWidth
(
'
170px
'
).
setFontSize
(
'
12px
'
).
onChange
(
update
);
...
...
@@ -46,11 +46,12 @@ Sidebar.Material = function ( editor ) {
copiedMaterial
=
currentObject
.
material
;
if
(
Array
.
isArray
(
copiedMaterial
)
==
true
)
{
if
(
Array
.
isArray
(
copiedMaterial
)
)
{
if
(
copiedMaterial
.
length
==
0
)
return
;
if
(
copiedMaterial
.
length
===
0
)
return
;
copiedMaterial
=
copiedMaterial
[
currentMaterialSlot
];
copiedMaterial
=
copiedMaterial
[
currentMaterialSlot
]
}
}
)
);
...
...
@@ -515,8 +516,7 @@ Sidebar.Material = function ( editor ) {
currentMaterialSlot
=
parseInt
(
materialSlotSelect
.
getValue
()
);
if
(
currentMaterialSlot
!=
previousSelectedSlot
)
refreshUI
(
true
);
if
(
currentMaterialSlot
!==
previousSelectedSlot
)
refreshUI
(
true
);
material
=
editor
.
getObjectMaterial
(
currentObject
,
currentMaterialSlot
)
...
...
@@ -1005,11 +1005,18 @@ Sidebar.Material = function ( editor ) {
var
material
=
currentObject
.
material
;
if
(
Array
.
isArray
(
material
)
==
true
){
if
(
Array
.
isArray
(
material
)
)
{
materialSlotRow
.
setDisplay
(
''
);
if
(
material
.
length
==
0
)
return
;
if
(
material
.
length
===
0
)
return
;
material
=
material
[
0
];
}
else
{
materialSlotRow
.
setDisplay
(
'
none
'
);
material
=
material
[
0
]
}
for
(
var
property
in
properties
)
{
...
...
@@ -1027,46 +1034,24 @@ Sidebar.Material = function ( editor ) {
var
material
=
currentObject
.
material
;
var
materialArray
=
[]
if
(
Array
.
isArray
(
material
)
==
true
){
if
(
Array
.
isArray
(
material
)
)
{
if
(
material
.
length
==
0
){
currentMaterialSlot
=
0
;
materialArray
=
[
undefined
];
}
else
{
materialArray
=
material
;
var
slotOptions
=
{};
}
currentMaterialSlot
=
Math
.
max
(
0
,
Math
.
min
(
material
.
length
,
currentMaterialSlot
)
);
}
else
{
for
(
var
i
=
0
;
i
<
material
.
length
;
i
++
)
{
materialArray
=
[
material
]
;
slotOptions
[
i
]
=
String
(
i
+
1
)
+
'
:
'
+
material
[
i
].
name
;
}
var
slotOptions
=
{};
if
(
(
currentMaterialSlot
<
0
)
||
(
currentMaterialSlot
>=
materialArray
.
length
)
)
currentMaterialSlot
=
0
;
for
(
var
i
=
0
;
i
<
materialArray
.
length
;
i
++
){
var
material
=
materialArray
[
i
];
materialSlotSelect
.
setOptions
(
slotOptions
).
setValue
(
currentMaterialSlot
);
var
label
=
material
?
(
material
.
name
==
''
?
'
[Unnamed]
'
:
material
.
name
)
:
'
[No Material]
'
;
slotOptions
[
i
]
=
''
+
(
i
+
1
)
+
'
:
'
+
materialArray
.
length
+
'
'
+
label
;
}
materialSlotSelect
.
setOptions
(
slotOptions
).
setValue
(
currentMaterialSlot
)
material
=
editor
.
getObjectMaterial
(
currentObject
,
currentMaterialSlot
);
if
(
material
.
uuid
!==
undefined
)
{
materialUUID
.
setValue
(
material
.
uuid
);
...
...
@@ -1352,14 +1337,22 @@ Sidebar.Material = function ( editor ) {
// events
signals
.
objectSelected
.
add
(
function
(
object
)
{
var
hasMaterial
=
false
var
hasMaterial
=
false
;
if
(
object
&&
object
.
material
)
{
if
(
(
Array
.
isArray
(
object
.
material
)
===
false
)
||
(
object
.
material
.
length
>
0
)
)
hasMaterial
=
true
;
if
(
Array
.
isArray
(
object
.
material
)
&&
object
.
material
.
length
===
0
)
{
hasMaterial
=
false
;
}
}
if
(
hasMaterial
)
{
if
(
hasMaterial
)
{
var
objectChanged
=
object
!==
currentObject
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录