Jump to content

confused with interface prefix parameter.


photo

Recommended Posts

hi:

   Currently i'm working on a editor plugin. but feel confused with the user interface prefix parameter.

in the editor plugin sample when you create a ui.

interface = new UserInterface(replace(source,".cpp",".ui"),getName() + "::"); 

it seems the getName() should match the  namespace of your script. example

if your namespace is AAA and getName string is BBB, in your UI file , no matter which namespace you use , it's always error.

 

is this a bug?

   

it's just that when i have 2 editor plugin which i want to use the same namespace prefix , i can't load the other one. example

in first plugin, namespace is AAA::Tools , second plugin AAA::Modify, in this case, I have to use AAA as the getName string. and as result, I can't load both plugin into the editor since they have same getName() string.

Ideally, i should able to use different getName(), so first plugin return "AAA_Tools". second one return "AAA_Modify".

Link to comment

Hi,
 

it seems the getName() should match the  namespace of your script


We've made two plugins samples, which you can find in attachement. Both of these examples are not using the same name as a namespace.

You need just to unpack contents of this folder into <SDK>/data. So, overall file structure will be looking like this:

  • <SDK>/data/temp/1 - first plugins example
  • <SDK>/data/temp/2 - second plugins example

Please, check them and tell if one of this solutions is suitable for you.

Thanks!

 

plugins_test.zip

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 1 month later...

Thanks for the samples! Now I know namespace more than ever. I have another question about namespace. In this code, 'interface = new UserInterface(replace(source,".cpp",".ui"),getName()+"::");', I don't wanna that prefix 'getName+"::"', and use this code, 'interface = new UserInterface(replace(source,".cpp",".ui"));', is that possible?  If it's possible, what must I do in the '.cpp' and '.ui' file?  

Link to comment

Hi there!

 

Yup, it's possible.

 

One thing you should know if you're working with edtior plugins — each of them has its own unique namespace with the name that was returned from plugins' getName() function. That said, if you want to skip prefixes then you should care about correct namespace names by yourself in .ui file.

Link to comment

Hi,

    I find out the problem.  I need to add the namespace which returned from getName() to the variables in .ui file, but it is still wrong if getName() return NULL. I really wanna is :  I need to call "Unigine::Widgets::Track" in editor plugins, but I don't wanna add any namespace at front of it, like "AAA::Unigine::Widgets::Track", as typeinfo(this) returns. Maybe there is no ways. Anyway, thanks a lot.

Link to comment
×
×
  • Create New...