Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
2db8a4a9
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
2db8a4a9
编写于
2月 03, 2019
作者:
T
Temdog007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed coding style
上级
d1f553f3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
53 deletion
+67
-53
editor/js/Editor.js
editor/js/Editor.js
+4
-2
editor/js/Loader.js
editor/js/Loader.js
+7
-7
editor/js/Sidebar.Animation.js
editor/js/Sidebar.Animation.js
+56
-44
未找到文件。
editor/js/Editor.js
浏览文件 @
2db8a4a9
...
...
@@ -240,8 +240,10 @@ Editor.prototype = {
},
addAnimation
:
function
(
result
)
{
this
.
animations
[
result
.
scene
.
uuid
]
=
result
.
animations
;
addAnimation
:
function
(
result
)
{
this
.
animations
[
result
.
scene
.
uuid
]
=
result
.
animations
;
},
//
...
...
editor/js/Loader.js
浏览文件 @
2db8a4a9
...
...
@@ -34,7 +34,7 @@ var Loader = function ( editor ) {
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
scope
.
loadFile
(
files
[
i
],
manager
)
;
scope
.
loadFile
(
files
[
i
],
manager
);
}
...
...
@@ -150,7 +150,7 @@ var Loader = function ( editor ) {
stream
.
offset
=
0
;
var
loader
=
new
THREE
.
CTMLoader
();
loader
.
createModel
(
new
CTM
.
File
(
stream
),
function
(
geometry
)
{
loader
.
createModel
(
new
CTM
.
File
(
stream
),
function
(
geometry
)
{
geometry
.
sourceType
=
"
ctm
"
;
geometry
.
sourceFile
=
file
.
name
;
...
...
@@ -216,7 +216,7 @@ var Loader = function ( editor ) {
loader
.
parse
(
contents
,
''
,
function
(
result
)
{
result
.
scene
.
name
=
filename
;
editor
.
addAnimation
(
result
);
editor
.
addAnimation
(
result
);
editor
.
execute
(
new
AddObjectCommand
(
result
.
scene
)
);
}
);
...
...
@@ -247,7 +247,7 @@ var Loader = function ( editor ) {
loader
.
parse
(
contents
,
''
,
function
(
result
)
{
result
.
scene
.
name
=
filename
;
editor
.
addAnimation
(
result
);
editor
.
addAnimation
(
result
);
editor
.
execute
(
new
AddObjectCommand
(
result
.
scene
)
);
}
);
...
...
@@ -452,7 +452,7 @@ var Loader = function ( editor ) {
var
group
=
new
THREE
.
Group
();
group
.
scale
.
multiplyScalar
(
0.1
);
group
.
scale
.
y
*=
-
1
;
group
.
scale
.
y
*=
-
1
;
for
(
var
i
=
0
;
i
<
paths
.
length
;
i
++
)
{
...
...
@@ -680,7 +680,7 @@ var Loader = function ( editor ) {
var
loader
=
new
THREE
.
GLTFLoader
();
loader
.
parse
(
file
.
asArrayBuffer
(),
''
,
function
(
result
)
{
editor
.
addAnimation
(
result
);
editor
.
addAnimation
(
result
);
editor
.
execute
(
new
AddObjectCommand
(
result
.
scene
)
);
}
);
...
...
@@ -692,7 +692,7 @@ var Loader = function ( editor ) {
var
loader
=
new
THREE
.
GLTFLoader
(
manager
);
loader
.
parse
(
file
.
asText
(),
''
,
function
(
result
)
{
editor
.
addAnimation
(
result
);
editor
.
addAnimation
(
result
);
editor
.
execute
(
new
AddObjectCommand
(
result
.
scene
)
);
}
);
...
...
editor/js/Sidebar.Animation.js
浏览文件 @
2db8a4a9
...
...
@@ -9,61 +9,71 @@ Sidebar.Animation = function ( editor ) {
var
renderer
=
null
;
signals
.
rendererChanged
.
add
(
function
(
newRenderer
)
{
renderer
=
newRenderer
;
});
signals
.
objectSelected
.
add
(
function
(
object
)
{
}
);
signals
.
objectSelected
.
add
(
function
(
object
)
{
var
uuid
=
object
!==
null
?
object
.
uuid
:
''
;
var
animations
=
editor
.
animations
[
uuid
];
if
(
animations
!==
undefined
)
{
container
.
setDisplay
(
''
);
var
animations
=
editor
.
animations
[
uuid
];
if
(
animations
!==
undefined
)
{
container
.
setDisplay
(
''
);
mixer
=
new
THREE
.
AnimationMixer
(
object
);
mixer
=
new
THREE
.
AnimationMixer
(
object
);
var
options
=
{};
for
(
var
animation
of
animations
)
{
options
[
animation
.
name
]
=
animation
.
name
;
for
(
var
animation
of
animations
)
{
options
[
animation
.
name
]
=
animation
.
name
;
var
action
=
mixer
.
clipAction
(
animation
);
actions
[
animation
.
name
]
=
action
;
var
action
=
mixer
.
clipAction
(
animation
);
actions
[
animation
.
name
]
=
action
;
}
animationsSelect
.
setOptions
(
options
);
}
else
{
container
.
setDisplay
(
'
none
'
);
animationsSelect
.
setOptions
(
options
);
}
else
{
container
.
setDisplay
(
'
none
'
);
}
});
}
);
var
mixer
,
currentAnimation
,
actions
=
{};
var
clock
=
new
THREE
.
Clock
();
function
updateAnimation
()
{
if
(
mixer
!==
undefined
&&
renderer
!==
null
)
{
function
updateAnimation
()
{
if
(
mixer
!==
undefined
&&
renderer
!==
null
)
{
var
dt
=
clock
.
getDelta
();
mixer
.
update
(
dt
);
if
(
currentAnimation
!==
undefined
&&
currentAnimation
.
isRunning
())
{
requestAnimationFrame
(
updateAnimation
);
renderer
.
render
(
editor
.
scene
,
editor
.
camera
);
}
else
{
mixer
.
update
(
dt
);
if
(
currentAnimation
!==
undefined
&&
currentAnimation
.
isRunning
()
)
{
requestAnimationFrame
(
updateAnimation
);
renderer
.
render
(
editor
.
scene
,
editor
.
camera
);
}
else
{
currentAnimation
=
undefined
;
}
}
}
function
stopAnimations
()
{
if
(
mixer
!==
undefined
)
{
function
stopAnimations
()
{
if
(
mixer
!==
undefined
)
{
mixer
.
stopAllAction
();
}
}
var
container
=
new
UI
.
Panel
();
...
...
@@ -71,21 +81,23 @@ Sidebar.Animation = function ( editor ) {
container
.
add
(
new
UI
.
Text
(
'
Animation
'
).
setTextTransform
(
'
uppercase
'
)
);
var
div
=
new
UI
.
Div
().
setMarginLeft
(
'
90px
'
);
container
.
add
(
div
);
var
div
=
new
UI
.
Div
().
setMarginLeft
(
'
90px
'
);
container
.
add
(
div
);
div
.
add
(
new
UI
.
Button
(
"
Stop
"
).
setFontSize
(
'
12px
'
).
onClick
(
stopAnimations
),
new
UI
.
Break
()
);
div
.
add
(
new
UI
.
Button
(
"
Stop
"
).
setFontSize
(
'
12px
'
).
onClick
(
stopAnimations
),
new
UI
.
Break
());
var
animationsSelect
=
new
UI
.
Select
().
setFontSize
(
'
12px
'
).
setMarginTop
(
'
10px
'
).
onChange
(
function
()
{
currentAnimation
=
actions
[
animationsSelect
.
getValue
()
];
if
(
currentAnimation
!==
undefined
)
{
var
animationsSelect
=
new
UI
.
Select
().
setFontSize
(
'
12px
'
).
setMarginTop
(
'
10px
'
).
onChange
(
function
()
{
currentAnimation
=
actions
[
animationsSelect
.
getValue
()];
if
(
currentAnimation
!==
undefined
)
{
stopAnimations
();
currentAnimation
.
play
();
updateAnimation
();
}
});
}
);
div
.
add
(
animationsSelect
);
return
container
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录