About Store Forum Documentation Contact



Post Reply 
MeshPart Related Queries
Author Message
ronghester Offline
Member

Post: #1
MeshPart Related Queries
Hi,

I am trying to replace a meshpart of the character with a meshpart of some other character.
I have access to both the mesh parts, but I am unable to do that replacement. Could somebody point me in right direction?

I am using this code from tutorial to access the meshpart, i am trying to replace part 0 of the mesh with part 3 of othermesh. but this code does nothing, I only see the material of part 0 changing to brick texture.

Code:
MeshPart &part=mesh.parts[0];
part.base.create(othermesh->parts[3].base);
part.setMaterial(Materials.ptrRequire("mtrl/brick/0.mtrl"));
Set(part.name, "ball");


I would appreciate any help.
08-19-2013 01:59 PM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #2
RE: MeshPart Related Queries
try to use '(' insteadof '[' e.g. othermesh->parts(3).base;
08-19-2013 02:53 PM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #3
RE: MeshPart Related Queries
That didn't change anything.[/quote]
08-19-2013 04:08 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
RE: MeshPart Related Queries
Do you have to call mesh.setRender()?
08-20-2013 04:43 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #5
RE: MeshPart Related Queries
Do yo mean I should call mesh.setRender() after create(), okay I will try that. Meanwhile I was playing with it and realize if I do
MeshPart &part=mesh.parts[0];
part->del()

The meshpart gets deleted. I guess my 50% problem is solved. Now I just have to figure out how to replace the desired meshpart at that position.

looks like a difficult task.
08-20-2013 11:02 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #6
RE: MeshPart Related Queries
I used setRender and whole mesh disappeared, so I guess that may not help. I tried couple more things but nothing seems to be working.

I would appreciate any suggestions.
08-20-2013 10:14 PM
Find all posts by this user Quote this message in a reply
SamerK Offline
Member

Post: #7
RE: MeshPart Related Queries
I haven't played with meshparts much, but I think since your accessing parts-base it means you need to initiate the software render this way,

MeshPart &part=mesh.parts[0];
part.setbase();

.
. Your code for part
.

part.setRender();

I hope this might help .
(This post was last modified: 08-20-2013 11:21 PM by SamerK.)
08-20-2013 11:20 PM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #8
RE: MeshPart Related Queries
I used setBase and that particular meshpart disappear which I suppose means the base is now empty. SetRender had no effect. Then I am setting new base using

Code:
part.base.create(othermesh->parts[3].base);

but the meshpart still render as empty. I guess the clue is somehwhere in render. but it has no effect the meshpart still render as empty.

I hope it is making some sense.
08-21-2013 09:28 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: MeshPart Related Queries
Hello,

'base' is the software part, for rendering you need the 'render' part.

'setRender' will create the 'render' part from 'base' (if the 'base' exists)

MeshPart has 'base' and 'render' members, they are independent of each other, and at one time both can be setup, only one can be setup, or none of them can be setup
08-21-2013 11:13 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #10
RE: MeshPart Related Queries
Hi esenthel,

I did not quite understand, I tried several combinations of the setBase and setRender but I was unable to replace the meshpart of a mesh with other meshpart. I may be doing something wrong. I wonder now is it possible at all?

For me there is alternative of setting drawgroup for the meshpart. I am facing one other problem related to the setDrawgroup and drawmask.
posted here..

http://www.esenthel.com/community/showth...p?tid=7027
(This post was last modified: 08-24-2013 04:07 PM by ronghester.)
08-23-2013 08:01 PM
Find all posts by this user Quote this message in a reply
Post Reply