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

error when exporting mesh_renderer #228

Open
bcatbat opened this issue Jan 30, 2024 · 0 comments
Open

error when exporting mesh_renderer #228

bcatbat opened this issue Jan 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bcatbat
Copy link

bcatbat commented Jan 30, 2024

here is my code:

if mr.m_GameObject:
    gameobject = mr.m_GameObject.read()
    export_dir = os.path.join(dst_folder, gameobject.name)
    mr.export(export_dir)

just follow your doc example.
it raises an exception local variable 'mesh' referenced before assignment at line mr.export(export_dir).

here is your code:

# MeshRendererExporter.py
def export_mesh_renderer(obj: Renderer, export_dir: str) -> None:
    env = mesh.assets_file.enviroment
    env.fs.makedirs(export_dir, exist_ok=True)

i think it should be:

    env = obj.assets_file.environment
    env.fs.makedirs(export_dir, exist_ok=True)

mesh is a field name mistake. and enviroment should be environment

@bcatbat bcatbat added the bug Something isn't working label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant