Page 1 of 1

Include custom library in plugin?

PostPosted: Tue Dec 20, 2016 1:10 am
by connor
Hi folks,
I'm trying to make a plugin that includes a custom library that I have built, but just once regardless of how many times it's requested in the plugin. I believe that I should be able to use either <depends> or <libraries>.

However, when I try to use either, it doesn't include my custom content.

My plugin folder structure looks like this:
Code: Select all
Documents -> PanotourPro 2 -> plugins ->
- plugin1
   - plug_info.xml
   - ...
- plugin2
   - plug_info.xml
   - ...
- plugin3
   - plug_info.xml
   - ...
- plugintoinclude
   - plugintemplatefile.tmpl


I've tried using the following kinds of requests:
Code: Select all
<depends>
    <template url="../plugintoinclude/plugintemplatefile.tmpl" />
</depends>

Code: Select all
<libraries>
    <file url="../plugintoinclude/plugintemplatefile" />
</libraries>

Code: Select all
<depends>
    <template url="../plugintoinclude/plugintemplatefile" />
</depends>

Code: Select all
<libraries>
    <file url="plugintemplatefile" />
</libraries>


Can anyone clarify the correct way to use this tag to import my own custom plugin? I've seen several uses of KOLORRES:, but given that mine is not part of the Kolor package, naturally that won't work.

For what it may be worth, I'm trying to add the same "<events>" and an "<action>" to each plugin, to ensure that it is included into the plugin if any plugin requires it. Is this where my problem may lie?

Thanks,
Connor

Re: Include custom library in plugin?

PostPosted: Tue Dec 20, 2016 6:35 am
by 360-compunics-com-ni
Hi connor,

i don't know if this is a correct way of doing it, but the following setup works for me.
I'm not aware of any negative side-effects, maybe we get some clarification from the Kolor-team :)

plugins/YourPlugin/plug_info.xml:
Code: Select all
  <templates>
    <template url="template.tmpl" />
    <template url="include_template.tmpl" />
    <template url="includes/another_template.tmpl" />
  </templates>

actions/include_template.tmpl:
Code: Select all
<events name="Include_Events"  keep="true"
   onTourStart="showlog();"
   onnewpano="trace_new_pano(); call_another_action();"
/>
<action name="trace_new_pano">
   trace('msg from includefile, pano=', get(xml.scene) );
</action>

actions/includes/another_template.tmpl:
Code: Select all
<action name="call_another_action">
   trace('msg from 2nd includefile, group=', get(scene[get(xml.scene)].group) );
</action>

The trick is to put the "include_template.tmpl"-file into the "actions"-folder, not in any of the plugin-folders you may have.
There is no need to specify the correct path to the file, as the software looks into this directory anyway.

EDIT:
I just verified that this also works, maybe a good idea to document the use of a custom library:
plugins/YourPlugin/plug_info.xml:
Code: Select all
  <templates>
    <template url="template.tmpl" />
    <template url="include_template.tmpl" />
    <template url="LIBRARY:ServiciosCompunics:includes/another_template.tmpl" />
  </templates>

Re: Include custom library in plugin?

PostPosted: Wed Dec 21, 2016 12:11 am
by connor
Thanks for that 360-compunics-com-ni, that should help a lot.

Could you possibly provide some clarification in regards to how you built the title for the library URL?
How did you get the title `ServiciosCompunics` in there? Where is that used?

Cheers

Re: Include custom library in plugin?

PostPosted: Wed Dec 21, 2016 1:18 am
by 360-compunics-com-ni
As far as i understand this, the library "title" is just a label, i did not use it in my plugin.. in other words, i just put it there to promote my business :/

Re: Include custom library in plugin?

PostPosted: Wed Dec 21, 2016 1:19 am
by connor
Ah, right. I've seen different labels around, like yours, and wasn't sure if it was encoded somewhere. Just so I know that I don't have to add it in somewhere. :)

Thanks!