Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
3da9762e
Commit
3da9762e
authored
8 years ago
by
Brad Payne (Vir Linden)
Browse files
Options
Downloads
Patches
Plain Diff
SL-374, SL-375 - dae_tool.py for dae manipulation, initially to make joint offset test content
parent
f3fb80c9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/content_tools/dae_tool.py
+91
-0
91 additions, 0 deletions
scripts/content_tools/dae_tool.py
scripts/content_tools/skel_tool.py
+1
-1
1 addition, 1 deletion
scripts/content_tools/skel_tool.py
with
92 additions
and
1 deletion
scripts/content_tools/dae_tool.py
0 → 100644
+
91
−
0
View file @
3da9762e
#!runpy.sh
"""
\
This module contains tools for manipulating collada files
$LicenseInfo:firstyear=2016&license=viewerlgpl$
Second Life Viewer Source Code
Copyright (C) 2016, Linden Research, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
version 2.1 of the License only.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
$/LicenseInfo$
"""
import
argparse
# Need to pip install numpy and pycollada
import
numpy
as
np
from
collada
import
*
from
lxml
import
etree
def
mesh_summary
(
mesh
):
print
"
scenes
"
,
mesh
.
scenes
for
scene
in
mesh
.
scenes
:
print
"
scene
"
,
scene
for
node
in
scene
.
nodes
:
print
"
node
"
,
node
def
mesh_lock_offsets
(
tree
,
joints
):
print
"
mesh_lock_offsets
"
,
tree
,
joints
for
joint_node
in
tree
.
iter
():
if
"
node
"
not
in
joint_node
.
tag
:
continue
if
joint_node
.
get
(
"
type
"
)
!=
"
JOINT
"
:
continue
if
joint_node
.
get
(
"
name
"
)
in
joints
:
for
matrix_node
in
joint_node
.
iter
():
if
"
matrix
"
in
matrix_node
.
tag
:
floats
=
[
float
(
x
)
for
x
in
matrix_node
.
text
.
split
()]
if
len
(
floats
)
==
16
:
floats
[
3
]
+=
0.0001
floats
[
7
]
+=
0.0001
floats
[
11
]
+=
0.0001
matrix_node
.
text
=
"
"
.
join
([
str
(
f
)
for
f
in
floats
])
print
joint_node
.
get
(
"
name
"
),
matrix_node
.
tag
,
"
text
"
,
matrix_node
.
text
,
len
(
floats
),
floats
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
process SL animations
"
)
parser
.
add_argument
(
"
--verbose
"
,
action
=
"
store_true
"
,
help
=
"
verbose flag
"
)
parser
.
add_argument
(
"
infilename
"
,
help
=
"
name of a collada (dae) file to input
"
)
parser
.
add_argument
(
"
outfilename
"
,
nargs
=
"
?
"
,
help
=
"
name of a collada (dae) file to output
"
,
default
=
None
)
parser
.
add_argument
(
"
--lock_offsets
"
,
nargs
=
"
+
"
,
help
=
"
tweak position of listed joints to lock their offsets
"
)
parser
.
add_argument
(
"
--summary
"
,
action
=
"
store_true
"
,
help
=
"
print summary info about input file
"
)
args
=
parser
.
parse_args
()
mesh
=
None
tree
=
None
if
args
.
infilename
:
print
"
reading
"
,
args
.
infilename
mesh
=
Collada
(
args
.
infilename
)
tree
=
etree
.
parse
(
args
.
infilename
)
if
args
.
summary
:
print
"
summarizing
"
,
args
.
infilename
mesh_summary
(
mesh
)
if
args
.
lock_offsets
:
print
"
locking offsets for
"
,
args
.
lock_offsets
mesh_lock_offsets
(
tree
,
args
.
lock_offsets
)
if
args
.
outfilename
:
print
"
writing
"
,
args
.
outfilename
f
=
open
(
args
.
outfilename
,
"
w
"
)
print
>>
f
,
etree
.
tostring
(
tree
,
pretty_print
=
True
)
#need update to get: , short_empty_elements=True)
This diff is collapsed.
Click to expand it.
scripts/content_tools/skel_tool.py
+
1
−
1
View file @
3da9762e
...
...
@@ -354,7 +354,7 @@ def compare_skel_trees(atree,btree):
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
process SL a
nimation
s
"
)
parser
=
argparse
.
ArgumentParser
(
description
=
"
process SL a
vatar_skeleton/avatar_lad file
s
"
)
parser
.
add_argument
(
"
--verbose
"
,
action
=
"
store_true
"
,
help
=
"
verbose flag
"
)
parser
.
add_argument
(
"
--ogfile
"
,
help
=
"
specify file containing base bones
"
)
parser
.
add_argument
(
"
--ref_file
"
,
help
=
"
specify another file containing replacements for missing fields
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment