Attrib::DescSet* ads = Attrib::eDSHolder().getDescSet(false, false);
Attrib::Desc* newdesc = Attrib::PF().createDescCopy("MyAttribute");
ads->addDesc(newdesc);
ODMainWin()->applMgr().editAttribSet(false);Desc* DescSet::gtDesc( const DescID& id ) const
{
const int idx = ids_.indexOf( id ); // here!
if ( !descs_.validIdx(idx) )
return 0;
return const_cast<Desc*>( descs_[idx] );
}
Here is a code snippet (in short you need to define two descs, one to provide the attribute input, and the second is your own attribute. Not sure what would happen if you skip the creation of the storeddesc)
Attrib::DescSet* ads = Attrib::eDSHolder().getDescSet(false,false);
// First attribute to define: The seismic input. Maybe you can skip it and see if ads already has such attribute to provide, as it may not be empty: ads->getStoredInput() would return non-null.
Attrib::Desc* storeddesc = Attrib::PF().createDescCopy(Attrib::StorageProvider::attribName() )
Attrib::ValParam* keypar = storeddesc->getValParam( Attrib::StorageProvider::keyStr() );
PtrMan<IOObj> seisioobj = IOM().get( uiSeisPartServer::getDefaultDataID( bool is2d ) );
if ( seisioobj )
{
keypar->setValue( seisioobj->key() );
storeddesc->setHidden( true );
storeddesc->selectOutput( 0 );
storeddesc->setUserRef( seisioobj->name() );
ads->addDesc( storeddesc );
}
// Second attribute to define: Your attribute (check if the key is appropriate)
Attrib::Desc* newdesc = Attrib::PF().createDescCopy( "MyAttribute" );
newdesc->setInput( 0, storeddesc );
newdesc->setUserRef( findFreeRef().buf() );
ads->addDesc( newdesc );
attrsetedcalled_.trigger();
Well, I had to change Line 4 to:
PtrMan<IOObj> seisioobj = IOM().get(ODMainWin()->applMgr().seisServer()->getDefaultDataID(false));newdesc->setUserRef( findFreeRef().buf() );
newdesc->setUserRef("New Attribute");
ODMainWin()->applMgr().editAttribSet(false);
BufferString& BufferString::assignTo( const char* s ) {...}
FilePath fp(GetDocFileDir(""));
BufferString baseurl("file:///");
baseurl.add(fp.fullPath().add("/"));
fp.add("MyHelp.txt");
BufferString tablefnm = fp.fullPath();
return new FracTexHelpProvider(baseurl.buf(), tablefnm.buf());
Attrib::DescSet* ads = Attrib::eDSHolder().getDescSet(false, false);
Attrib::Desc* newdesc = Attrib::PF().createDescCopy("MyAttribute");
ads->addDesc(newdesc);
ODMainWin()->applMgr().editAttribSet(false);