BlenderVR / source

Blender Virtual Reality Main Code
52 stars 21 forks source link

Animation plays only in master #40

Open dfelinto opened 8 years ago

dfelinto commented 8 years ago

Try this file with the split screen config http://dalaifelinto.com/ftp/tmp/momo.blend

jmespadero commented 8 years ago

Hi, I just wanted to recall this issue, which I found is a feature-stop for many applications. I suppose that it can be solved by the master sending the current animation frame of each object, in the same way that it is sending its position and orientation. Isn't it? screenshot-split

Not sure if there any way to do this with a processor.py file...

PyrApple commented 8 years ago

The bug seems to be related to scene.suspend() not working on animations in BlenderVR (while it does obviously in Blender). Even in single screen mode (no slave), everything happens has if a third party was handling animation while scene is suspended. see test file: https://dl.dropboxusercontent.com/u/67761747/anim-test.zip

jmespadero commented 8 years ago

Hi, The anim-test.zip file is (almost) empty. It contains just a link to another directory.

I have trying to hack a patch for this, asking the master to send the current animation keyframe to slaves, using getSynchronizerBuffer(self) and processSynchronizerBuffer(self, buffer), but I still have it not working.

By the way, I was suspecting that the problem was elsewhere... I was suspecting of action culling (means actions will not be played when the bounding box of the armature is outside of the camera's viewing frustum), as you can see here: http://blenderartists.org/forum/showthread.php?392168-Pose-position-from-one-camera-rest-position-from-the-other

PyrApple commented 8 years ago

Interesting clue, will investigate. Meanwhile test file update: https://dl.dropboxusercontent.com/u/67761747/anim-test.zip

jmespadero commented 8 years ago

Hi, I see several things not working in the anim-test.blend file (mainly, that slaves are not moving the "fingers" on the floor).

But I don't understand the issue with scene.suspend(). How do you run the test? What is the expected behavior? Is the .processor.py file doing something to launch scene.suspend() or something else?

PyrApple commented 8 years ago

As you say, several things not working so there's not yet one way to run the test: the expected behavior is synchronization, the scene implement animation / color / visibility modifications in bge to test those features. That being said, the issues highlighted are, running the scene in BlenderVR split mode:

dfelinto commented 8 years ago

One thing can help this report is trying to pin point which was the last Blender where this worked. Even better if the exactly commit could be pin pointed (via git bisect)

PyrApple commented 8 years ago

agreed, I'll work on that as soon as I manage to recompile blender (as I need to patch < 2.75a versions) on OSX 10.11, which somehow raises unexpected issues (or change OS).

PyrApple commented 8 years ago

Well, we may not have to go that deep finally.

While digging into old Blender/BlenderCAVE code, I actually compiled the current git version of Blender (2.76 - commit 2ecd67efa4aeadb442e094b795a9171149ccbab1), which solved the problem of KX_GameObject animation synchronization on Slaves. Remains to see if current 2.76 release does the job or if we have to wait for 2.77.

Regarding BL_ArmatureObject animations, removing the scene.suspend() applied on Slave nodes enables armature animations on Slaves, synchronized with Master's as it is. This fix not being receivable as is (the suspend scene mechanism for Slaves exists for a reason - while a test on a physic simulation shows perfectly synchronized objects...), I created the fix_anim_in_slaves branch to dig in further.

jmespadero commented 8 years ago

That a great notice, but I have just tried blender-2.76b (the current release) and the bug is still there. We will wait for 2.77

dfelinto commented 8 years ago

@jmespadero you can get a daily build here: http://builder.blender.org/download

PyrApple commented 8 years ago

We've got a situation :)

Armature update in BlenderVR is handled in player/network/synchronizer/objects/itemarmature*.py, running a BL_ArmatureObject.update() if animation frame changed in master. Naturally, the scene.suspend() on slave nodes prevents any .update() flagged object to actually being updated.

Problem: none of the read/write properties of armatures in Blender impacting current pose have a direct effect, but rather will be "updated when the armature is updated during the graphic render" (see the BL_ArmatureChannel API page).

Solution 1: I didn't see it, a "setPose()" actually exists that, as e.g. worldTransform, acts immediately on the object without waiting for graphic render update. Everyone is happy, I'm humbled.

Solution 2: We deactivate scene.suspend() on slave nodes and think hard on what that fix will ... break.

Solution 3: We code a setPose() method in Blender code itself (fun ahead!)

jmespadero commented 8 years ago

I didn't see it, a "setPose()" actually exists [...]. Everyone is happy, I'm humbled.

Me too. I have been searching such feature for a time, and I haven't found it. I can't believe that feature is not available.