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

View BasicParticleSystem Frames in Jupyter Notebooks #2

Open
wants to merge 118 commits into
base: master
Choose a base branch
from

Conversation

cesarr
Copy link

@cesarr cesarr commented Jul 2, 2020

Added the BasicParticleSystem.writeParticlesNumPyText() method which serializes the coordinates of the particles in NumPy text format. The NumPy text files can be read from a Jupyter notebook to instantiate NumPy arrays that can be used to visualize the particles in the notebook using the K3D library (https://github.com/K3D-tools/K3D-jupyter).

sebbas and others added 30 commits April 24, 2019 18:22
Similar to Blenders current smoke dissolve function
added numpy conversion from and to int grids (e.g. Flag)
access grid meta information from python
Check upres before creating wavelet noise field. xl solver might not exist.
sebbas and others added 29 commits June 16, 2020 15:37
OpenVDB has c++14 as one if its dependencies.
Must not hide all OpenVDB IO functions.
The read and write functions accept not only grids but also particle systems as arguments. A more general name is therefore appropriate here.
Presence of a particle data object needs to be checked before looping through the list of vdb objects. Otherwise, the particle data will not be buffered when the particle system is being read.
In programs like Blender we can easily check if a particle has been marked for deletion. However, one should not rely on other dcc's checking for this flag before loading particles.
The compression level can now be supplied in the arguments of the save() function. By default, there will be some compression (zip).
All IO functions now have a return value (read/write success == 1). This can be used in Python scripts to ensure that files were written successfully.
The precision level can now be supplied in the arguments of the save() function. By default, the grid values will be saved as half-floats (16 bit).
Bundled grid attribute set calls in a helper function.
OpenVDB compression is set to 'Zip' by default, so having access to 'None' is necessary too.
Need to ensure that particle data objects do not call this function as they have no grid.
This issue was found through the Blender build.
While the fix from bc6fa36 worked, it was not the root of the problem. It looks more like this issue was an unintentional placement of the Manta namespace.
This issue was found through the Blender build.
The bounds check requires a value for the boundary argument. Otherwise, the code is in trouble when later trying to get centered velocities - there might be no neighboring cell.
…ting mantaflow .txt files to numpy text files. The code is commented out and will be deleted in the next commit so I wanted to keep a copy of the code in git in case I needed it in the future.
…rializes the particle coordinates in NumPy text format. The particle coordinates can be read from a Jupyter notebook and visualized with K3D-Jupyter.
@sebbas
Copy link
Contributor

sebbas commented Nov 28, 2020

Thanks for the patch! I wouldn't be opposed to adding the Numpy text export function - it's seems simple enough to be added along the other export options.

The new code in /scenes is not generic enough to be considered for the main repository. scenes should only include Python files that showcase some of the core functionality (e.g. a new scene could be added if there is a new plugin).

All in all, this PR would have to be updated first as there have been some bigger changes to the file IO.

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

Successfully merging this pull request may close these issues.

4 participants