Merge pull request #26599 from MarianoGnu/fix_25817
TileSetEditor: Expose to the user OneWayCollision+Margin properties.
This commit is contained in:
commit
3aff78f532
1 changed files with 40 additions and 0 deletions
|
@ -3118,6 +3118,24 @@ bool TilesetEditorContext::_set(const StringName &p_name, const Variant &p_value
|
||||||
} else if (name == "tileset_script") {
|
} else if (name == "tileset_script") {
|
||||||
tileset->set_script(p_value);
|
tileset->set_script(p_value);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (name == "selected_collision_one_way") {
|
||||||
|
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(tileset_editor->get_current_tile());
|
||||||
|
for (int index = 0; index < sd.size(); index++) {
|
||||||
|
if (sd[index].shape == tileset_editor->edited_collision_shape) {
|
||||||
|
tileset->tile_set_shape_one_way(tileset_editor->get_current_tile(), index, p_value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else if (name == "selected_collision_one_way_margin") {
|
||||||
|
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(tileset_editor->get_current_tile());
|
||||||
|
for (int index = 0; index < sd.size(); index++) {
|
||||||
|
if (sd[index].shape == tileset_editor->edited_collision_shape) {
|
||||||
|
tileset->tile_set_shape_one_way_margin(tileset_editor->get_current_tile(), index, p_value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tileset_editor->err_dialog->set_text(TTR("This property can't be changed."));
|
tileset_editor->err_dialog->set_text(TTR("This property can't be changed."));
|
||||||
|
@ -3160,6 +3178,24 @@ bool TilesetEditorContext::_get(const StringName &p_name, Variant &r_ret) const
|
||||||
} else if (name == "selected_collision") {
|
} else if (name == "selected_collision") {
|
||||||
r_ret = tileset_editor->edited_collision_shape;
|
r_ret = tileset_editor->edited_collision_shape;
|
||||||
v = true;
|
v = true;
|
||||||
|
} else if (name == "selected_collision_one_way") {
|
||||||
|
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(tileset_editor->get_current_tile());
|
||||||
|
for (int index = 0; index < sd.size(); index++) {
|
||||||
|
if (sd[index].shape == tileset_editor->edited_collision_shape) {
|
||||||
|
r_ret = sd[index].one_way_collision;
|
||||||
|
v = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (name == "selected_collision_one_way_margin") {
|
||||||
|
Vector<TileSet::ShapeData> sd = tileset->tile_get_shapes(tileset_editor->get_current_tile());
|
||||||
|
for (int index = 0; index < sd.size(); index++) {
|
||||||
|
if (sd[index].shape == tileset_editor->edited_collision_shape) {
|
||||||
|
r_ret = sd[index].one_way_collision_margin;
|
||||||
|
v = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (name == "selected_navigation") {
|
} else if (name == "selected_navigation") {
|
||||||
r_ret = tileset_editor->edited_navigation_shape;
|
r_ret = tileset_editor->edited_navigation_shape;
|
||||||
v = true;
|
v = true;
|
||||||
|
@ -3206,6 +3242,10 @@ void TilesetEditorContext::_get_property_list(List<PropertyInfo> *p_list) const
|
||||||
}
|
}
|
||||||
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_COLLISION && tileset_editor->edited_collision_shape.is_valid()) {
|
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_COLLISION && tileset_editor->edited_collision_shape.is_valid()) {
|
||||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_collision", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_collision_shape->get_class()));
|
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_collision", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_collision_shape->get_class()));
|
||||||
|
if (tileset_editor->edited_collision_shape.is_valid()) {
|
||||||
|
p_list->push_back(PropertyInfo(Variant::BOOL, "selected_collision_one_way", PROPERTY_HINT_NONE));
|
||||||
|
p_list->push_back(PropertyInfo(Variant::REAL, "selected_collision_one_way_margin", PROPERTY_HINT_NONE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_NAVIGATION && tileset_editor->edited_navigation_shape.is_valid()) {
|
if (tileset_editor->edit_mode == TileSetEditor::EDITMODE_NAVIGATION && tileset_editor->edited_navigation_shape.is_valid()) {
|
||||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_navigation", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_navigation_shape->get_class()));
|
p_list->push_back(PropertyInfo(Variant::OBJECT, "selected_navigation", PROPERTY_HINT_RESOURCE_TYPE, tileset_editor->edited_navigation_shape->get_class()));
|
||||||
|
|
Loading…
Reference in a new issue