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
943da2d1
Commit
943da2d1
authored
9 months ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
tentative viteuf'
parent
d80216ac
Branches
simple_rewrite
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assets.py
+28
-5
28 additions, 5 deletions
assets.py
with
28 additions
and
5 deletions
assets.py
+
28
−
5
View file @
943da2d1
...
...
@@ -106,7 +106,7 @@ class UnityFile:
print
(
f
"
lecture de
{
self
.
get_full_path
()
}
"
)
if
platform
.
system
()
==
"
Windows
"
:
winsound
.
PlaySound
(
self
.
get_full_path
(),
winsound
.
SND_FILENAME
)
else
:
playsound
(
self
.
get_full_path
(),
sync
)
...
...
@@ -118,17 +118,22 @@ class UnityFile:
#https://stackoverflow.com/a/7493603/19587593
def
asset_atlas
(
cls
):
cls
.
atlas
=
{}
def
getinstance
(
anid
,
snd_or_dico
=
None
,
img
=
None
,
base_path
=
""
):
cls
.
rewrite_list
=
{}
def
getinstance
(
anid
,
snd_or_dico
=
None
,
img
=
None
,
base_path
=
""
,
name_space
=
None
):
if
name_space
!=
None
:
anid
=
cls
.
check_rewrite
(
anid
,
name_space
)
if
anid
not
in
cls
.
atlas
:
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
base_path
)
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
base_path
)
#le name_space n'est pas nécessaire dans ce cas
elif
snd_or_dico
!=
None
or
img
!=
None
:
cls
.
atlas
[
anid
].
merge
(
cls
(
anid
,
snd_or_dico
,
img
,
base_path
))
if
not
cls
.
atlas
[
anid
].
merge
(
cls
(
anid
,
snd_or_dico
,
img
,
base_path
)):
anid
=
cls
.
rewrite_id
(
anid
,
name_space
)
cls
.
atlas
[
anid
]
=
cls
(
anid
,
snd_or_dico
,
img
,
base_path
)
return
cls
.
atlas
[
anid
]
return
getinstance
@asset_atlas
class
Asset
:
def
__init__
(
self
,
anid
,
snd_or_dico
=
None
,
img
=
None
,
base_path
=
""
):
def
__init__
(
self
,
anid
,
snd_or_dico
=
None
,
img
=
None
,
base_path
=
""
,
name_space
=
None
):
self
.
mid
=
anid
if
type
(
snd_or_dico
)
==
dict
:
if
img
==
None
:
...
...
@@ -149,6 +154,24 @@ class Asset:
else
:
#path
self
.
img
=
UnityFile
(
img
,
base_path
,
self
.
mid
)
@classmethod
def
rewrite_id
(
cls
,
anid
,
name_space
):
if
anid
in
cls
.
atlas
.
keys
():
new_id
+=
f
"
_
{
name_space
}
"
while
new_id
in
cls
.
atlas
.
keys
():
new_id
+=
name_space
if
name_space
not
in
cls
.
rewrite_list
.
keys
():
cls
.
rewrite_list
[
name_space
]
=
{}
cls
.
rewrite_list
[
name_space
][
anid
]
=
new_id
return
new_id
@classmethod
def
check_rewrite
(
cls
,
anid
,
name_space
):
if
name_space
in
cls
.
rewrite_list
.
keys
()
and
anid
in
cls
.
rewrite_list
[
name_space
].
keys
():
return
cls
.
rewrite_list
[
name_space
][
anid
]
else
:
return
anid
def
set_id
(
self
,
new_id
):
self
.
mid
=
new_id
...
...
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