BOOL RecursePipeAndMatch(LocalPatchData *smd, Object *obj)
	{
	SClass_ID		sc;
	IDerivedObject* dobj;
	Object *currentObject = obj;

	if ((sc = obj->SuperClassID()) == GEN_DERIVOB_CLASS_ID)
		{
		dobj = (IDerivedObject*)obj;
		while (sc == GEN_DERIVOB_CLASS_ID)
			{
			for (int j = 0; j < dobj->NumModifiers(); j++)
				{
				ModContext *mc = dobj->GetModContext(j);
				if (mc->localData == smd)
					{
					return TRUE;
					}

				}
			dobj = (IDerivedObject*)dobj->GetObjRef();
			currentObject = (Object*) dobj;
			sc = dobj->SuperClassID();
			}
		}

	int bct = currentObject->NumPipeBranches(FALSE);
	if (bct > 0)
		{
		for (int bi = 0; bi < bct; bi++)
			{
			Object* bobj = currentObject->GetPipeBranch(bi,FALSE);
			if (RecursePipeAndMatch(smd, bobj)) return TRUE;
			}

		}

	return FALSE;
}
	//---------------------------------------------------------------
	void ControllerList::resolveControllers( const ExportNode& exportNode )
	{
		Object* object = exportNode.getINode()->GetObjectRef();

		if ( !object )
			return;

		if ( exportNode.getIsXRefObject() )
			object = XRefFunctions::getXRefItemSource(object);

		if ( !object )
			return;

		SClass_ID		superClassId;
		IDerivedObject* derivedObject;
		Object *currentObject = object;

		//int modIdx = 0;
		superClassId = object->SuperClassID();
		if (superClassId == GEN_DERIVOB_CLASS_ID || superClassId == DERIVOB_CLASS_ID || superClassId == WSM_DERIVOB_CLASS_ID)
		{
			derivedObject = (IDerivedObject*)object;
			while (superClassId == GEN_DERIVOB_CLASS_ID || superClassId == DERIVOB_CLASS_ID || superClassId == WSM_DERIVOB_CLASS_ID)
			{
				for (int modifierIndex = 0; modifierIndex < derivedObject->NumModifiers(); ++modifierIndex)
				{
					Modifier* modifier = derivedObject->GetModifier(modifierIndex);
					//no iskin support for xrefs
					// TODO needs further investigation...

					if ( SkinController::isSkinController(modifier) /*&& !exportNode.getIsXRefObject() */) 
					{
						SkinController * skinController = new SkinController(derivedObject, modifierIndex, modifier->IsEnabled() != false);
						mControllers.push_back(skinController);
					}
					else if ( MorphController::isMorphController(modifier) )
					{
						MorphController * morphController = new MorphController(derivedObject, modifierIndex, modifier->IsEnabled() != false);
						mControllers.push_back(morphController);
					}
					else
						return;
				}
				derivedObject = (IDerivedObject*) derivedObject->GetObjRef();
				currentObject = (Object*) derivedObject;
				superClassId = derivedObject->SuperClassID();
			}
		}

/*		int bct = currentObject->NumPipeBranches(FALSE);
		if (bct > 0)
		{
			for (int bi = 0; bi < bct; bi++)
			{
				Object* bobj = currentObject->GetPipeBranch(bi,FALSE);
				Resolve(bobj);
				return;
			}
		}
*/
	}
Beispiel #3
0
static INT_PTR CALLBACK UVStripDlgProc(
		HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
		case WM_INITDIALOG:
			theUVStrip.Init(hWnd);
			TCHAR s[50]; _stprintf(s,GetString(IDS_OBJ_SELECTED),theUVStrip.ip->GetSelNodeCount());
			SetWindowText(GetDlgItem(hWnd,IDC_SEL),s);
			break;

		case WM_DESTROY:
			theUVStrip.Destroy(hWnd);
			break;

		case WM_COMMAND:
			switch (LOWORD(wParam)) {
			
			case IDC_R1:
				{
				int cn = theUVStrip.ip->GetSelNodeCount();
				Interval valid=FOREVER;
				if(cn>0)
					{
					for(int x=0;x<cn;x++)
						{
						// then osm stack
						Object* obj = theUVStrip.ip->GetSelNode(x)->GetObjectRef();

//check to make sure no modifiers on the object
						int ct = 0;
						SClass_ID		sc;
						IDerivedObject* dobj;
						if ((sc = obj->SuperClassID()) == GEN_DERIVOB_CLASS_ID)
							{
							dobj = (IDerivedObject*)obj;

							while (sc == GEN_DERIVOB_CLASS_ID)
								{
								ct +=  dobj->NumModifiers();
								dobj = (IDerivedObject*)dobj->GetObjRef();
								sc = dobj->SuperClassID();
								}

							}
						if ((dobj = theUVStrip.ip->GetSelNode(x)->GetWSMDerivedObject()) != NULL)
							{
							ct +=  dobj->NumModifiers();
							}

						
						if (ct != 0)
							{
//error message here
							TSTR buf2 = GetString(IDS_ERROR);
							TSTR buf1 = GetString(IDS_ERROR_MESH);
							MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION);
							}
						else 
							{
							ObjectState os = theUVStrip.ip->GetSelNode(x)->EvalWorldState(theUVStrip.ip->GetTime());
							if (os.obj && os.obj->SuperClassID() == GEOMOBJECT_CLASS_ID && os.obj->IsSubClassOf(triObjectClassID)) 
								{
								Object *bobj = os.obj->FindBaseObject();
								if (bobj->ClassID() ==Class_ID(EDITTRIOBJ_CLASS_ID,0))
									{
									TriObject *T1 = (TriObject *)os.obj;
									T1->GetMesh().setNumTVerts(0);
									T1->GetMesh().setNumTVFaces(0);
									}	
								else
									{
//error message here
									TSTR buf2 = GetString(IDS_ERROR);
									TSTR buf1 = GetString(IDS_ERROR_MESH);
									MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION);
									}
								}
							else
								{
//error message here
								TSTR buf2 = GetString(IDS_ERROR);
								TSTR buf1 = GetString(IDS_ERROR_MESH);
								MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION);
								}
							}
						  theUVStrip.ip->ForceCompleteRedraw();
						}
					}
				
				break;
				}

			case IDC_R2:{
				int cn = theUVStrip.ip->GetSelNodeCount();
				if(cn>0){
					for(int x=0;x<cn;x++){
						INode *tmp=theUVStrip.ip->GetSelNode(x);
						tmp->SetMtl(NULL);
						if(GetCheckBox(hWnd, IDC_BLANK)) tmp->SetWireColor(RGB(160,160,160));
					}
					theUVStrip.ip->ForceCompleteRedraw();
				}
				break;}

			}
			break;

		default:
			return FALSE;
	}
	return TRUE;
}