-
Notifications
You must be signed in to change notification settings - Fork 52
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
Maxx 55788 add samples to how tos #9
Merged
hugow
merged 11 commits into
ADN-DevTech:master
from
hugow:MAXX-55788-addSamplesToHowTos
Apr 14, 2020
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
785740e
Reorganize directory structure
hugow 6ed01fe
Add the samples
hugow 8a9112f
reorganize the doc
hugow 5504fd0
minor fixes
hugow 0b39bf4
doc improvement
hugow 72f2a29
further simplify directory structure
hugow 7035e43
fix testing
hugow fb05db6
more fixes
hugow d88dcc5
fix .pylintrc
hugow e3d1e3d
Add menu item pointing to samples
hugow 563959a
point the doc to MAXDEV/2021
hugow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# How To - Practical Examples For Python | ||
|
||
![Splash](Splash.png) | ||
![Splash](/doc/Splash.png) | ||
|
||
This repo contains various Python programming samples. | ||
|
||
|
@@ -15,133 +15,67 @@ practice to package 3ds Max Python tools with pip, we provide all our examples i | |
It is not necessary to install the HowTos: the repo can simply be used as a passive | ||
directory of samples and documentation for Python developers. | ||
|
||
This being said, it is also possible to install the samples in 3ds Max. This | ||
will add a Python3 scripting menu to 3ds Max: | ||
- Installing the HowTos will add menu items to 3ds Max, and is documented [here](doc/install.md) | ||
- After an update from github it is necessary to rerun install scripts to get everything | ||
working as expected | ||
|
||
![Integration](Integration.png) | ||
|
||
The examples and some development goodies will be made available from there. | ||
|
||
The installation does the following: | ||
- it installs pip in your 3ds Max installation if it's not already there | ||
- it installs pystartup.ms that enables auto start pip packages | ||
- it installs all the samples in --user and -e mode with pip | ||
|
||
If you decide to install the howtos, it is highly recommended that you clone | ||
this git repository locally using git bash (whenever we update the samples, | ||
you will be able to update your local version and re-run the installation scripts): | ||
|
||
```bash | ||
# from the directory where you want the sample | ||
git clone https://github.com/ADN-DevTech/3dsMax-Python-HowTos.git | ||
``` | ||
|
||
Also note that *all installation steps decribed here also use git bash* (it is | ||
possible to use another client for git but all installation scripts in | ||
this repo use bash). | ||
|
||
### Option A: Install Everthing Locally in One Step (--user) | ||
> Note: the steps described here need to be done from a git bash prompt | ||
|
||
The [install.sh](install.sh) script can be used from bash | ||
to install the samples in 3ds Max. The script needs to be run from a | ||
3ds Max installation directory. | ||
|
||
### Option B: Install Everything Locally in Two Steps (--user) | ||
> Note: the steps described here need to be done from a git bash prompt | ||
## Python How Tos | ||
|
||
It is possible to break up the installation in two steps. | ||
The samples below are translations of [MAXScript How Tos](https://help.autodesk.com/view/3DSMAX/2020/ENU/?guid=GUID-25C9AD58-3665-471E-8B4B-54A094C1D5C9) that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe point to the 2021 docs now? |
||
can be found in the 3ds Max online documentation. | ||
|
||
- The [installstartup.sh](installstartup.sh) script can be used | ||
from bash to install pip and [pystartup.ms](/pystartup/pystartup.ms). | ||
It needs to run in the 3ds Max installation directory. | ||
The conversion from MaxScript to Python could have been more mechanical but we chose to implement | ||
the Python version in the best Python way known to us. An example of this is that we use PySide2 | ||
(Qt) for the UI as much as possible instead of using more traditional 3ds Max ui mechanisms. | ||
|
||
You may do only this step if you don't want the HowTos but you | ||
want to install pip and pystartup.ms. | ||
*How To?* | ||
|
||
- The [installhowtos.sh](installhowtos.sh) script can be used from | ||
bash to pip install all the howtos in `--user` mode and `-e` mode (--user | ||
means that the samples will be intalled under `~/AppData/Roaming/Python/Python37/site-packages/`, | ||
and -e means that the packages will be installed as symlinks to the | ||
source directories so that if the sources change the packages don't need | ||
to be reinstalled). | ||
This script needs to run in the 3ds Max installation directory. | ||
- Develop a Transform Lock Script [transformlock](/src/packages/transformlock/README.md) | ||
- Remove all materials [removeallmaterials](/src/packages/removeallmaterials/README.md) | ||
- Quickly rename selected objects [renameselected](/src/packages/renameselected/README.md) | ||
- Output Object Data to File [speedsheet](/src/packages/speedsheet/README.md) | ||
- Create a quick video preview [quickpreview](/src/packages/quickpreview/README.md) | ||
- Access the Z-Depth Channel [zdepthchannel](/src/packages/zdepthchannel/README.md) | ||
|
||
## Uninstalling the HowTos | ||
## Python Examples that don't come from maxscript howtos | ||
|
||
The steps needed to uninstall the HowTos can be found in [uninstall.md](uninstall.md). | ||
- Update a progressbar from a Python thread [threadprogressbar](/src/packages/threadprogressbar/README.md) | ||
- Create a single instance modal dialog [singleinstancedlg](/src/packages/singleinstancedlg/README.md) | ||
- Add menu items to open documentation pages in the web browser [inbrowserhelp](/src/packages/inbrowserhelp/README.md) | ||
|
||
### Option C: Install the howtos in a virtual environment | ||
> Note: the steps described here need to be done from a git bash prompt | ||
## Python Samples | ||
|
||
This last option requires three steps. | ||
Python samples can be found in [src/samples](/src/samples). These samples may already be in your 3ds Max | ||
installation directories. | ||
|
||
It can be used to install the HowTos in a virtual environment (ex: | ||
you may want to have a virtual environment for Python development). | ||
## 3dsMax startup entry point | ||
|
||
- The first step is the same as the first step described in option B: | ||
[installstartup.sh](installstartup.sh) needs to run in the 3ds Max | ||
installation directory to install pip if it is missing and pystartup. | ||
[pystartup](/src/pystartup/README.md) provides the maxscript code that, when copied to 3ds Max's | ||
startup directory, will automatically launch pip packages with the 3dsMax startup | ||
entry point. | ||
|
||
- The second step consists in installing virtualenv with pip and creating a | ||
virtual environment. These steps are described in the [3ds Max documentation](http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=__developer_python_3_support_virtual_env_html). | ||
- The last step consists in installing the HowTos in the virtual environment. | ||
From the same git bash prompt, the [installhowtos.sh](/installhowtos.sh) | ||
script can be used to install the HowTos in a virtual environment. First `cd` | ||
to the directory of the virtual env and then (without activating the env) simply | ||
run [installhowtos.sh](/installhowtos.sh) from that directory. | ||
## Tools | ||
|
||
## Packages that are not examples but that are provided in this repo | ||
The following packages are not really examples but python tools. | ||
|
||
- [menuhook](menuhook/README.md) is not meant to be an example (but is still interesting as such!) but | ||
- [menuhook](/src/packages/menuhook/README.md) is not meant to be an example (but is still interesting as such!) but | ||
as a way of attaching Python functions to 3ds Max menu items. The menuhook package is used by | ||
most of the other samples. | ||
|
||
- [realoadmod](reloadmod/README.md) is small tool that will reload all development modules in one | ||
- [realoadmod](/src/packages/reloadmod/README.md) is small tool that will reload all development modules in one | ||
operation | ||
|
||
- [mxvscode](mxvscode/README.md) is a small tool that will automatically import ptvsd (the | ||
- [mxvscode](/src/packages/mxvscode/README.md) is a small tool that will automatically import ptvsd (the | ||
VSCode debugging interface) during the startup of 3ds Max and make it accept remote connections. | ||
This may slow down the startup of 3ds Max quite a bit and is meant as a developer-only tool. | ||
|
||
|
||
## Python How Tos | ||
|
||
The samples below are translations of [MAXScript How Tos](https://help.autodesk.com/view/3DSMAX/2020/ENU/?guid=GUID-25C9AD58-3665-471E-8B4B-54A094C1D5C9) that | ||
can be found in the 3ds Max online documentation. | ||
|
||
The conversion from MaxScript to Python could have been more mechanical but we chose to implement | ||
the Python version in the best Python way known to us. An example of this is that we use PySide2 | ||
(Qt) for the UI as much as possible instead of using more traditional 3ds Max ui mechanisms. | ||
|
||
*How To?* | ||
|
||
- Develop a Transform Lock Script [transformlock](transformlock/README.md) | ||
- Remove all materials [removeallmaterials](removeallmaterials/README.md) | ||
- Quickly rename selected objects [renameselected](renameselected/README.md) | ||
- Output Object Data to File [speedsheet](speedsheet/README.md) | ||
- Create a quick video preview [quickpreview](quickpreview/README.md) | ||
- Access the Z-Depth Channel [zdepthchannel](zdepthchannel/README.md) | ||
|
||
## Python Examples that don't come from maxscript howtos | ||
|
||
- Update a progressbar from a Python thread [threadprogressbar](threadprogressbar/README.md) | ||
- Create a single instance modal dialog [singleinstancedlg](singleinstancedlg/README.md) | ||
- Add menu items to open documentation pages in the web browser [inbrowserhelp](inbrowserhelp/README.md) | ||
|
||
## 3dsMax startup entry point | ||
|
||
[pystartup](pystartup/README.md) provides the maxscript code that, when copied to 3ds Max's | ||
startup directory, will automatically launch pip packages with the 3dsMax startup | ||
entry point. | ||
|
||
## Extra Goodies | ||
|
||
- [create.sh](create.sh) will generate an empty pip package in the current working directory. | ||
- [install.sh](install.sh) will install pip, install pystartup and pip install all the samples | ||
- [uninstall.sh](uninstall.sh) will uninstall what was installed with install.sh | ||
- [installstartup.sh](installstartup.sh) will install pip and pystartup and nothing more | ||
- [installhowtos.sh](installhowtos.sh) will install only the howtos (works in a virtual env) | ||
- [checks.sh](checks.sh) runs pylint on the code, validates that 3ds Max is named properly, | ||
- [checks.sh](/scripts/checks.sh) runs pylint on the code, validates that 3ds Max is named properly, | ||
validates that code blocks in markdown always specify the programming language, checks that | ||
all links are valid in all markdown files of the repo | ||
- [create.sh](/scripts/create.sh) will generate an empty pip package in the current working directory. |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Installation | ||
|
||
It is possible to install the samples in 3ds Max. This | ||
will add a Python3 scripting menu to 3ds Max: | ||
|
||
![Integration](/doc/Integration.png) | ||
|
||
The examples and some development goodies will be made available from there. | ||
|
||
The installation does the following: | ||
- it installs pip in your 3ds Max installation if it's not already there | ||
- it installs pystartup.ms that enables auto start pip packages | ||
- it installs all the samples in --user and -e mode with pip | ||
|
||
If you decide to install the howtos, it is highly recommended that you clone | ||
this git repository locally using git bash (whenever we update the samples, | ||
you will be able to update your local version and re-run the installation scripts): | ||
|
||
```bash | ||
# from the directory where you want the sample | ||
git clone https://github.com/ADN-DevTech/3dsMax-Python-HowTos.git | ||
``` | ||
|
||
Also note that *all installation steps decribed here also use git bash* (it is | ||
possible to use another client for git but all installation scripts in | ||
this repo use bash). | ||
|
||
### Option A: Install Everthing Locally in One Step (--user) | ||
> Note: the steps described here need to be done from a git bash prompt | ||
|
||
The [install.sh](/install.sh) script can be used from bash | ||
to install the samples in 3ds Max. The script needs to be run from a | ||
3ds Max installation directory. | ||
|
||
### Option B: Install Everything Locally in Two Steps (--user) | ||
> Note: the steps described here need to be done from a git bash prompt | ||
|
||
It is possible to break up the installation in two steps. | ||
|
||
- The [installstartup.sh](/installstartup.sh) script can be used | ||
from bash to install pip and [pystartup.ms](/src/pystartup/pystartup.ms). | ||
It needs to run in the 3ds Max installation directory. | ||
|
||
You may do only this step if you don't want the HowTos but you | ||
want to install pip and pystartup.ms. | ||
|
||
- The [installhowtos.sh](/installhowtos.sh) script can be used from | ||
bash to pip install all the howtos in `--user` mode and `-e` mode (--user | ||
means that the samples will be intalled under `~/AppData/Roaming/Python/Python37/site-packages/`, | ||
and -e means that the packages will be installed as symlinks to the | ||
source directories so that if the sources change the packages don't need | ||
to be reinstalled). | ||
This script needs to run in the 3ds Max installation directory. | ||
|
||
## Uninstalling the HowTos | ||
|
||
The steps needed to uninstall the HowTos can be found in [uninstall.md](/doc/uninstall.md). | ||
|
||
### Option C: Install the howtos in a virtual environment | ||
> Note: the steps described here need to be done from a git bash prompt | ||
|
||
This last option requires three steps. | ||
|
||
It can be used to install the HowTos in a virtual environment (ex: | ||
you may want to have a virtual environment for Python development). | ||
|
||
- The first step is the same as the first step described in option B: | ||
[installstartup.sh](/installstartup.sh) needs to run in the 3ds Max | ||
installation directory to install pip if it is missing and pystartup. | ||
|
||
- The second step consists in installing virtualenv with pip and creating a | ||
virtual environment. These steps are described in the [3ds Max documentation](http://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=__developer_python_3_support_virtual_env_html). | ||
- The last step consists in installing the HowTos in the virtual environment. | ||
From the same git bash prompt, the [installhowtos.sh](/installhowtos.sh) | ||
script can be used to install the HowTos in a virtual environment. First `cd` | ||
to the directory of the virtual env and then (without activating the env) simply | ||
run [installhowtos.sh](/installhowtos.sh) from that directory. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA: Test review (on changed file).