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

Animcomposer and external change refactor #316

Merged
merged 22 commits into from
May 30, 2022

Conversation

neph1
Copy link
Contributor

@neph1 neph1 commented Mar 25, 2022

I'd like some opinions on this. Primary goal is to replace AnimComposer when updating the gltf, which it seems to do, although you need to reopen the .j3o to see it.

But mostly I'd like to know your thoughts on the refactoring. I'm thinking it can be taken further and maybe have a selectable list of transfers the user might want to do, rather than automating everything. It's out of scope for now though.

@neph1 neph1 changed the title Animcomposer Animcomposer and external change refactor Mar 26, 2022
@neph1
Copy link
Contributor Author

neph1 commented Mar 26, 2022

Since I don't know how to make a checklist option, I added an option to either apply all data or only the mesh data (or none). Should satisfy most needs. I don't like that it loses the option to select whether to only apply mesh and animation data (like before)

@neph1
Copy link
Contributor Author

neph1 commented Apr 8, 2022

Not sure what happened here, I must have missed adding a couple of files before committing, then made a hard reset of the branch because they were missing locally too. The dangers of context switching I guess.
I think this is done feature wise. Not sure I'll be able to fix all those codacy issues, though.

@neph1 neph1 marked this pull request as ready for review April 8, 2022 19:43
@tonihele tonihele added this to the 3.4 release milestone Apr 21, 2022
@neph1
Copy link
Contributor Author

neph1 commented Apr 22, 2022

Pause this for a bit. I found an issue while testing.

@neph1
Copy link
Contributor Author

neph1 commented Apr 23, 2022

I hadn't checked before that animations actually worked, just that they had been updated. I've fixed that now, however, they don't work in the scenecomposer (without reloading the j3o). My guess is that the JmeAnimComposer needs to be updated with the cloned AnimComposer. Since you're the author, @MeFisto94, is there a convenient method of doing such things?

Edit: I've sort of semi-verified that it's something like that, by not deleting the old AnimComposer and just cloning the fields unto it. That could be a work-around, but I'm unsure if it could cause other issues, since the old code relies on deleting all controls for the node tree.

@MeFisto94
Copy link
Member

I don't remember too much of it, just that the JmeXyz are counterpart to engine Xyz classes and basically are mostly there for having Java Bean Properties and a tree structure. We had this refreshChildren thing on JmeNodes or something, but I don't know if it fixes that. Technically, the cloned AnimComposer is a new AnimComposer that should have a new JmeAnimComposer that is then put into this tree hierarchy and refreshed, I think.

So instead of trying to change stuff in there, I guess the official way would be to kinda reload the node tree in some way (but I don't remember API specifics there)

@neph1
Copy link
Contributor Author

neph1 commented May 2, 2022 via email

@MeFisto94
Copy link
Member

Looking at #83 this should be possible.
Something like AbstractSceneExplorerNode#refresh. And ideally those node classes extend that.
If that doesn't help, give me a ping and I do a more thorough search

Fixing a couple of codacy issues, but probably introducing more.
@neph1
Copy link
Contributor Author

neph1 commented May 10, 2022

I think this is finally done. It's not an elegant solution, but at lest it seems to work. If someone wants to test it:

  1. Convert an asset of your liking (preferably with animations
  2. Open it in the SceneComposer
  3. Edit it in Blender and save (preferably something to do with animations, just change default anim)
  4. Wait for ExternalChangeScanner to kick in
  5. Choose what to update (Animations is the most critical part)
  6. If you changed default anim, you should notice it updating in the 3D view. You should also be able to change animations in the SceneExplorer.
  7. Feel free to test the other options too.
    Something you can't do is delete nodes and update, it has nothing to go on then. But it was like that before this PR, too.

@MeFisto94
Copy link
Member

I'd love if someone would help in testing this PR :) I'll still need to review it, but since it's rather large, I probably need to schedule some time for it

@neph1
Copy link
Contributor Author

neph1 commented May 16, 2022

It may not be as big as it looks. Most of the code for Mesh and Animation transfer is taken from SpatialUtil, only broken out into separate classes, and Material and Transform transfer is built on the same "pipeline".
I've tested everything quite well, but since the Animation transfer is newest, and I was a bit exhausted with the whole thing, there may be edge-cases I didn't cover.
Maybe I should do another documentation commit.

@neph1
Copy link
Contributor Author

neph1 commented May 25, 2022

@MeFisto94 If you want to, we could try scheduling an hour and do the review together. Regarding testing, perhaps we can push out a beta to let others try it.

Copy link
Member

@MeFisto94 MeFisto94 left a comment

Choose a reason for hiding this comment

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

Looking good, there are just a few things that need fixing and those mostly apply to all classes from the datatransfer packet: Wrong LogLevel Imports and maybe considering giving them a different name. They may not come from your PR directly, but I guess we can fix them easily anyway

if (animComposer != null) {
final Spatial mySpatial = finder.find(root, spatial);
if (mySpatial != null) {
//TODO: move attachments: have to scan through all
Copy link
Member

Choose a reason for hiding this comment

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

Should we create an issue for that and maybe mention that in the TODO comment and vice versa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is an old comment, but I think it's still valid. But it's probably a rare use case.

@neph1 neph1 merged commit de897e0 into jMonkeyEngine:master May 30, 2022
@neph1 neph1 deleted the animcomposer branch May 6, 2023 07:53
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.

3 participants