Skip to content
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

MeshPlugin #221

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

CreatorsOfficial
Copy link

@CreatorsOfficial CreatorsOfficial commented Jan 30, 2023

MeshPlugin to export meshes from UABEA

@nesrak1 nesrak1 mentioned this pull request Feb 8, 2023
Copy link
Author

@CreatorsOfficial CreatorsOfficial left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the problem with the FindAssetClassByName and ClassDatabase

Plugin for extracting mesh files from unity assets files
The format supported is .obj for now
Copy link
Owner

@nesrak1 nesrak1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

/// - IEEE 754 revision, link: http://grouper.ieee.org/groups/754/
/// </remarks>
[Serializable]
public struct Half : IComparable, IFormattable, IConvertible, IComparable<Half>, IEquatable<Half>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.NET 6 has this class now, please use that instead.

/// - Fast Half Float Conversions, Jeroen van der Zijp, link: http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
/// </remarks>
[ComVisible(false)]
internal static class HalfHelper
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, only used with Half.cs


namespace MeshPlugin
{
public class MeshClass
Copy link
Owner

@nesrak1 nesrak1 Apr 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put these in separate files. Even if it was like that in AssetStudio, I'd rather not have 30 classes in a single file.

{

string searchPath = m_StreamData.path;
if (searchPath.StartsWith("archive:/"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate code here with what's in ResourceReader.

ResourceLoader loader = new ResourceLoader();
bool saved = await loader.ShowDialog<bool>(loader);
}
private void ProcessDataBytes(AssetsFileInstance AFinst, MemoryStream ms)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using ms here, stream is read twice.


MeshClass.Mesh mesh = new MeshClass.Mesh(baseField, cont.FileInstance);
{
if (mesh.m_VertexData.m_VertexCount <= 0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of duplicate code here. Please put this in a method.

@@ -0,0 +1,23 @@
<Window xmlns="https://github.com/avaloniaui"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be a MessageBox.

AssetBundleDirectoryInfo info = dirInf[i];
if (info.Name == searchPath)
{
reader.Position = bundle.Header.GetFileDataOffset() + info.Offset + (long)offset2;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a single set of offset and size fields and use DataReader instead of GetFileDataOffset(). GetFileDataOffset won't work for LZ4 bundles.

namespace AssetsTools
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct Vector3 : IEquatable<Vector3>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put these in separate files as well (in their own directory). Even if it was originally like that in the AssetStudio repo, I'd rather them be separate.

using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace AssetsTools
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the right namespace.

@CreatorsOfficial CreatorsOfficial requested a review from nesrak1 July 4, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants