客户端问题修改
This commit is contained in:
@@ -68,6 +68,7 @@ void Metin2Model::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_surface_texture", "surface", "path"), &Metin2Model::set_surface_texture);
|
||||
ClassDB::bind_method(D_METHOD("reload"), &Metin2Model::reload);
|
||||
ClassDB::bind_method(D_METHOD("get_info"), &Metin2Model::get_info);
|
||||
ClassDB::bind_method(D_METHOD("get_ground_offset"), &Metin2Model::get_ground_offset);
|
||||
ClassDB::bind_method(D_METHOD("get_hair_options"), &Metin2Model::get_hair_options);
|
||||
ClassDB::bind_method(D_METHOD("set_hair_gr2", "p"), &Metin2Model::set_hair_gr2);
|
||||
ClassDB::bind_method(D_METHOD("get_hair_gr2"), &Metin2Model::get_hair_gr2);
|
||||
@@ -455,6 +456,10 @@ void Metin2Model::reload() {
|
||||
base_parts = parts;
|
||||
AABB bounds;
|
||||
Ref<ArrayMesh> mesh = build_mesh(fi, parts, flip_winding, bounds);
|
||||
// build_mesh keeps the source GR2 coordinate frame (Z-up, centimetres);
|
||||
// make_conv() below maps it to Godot Y-up and applies unit_scale. Keep the
|
||||
// actor root on the terrain while translating only the visual subtree.
|
||||
ground_offset = -static_cast<double>(bounds.position.z) * unit_scale;
|
||||
if (mesh->get_surface_count() > 0) {
|
||||
mi = memnew(MeshInstance3D);
|
||||
mi->set_name("MeshInstance3D");
|
||||
@@ -1085,6 +1090,17 @@ void Metin2Model::_apply_materials() {
|
||||
return _load_dds(dir.path_join(dds_files[i]));
|
||||
}
|
||||
}
|
||||
// Expansion armors share face textures with the base PC pack.
|
||||
// Resolve that exact name before falling back to unrelated local DDS.
|
||||
String cls = gr2_path.get_base_dir().get_file();
|
||||
for (const String &pc : { String("pc"), String("pc2") }) {
|
||||
String spec = "d:/ymir work/" + pc + "/" + cls + "/" + want + ".dds";
|
||||
String resolved = resolve_rel_gr2(gr2_path, spec);
|
||||
Ref<ImageTexture> shared = _load_dds(resolved);
|
||||
if (shared.is_valid()) {
|
||||
return shared;
|
||||
}
|
||||
}
|
||||
return Ref<ImageTexture>();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user