On 05/12/2016 at 02:41, xxxxxxxx wrote:
Hi Yannick,
I'm still trying to think my way through this, but just for response's sake, here's my current state of thought. I'll deal with just the poly hits first, we'll come back to the non-drawn objects later.
By "original object", I mean the original object sitting in the AM. Here's an example screen cap of my AM setup:
http://wickedp.com/plugincafe/PolyHits01.jpg
My object plugin (third down) takes the child object (fourth down) and puts it under a hypernurbs, and returns the HN in GVO. When I test the hits in the viewport, I get this:
http://wickedp.com/plugincafe/PolyHits02.jpg
The yellow triangle and the yellow dot are where the hits occurred. The GePrints show there are three hits, one hit on polygon 19 of the polygon mesh in the viewport (yellow text "CORRECT"), and two hits on identical looking objects on polygon 4 (yellow text "HIT - NOT DRAWN") neither of which are drawn in the viewport. Technically, the index for all hits is correct.
So my first query, how do I get from the "correct" hit on poly 19, back to the original object source (which is a cube with 6 polygons)? I ask this because my hierarchy recursive function tests for caches, eg:
// psuedo code
BaseObject* MyObject::Find_Match(...)
{
while(obj)
{
ViewportSelect *v = ViewportSelect::Alloc();
if(v->Init(width,height,working_bd,obj,Mpolygons,TRUE,VIEWPORTSELECTFLAGS_0))
{
int Hit = Test_Polygon(obj,ix,iy,v); // function to test polygon hit, returns index or -1
if(Hit >= 0)
{
GePrint("HIT found on obj " + obj->GetName() + ", poly " + LongToString(Hit));
}
}
if(v)
{
ViewportSelect::Free(v);
}
if(obj->GetCache() != nullptr) // **THE "CORRECT" HIT COMES FROM THIS**
{
Find_Match(obj->GetCache(),Matcher,counter+1);
}
if(obj->GetDeformCache() != nullptr)
{
Find_Match(obj->GetDeformCache(),Matcher,counter+1);
}
etc..
}
return obj;
}
The correct hit comes from part of the recursive function when the getcache() statement is met. So how do I know if/when an object has been used in another generator etc and there could be caches all over the place etc that need to be taken into account? How do I get back to the original source?
Hope that explains it somewhat. Let me know if you need any more info/code/something else!
WP.