// This method is templated on the implementation of hctMayaSceneExporter/hctMaxSceneExporter::createScene()
bool FbxToHkxConverter::createScenes(FbxScene* fbxScene)
{
	clear();

	m_curFbxScene = fbxScene;
	m_rootNode = m_curFbxScene->GetRootNode();

	m_modeller = "FBX";
	hkStringBuf application = fbxScene->GetSceneInfo()->Original_ApplicationName.Get();
	if (application.getLength() > 0)
	{
		m_modeller += " [";
		m_modeller += application;
		m_modeller += "]";
	}
	printf("Modeller: %s\n", m_modeller.cString());

	if (m_options.m_selectedOnly)
	{
		printf("Exporting Selected Only\n");
	}

	if (m_options.m_visibleOnly)
	{
		printf("Exporting Visible Only\n");
	}

	hkArray<FbxNode*> boneNodes;
	findChildren(m_rootNode, boneNodes, FbxNodeAttribute::eSkeleton);
	m_numBones = boneNodes.getSize();
	printf("Bones: %d\n", m_numBones);

	const int poseCount = m_curFbxScene->GetPoseCount();
	if (poseCount > 0)
	{
		m_pose = m_curFbxScene->GetPose(0);
		printf("Pose Elements: %d\n", m_pose->GetCount());		
	}

	m_numAnimStacks = m_curFbxScene->GetSrcObjectCount<FbxAnimStack>();
	if (m_numAnimStacks > 0)
	{
		const FbxAnimStack* lAnimStack = m_curFbxScene->GetSrcObject<FbxAnimStack>(0);
		const FbxTimeSpan animTimeSpan = lAnimStack->GetLocalTimeSpan();
		FbxTime timePerFrame; timePerFrame.SetTime(0, 0, 0, 1, 0, m_curFbxScene->GetGlobalSettings().GetTimeMode());
		m_startTime = animTimeSpan.GetStart();
	}
	printf("Animation stacks: %d\n", m_numAnimStacks);

	createSceneStack(-1);

	for (int animStackIndex = 0;
		 animStackIndex < m_numAnimStacks && m_numBones > 0;
		 animStackIndex++)
	{
		createSceneStack(animStackIndex);
	}
	
	return true;
}
QList<QObject*> PythonQtStdDecorators::findChildren(QObject* parent, PyObject* type, const QString& name)
{
  const QMetaObject* meta = NULL;
  QByteArray typeName;

  if (PyObject_TypeCheck(type, &PythonQtClassWrapper_Type)) {
    meta = ((PythonQtClassWrapper*)type)->classInfo()->metaObject();
  } else if (PyObject_TypeCheck(type, &PythonQtInstanceWrapper_Type)) {
    meta = ((PythonQtInstanceWrapper*)type)->classInfo()->metaObject();
  }
  else if (PyBytes_Check(type) || PyUnicode_Check(type)) {
    typeName = PythonQtConv::PyObjGetString(type).toUtf8();
  }


  QList<QObject*> list;

  if (typeName.isEmpty() && !meta) {
    return list;
  }

  findChildren(parent, typeName, meta, name, list);

  return list;
}
int PythonQtStdDecorators::findChildren(QObject* parent, const char* typeName, const QMetaObject* meta, const QRegExp& regExp, QList<QObject*>& list)
{
  const QObjectList& children = parent->children();
  int i;

  for (i = 0; i < children.size(); ++i) {
    QObject* obj = children.at(i);

    if (!obj)
      return -1;

    // Skip if the name doesn't match.
    if (regExp.indexIn(obj->objectName()) == -1)
      continue;

    if ((typeName && obj->inherits(typeName)) ||
      (meta && meta->cast(obj))) {
        list += obj;
    }

    if (findChildren(obj, typeName, meta, regExp, list) < 0)
      return -1;
  }

  return 0;
}
Example #4
0
void CDFamily::extractFamily(CCdCore* parentCD, CDFamily& cdFamily, vector<CCdCore*>& cds)
{
	set<int> children;
	//parentCD= cdFamily.getRootCD();
	if (findChildren(parentCD, cds, children))
	{
		//add children
		for (set<int>::iterator sit = children.begin(); sit != children.end(); ++sit)
		{
			cdFamily.addChild(cds[*sit], parentCD);
		}
		//remove added children from cds
		vector<CCdCore*> tmp(cds);
		cds.clear();
		for (unsigned int i = 0; i < tmp.size(); i++)
		{
			if (children.find(i) == children.end())
			{
				cds.push_back(tmp[i]);
			}
		}
		// extract the subfamily for each children
		for (set<int>::iterator sit = children.begin(); sit != children.end(); ++sit)
		{
			extractFamily(tmp[*sit], cdFamily, cds);
		}
	}
}
Example #5
0
VTabContent * VContentGetter::veloFileConfigs(VPlotOps * plotOps, std::string interfaceScript)
{
  VTabContent * topDummyTab = new VTabContent("Top"); // Always needed.
  std::vector<VTabContent*> allTabs; // Useful to have container for all tabs.
  allTabs.push_back(topDummyTab);

  // Load all data into a vector.
  std::vector< std::vector< std::string > > ops;
  FILE * in;
  char buff[512];

  std::string command = "python " + interfaceScript + " run_view_config";
  in = popen(command.c_str(), "r");
  while(fgets(buff, sizeof(buff), in)!=NULL) {
    std::string rawData(buff);
    // Split by spaces.
    std::vector<std::string> rawDataSplit;
    std::istringstream iss(rawData);
    std::copy(std::istream_iterator<std::string>(iss),
       std::istream_iterator<std::string>(),
       std::back_inserter(rawDataSplit));
    ops.push_back(rawDataSplit);
  }

  findChildren(topDummyTab, &allTabs, &ops); // Called recursively.
  findPlots(&allTabs, &ops, plotOps);
  return topDummyTab;
}
Example #6
0
/*!
  Constructs an AppLnkSet that contains AppLnk objects representing
  all the files in the given \a directory (and any subdirectories
  recursively).

  \omit
  The directories may contain ".directory" files which override
  any AppLnk::type() values for AppLnk objects found in the directory.
  This allows simple localization of application types.
  \endomit
*/
AppLnkSet::AppLnkSet( const QString &directory ) :
    d(new AppLnkSetPrivate)
{
    QDir dir( directory );
    mFile = directory;
    findChildren(directory,QString::null,QString::null);
}
Example #7
0
void BaseSpec::store()
{
#ifdef PRINT
    this->wasFound();
#endif // PRINT

    findChildren();
}
Example #8
0
void AppLnkSet::findChildren(const QString &dr, const QString& typ, const QString& typName, int depth)
{
    depth++;
    if ( depth > 10 )
  return;

    QDir dir( dr );
    QString typNameLocal = typName;

    if ( dir.exists( ".directory" ) ) {
      Config config( dr + "/.directory", Config::File );
      config.setGroup( "Desktop Entry" );
      typNameLocal = config.readEntry( "Name", typNameLocal );
      if ( !typ.isEmpty() ) {
        d->typPix.insert( typ,
          new AppLnkImagePrivate( config.readEntry( "Icon", "AppsIcon" ) )
        );
        d->typName.insert(typ, new QString(typNameLocal));

      }
    }

    const QFileInfoList *list = dir.entryInfoList();
    if ( list ) {
      QFileInfo* fi;
      bool cadded=FALSE;
      for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
        QString bn = fi->fileName();
  //      qDebug("findChildren "+bn);
        if ( bn[0] != '.' && bn != "CVS" ) {
          if ( fi->isDir() ) {
              QString c = typ.isNull() ? bn : typ+"/"+bn;
              QString d = typNameLocal.isNull() ? bn : typNameLocal+"/"+bn;
              findChildren(fi->filePath(), c, d, depth );
          } else {
            if ( fi->extension(FALSE) == "desktop" ) {
              AppLnk* app = new AppLnk( fi->filePath() );
#ifdef QT_NO_QWS_MULTIPROCESS
              if ( !Global::isBuiltinCommand( app->exec() ) )
                  delete app;
              else
#endif
              {
                if ( !typ.isEmpty() ) {
                  if ( !cadded ) {
                      typs.append(typ);
                      cadded = TRUE;
                  }
                  app->setType(typ);
                }
                add(app);
              }
            }
          }
        }
      }
    }
}
Example #9
0
void DocLnkSet::findChildren(const QString &dr, const QValueList<QRegExp> &mimeFilters, QDict<void> &reference, int depth)
{
    depth++;
    if ( depth > 10 )
  return;

    QDir dir( dr );

    /* Opie got a different approach
     * I guess it's geek vs. consumer
     * in this case to be discussed
     */
    if ( dir.exists( ".Qtopia-ignore" ) )
  return;

    const QFileInfoList *list = dir.entryInfoList();
    if ( list ) {
  QFileInfo* fi;
  for ( QFileInfoListIterator it(*list); (fi=*it); ++it ) {
      QString bn = fi->fileName();
      if ( bn[0] != '.' ) {
    if ( fi->isDir()  ) {
        if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" )
      findChildren(fi->filePath(), mimeFilters, reference, depth);
    } else {
        if ( fi->extension(FALSE) == "desktop" ) {
      DocLnk* dl = new DocLnk( fi->filePath() );
      QFileInfo fi2(dl->file());
      bool match = FALSE;
      if ( !fi2.exists() ) {
          dir.remove( dl->file() );
      }
      if ( mimeFilters.count() == 0 ) {
          add( dl );
          match = TRUE;
      } else {
          for( QValueList<QRegExp>::ConstIterator it = mimeFilters.begin(); it != mimeFilters.end(); ++ it ) {
        if ( (*it).match(dl->type()) >= 0 ) {
            add(dl);
            match = TRUE;
        }
          }
      }
      if ( !match )
          delete dl;
        } else {
      if ( !reference.find(fi->fileName()) )
          reference.insert(fi->filePath(), (void*)2);
        }
    }
      }
  }
    }
}
Example #10
0
int height(const std::vector<int> parents) {
  if (parents.size() == 0) {
    return 0;
  }

  if (!valid(parents)) {
    return -1;
  }

  std::vector<std::unordered_set<int>> children = findChildren(parents);
  return height(children, parents);
}
Example #11
0
void FbxToHkxConverter::findChildren(FbxNode* root, hkArray<FbxNode*>& children, FbxNodeAttribute::EType type)
{
	for (int childIndex = 0; childIndex < root->GetChildCount(); childIndex++)
	{
		FbxNode *node = root->GetChild(childIndex);
		if (node->GetNodeAttribute() != NULL &&
			node->GetNodeAttribute()->GetAttributeType() == type)
		{
			children.pushBack(node);
		}

		findChildren(node, children, type);
	}
}
Example #12
0
void VContentGetter::findChildren(VTabContent * parentTab,
    std::vector<VTabContent*> * allTabs,
    std::vector< std::vector< std::string > > * ops)
{
  std::vector< std::vector< std::string > >::iterator iop;
  for (iop = ops->begin(); iop != ops->end(); iop++) {
    if ((*iop)[0] != "Tab" || (*iop)[0].substr(0, 1) == "#") continue;
    if ((*iop)[2] == parentTab->m_title) {
      VTabContent * tab = new VTabContent((*iop)[1], parentTab);
      allTabs->push_back(tab);
      if (allTabs->size()>10) exit(1);
      findChildren(tab, allTabs, ops);
    }
  }
}
Example #13
0
/*!
  Constructs a DocLnkSet that contains DocLnk objects representing all
  the files in the \a directory (and any subdirectories, recursively).

  If \a mimefilter is not null,
  only documents with a MIME type matching \a mimefilter are selected.
  The value may contain multiple wild-card patterns separated by ";",
  such as \c{*o/mpeg;audio/x-wav}.

  See also \link applnk.html#files-and-links Files and Links\endlink.

*/
DocLnkSet::DocLnkSet( const QString &directory, const QString& mimefilter ) :
    AppLnkSet()
{
    QDir dir( directory );
    mFile = dir.dirName();
    QDict<void> reference(1021);

    QStringList subFilter = QStringList::split(";", mimefilter);
    QValueList<QRegExp> mimeFilters;
    for( QStringList::Iterator it = subFilter.begin(); it != subFilter.end(); ++ it )
  mimeFilters.append( QRegExp(*it, FALSE, TRUE) );

    findChildren(directory, mimeFilters, reference);

    const QList<DocLnk> &list = children();
    for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
  reference.remove( (*it)->file() );
    }
    for ( QDictIterator<void> dit(reference); dit.current(); ++dit ) {
  if ( dit.current() == (void*)2 ) {
      // Unreferenced, make an unwritten link
      DocLnk* dl = new DocLnk;
      QFileInfo fi( dit.currentKey() );
      dl->setFile(fi.filePath());
      dl->setName(fi.baseName());
      // #### default to current path?
      // dl->setCategories( ... );
      bool match = mimefilter.isNull();
      if ( !match )
    for( QValueList<QRegExp>::Iterator it = mimeFilters.begin(); it != mimeFilters.end() && !match; ++ it )
        if ( (*it).match(dl->type()) >= 0 )
      match = TRUE;
      if ( match /* && dl->type() != "application/octet-stream" */
        && !!dl->exec() )
    add(dl);
      else
    delete dl;
  }
    }
}