habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Viewer py add magnum text

Open jrreyna opened this issue 2 years ago • 13 comments

Motivation and Context

Using the magnum text code merged in PR #1853 to add text to the viewer.py app. I had to update the settings.py code. For some reason, it was drastically different from what I originally used for my the code in my #1838 PR so it wasn't working. It couldn't find "habitat_sim.utils.settings" so I had to change it to "examples.settings." I think the former refers to the settings file used for viewer.cpp

How Has This Been Tested

Nothing yet, just started

Types of changes

  • [ ] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have completed my CLA (see CONTRIBUTING)
  • [ ] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

jrreyna avatar Sep 13 '22 00:09 jrreyna

Seems like you accidentally reverting some submodules? Like pybind11?

Skylion007 avatar Sep 13 '22 17:09 Skylion007

Seems like you accidentally reverting some submodules? Like pybind11?

Yes I have no idea what is happening. I made a branch from origin/main, and it says I am up to date, but the magnum-bindings submodule is also not correct. I am missing several files and changes that I see were pushed in the #1853 PR. I also tried the command git submodule update src/deps/magnum-bindings but it is not doing anything

jrreyna avatar Sep 13 '22 18:09 jrreyna

Seems like you accidentally reverting some submodules? Like pybind11?

Yes I have no idea what is happening. I made a branch from origin/main, and it says I am up to date, but the magnum-bindings submodule is also not correct. I am missing several files and changes that I see were pushed in the #1853 PR. I also tried the command git submodule update src/deps/magnum-bindings but it is not doing anything

You need to cd into those folders, git checkout the proper commits (and then git add the submodule folder) (or git checkout the .submodule file directly and then do the git submodule update).

Skylion007 avatar Sep 13 '22 22:09 Skylion007

habitat_sim.utils.settings came from PR #1832. Since you have the viewer code from that PR, my guess is that you installed habitat_sim using python setup.py install (which copies the contents of src_python to the Python site-packages folder and then ignores all changes that you git pull) instead of python setup.py develop (which creates a link to the src_python code in your local clone of the repo, which can be kept up to date).

jaraujo98 avatar Sep 15 '22 17:09 jaraujo98

@jaraujo98

habitat_sim.utils.settings came from PR #1832. Since you have the viewer code from that PR, my guess is that you installed habitat_sim using python setup.py install (which copies the contents of src_python to the Python site-packages folder and then ignores all changes that you git pull) instead of python setup.py develop (which creates a link to the src_python code in your local clone of the repo, which can be kept up to date).

Oh thanks for pointing that out. Yeah, the code didn't recognize habitat_sim.utils.settings so I was confused. I knew there was a settings.py file in the example directory that I was using beforehand, so I just used that one. So what do you recommend? I imagine changing the examples.settings import line to a habitat_sim.utils.settings import. Should I rebuild it using python setup.py develop instead of install? Do I run python setup.py develop --bullet?

jrreyna avatar Sep 15 '22 18:09 jrreyna

Do I run python setup.py develop --bullet?

Yes, that's what I use. You can git checkout main examples/settings.py to restore settings.py to how it was before, and then use from habitat_sim.utils.settings import default_sim_settings, make_cfg in viewer.py. Sorry for the confusion... XD

jaraujo98 avatar Sep 15 '22 18:09 jaraujo98

Do I run python setup.py develop --bullet?

Yes, that's what I use. You can git checkout main examples/settings.py to restore settings.py to how it was before, and then use from habitat_sim.utils.settings import default_sim_settings, make_cfg in viewer.py. Sorry for the confusion... XD

No worries that makes sense. So the settings.py file that habitat_sim.utils.settings refers to is the file ./src_python/habitat_sim/utils/settings.py, right?

jrreyna avatar Sep 15 '22 18:09 jrreyna

Yes, that's correct. That settings file has the bare minimum settings you need to start a viewer. Everything else that is added in examples.settings is for the demo runner and the benchmark scripts, so you don't really need it.

jaraujo98 avatar Sep 15 '22 18:09 jaraujo98

Yes, that's correct. That settings file has the bare minimum settings you need to start a viewer. Everything else that is added in examples.settings is for the demo runner and the benchmark scripts, so you don't really need it.

It seems that ./examples/settings.py has the bare minimum and ./src_python/habitat_sim/utils/settings.py is the one with a lot more code. Is that what you meant?

jrreyna avatar Sep 15 '22 18:09 jrreyna

Where are these extra fonts coming from? Are they included on purpose?

aclegg3 avatar Sep 15 '22 20:09 aclegg3

Where are these extra fonts coming from? Are they included on purpose?

Yeah, I just added them to this directory in case the font directory changes and the default font is no longer in the right place. I want a default font loaded so that the user doesn't always have to provide one in the command line, and right now it just loads it from the current directory. I can remove them and just provide the relative path of the font in a fonts directory to the function that loads it in _init_. The viewer.cpp app has a font file in its directory as well, so I did the same. But I amenable to whatever. In general, it's probably a bad idea to duplicate files

johnrreyna avatar Sep 15 '22 21:09 johnrreyna

Why can't we use the same proggytff file that C++ user is using btw?

Skylion007 avatar Sep 20 '22 16:09 Skylion007

Why can't we use the same proggytff file that C++ user is using btw?

That proggy ttf file was copied directly into the same directory as viewer.cpp, so I did something similar and copied the file into the same directory as viewer.py. Though I think the best solution is to have a fonts directory and specify the relative path to it. I just wanted to be safe and put the ttf file in the same directory for now in case the font directory moves

johnrreyna avatar Sep 20 '22 19:09 johnrreyna

Do we need the other font files besides proggy?

Skylion007 avatar Sep 27 '22 18:09 Skylion007

Do we need the other font files besides proggy?

I'm not sure, I just used the same file that was in the viewer.cpp file. Those fonts were in a directory in the imgui submodule, so I don't even think those font files are on main, right?

jrreyna avatar Sep 27 '22 19:09 jrreyna

Do we need the other font files besides proggy?

Just talked to mosra, probably not. Will delete them for now

johnrreyna avatar Sep 27 '22 19:09 johnrreyna

@johnrreyna Please squash your commits next time when merging.

Skylion007 avatar Sep 27 '22 23:09 Skylion007