Jump to content

View more

Image of the Day

I've done more tweaks to my color palette selector. #gamedev #screenshotsaturday #madewithunity https://t.co/aJXrC4ruRg
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

Unable to find interface in namespace

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
5 replies to this topic

#1 fanwars   Members   

1349
Like
0Likes
Like

Posted 16 August 2012 - 07:01 AM

It seems like methods GetInterfaceCount() and GetInterface() are ignoring namespaced interfaces. For example:
psg->SetDefaultNamespace("Base::Control");
psg->RegisterInterface("IComponent");
psg->SetDefaultNamespace("");

//Code pretty much the same code as in the angelscript's game sample
asIObjectType *pt = 0;
bool f = false;
uint otc = pm->GetObjectTypeCount();
for(uint i = 0; i < otc; ++i){
  pt = pm->GetObjectTypeByIndex(i);
  uint ic = pt->GetInterfaceCount();
  for(uint j = 0; j < ic; ++j)
   if(strcmp(pt->GetInterface(j)->GetName(),pintfn) == 0){
	f = true;
	break;
   }
}
if(!f)
  return false;
//...


class SpectatorControl : Base::Control::IComponent{
SpectatorControl(Actor @t){
  @a = t;
}
//...
Actor @a;
};
Probably not a feature? Or am I failing it again..?
I also tried nesting these methods in SetDefaultNamespace(), but it didn't make any difference.
Without namespaces the method above works correctly.

#2 Andreas Jonsson   Moderators   

4625
Like
0Likes
Like

Posted 16 August 2012 - 02:07 PM

I'll investigate this.

Thanks for the report.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Andreas Jonsson   Moderators   

4625
Like
0Likes
Like

Posted 16 August 2012 - 03:22 PM

Which version of AngelScript are you using?

There is a bug fix in the latest WIP that I believe is related to your problem. Basically, when inheriting from a class or interface in a different namespace, the compiler would compile without error, but would ignore the base class.

The fix is in revision 1388, that was checked in on August 9th.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#4 fanwars   Members   

1349
Like
0Likes
Like

Posted 17 August 2012 - 05:36 AM

Allright, updated to r1394 and it works now if I omit namespaces in the name comparison.
So it's
if(strcmp(pt->GetInterface(j)->GetName(),"IComponent") == 0)
instead of
if(strcmp(pt->GetInterface(j)->GetName(),"Base::Control::IComponent") == 0)
Haven't tested yet, but this may cause problems later since there's probably going to be other namespaces with "IComponent" involved in the same script module. But it's working for now, thanks.

#5 Andreas Jonsson   Moderators   

4625
Like
0Likes
Like

Posted 17 August 2012 - 07:13 AM

Great. Thanks for confirming that the bug had indeed already been fixed.

The namespace for an object is obtained with asIObjectType::GetNamespace(), so if needed you can compare this too.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#6 behc   Members   

1369
Like
0Likes
Like

Posted 17 August 2012 - 11:31 AM

//offtopic, can someone up vote first post, my browser hung and after some random clicking to recover/crash it I unintentionally did down vote. And now I see no means to revert this. Sorry for inconvenience




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.