-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template property override #310
Comments
Looking at the code here I think I found the problem. // Possibly copy properties from the template into the object
// Any that already exist in the object's map don't get copied over
if let Some(templ) = template {
shape.get_or_insert(templ.object.shape.clone());
for (k, v) in &templ.object.properties {
if !properties.contains_key(k) {
properties.insert(k.clone(), v.clone());
}
}
} When I am using the template, the object in the level file does not have the ellipse tag so the shape is not parsed at all. When this code is reached, |
This looks incorrect, but I'll wait for @bjorn's response |
Hmm, yes this is a bug. It is correct to inherit the shape from the template, but the size can be overridden by the object. This is also broken for point shapes, where the position stored in the shape currently ends up being the one of the template. I'm working on a fix. |
Template instances of rectangle, ellipse and text objects can override the width and height of the template object. This is now taken into account when reading out the attributes and when inheriting the shape from the template. Template instances of point objects are now also correctly storing the instance position in the Point shape, instead of the position of the template object. Closes #310
Template instances of rectangle, ellipse and text objects can override the width and height of the template object. This is now taken into account when reading out the attributes and when inheriting the shape from the template. Template instances of point objects are now also correctly storing the instance position in the Point shape, instead of the position of the template object. Closes #310
Template instances of rectangle, ellipse and text objects can override the width and height of the template object. This is now taken into account when reading out the attributes and when inheriting the shape from the template. Template instances of point objects are now also correctly storing the instance position in the Point shape, instead of the position of the template object. Closes #310
Template instances of rectangle, ellipse and text objects can override the width and height of the template object. This is now taken into account when reading out the attributes and when inheriting the shape from the template. Template instances of point objects are now also correctly storing the instance position in the Point shape, instead of the position of the template object. Added a small test for the resized templated object case. Closes #310
I have an ellipse object that triggers some functionality when the player enters the zone defined by the ellipse shape. I have some custom properties for this object so I have converted it into a template to reuse in many places.
The issue I'm having is that when I try to resize the ellipse, the new width and height is not in the
ObjectData
anywhere. It only gives me the width and height that is defined in the template file. Perhaps I am missing something but I couldn't find anything in the docs about this.Here is the object from my .tmx file:
And here is the template:
In this case the
ObjectData
only contains a width of 111 and height of 289 but I would expect it to have a width and height of 100. Is this the intended behaviour? I have another similar template with the same issue but it is a rectangle.I am new to Tiled so let me know if there is a better way to go about this.
The text was updated successfully, but these errors were encountered: