Skip to content

constants.py cleanup and improvement #12

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

Closed
XorUnison opened this issue May 19, 2020 · 10 comments · Fixed by #58
Closed

constants.py cleanup and improvement #12

XorUnison opened this issue May 19, 2020 · 10 comments · Fixed by #58
Assignees
Labels
enhancement Additions and improvements in general pr:bugfix Bug fix for use in PRs solving a specific issue:bug

Comments

@XorUnison
Copy link
Collaborator

manimlib/media_dir.txt is deprecated and should be removed, and the constants.py file should be brushed up as well.

Most notably the constant MEDIA_DIR currently gets completely ignored due to always being overwritten by this part of the code:

        if config["media_dir"]:
            MEDIA_DIR = config["media_dir"]
        else:
            MEDIA_DIR = os.path.join(
                os.path.expanduser('~'),
                "Dropbox (3Blue1Brown)/3Blue1Brown Team Folder"

This causes manim to always create a media folder in the location of the executed py file containing the rendered scenes.
Just removing the else statement is enough.

The original DIR lines might also be changed to immediately imply raw text input for obvious reasons (you know, with \ being used for win folders, but also escape characters).

MEDIA_DIR = ""

MEDIA_DIR = r""

Adding a 4K rendering constant might be prudent, although linking it to an argument would happen in some other file I don't know out of my head.

I've also spotted at least two text issues:

  1. Two times 'both' in a sentence that triggers when media_dir is redundantly specified in the terminal.
  2. -p referring to low quality output, even though it's only triggering a preview, that is firing the mp4 into its assigned program.

And the file could use some serious commenting to make it easier for others to get into what's going on. I'm willing to work on that and submit a PR for that.

@leotrs leotrs added pr:bugfix Bug fix for use in PRs solving a specific issue:bug enhancement Additions and improvements in general labels May 19, 2020
@leotrs
Copy link
Contributor

leotrs commented May 19, 2020

@XorUnison is this issue really about constants.py, as the title suggest?

@XorUnison
Copy link
Collaborator Author

Yes, just to clarify, this issue is all about the constants.py, except maybe for the single line of code to add a 4K argument.

@PgBiel
Copy link
Member

PgBiel commented May 19, 2020

We should make a separate configuration file for stuff like media_dir and whatnot; .cfg seems like a nice option

@eulertour
Copy link
Member

The directories really shouldn't be stored as global variables at all. They should be stored as part of the config and passed to scene_file_writer (or anything else that needs them) that way.
That would eliminate the need for weird workarounds like this.

@leotrs
Copy link
Contributor

leotrs commented May 21, 2020

I agree @PgBiel there should be a .cfg file. We seem to be converging on this. Any PR takers?

@PgBiel
Copy link
Member

PgBiel commented May 21, 2020

Any PR takers?

I'd be willing to help on this one

@leotrs
Copy link
Contributor

leotrs commented May 21, 2020

Thanks! @XorUnison is also assigned to maybe confer with them too!

@XorUnison
Copy link
Collaborator Author

Right, but I've been mostly for now focused on fixing what's there, and I don't have any particular plans for how to restructure it to ditch the global variables. If we make a whole separate .cfg file that's probably gonna be a bigger thing, won't it?

@XorUnison
Copy link
Collaborator Author

Oh right, we might also want to get the review and merge on #26 done first if we do the whole .cfg business here.

@leotrs
Copy link
Contributor

leotrs commented May 21, 2020

Agreed #26 should come first

@XorUnison XorUnison linked a pull request May 22, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general pr:bugfix Bug fix for use in PRs solving a specific issue:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants