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

Handle SubAssetKey instead of string strictly #974

Merged
merged 8 commits into from
May 25, 2021

Conversation

Santarh
Copy link
Contributor

@Santarh Santarh commented May 24, 2021

  • Extract した Object や SubAsset の Object に対する取り回しが string で曖昧なのを SubAssetKey で厳密に取り扱う
  • SubAssetKey を不用意に外部で new しないようにする
  • テクスチャに対する SubAssetKeyTexture2D ではなく Texture で取り扱う
  • TextureImportParam は「Import した結果生成される Texture Asset 1 つ」に対応する。
    • したがって中間生成される Texture は TextureFactory には残さず、処理中に破棄する
  • .gltf 形式のインポート時も、Texture は SubAsset となる

@Santarh Santarh requested a review from ousttrue May 25, 2021 07:51
@Santarh Santarh changed the title [WIP] Handle SubAssetKey instead of string strictly Handle SubAssetKey instead of string strictly May 25, 2021
UnityPath m_textureDirectory;

public TextureExtractor(GltfParser parser, UnityPath textureDirectory, (SubAssetKey, UnityEngine.Texture2D)[] subAssets)
public TextureExtractor(GltfParser parser, UnityPath textureDirectory, IReadOnlyDictionary<SubAssetKey, Texture> subAssets)
Copy link
Contributor

@ousttrue ousttrue May 25, 2021

Choose a reason for hiding this comment

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

(SubAssetKey, UnityEngine.Texture2D)[] => IReadOnlyDictionary<SubAssetKey, Texture>

public class TextureFactory : IDisposable
{
public readonly Dictionary<string, Texture2D> ExternalMap;
private readonly Dictionary<SubAssetKey, Texture> m_temporaryTextures = new Dictionary<SubAssetKey, Texture>();
Copy link
Contributor

Choose a reason for hiding this comment

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

SubAssetKey

/// </summary>
public bool ExtractConverted => TextureType == TextureImportTypes.StandardMap;
public SubAssetKey SubAssetKey => new SubAssetKey(SubAssetKey.TextureType, UnityObjectName);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@ousttrue ousttrue left a comment

Choose a reason for hiding this comment

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

掃除されたぽい

@ousttrue ousttrue merged commit a3def49 into vrm-c:master May 25, 2021
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