dAnimIKController* CreateSkeletonRig(DemoEntity* const character)
	{
		DemoEntity* const rootEntity = FindRigRoot(character);
		dAnimIKController* const controller = CreateIKController();
		controller->SetUserData(rootEntity);

		int stack = 0;
		DemoEntity* entityStack[32];
		dAnimIKRigJoint* parentJointStack[32];

		for (DemoEntity* node = rootEntity->GetChild(); node; node = node->GetSibling()) {
			entityStack[stack] = node;
			parentJointStack[stack] = controller->GetAsIKRigJoint();
			stack ++;
		}

		while (stack) {
			stack--;
			DemoEntity* const entity = entityStack[stack];
			dAnimIKRigJoint* const parentJoint = parentJointStack[stack];
			dSkeletonRigDefinition* const definitions = FindDefinition(entity);
			if (definitions) {
				dAnimIK3dofJoint* const joint = new dAnimIK3dofJoint(parentJoint);
				joint->SetUserData(entity);

				for (DemoEntity* node = entity->GetChild(); node; node = node->GetSibling()) {
					entityStack[stack] = node;
					parentJointStack[stack] = joint;
					stack++;
				}
			}
		}

		return controller;
	}
Esempio n. 2
0
void PHPCodeCompletion::GotoDefinition(IEditor* editor, int pos)
{

    CHECK_PTR_RET(editor);
    wxStyledTextCtrl* sci = editor->GetCtrl();
    CHECK_PTR_RET(sci);

    PHPLocation::Ptr_t definitionLocation = FindDefinition(editor, pos);
    CHECK_PTR_RET(definitionLocation);

    // Open the file (make sure we use the 'OpenFile' so we will get a browsing record)
    IEditor* activeEditor =
        m_manager->OpenFile(definitionLocation->filename, wxEmptyString, definitionLocation->linenumber);
    if(activeEditor) {
        int selectFromPos = activeEditor->GetCtrl()->PositionFromLine(definitionLocation->linenumber);
        DoSelectInEditor(activeEditor, definitionLocation->what, selectFromPos);
    }
}
JBoolean
CBCClass::ViewDefinition
	(
	const JCharacter*	fnName,
	const JBoolean		caseSensitive,
	const JBoolean		reportNotFound
	)
	const
{
	JBoolean found = kJFalse;

	JString headerName;
	if (IsEnum())
		{
		found = ViewDeclaration(fnName, caseSensitive, reportNotFound);
		}
	else if (!Implements(fnName, caseSensitive))
		{
		found = ViewInheritedDefinition(fnName, caseSensitive, reportNotFound);
		if (!found && reportNotFound)
			{
			JString msg = "Unable to find any definition for \"";
			msg += fnName;
			msg += "\".";
			(JGetUserNotification())->ReportError(msg);
			}
		}
	else if (GetFileName(&headerName))
		{
		// search for class::fn

		const JCharacter* nsOp = "[[:space:]]*::[[:space:]]*";

		JString searchStr = GetFullName();

		JIndex i=1;
		while (searchStr.LocateNextSubstring("::", &i))
			{
			searchStr.ReplaceSubstring(i,i+1, nsOp);
			i += strlen(nsOp);
			}

		searchStr += nsOp;
		searchStr += fnName;
		found = FindDefinition(headerName, searchStr, caseSensitive);

		if (!found)
			{
			// "::" insures that we find the source instead of a call to the function.
			// We can't use "class::" because this doesn't work for templates.

			searchStr = "::[[:space:]]*";
			searchStr += fnName;
			found = FindDefinition(headerName, searchStr, caseSensitive);
			}

		if (!found)
			{
			CBDocumentManager* docMgr = CBGetDocumentManager();

			// look for it in the header file (pure virtual or inline in class defn)

			JIndex lineIndex;
			if (docMgr->SearchFile(headerName, fnName, caseSensitive, &lineIndex))
				{
				docMgr->OpenTextDocument(headerName, lineIndex);
				found = kJTrue;
				}

			// we couldn't find it anywhere

			else if (reportNotFound)
				{
				JString msg = "Unable to find the definition for \"";
				msg += fnName;
				msg += "\".";
				(JGetUserNotification())->ReportError(msg);
				}
			}
		}
	else if (reportNotFound)
		{
		JString msg = GetFullName();
		msg.PrependCharacter('"');
		msg += "\" is a ghost class, so no information is available for it.";
		(JGetUserNotification())->ReportError(msg);
		}

	return found;
}