MonZop / BioBlender

AddOn for Blender to do molecular work
BSD 2-Clause "Simplified" License
113 stars 20 forks source link

Game Engine #2

Open MonZop opened 9 years ago

MonZop commented 9 years ago

BipoBlender is supposed to use the Blender GE to calculate the transitiono fo a molecule from one conformation to another. However, as soon as the 'Run In GE' button is hit, Blender crashes

zeffii commented 9 years ago

there's an import error, in 2.73,

Blender Game Engine Started
Python module can't be imported - object 'Empty', controller 'Python Script':
ImportError: No module named 'BioBlender2'
Blender Game Engine Finished

but it doesn't crash, pressing esc releases it

zeffii commented 9 years ago

in 2.73 using the branch (2.73_Comp_Explore) To my surprise the Game engine does run, but doesn't record anything (no cache) probably because of the failed import. I'll investigate.

MonZop commented 9 years ago

The recorded animation will be stored as keyframes (one KF for every atom, at each frame), starting 500 frames after the last imported model. Pls. pay attention that animation makes sense only with at least two different conformations of a protein. If you use file '01_CaM 3 conformations.pdb', and changed nothing in the import, you will have a KF at frame 1 (conformation= model 1), a KF at frame 100 (conf 2), and another one at frame 200. After recording the GE simulation, all frames between 500 and 800 will be keyframed.

zeffii commented 9 years ago

woop i'll add some update prints so it shows when a keyframe is added, else it is impossible to tell if it's actually performing useful work

zeffii commented 9 years ago

OK i see, those keyframes are inserted upon .pdb import if there are several conformations present in the file.

MonZop commented 9 years ago

Back to the GE issue: using 273_Comp animations are not recorded, even when the "Record animation" box is checked. Also it presents a set of options that make little sense to me. geoptions

zeffii commented 9 years ago

I've noticed this. this worked in 0.6 ? It will be the first thing I look at tomorrow (cross differential between older and newer version of addon)

zeffii commented 9 years ago

The dropdown options comes from this line

split.prop(bpy.context.scene.objects[str(m)].game, "physics_type") 

the options are generic to the physics type, from what I can tell:

http://www.blender.org/api/blender_python_api_2_73_5/bpy.types.GameObjectSettings.html?highlight=physics_type#bpy.types.GameObjectSettings.physics_type (produces the same list)

Perhaps it would be simpler to remove the options and set Rigid Body if the game engine is invoked.

zeffii commented 9 years ago

This however does not seem to be the reason for the GE to fail to do anything, it is an import issue as mentioned here: https://github.com/MonZop/BioBlender/issues/2#issuecomment-72259622

MonZop commented 9 years ago

Yes, if joints are not built, then the recording of GE is not done, as it is meaningless (in biological sense) As you say, Perhaps it would be simpler to remove the options and set Rigid Body if the game engine is invoked., I agree

zeffii commented 9 years ago

could you add a few simple molecules for the purpose of testing the GE , bones / joints ?

MonZop commented 9 years ago

OK, let me prepare a file with a very small protein in 4 conformations

MonZop commented 9 years ago

Done: you'll find it in the Test Molecules folder. It is a small artificial protein made of only 20 aminoacids, for a total of 158 atoms (excluding Hydrogens). The file contains 4 MODELS (conformations), but I noticed that BB2 only imports 3 of them. I also tried to import other proteins that have many conformations, but BB2 imports all models except the last one.

MonZop commented 9 years ago

Back to the Game Engine: In the master_main_first_fixes version of BB, bones are created (they are listed in the Outliner), but the GE is completely still. In the Blender console it says: Blender Game Engine Started Python module can't be imported - object 'Empty', controller 'Python Script': ImportError: No module named 'BioBlender2' Blender Game Engine Finished

zeffii commented 9 years ago

There's recent fixes to the BGE, today this: https://developer.blender.org/rBbf157ce9277ba1011a6e317c7629bab0dd8c36a5 it may relate to the problem.

@mikepan can probably make more sense of the BGE stuff (either the BioBlender Master, or the experiments branch)

zeffii commented 9 years ago

image I renamed BioBlender2.py to BioBlender.py and edited the EmptySet.blend to link to BioBlender.recorder, and now the ImportError seems to go away.. Even if this isn't the solution, the naming seems to have caused a problem. image

zeffii commented 9 years ago

it seems to be doing some thing.. image

MonZop commented 9 years ago

I also just tried, but I get an error: Blender Game Engine Started Python module can't be imported - object 'Empty', controller 'Python Script': ImportError: No module named 'BioBlender2' and no recording of motion

MonZop commented 9 years ago

But I am using an old portable, it might be not very updated. I'll check again when I gat back to the office in Pisa (thursday afernoon)

zeffii commented 9 years ago

I am using a latest Buildbot version, as it includes Game Engine fixes (which might be good to have anyway) I've pushed the change to the experimental branch.

further in the right place: https://github.com/MonZop/BioBlender/issues/9#issuecomment-74645953

this will get easier, not harder :)

MonZop commented 9 years ago

I have tested with several combinations, but nothing seems to worrk for me: 2302getest3

any clue?

zeffii commented 9 years ago

I think this happens if the Addon folder is not called BioBlender, which might be the case if you are using the zip. Yours might be called BioBlender-master , or one of the branches. Ideally the addon wouldn't care about the name of the folder inside which it lives.

zeffii commented 9 years ago

So if you are trying the version i'm experimenting with that folder would be called:

BioBlender-master_mff_experiments , but rename it to BioBlender

the content of this version should be: image

If any other BioBlender addons are enabled / ticked other than this one untick them, save settings / Ctrl+U to store this preference. Restart Blender. When you navigate to the addons panel again, you can see where it's loading the addon from by viewing the dropdown:

image

zeffii commented 9 years ago

Now i said:

Ideally the addon wouldn't care about the name of the folder inside which it lives.

Most likely it can be made to be entirely agnostic about folder and file names, but that's a different problem (one I would like to solve soon)

MonZop commented 9 years ago

Oh, finally, I managed! :-) worikngge