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

(BUG) Community Scenes not Registering to CLI #3

Open
Kaszanas opened this issue Mar 30, 2024 · 2 comments
Open

(BUG) Community Scenes not Registering to CLI #3

Kaszanas opened this issue Mar 30, 2024 · 2 comments
Assignees

Comments

@Kaszanas
Copy link

When exploring the repository, there are some key issues that prevent me from successfully registering a custom scene that @Tremeschin have prepared.

After setting up https://github.com/BrokenSource/BrokenSource from scratch with rye, the updated version of the repository mentions:

Official Scene files are located at ShaderFlow/Resources/Scenes/**/*.py

Community Scene files are located at Community/**/*.py

Yet upon entering the posted commit SHA:

image

It points towards Scenes directory:

image

Unfortunately when placing the scene files either in Community or Scenes, the scene files do not register upon running shaderflow

@Tremeschin
Copy link
Member

There's two heuristics that the main CLI solves: "Where the scenes are located?" and "What makes a .py a Scene file?"

For the first one, the rules on the main file are quite simple:

  • If the first argument after shaderflow is a valid path:
    • Sending shaderflow ./file.py directly scans it
    • Sending shaderflow ./directory recursively*1 scans it
  • Else scan for the ShaderFlow/Resources/Scenes and Community/*

Mayybe it's a good idea to limit maximum depth of the search :)


Your custom file was for certain scanned for, but does its content consists of a Scene? (heuristic 2:)

  • Must not be a "hidden" file __ (prob need to also add starts with .)
  • "ShaderScene" must be present on its contents (we always want to inherit from the base class)

Also, any syntax errors on the file are kind of ignored..? Like, what should we if a bad file we don't want to run blocks everything and spams errors on any shaderflow (working scene) --help usage?


These two optimizations are for potential future binary releases where we scan the current working directory entirely, and want to avoid stuff like a .venv path and files that most certainly scenes won't be defined there

@Tremeschin
Copy link
Member

Tremeschin commented Mar 30, 2024

Thinking about it a bit, could we just regex search any of class*[name]*(*ShaderScene*) for name and keep track of the scene's name and file, then execute later and blockingly showing errors?

Seems like a safer method instead of trusting exec files for scenes, that's also why I avoided scanning the current directory at all unless explicit


Edit: I remember now why this "failed", how do we get its docstrings for the CLI :)

Regexing a docstring seems a bit painful isn't it, I'll try see how it oges

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

No branches or pull requests

2 participants