Digital Art Zone

 
     
Questions on DzBone
Posted: 08 December 2012 09:18 AM   [ Ignore ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

Hello,
my thesis finally got serious and I have to extend it a bit starting with DzBones.

I have two questions about it.

The first: can I get the geometry associated to the DzBone (like when you select one in the viewport) and how should I do this?

The second: the hierarchy you see in the Scene panel can be accessed also from code?

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 08 December 2012 12:56 PM   [ Ignore ]   [ # 1 ]
Member
Rank
Total Posts:  90
Joined  2010-12-31
gravity0 - 08 December 2012 09:18 AM

Hello,
my thesis finally got serious and I have to extend it a bit starting with DzBones.

I have two questions about it.

The first: can I get the geometry associated to the DzBone (like when you select one in the viewport) and how should I do this?

The second: the hierarchy you see in the Scene panel can be accessed also from code?

Hierarchy is the Node hierarchy.  See DzNode::getNodeChildren()

The geometry is on the root DzNode of the figure.  So think skeleton->getObject()->getCurrentShape()->getGeometry().  cast that to a DzFacetMesh and go from there.  There is a selection map the associates what facet goes to which bone.

Profile
 
 
Posted: 12 December 2012 04:56 AM   [ Ignore ]   [ # 2 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

I have found how to get the mesh. The problem is that I am not able to find what you told me. There is a
  getAllEdgesForGroup (DzFaceGroup *group, DzTSortedArray< int > &edges;) const
and a
  DzFaceGroup *  findFaceGroup (const QString &name;, int *index=NULL) const
in the documentation. But I am not so sure on wht name should I pass to the second function.

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 12 December 2012 12:15 PM   [ Ignore ]   [ # 3 ]
Member
Rank
Total Posts:  114
Joined  2008-04-10
gravity0 - 12 December 2012 04:56 AM

I have found how to get the mesh. The problem is that I am not able to find what you told me. There is a
  getAllEdgesForGroup (DzFaceGroup *group, DzTSortedArray< int > &edges;) const
and a
  DzFaceGroup *  findFaceGroup (const QString &name;, int *index=NULL) const
in the documentation. But I am not so sure on wht name should I pass to the second function.

Does this help?:

for(int i 0facetMesh->getNumFaceGroups(); i++)
{
  DzFaceGroup
faceGroup facetMesh->getFaceGroup(i);
  
DzTSortedArray<intedges
  
facetMesh->getAllEdgesForGroup(faceGroupedges);
Profile
 
 
Posted: 14 December 2012 02:02 AM   [ Ignore ]   [ # 4 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

That is actually pretty cool but I need to find geometries for specific bones like torso, head and abdomen to make a raycast and detect the bone the ray intersects (I acuallyhave a bridge to Bullet for the raycast but I need to send geometries to it).

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 14 December 2012 08:22 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

Mesh doesn’t necessarily belong to bones as it did in older versions of DS and Poser - it may have a group, which may be associated with a bone, butt hat’s really cosmetic (so that you can click on it to select the bone) rather than needed for a figure to work.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 14 December 2012 08:29 AM   [ Ignore ]   [ # 6 ]
Member
Rank
Total Posts:  90
Joined  2010-12-31

All geometry is on the skeleton. The selection map is a mapping from faceGroup to bone.
DzNode::getSelectionMap

 

Profile
 
 
Posted: 03 January 2013 03:46 AM   [ Ignore ]   [ # 7 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12
Richard Haseltine - 14 December 2012 08:22 AM

Mesh doesn’t necessarily belong to bones as it did in older versions of DS and Poser - it may have a group, which may be associated with a bone, butt hat’s really cosmetic (so that you can click on it to select the bone) rather than needed for a figure to work.

Ok but what I need is to get the vertices of only a part of a figure, not just a bone. For example I need to get the geometry for the upper body and I thought that if I am able to see them selected in the viewport I will be able to get them by code. Is this possible?

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 03 January 2013 06:37 AM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

You need the selection map mentioned by dtamm, that’s the thing that determines which areas select a bone when clicked.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 06 January 2013 12:41 PM   [ Ignore ]   [ # 9 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

I got this. But I actually need all of them, not just the selected ones. Should I use DzFaceGroup* faceGroup = facetMesh->getFaceGroup(i); Does these FaceGoups have names associated (like abdomen, ...).

Sorry for bothering you about this but I really need them for my thesis.

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 06 January 2013 01:30 PM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13579
Joined  2003-10-09

The selection map sets the relationship between the mesh and the bones, for the purposes of clicking in the viewport and visibility. If for each bone you invoke getSelectionMap that should enable you to get the mesh for each bone - it has nothing to do with whether or not they are currently selected, as I understand it. Of course you need to allow for bones with no selection map, and polygons that don’t belong to any bone’s selection map (though the latter should be rare, for Poser-compatibility).

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 06 January 2013 02:05 PM   [ Ignore ]   [ # 11 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

Thanks for pointing me in the right direction. I’ll check the docs and then tell you what I find smile

EDIT: check out. I have arrived to the DzSelectionMap but I cannot get any geometry from that.

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 08 January 2013 09:02 PM   [ Ignore ]   [ # 12 ]
Power Member
Avatar
RankRankRank
Total Posts:  1820
Joined  2006-01-19

i published the .cpp code for the mcjColllider node (plugin) for DS4.5

https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

here’s how i handle selected bones

DzSkeleton *targetNode;
        
DzFaceGroup *faceGroup;
        for( 
int n 0numTargetNodesn++ )
        
{
                targetNode 
= (DzSkeleton*) targetList.at);
                if( !
targetNode )
                

                        
return( false ); 
                
//cause for concerm
                
bool bIsAbone;
                
DzFacetMesh *targetMesh 0;
                if( 
targetNode->inherits"DzBone" ) )
                
{
                        bIsAbone 
true;
                        
QString boneName targetNode->getName();
                        
targetNode targetNode->getSkeleton();
                        
targetMesh getCachedMeshtargetNode );
                        if( 
targetMesh )
                        
{
                                faceGroup 
targetMesh->findFaceGroupboneName );
                        
}
                }
                
else
                
{
                        bIsAbone 
false;
                        
targetMesh getCachedMeshtargetNode );
                


if the object is a bone, i go through the faces in the faceGroup

if it’s a figure or a prop, i go through all the faces of the mesh

 

Profile
 
 
Posted: 09 January 2013 08:45 AM   [ Ignore ]   [ # 13 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

Looks like what I need Casual smile Thank you smile I will keep you posted.


EDIT: So face groups are named after the bone smile

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile
 
 
Posted: 09 January 2013 05:31 PM   [ Ignore ]   [ # 14 ]
Power Member
Avatar
RankRankRank
Total Posts:  1820
Joined  2006-01-19
gravity0 - 09 January 2013 08:45 AM

Looks like what I need Casual smile Thank you smile I will keep you posted.


EDIT: So face groups are named after the bone smile

it seems to work so far though i only tested this on Aiko3

... i think

... nope, i tested it on Genesis too! since that’s how i built her dress

hmm, well i used the whole body as a collision object .... so i guess more testing of this would be needed

 

Image Attachments
promodress.jpg
Profile
 
 
Posted: 10 January 2013 08:43 AM   [ Ignore ]   [ # 15 ]
Member
Avatar
Rank
Total Posts:  119
Joined  2007-09-12

I have arrived to get the edges of the face groups. But as they are edges I need to build triangles.

I did it from facets in another piece of code. Is there a way to use the facets of the facegroup instead of the edges?

 Signature 

Favourite Figure: Victoria 5
My Art Gallery: http://mattiascibien.deviantart.com/
Developer of AutoCam (commercial follow-up of my thesis project).

Profile