Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
evalulu
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luciole
evalulu
Commits
aca56e3f
Commit
aca56e3f
authored
8 months ago
by
Hilel Alvarez--Huguet
Browse files
Options
Downloads
Patches
Plain Diff
[edit] utilisation du name space + modification du merge
parent
531aa698
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Backend/asset_list.py
+2
-2
2 additions, 2 deletions
Backend/asset_list.py
Backend/assets.py
+15
-16
15 additions, 16 deletions
Backend/assets.py
Backend/test.py
+2
-1
2 additions, 1 deletion
Backend/test.py
with
19 additions
and
19 deletions
Backend/asset_list.py
+
2
−
2
View file @
aca56e3f
...
@@ -155,10 +155,10 @@ class AssetList:
...
@@ -155,10 +155,10 @@ class AssetList:
return
res
return
res
@classmethod
@classmethod
def
unserialize
(
cls
,
aDict
,
aBasePath
=
""
):
def
unserialize
(
cls
,
aDict
,
aBasePath
=
""
,
name_space
=
None
):
a_l
=
cls
(
aBasePath
)
a_l
=
cls
(
aBasePath
)
for
k
,
v
in
aDict
.
items
():
for
k
,
v
in
aDict
.
items
():
a_l
.
assets
[
k
]
=
Asset
(
k
,
v
,
base_path
=
aBasePath
)
a_l
.
assets
[
k
]
=
Asset
(
k
,
v
,
base_path
=
aBasePath
,
name_space
=
name_space
)
a_l
.
set_folders
(
a_l
.
assets
[
k
])
a_l
.
set_folders
(
a_l
.
assets
[
k
])
return
a_l
return
a_l
...
...
This diff is collapsed.
Click to expand it.
Backend/assets.py
+
15
−
16
View file @
aca56e3f
...
@@ -99,7 +99,8 @@ class UnityFile:
...
@@ -99,7 +99,8 @@ class UnityFile:
return
os
.
path
.
splitext
(
self
.
path
)[
0
]
return
os
.
path
.
splitext
(
self
.
path
)[
0
]
def
get_full_path
(
self
):
def
get_full_path
(
self
):
return
os
.
path
.
join
(
self
.
base_path
,
self
.
path
)
relative
=
os
.
path
.
join
(
self
.
base_path
,
self
.
path
)
return
os
.
path
.
abspath
(
relative
)
def
is_image
(
self
):
def
is_image
(
self
):
return
self
.
type
==
"
image
"
return
self
.
type
==
"
image
"
...
@@ -128,13 +129,13 @@ class UnityFile:
...
@@ -128,13 +129,13 @@ class UnityFile:
def
asset_atlas
(
cls
):
def
asset_atlas
(
cls
):
cls
.
atlas
=
{}
cls
.
atlas
=
{}
cls
.
rewrite_list
=
{}
cls
.
rewrite_list
=
{}
def
getinstance
(
anid
,
snd_or_dico
=
None
,
img
=
None
,
txt
=
None
,
base_path
=
""
,
name_space
=
''
):
def
getinstance
(
anid
,
snd_or_dico
=
None
,
img
=
None
,
txt
=
None
,
base_path
=
""
,
name_space
=
None
):
if
name_space
!=
None
:
if
name_space
!=
None
:
anid
=
cls
.
check_rewrite
(
anid
,
name_space
)
anid
=
cls
.
check_rewrite
(
anid
,
name_space
)
if
anid
not
in
cls
.
atlas
:
if
anid
not
in
cls
.
atlas
:
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)
#le name_space n'est pas nécessaire dans ce cas
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)
#le name_space n'est pas nécessaire dans ce cas
elif
snd_or_dico
!=
None
or
img
!=
None
or
txt
!=
None
:
elif
snd_or_dico
!=
None
or
img
!=
None
or
txt
!=
None
:
if
not
cls
.
atlas
[
anid
].
merge
(
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)):
if
cls
.
atlas
[
anid
].
merge
(
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)):
anid
=
cls
.
rewrite_id
(
anid
,
name_space
)
anid
=
cls
.
rewrite_id
(
anid
,
name_space
)
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
txt
,
base_path
)
return
cls
.
atlas
[
anid
]
return
cls
.
atlas
[
anid
]
...
@@ -142,7 +143,7 @@ def asset_atlas(cls):
...
@@ -142,7 +143,7 @@ def asset_atlas(cls):
@asset_atlas
@asset_atlas
class
Asset
:
class
Asset
:
def
__init__
(
self
,
anid
,
snd_or_dico
=
None
,
img
=
None
,
txt
=
None
,
base_path
=
""
,
name_space
=
''
):
def
__init__
(
self
,
anid
,
snd_or_dico
=
None
,
img
=
None
,
txt
=
None
,
base_path
=
""
,
name_space
=
None
):
self
.
mid
=
anid
self
.
mid
=
anid
self
.
lang
=
None
self
.
lang
=
None
self
.
transcript
=
None
self
.
transcript
=
None
...
@@ -302,18 +303,16 @@ class Asset:
...
@@ -302,18 +303,16 @@ class Asset:
def
merge
(
self
,
other
):
def
merge
(
self
,
other
):
merged
=
False
merged
=
False
if
self
!=
other
and
self
.
mid
==
other
.
mid
:
if
str
(
self
)
!=
str
(
other
)
and
self
.
mid
==
other
.
mid
:
if
not
(
if
not
(
self
.
snd
!=
None
and
other
.
snd
!=
None
and
self
.
snd
.
get_full_path
()
!=
other
.
snd
.
get_full_path
()):
self
.
txt
!=
None
or
other
.
txt
!=
None
or
self
.
snd
=
other
.
snd
(
self
.
snd
!=
None
and
other
.
snd
!=
None
and
self
.
snd
.
get_full_path
()
!=
other
.
snd
.
get_full_path
())
or
self
.
set_lang
(
other
.
lang
)
(
self
.
img
!=
None
and
other
.
img
!=
None
and
self
.
img
.
get_full_path
()
!=
other
.
img
.
get_full_path
())
self
.
txt
=
other
.
txt
):
#not not mergeable
self
.
transcript
=
other
.
transcript
if
self
.
snd
==
None
and
other
.
snd
!=
None
:
merged
=
True
self
.
snd
=
other
.
snd
if
not
(
self
.
img
!=
None
and
other
.
img
!=
None
and
self
.
img
.
get_full_path
()
!=
other
.
img
.
get_full_path
()):
merged
=
True
self
.
img
=
other
.
img
if
self
.
img
==
None
and
other
.
img
!=
None
:
merged
=
True
self
.
img
=
other
.
img
merged
=
True
return
merged
return
merged
@classmethod
@classmethod
...
...
This diff is collapsed.
Click to expand it.
Backend/test.py
+
2
−
1
View file @
aca56e3f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
Backend.asset_list
import
AssetList
from
Backend.asset_list
import
AssetList
from
Backend.sessions
import
Session
from
Backend.sessions
import
Session
from
pathlib
import
Path
import
json
import
json
import
os
import
os
...
@@ -16,7 +17,7 @@ class Test:
...
@@ -16,7 +17,7 @@ class Test:
else
:
else
:
self
.
base_path
=
base_path
self
.
base_path
=
base_path
json_t
=
json
.
load
(
open
(
json_file_path
,
encoding
=
"
utf8
"
))
json_t
=
json
.
load
(
open
(
json_file_path
,
encoding
=
"
utf8
"
))
self
.
assets
=
AssetList
.
unserialize
(
json_t
[
'
assets
'
],
os
.
path
.
dirname
(
json_file_path
))
self
.
assets
=
AssetList
.
unserialize
(
json_t
[
'
assets
'
],
os
.
path
.
dirname
(
json_file_path
)
,
name_space
=
Path
(
self
.
json_path
).
stem
)
self
.
sessions
=
[]
self
.
sessions
=
[]
for
s
in
json_t
[
'
sessions
'
]:
for
s
in
json_t
[
'
sessions
'
]:
self
.
add_session
(
Session
.
unserialize
(
s
))
self
.
add_session
(
Session
.
unserialize
(
s
))
...
...
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