xbuf / blender_io_xbuf

Delegate rendering to an external render engine (eg provided by game engine)
GNU General Public License v3.0
10 stars 6 forks source link

Missing Feature : supporting Parent to Bone (in blender) as AttachmentNode (in jme) #8

Open Ali-RS opened 8 years ago

Ali-RS commented 8 years ago

Hi In blender we can set an specific bone to be the parent of one or many objects (Ctr+P --> parent to bone) which is the same as setting an object to a bone AttachmentNode in jme. So is it good idea to support this and make the life a bit easy ?

davidB commented 8 years ago

Before response, I need to understand it (usage, use case,...). I never use it. Today in blender, iirc, I already use parent to bone to link skeleton to model.

Ali-RS commented 8 years ago

Use Case : for example connect sword to hand of warrior so that sword will swing by his hand movement.

I tried it but it did not connect. Let me try it one more time.

davidB commented 8 years ago

So attachment is for runtime, not for design/modeling time ?

Ali-RS commented 8 years ago

Yes , attaching is for runtime but before then I need to add some place holder Node (By place-holder i mean a node with a local translation inside bone attachment node) in design time so that for example all knifes (which are small) should have a place-holder node for of type knife, an other place holder node for type sword (which are big) which any weapon of type sword will be attached to it and so on ... this will help manage local translation of attachments inside bone attachment node. Could i explain the idea ?

Edit : I can do it in code with some default translation but i like to concentrate all of these works on blender and try not to hard-code them. And by simply transforming that place-holder node in blender i can change where the attachments will be added.

Ali-RS commented 8 years ago

Tested it once more : I am attaching the cube to arm bone of model using [Ctr+P --> Bone] in blender attachtoparentnode As you see in the picture in jme side it is just attached to node "Armature" (root node of model) as child which is wrong and it should be added to bone attachment node.

it supposed to be like this. I am attaching box to bone attachment node in SDK. attachtobonenode

Ali-RS commented 8 years ago

Parent type should be considered when exporting object relation : untitled

davidB commented 8 years ago

Thanks for all the info (again). I agree providing support for attachment should be added (I but I don't know when and how, I'll also check how assimp manage it).

On Tue, Aug 2, 2016 at 9:10 AM, Ali-RS notifications@github.com wrote:

Parent type should be considered when exporting object relation : [image: untitled] https://cloud.githubusercontent.com/assets/5787647/17319861/d4366c52-58a5-11e6-8033-bf8fc97a427e.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xbuf/blender_io_xbuf/issues/8#issuecomment-236820386, or mute the thread https://github.com/notifications/unsubscribe-auth/AAApswfkqe0wWtBdjq5GUEN_Sd601km4ks5qbu1ngaJpZM4JZlQk .

Ali-RS commented 8 years ago

thanks

was looking to codes. May be there is need to add new linker for this. kind of a NodeToBone linker or use the existing NodeToNode linker (attachment node itself is an instance of Node class in jme).

Ali-RS commented 8 years ago

I can add a test case for this in xbuf_unittest.blend file, if you want. Anyway, you can count on me for any testing and providing information of how things work in blender side and jme side.

Ali-RS commented 8 years ago

here is how to set rotation,transform of attachments in jme side to get the result same as it looks in blender: Parent to bone in blender : boneparrent-blender

and Parent to bone in jme using attachment nodes: (the scene and cube loaded directly from blender) attachmentnode

for getting the same result in jme, i need to :

            Vector3f world=cube.getWorldTranslation();
            Vector3f local=new Vector3f();
            attachmentNode.worldToLocal(world, local);
            attachmentNode.attachChild(cube);
            cube.setLocalTranslation(local);
            Quaternion q=attachmentNode.getLocalRotation(); 
            q.inverseLocal();  
            cube.setLocalRotation(q);

hope it helps

So for loading in JME side we will have no problem :smiley: