Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
rs-tiled
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Microhacks
rs-tiled
Commits
fd15cb4c
Unverified
Commit
fd15cb4c
authored
3 years ago
by
aleok
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #111 from PieKing1215/layer-id
Add layer id parsing
parents
7585b490
3a7b069f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/layers.rs
+6
-1
6 additions, 1 deletion
src/layers.rs
src/objects.rs
+8
-2
8 additions, 2 deletions
src/objects.rs
with
14 additions
and
3 deletions
src/layers.rs
+
6
−
1
View file @
fd15cb4c
...
...
@@ -54,6 +54,9 @@ pub struct Layer {
pub
tiles
:
LayerData
,
pub
properties
:
Properties
,
pub
layer_index
:
u32
,
/// The ID of the layer, as shown in the editor.
/// Layer ID stays the same even if layers are reordered or modified in the editor.
pub
id
:
u32
,
}
impl
Layer
{
...
...
@@ -64,7 +67,7 @@ impl Layer {
layer_index
:
u32
,
infinite
:
bool
,
)
->
Result
<
Layer
,
TiledError
>
{
let
((
o
,
v
,
ox
,
oy
),
n
)
=
get_attrs!
(
let
((
o
,
v
,
ox
,
oy
),
(
n
,
id
)
)
=
get_attrs!
(
attrs
,
optionals
:
[
(
"opacity"
,
opacity
,
|
v
:
String
|
v
.parse
()
.ok
()),
...
...
@@ -74,6 +77,7 @@ impl Layer {
],
required
:
[
(
"name"
,
name
,
|
v
|
Some
(
v
)),
(
"id"
,
id
,
|
v
:
String
|
v
.parse
()
.ok
()),
],
TiledError
::
MalformedAttributes
(
"layer must have a name"
.to_string
())
);
...
...
@@ -103,6 +107,7 @@ impl Layer {
tiles
:
tiles
,
properties
:
properties
,
layer_index
,
id
,
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/objects.rs
+
8
−
2
View file @
fd15cb4c
...
...
@@ -20,6 +20,9 @@ pub struct ObjectGroup {
*/
pub
layer_index
:
Option
<
u32
>
,
pub
properties
:
Properties
,
/// The ID of the layer, as shown in the editor.
/// Layer ID stays the same even if layers are reordered or modified in the editor.
pub
id
:
u32
,
}
impl
ObjectGroup
{
...
...
@@ -28,7 +31,7 @@ impl ObjectGroup {
attrs
:
Vec
<
OwnedAttribute
>
,
layer_index
:
Option
<
u32
>
,
)
->
Result
<
ObjectGroup
,
TiledError
>
{
let
((
o
,
v
,
c
,
n
),
()
)
=
get_attrs!
(
let
((
o
,
v
,
c
,
n
),
id
)
=
get_attrs!
(
attrs
,
optionals
:
[
(
"opacity"
,
opacity
,
|
v
:
String
|
v
.parse
()
.ok
()),
...
...
@@ -36,7 +39,9 @@ impl ObjectGroup {
(
"color"
,
colour
,
|
v
:
String
|
v
.parse
()
.ok
()),
(
"name"
,
name
,
|
v
:
String
|
v
.into
()),
],
required
:
[],
required
:
[
(
"id"
,
id
,
|
v
:
String
|
v
.parse
()
.ok
()),
],
TiledError
::
MalformedAttributes
(
"object groups must have a name"
.to_string
())
);
let
mut
objects
=
Vec
::
new
();
...
...
@@ -59,6 +64,7 @@ impl ObjectGroup {
colour
:
c
,
layer_index
,
properties
,
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