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

Initial experiment with #20 #21

Conversation

philipbelesky
Copy link
Collaborator

This all seemed simple enough in terms of code implementation, although there is a slightly strange behavior where the setting seems to 'persist' in the output mesh. If the toggle is set before the definition is executed, the resulting mesh will either be colored or 'bare' as expected. However, changing the setting subsequently will not then change the result despite the fact the correct code path is being executed for the toggle. Is there some behavior, or interaction with the scheduler, which would explain why the output mesh 'remembers' its previous vertex colors? As far as I can tell, the lookup table definitely isn't being employed.

The change in behavior in Core.vs and the component file is pretty straightforward now given the only options are basically on/off. If additional color options are added it would probably benefit from a better abstraction to map between the set option and, the calculations needed to identify vertex colors.

Anyway, let me know if you think the context menu approach is useful, or if #20 should be abandoned in favour of dedicated components / a standard parameter / something else.

@mariuszhermansdorfer
Copy link
Owner

mariuszhermansdorfer commented Sep 5, 2019

You need to clear the vertex color list when the boolean changes like this

As long as the number of faces in the mesh remains the same, I only replace individual vertices to keep things snappy. Resizing the mesh with one of the sliders fires up a new Mesh() call, clearing everything else in the process.

Also, the lookupTable, once computed, remains in memory. You could try resetting this one when changing the option in the right click menu.

Copy link
Owner

@mariuszhermansdorfer mariuszhermansdorfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try if this works. Alternatively you could try resetting the lookupTable here.

SandWorm/SandWormComponent.cs Show resolved Hide resolved
@philipbelesky
Copy link
Collaborator Author

Have updated with the mesh clear function and tested with a live setup. I've held off on clearing the lookup table as I suspect the implementation of other color options, like #13, would affect this and so might be best tackled at the same time.

@mariuszhermansdorfer mariuszhermansdorfer merged commit f06b2f2 into mariuszhermansdorfer:master Sep 6, 2019
@philipbelesky philipbelesky deleted the feature/context-menu branch September 12, 2019 08:49
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.

2 participants