Notifications
Clear all

[Closed] SDK Attaching Splines

Hi, I am trying to attach splines together, which works ( yay ) but it seems to move the new spline into the center pivot of the Attached object. I have used different transforms but none seem to be working. I have been using the editspl.cpp with their attach code, but even when I uses their transforms, its still going to the center … Help anyone ?? Code is below:


 void SplineTools::AttachSplines(){
 	ip = GetCOREInterface();
 	t = GetCOREInterface()->GetTime();
 
 	if(ip->GetSelNodeCount() > 0){
 		INode *node = ip->GetSelNode(0);
 		Object *newObject = node->GetObjectRef();
 
 		if(newObject->SuperClassID() == SHAPE_CLASS_ID){
 			if(newObject->ClassID() != Class_ID(SPLINESHAPE_CLASS_ID, 0)){
 				SplineShape* newSpline = (SplineShape*)newObject->ConvertToType(t, Class_ID(SPLINESHAPE_CLASS_ID, 0));
 				newObject = newSpline->CollapseObject();
 				node->SetObjectRef(newObject);
 				newObject = node->GetObjectRef();
 			}
 		}
 
 		SplineShape* newSpline = (SplineShape*) newObject;
 		BezierShape* bs = &((SplineShape*)newObject)->shape;
 		int boff = bs->splineCount;
 		for(int i = 1; i < ip->GetSelNodeCount(); i++){
 			INode *NextNode = ip->GetSelNode(i);
 			Object *NextObject = NextNode->GetObjectRef();
 
 			if(NextObject->SuperClassID() == SHAPE_CLASS_ID){
 				if(NextObject->ClassID() != Class_ID(SPLINESHAPE_CLASS_ID, 0)){
 					SplineShape* newSpline = (SplineShape*)NextObject->ConvertToType(t, Class_ID(SPLINESHAPE_CLASS_ID, 0));
 					NextObject = newSpline->CollapseObject();
 					NextNode->SetObjectRef(NextObject);
 					NextObject = NextNode->GetObjectRef();
 				}
 
 				SplineShape* NextSpline = (SplineShape*) NextObject;
 				BezierShape* NextBS = &((SplineShape*)NextObject)->shape;
 
 				Spline3D *spline = bs->NewSpline();
 				*spline = *(NextBS->splines[0]);
 				//Some Transform code needed
 
 				bs->UpdateSels();
 				bs->InvalidateGeomCache();
 				ip->RedrawViews(ip->GetTime());
 			}
 		}
 	}
 	ip->ClearNodeSelection();
 }