Example #1
0
int BendManip::Display(TimeValue t, INode* pNode, ViewExp *pVpt, int flags)
{

	ModContext* mc = FindModContext( pNode, modifier );
	if( mc==NULL ) return 0;


	Interval valid;
	GraphicsWindow *gw = pVpt->getGW();
	Matrix3 modmat, ntm = pNode->GetObjTMBeforeWSM(t), off, invoff;

	if (mc->box->IsEmpty()) return 0;

	//Lets get the Modifier do all the work here
	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);
	gw->setTransform(modmat);
	if(mouseWithin)
		gw->setColor( LINE_COLOR, (float)1.0, (float)0.0, (float)0.0);
	else
		gw->setColor( LINE_COLOR, (float)0.0, (float)1.0, (float)0.0);

	DoModifiedBox(*mc->box,modifier->GetDeformer(t,*mc,invoff,off),DrawLineProc(gw));

	
	return 1;
	
}
Example #2
0
int BendManip::HitTest(TimeValue t, INode* pNode, int type, int crossing,
			int flags, IPoint2 *p, ViewExp *pVpt)
{
	ModContext* mc = FindModContext( pNode, modifier );
	if( mc==NULL ) return 0;

// From SimpleMod - Removed the centre drawing section
	Interval valid;
	int savedLimits;	
	GraphicsWindow *gw = pVpt->getGW();
	HitRegion hr;
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	Matrix3 modmat, ntm = pNode->GetObjTMBeforeWSM(t);

	if (mc->box->IsEmpty()) return 0;

	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();

	//Lets get the Modifier do all the work here

	Matrix3 off, invoff;
	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);
	gw->setTransform(modmat);		
	DoModifiedBox(*mc->box,modifier->GetDeformer(t,*mc,invoff,off),DrawLineProc(gw));
	

	gw->setRndLimits(savedLimits);	

	if (gw->checkHitCode()) {
		pVpt->LogHit(pNode, mc, gw->getHitDistance(), 0, NULL); 

	}

// Setup the Hit data from the Manipulator system into the HitRecord
	if(  pVpt->NumSubObjHits() ) {
		ManipHitData* pHitData = new ManipHitData(this);
		HitRecord* hit = pVpt->GetSubObjHitList().First();

		hit->hitData = pHitData; //Add the manip hit data
		return TRUE;
	}

	else 
	{
		return FALSE;
	}
}
Example #3
0
void BendManip::GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp,  Box3& box )
{
	if ( ! vp || ! vp->IsAlive() )
	{
		box.Init();
		return;
	}

	if(inode == NULL)
		return;

	ModContext* mc = FindModContext( inode, modifier );
	
	if( mc==NULL ) 
		return;

	Interval valid;

  if (!vp)
		vp = GetCOREInterface()->GetActiveViewExp().ToPointer();

	if ( ! vp || ! vp->IsAlive() )
	{
		box.Init();
		return;
	}


	GraphicsWindow *gw = vp->getGW();

	Matrix3 modmat, ntm = inode->GetObjTMBeforeWSM(t), off, invoff;

	if (mc->box->IsEmpty()) {
		return;
	}

	//Lets get the Modifier do all the work here

	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);	
	BoxLineProc bp1(&modmat);	
	DoModifiedBox(*mc->box, modifier->GetDeformer(t,*mc,invoff,off), bp1);
	box = bp1.Box();

	box = *(mc->box);

	Eval(t);

}