Example #1
0
bool LiveScene::hasAttribute( const Name &name ) const
{
	if ( !m_isRoot && m_dagPath.length() == 0 )
	{
		throw Exception( "IECoreMaya::LiveScene::hasAttribute: Dag path no longer exists!" );
	}
	
	if( name == SceneInterface::visibilityName )
	{
		return true;
	}
	
	std::vector< CustomAttributeReader > &attributeReaders = customAttributeReaders();
	for ( std::vector< CustomAttributeReader >::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
	{
		NameList names;
		{
			// call it->m_names under a mutex, as it could be reading plug values,
			// which isn't thread safe:
			tbb::mutex::scoped_lock l( s_mutex );
			it->m_names( m_dagPath, names );
		}
		
		if ( std::find(names.begin(), names.end(), name) != names.end() )
		{
			return true;
		}
	}
	return false;
}
Example #2
0
Imath::Box3d HoudiniScene::readBound( double time ) const
{
	OP_Node *node = retrieveNode( true );
	
	Imath::Box3d bounds;
	UT_BoundingBox box;
	OP_Context context( time );
	/// \todo: this doesn't account for SOPs containing multiple shapes
	/// if we fix it, we need to fix the condition below as well
	if ( node->getBoundingBox( box, context ) )
	{
		bounds = IECore::convert<Imath::Box3d>( box );
	}
	
	// paths embedded within a sop already have bounds accounted for
	if ( m_contentIndex )
	{
		return bounds;
	}
	
	NameList children;
	childNames( children );
	for ( NameList::iterator it=children.begin(); it != children.end(); ++it )
	{
		ConstSceneInterfacePtr childScene = child( *it );
		Imath::Box3d childBound = childScene->readBound( time );
		if ( !childBound.isEmpty() )
		{
			bounds.extendBy( Imath::transform( childBound, childScene->readTransformAsMatrix( time ) ) );
		}
	}
	
	return bounds;
}
Example #3
0
void
user_pass(char *username)
{
	NameList name;
	IdMap users;
	ServerPrx server;
	
	server = meta->getServer(serverId, ctx);
	name.push_back(username);

	users = server->getUserIds(name, ctx);
	if (users[username] < 0)
		throw "Invalid User";
	else
	{
		UserInfoMap uinfo = server->getRegistration(users[username], ctx);
		cout << "Enter new password for " << uinfo[UserName] << ": ";
		string pass;
		getline(cin, pass);
		
		uinfo[UserPassword] = pass;
		server->updateRegistration(users[username], uinfo, ctx);
		cout << "Password Updated!" << endl;
	}
}
Example #4
0
 NameList SplattingManager::getMapTextureNames() const
 {
   NameList names;
   for (size_t i = 0; i < mImpl->maps.size(); ++i)
     names.push_back(mImpl->maps[i]->getName());
   return names;
 }
Example #5
0
void LinkedScene::readTags( NameList &tags, int filter ) const
{
	if ( filter!=SceneInterface::LocalTag && !m_readOnly )
	{
		throw Exception( "readTags with filter != LocalTag is only supported when reading the scene file!" );
	}

	if ( m_linkedScene )
	{
		m_linkedScene->readTags( tags, filter );

		/// Only queries ancestor tags and local tags (if at the link location) from the main scene.
		int mainFilter = filter & ( SceneInterface::AncestorTag | ( m_atLink ? SceneInterface::LocalTag : 0 ) );
		if ( !m_atLink && (filter & SceneInterface::AncestorTag) )
		{
			/// child locations inside the link consider all the local tags at the link location as ancestor tags as well.
			mainFilter |= SceneInterface::LocalTag;
		}
		if ( mainFilter )
		{
			NameList mainTags;
			m_mainScene->readTags( mainTags, mainFilter );
			tags.insert( tags.end(), mainTags.begin(), mainTags.end() );
		}
	}
	else
	{
		m_mainScene->readTags( tags, filter );
	}
}
Example #6
0
RecordPtr Common::assembleRecord(const Json::Value& rVal)
{
  auto contact = rVal["contact"].asString();
  auto nonce = rVal["nonce"].asString();
  auto pow = rVal["pow"].asString();
  auto pubHSKey = rVal["pubHSKey"].asString();
  auto sig = rVal["recordSig"].asString();
  auto type = rVal["type"].asString();
  auto name = rVal["name"].asString();

  if (type != "Create")
    Log::get().error("Record parsing: not a Create Record!");

  NameList subdomains;
  if (rVal.isMember("subd"))
  {
    Json::Value list = rVal["subd"];
    auto sources = list.getMemberNames();
    for (auto source : sources)
      subdomains.push_back(std::make_pair(source, list[source].asString()));
  }

  auto key = Utils::base64ToRSA(pubHSKey);
  return std::make_shared<CreateR>(contact, name, subdomains, nonce, pow, sig,
                                   key);
}
Example #7
0
		void print(int start = 0) {
			cout << "Loop-------------------------------------\n";
			cout << " |---[namelist]---------------" << endl;
			names->print(5);
			BLANKS(start); 
			cout << " |---" << "[beforeloop] [|" << (beforeloop? *beforeloop:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[beforeloopinit] [|" << (beforeloopinit? *beforeloopinit:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[precondition] [|" << (precondition? *precondition:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[loopcondition] [|" << (loopcondition? *loopcondition:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[realloopcondition] [|" << (realloopcondition? *realloopcondition:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[loopbody] [|" << (loopbody->body? *loopbody->body:"NULL") <<  "|]" << endl;
			loopbody->print(start + 7);
			BLANKS(start); 
			cout << " |---" << "[postcondition] [|" << (postcondition? *postcondition:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[afterloop] [|" << (afterloop? *afterloop:"NULL") << "|]" << endl;
			BLANKS(start); 
			cout << " |---" << "[loopinvariant] [|" << (loopinvariant? *loopinvariant:"NULL") << "|]" << endl;
			if (learners != NULL) {
				cout << " |---[learnerlist]---------------" << endl;
				learners->print(5);
				cout << endl;
			}
			//cout << " |---" << endl;
		}
Example #8
0
const clbr::RuleNameMap* clbr::DrcLibrary::rules()
{
    RuleNameMap* ruleMap = DEBUG_NEW clbr::RuleNameMap();
    for (CellMap::const_iterator wc = _cells.begin(); wc != _cells.end(); wc++)
    {
        std::string cellName = wc->first;
        const RuleMap* cRules = wc->second->rules();
        for (RuleMap::const_iterator wr = cRules->begin(); wr != cRules->end(); wr++)
        {
            std::string ruleName = wr->first;
            NameList* cellNames;
            if (ruleMap->end() == ruleMap->find(ruleName))
            {
                cellNames = DEBUG_NEW NameList();
                (*ruleMap)[ruleName] = cellNames;
            }
            else
                cellNames = (*ruleMap)[ruleName];
            cellNames->push_back(cellName);
        }
    }
    for (RuleNameMap::iterator wr = ruleMap->begin(); wr != ruleMap->end(); wr++)
    {
        wr->second->unique();
    }
    return ruleMap;
}
Example #9
0
void LiveScene::attributeNames( NameList &attrs ) const
{
	if( !m_isRoot && m_dagPath.length() == 0 )
	{
		throw Exception( "IECoreMaya::LiveScene::attributeNames: Dag path no longer exists!" );
	}

	tbb::mutex::scoped_lock l( s_mutex );
	attrs.clear();
	attrs.push_back( SceneInterface::visibilityName );

	// translate attributes with names starting with "ieAttr_":
	MFnDependencyNode fnNode( m_dagPath.node() );
	unsigned int n = fnNode.attributeCount();
	for( unsigned int i=0; i<n; i++ )
	{
		MObject attr = fnNode.attribute( i );
		MFnAttribute fnAttr( attr );
		MString attrName = fnAttr.name();
		if( attrName.length() > 7 && ( strstr( attrName.asChar(),"ieAttr_" ) == attrName.asChar() ) )
		{
			attrs.push_back( ( "user:" + attrName.substring( 7, attrName.length()-1 ) ).asChar() );
		}
	}

	// add attributes from custom readers:
	for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ )
	{
		it->m_names( m_dagPath, attrs );
	}

	// remove duplicates:
	std::sort( attrs.begin(), attrs.end() );
	attrs.erase( std::unique( attrs.begin(), attrs.end() ), attrs.end() );
}
Example #10
0
void HoudiniScene::attributeNames( NameList &attrs ) const
{
	attrs.clear();
	for ( std::map<Name, CustomReader>::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); ++it )
	{
		if ( it->second.m_has( retrieveNode() ) )
		{
			attrs.push_back( it->first );
		}
	}
}
Example #11
0
		ConvertHandler()
		{
#define ADD_OPTION(name) mNames.push_back("-" name); mOptions.insert(name)
#define ADD_ALIAS(alias,original) ADD_OPTION(alias); mAliases.insert(pair<string,string>(alias,original))

			// Long names
			mNames.push_back("--convert");
			mNames.push_back("--input");
			mNames.push_back("--output");

			// Short names
			mNames.push_back("-c");
			mNames.push_back("-i");
			mNames.push_back("-o");

			// Options
			ADD_OPTION("flips"); //flip s coordinate
			ADD_OPTION("flipt"); //flip t coordinate
			ADD_OPTION("flipr"); //flip r coordinate
			ADD_OPTION("flipx"); //flip x coordinate
			ADD_OPTION("flipy"); //flip y coordinate
			ADD_OPTION("flipz"); //flip z coordinate
			ADD_OPTION("flip");  //?
			ADD_OPTION("flop");  //?
			ADD_OPTION("flipn"); //flip normals
			ADD_OPTION("dims");  //show dimensions
			ADD_OPTION("basepath");       //specify model base path for building material scripts
			ADD_OPTION("autolod");        //create automatic lods (TODO: may specify distance list)
			ADD_OPTION("autoedge");       //create edge list (prepare for stencil shadows)
			ADD_OPTION("autotangent");    //create tangent texcoord unit
			ADD_OPTION("forceflatshade"); //force flat shading
			ADD_OPTION("no-optimize");    //forcefully disable mesh optimization
			ADD_ALIAS ("x","addx"); //translate x (alias)
			ADD_ALIAS ("y","addy"); //translate y (alias)
			ADD_ALIAS ("z","addz"); //translate z (alias)
			ADD_OPTION("addx"); //translate x 
			ADD_OPTION("addy"); //translate y
			ADD_OPTION("addz"); //translate z
			ADD_OPTION("adds"); //translate s
			ADD_OPTION("addt"); //translate t
			ADD_OPTION("addr"); //translate r
			ADD_OPTION("mpyx"); //multiply x 
			ADD_OPTION("mpyy"); //multiply y
			ADD_OPTION("mpyz"); //multiply z
			ADD_OPTION("mpys"); //multiply s
			ADD_OPTION("mpyt"); //multiply t
			ADD_OPTION("mpyr"); //multiply r
			ADD_OPTION("inputPath");  //override input path
			ADD_OPTION("outputPath"); //override output path
			ADD_OPTION("rootPath");   //override executable path

#undef ADD_OPTION
		}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int PluginRegistry::loadConfiguredPlugins(const Config::Config *config) {
	try { _pluginNames = config->getStrings("core.plugins"); }
	catch ( ... ) {}

	try {
		NameList appPlugins = config->getStrings("plugins");
		_pluginNames.insert(_pluginNames.end(), appPlugins.begin(), appPlugins.end());
	}
	catch ( ... ) {}

	return loadPlugins();
}
Example #13
0
void MayaScene::attributeNames( NameList &attrs ) const
{
	if( !m_isRoot && m_dagPath.length() == 0 )
	{
		throw Exception( "MayaScene::attributeNames: Dag path no longer exists!" );
	}
	
	tbb::mutex::scoped_lock l( s_mutex );
	attrs.clear();
	attrs.push_back( SceneInterface::visibilityName );
	for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ )
	{
		it->m_names( m_dagPath, attrs );
	}
}
Example #14
0
bool LiveScene::hasAttribute( const Name &name ) const
{
	OP_Node *node = retrieveNode();
	
	const std::vector<CustomAttributeReader> &attributeReaders = customAttributeReaders();
	for ( std::vector<CustomAttributeReader>::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
	{
		NameList names;
		it->m_names( node, names );
		if ( std::find( names.begin(), names.end(), name ) != names.end() )
		{
			return true;
		}
	}
	
	return false;
}
Example #15
0
void
user_delete(char *username)
{
	NameList name;
	IdMap users;
	ServerPrx server;
	
	server = meta->getServer(serverId, ctx);
	name.push_back(username);
	
	users = server->getUserIds(name, ctx);
	if (users[username] < 0)
		throw "Invalid User";
	else 
	{
		server->unregisterUser(users[username], ctx);
		cout << username << " deleted." << endl;
	}
}
Example #16
0
    /**
     * Create a new field declaration with exactly one variable in it.
     * If the field is uninitialized, the initializer may be
     * <code>null</code>.
     *
     * @param  context  Context indicating what line and file this
     *                  field is created at
     * @param  type     Type of the field
     * @param  name     Name of the field
     * @param  init     Expression initializing the field, or
     *                  <code>null</code> if the field is uninitialized
     */
    FieldDecl(FEContext *context, Type *type, string name,
	      Expression *init) : FENode(context)
    {
	types = new TypeList;
	names = new NameList;
	inits = new ExpressionList;

	types->push_back(type);
	names->push_back(name);
	inits->push_back(init);
    }
Example #17
0
void LinkedScene::attributeNames( NameList &attrs ) const
{
	if ( m_linkedScene && !m_atLink )
	{
		m_linkedScene->attributeNames(attrs);
	}
	else
	{
		m_mainScene->attributeNames(attrs);
		
		for ( NameList::iterator it = attrs.begin(); it != attrs.end(); it++ )
		{
			// \todo: remove "*it == linkAttribute" when it's no longer relevant
			if ( *it == linkAttribute || *it == fileNameLinkAttribute || *it == rootLinkAttribute || *it == timeLinkAttribute )
			{
				attrs.erase( it );
				--it;
			}
		}
	}
}
Example #18
0
void MayaScene::readTags( NameList &tags, int filter ) const
{
	tags.clear();

	if ( m_isRoot )
	{
		return;
	}

	if( m_dagPath.length() == 0 )
	{
		throw Exception( "MayaScene::attributeNames: Dag path no longer exists!" );
	}
	
	std::set<Name> uniqueTags;
	std::vector<CustomTagReader> &tagReaders = customTagReaders();
	for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it )
	{
		NameList values;
		it->m_read( m_dagPath, values, filter );
		uniqueTags.insert( values.begin(), values.end() );
	}

	tags.insert( tags.end(), uniqueTags.begin(), uniqueTags.end() );
}
Example #19
0
bool MayaScene::hasAttribute( const Name &name ) const
{
	if ( m_isRoot )
	{
		return false;
	}
	
	if( m_dagPath.length() == 0 )
	{
		throw Exception( "MayaScene::hasAttribute: Dag path no longer exists!" );
	}
	std::vector< CustomAttributeReader > &attributeReaders = customAttributeReaders();
	for ( std::vector< CustomAttributeReader >::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
	{
		NameList names;
		it->m_names( m_dagPath, names );
		if ( std::find(names.begin(), names.end(), name) != names.end() )
		{
			return true;
		}
	}
	return false;
}
Example #20
0
int MaterialList::delete_material(int n) {
  int i, num = mlist->num();
  if (n < 2 || n >= num) 
    return FALSE;

  NameList<Material *> *newlist = new NameList<Material *>;
  for (i=0; i<num; i++) {
    Material *mat = mlist->data(i);
    if (i == n) {
      delete mat;
    } else {
      mat->ind = newlist->num();   
      newlist->add_name(mlist->name(i), mat); 
    }
  }
  delete mlist;
  mlist = newlist;

  // notify displayables that material n has been deleted.  Pass reference
  // to self so that the displayable can get a new material if it's old
  // one was deleted.
  root->delete_material(n, this);
  return TRUE;
}
Example #21
0
int BlockControl::AddBlockName(ReferenceTarget *anim,ReferenceTarget *client, int subNum, NameList &names)

{

MyEnumProc dep;              
anim->DoEnumDependents(&dep);
TSTR nodeName = dep.name;
TSTR np = TSTR(client->SubAnimName(subNum));
TSTR Slash(_T("/"));
nodeName += Slash;
nodeName += np;
      
TSTR *st = new TSTR(nodeName);
names.Append(1,&st,1);
return 1;
}
Example #22
0
/** Generate a temporary file name of format:
  *   TempPrefix_<#>
  * where <#> is based on the current number of temporary file names
  * that have been requested.
  */
FileName GenTempName() {
  // Could also set this to 0, but setting it to size is a better guarantee
  // that the name will be free.
  unsigned int tmpidx = TempFileNames_.size();
  FileName temp( TempPrefix_ + integerToString(tmpidx) );
  while (tmpidx < maxtmpidx_ && Exists(temp)) {
    tmpidx++;
    temp = FileName( TempPrefix_ + integerToString(tmpidx) );
  }
  if (tmpidx >= maxtmpidx_) {
    mprinterr("Internal Error: Too many temporary files. Remove files named '%s*'\n",
              TempPrefix_.c_str());
    return FileName();
  }
  return temp;
}
Example #23
0
void MayaScene::attributeNames( NameList &attrs ) const
{
	if ( m_isRoot )
	{
		return;
	}
	
	if( m_dagPath.length() == 0 )
	{
		throw Exception( "MayaScene::attributeNames: Dag path no longer exists!" );
	}

	attrs.clear();
	for ( std::vector< CustomAttributeReader >::const_iterator it = customAttributeReaders().begin(); it != customAttributeReaders().end(); it++ )
	{
		it->m_names( m_dagPath, attrs );
	}
}
Example #24
0
void LiveScene::attributeNames( NameList &attrs ) const
{
	attrs.clear();
	
	OP_Node *node = retrieveNode();
	
	const std::vector<CustomAttributeReader> &attributeReaders = customAttributeReaders();
	for ( std::vector<CustomAttributeReader>::const_iterator it = attributeReaders.begin(); it != attributeReaders.end(); ++it )
	{
		NameList names;
		it->m_names( node, names );
		/// \todo: investigate using a set here if performance becomes an issue
		for ( NameList::const_iterator nIt = names.begin(); nIt != names.end(); ++nIt )
		{
			if ( std::find( attrs.begin(), attrs.end(), *nIt ) == attrs.end() )
			{
				attrs.push_back( *nIt );
			}
		}
	}
}
Example #25
0
void test_aliases(const NameList &elements)
{
  int count = elements.size();
  OUTPUT << "\n\nTesting Element Topology Aliases...\n";

  for (int i=0; i < count; i++) {
    Ioss::ElementTopology *el_top = Ioss::ElementTopology::factory(elements[i]);
    if (el_top->name() == elements[i]) {
      OUTPUT << "Element: " << std::setw(20) << elements[i]
	   << "(" << el_top->master_element_name() << ") has the following aliases:\n\t";
      for (int j=0; j < count; j++) {
	if (i != j && el_top->is_alias(elements[j])) {
	  OUTPUT << elements[j] << ", ";
	}
      }
      OUTPUT << std::endl;
    }
  }
}
Example #26
0
namespace File {

typedef std::list<FileName> NameList;

static NameList TempFileNames_ = NameList();

// This seems a resonable limit for now
static const unsigned int maxtmpidx_ = 1628634;

static std::string TempPrefix_ = "cpptrajtmp";

/** Generate a temporary file name of format:
  *   TempPrefix_<#>
  * where <#> is based on the current number of temporary file names
  * that have been requested.
  */
FileName GenTempName() {
  // Could also set this to 0, but setting it to size is a better guarantee
  // that the name will be free.
  unsigned int tmpidx = TempFileNames_.size();
  FileName temp( TempPrefix_ + integerToString(tmpidx) );
  while (tmpidx < maxtmpidx_ && Exists(temp)) {
    tmpidx++;
    temp = FileName( TempPrefix_ + integerToString(tmpidx) );
  }
  if (tmpidx >= maxtmpidx_) {
    mprinterr("Internal Error: Too many temporary files. Remove files named '%s*'\n",
              TempPrefix_.c_str());
    return FileName();
  }
  return temp;
}

/** Free the given temporary file name. */
void FreeTempName(FileName const& temp) {
  TempFileNames_.remove( temp );
  if (Exists(temp)) remove(temp.full());
}
 
} /* END namespace File */
Example #27
0
void LiveScene::childNames( NameList &childNames ) const
{
	tbb::mutex::scoped_lock l( s_mutex );
	
	if( m_dagPath.length() == 0 && !m_isRoot )
	{
		throw Exception( "IECoreMaya::LiveScene::childNames: Dag path no longer exists!" );
	}
	
	unsigned currentPathLength = m_dagPath.fullPathName().length();
	MDagPathArray paths;
	getChildDags( m_dagPath, paths );
	
	for( unsigned i=0; i < paths.length(); ++i )
	{
		if( paths[i].hasFn( MFn::kTransform ) )
		{
			std::string childName( paths[i].fullPathName().asChar() + currentPathLength + 1 );
			childNames.push_back( Name( childName ) );
		}
	}
}
Example #28
0
void LiveScene::readTags( NameList &tags, int filter ) const
{
	tags.clear();

	if ( m_isRoot )
	{
		return;
	}

	if( m_dagPath.length() == 0 )
	{
		throw Exception( "IECoreMaya::LiveScene::attributeNames: Dag path no longer exists!" );
	}
	
	std::set<Name> uniqueTags;

	// read tags from ieTags attribute:
	MStatus st;
	MFnDependencyNode fnNode( m_dagPath.node() );
	MPlug tagsPlug = fnNode.findPlug( "ieTags", false, &st );
	if( st )
	{
		std::string tagsStr( tagsPlug.asString().asChar() );
		boost::tokenizer<boost::char_separator<char> > t( tagsStr, boost::char_separator<char>( " " ) );
		for (
			boost::tokenizer<boost::char_separator<char> >::iterator it = t.begin();
			it != t.end();
			++it
		)
		{
			uniqueTags.insert( Name( *it ) );
		}
	}

	// read tags from custom readers:
	std::vector<CustomTagReader> &tagReaders = customTagReaders();
	for ( std::vector<CustomTagReader>::const_iterator it = tagReaders.begin(); it != tagReaders.end(); ++it )
	{
		NameList values;
		it->m_read( m_dagPath, values, filter );
		uniqueTags.insert( values.begin(), values.end() );
	}

	tags.insert( tags.end(), uniqueTags.begin(), uniqueTags.end() );
}
Example #29
0
/** Free the given temporary file name. */
void FreeTempName(FileName const& temp) {
  TempFileNames_.remove( temp );
  if (Exists(temp)) remove(temp.full());
}
 int count() { return _list.count(); }