Set another path for res files?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2009 at 07:37, xxxxxxxx wrote:
The problem with that is he is trying to implement Python (Py4D) plugins and not simply C++ plugins. If he is able to transmit the necessary information (plugin folder, id, type name) from one of these plugins to the C++ code and have it associated with the Py4D plugin then this might be possible.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2009 at 08:13, xxxxxxxx wrote:
3DDesigner: I already tried this out but that does not work because Get() always returns "NULL".
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 03:18, xxxxxxxx wrote:
I am using this exact code myself (working flawlessly), so either you are doing something wrong or......I don´t know why it´s not working for you. My custom folder is inside my plugin`s folder.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 07:21, xxxxxxxx wrote:
@3DDesigner:
You wrote you use it in In C4D_PL_INIT:I would like to call in in PluginStart. Maybe thats the reason why it does not work?
it seems I have problems to explain it well enough, but maybe there is a solution
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 07:35, xxxxxxxx wrote:
Maybe PluginStart() is too early for this type of registration to work. Try it in PluginMessage() with C4DPL_INIT. Hopefully that won't make a difference for registering the python plugins.
But, I see a problem. Samir is only registering a single plugin but you'll be registering any number of plugins. So, this idea of storing 'myres' is going to get tricky - you'll need a myres for every plugin description resource being registered this way in order to free them later in C4DPL_ENDACTIVITY.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 07:40, xxxxxxxx wrote:
yep, I think this is the problem. It must be registered in C4DPL_INIT_SYS as that´s also when plugins check if the resources are available, so I assume it´s fundamental to register the resources at that point in the pipeline.
C4DPL_INIT is maybe too late (was a typo that I wrote it´s the one to be used! it´s INIT_SYS). Is there a special reason why you need to do it in PluginStart() (which is actually called by C4DPL_INIT)?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 08:38, xxxxxxxx wrote:
Because of several initialization stuff of python and the parsing of the python files, I have just the possibility to execute the plugins code at PluginStart.
thats very tricky. hm...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 10:43, xxxxxxxx wrote:
Ok. Hmm, but doesn´t plugin start come AFTER resource registering?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 10:52, xxxxxxxx wrote:
I opened RegisterTag() and saw that a description is registered before - for each RegisterTag().
So I just copied the whole content of the original Registration method and changed the RegisterDescription() method with the given examples here in the thread.
The other thing was just to register another res folder for the whole project (your example) but that does not work either.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 11:12, xxxxxxxx wrote:
sorry, could you repeat? I didn´t understand this.
I´ll be writing a message in german now:
Also, mein Punkt ist eigentlich, dass C4DPL_INIT_SYS vor PluginStart() aufgerufen wird. Es sollte doch daher nicht problematisch sein die Resource dateien in C4DPL_INIT_SYS zu registrieren. Oder versteh ich das jetzt falsch? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 11:25, xxxxxxxx wrote:
Okay, dann antworte ich auch mal auf deutsch
Das Problem ist, das mein Plugin mit mehreren res Ordnern zu tun hat. Zum einen der originale res Ordner von Py4D für die Dialoge wie der Konsole, etc.
Zum anderen muss Py4D aber auch die res Ordner der Python Plugins registrieren. Und da ich erst in PluginStart die Plugins durch den Parser schicken kann und dort erst die Plugins registriere, steht mir auch erst dort die Information zu Verfügung welche Plugins es überhaupt gibt. Und erst dort weiß ich dann überhaupt welche Res Ordner die anderen plugins haben.
Ich habe die RegisterTag() Methode aus den Header Dateien geöffnet und gesehen dass vor jedem RegisterTag eine Description registriert wird. Siehe hier:
>
\> Bool RegisterTagPlugin(LONG id, const String &str;, LONG info, DataAllocator \*npalloc, const String &description;, \> BaseBitmap \*icon, LONG disklevel, void \*emulation) \> { \> if (description.Content() && !RegisterDescription(id,description)) return FALSE; <-------- \> \> TAGPLUGIN np; \> ClearMem(&np;,sizeof(np)); \> FillTagPlugin(&np;,npalloc,info,disklevel,icon,emulation); \> return GeRegisterPlugin(C4DPL_TAG,id,str,&np;,sizeof(np)); \> } \>
Also habe ich zwei Sachen versucht.
1. Ich habe versucht überhaupt einen anderen Res Ordner zu registrieren (mit der Möglichkeit die bei dir ja zu funktionieren scheint).
2. Zum anderen habe ich dann dein Beispiel genommen und RegisterDescription() aus der originalen RegisterTag abgeändert da ich dann dort ja weiß wo sich das Plugin befindet.
Soll ich eventuell mal ein bischen Code posten?
Liebe Grüße,
Shawni
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 14:03, xxxxxxxx wrote:
Ah ok, jetzt verstehe ich.
Ich habe mir gerade mal die GeResource klasse angesehen. Theoretisch sollte es auch in PluginStart() möglich sein die GeResource zu allozieren und zu initialisieren, da man auch neuinitialisieren kann.
Edit: jup habs grad mal probiert. Konnte in PluginStart die resource initialisieren,die LocalResource mit Get() kriegen und RegisterDescription(id,"Ttest",local) hat TRUE zurückgegeben. Scheint also einwandfrei zu funktionieren. Hmm, das ist natürlich komisch dass das bei dir nicht funktioniert. Etwas Code wäre sicherlich hilfreich.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 14:28, xxxxxxxx wrote:
Okay, I will check it with a new project. If this will fail, too, I will post it, maybe I just forgot something.. :
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/03/2009 at 17:01, xxxxxxxx wrote:
yeeeehaaa.. it works. oh, thats really cool.3D Designer.. thx.
I know whats the problem. GeResource::Init failed becaue custom_res should contain the res folder.
In my case I renamed the res folder to custom_res. Oh damn.. but now it works. I already wrapped the TagData and works fine. That will be a cool update.
Thanks again..
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/03/2009 at 16:12, xxxxxxxx wrote:
just wanted to show the plugin. works fine and the user can store the plugin everywhere (in CINEMA4D/plugins/). The NodeData problem is solved, too. TagData also supports BaseDraw draw operations in the method 'draw'.
Here a small video. Just have to support the priorities that this type be changed/read on init() :
>
\> import c4d \> from c4d import plugins \> from c4d import tools \> import os \> \> # be sure to use a unique ID obtained from www.plugincafe.com \> PLUGIN_ID = 1023740 \> \> class LookAtCamera(plugins.TagData) : \> \> def execute(self, tag, doc, op, priority, flags) : \> bd = doc.get_render_basedraw() \> cp = bd.get_scene_camera(doc) \> if cp is None: cp = bd.get_editor_camera() \> \> local = cp.get_mg().off \* (~op.get_up_mg()) - op.get_pos() \> hpb = tools.vector_to_hpb(local) \> hpb.z = op.get_rot().z \> op.set_rot(hpb) \> \> return plugins.EXECUTION_RESULT_OK \> \> if \__name\_\_ == "\__main\_\_": \> dir, file = os.path.split(\__file\_\_) \> icon = c4d.BaseBitmap() \> print icon.init(Filename(os.path.join(dir, "res/cam.tif"))) \> plugins.register_tagdata(id=PLUGIN_ID, name="Py4D LookAtCamera", obj=LookAtCamera, \> desc="lookatcamera", bmp=icon, res=dir, \> flags=plugins.TAG_MULTIPLE|plugins.TAG_EXPRESSION|plugins.TAG_VISIBLE) \>
bye, shawni
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/03/2009 at 06:20, xxxxxxxx wrote:
Hey cool! Glad it finally worked and I could help. Looking forward to the update. I already downloaded the last version but didn´t had time yet to look more into it. Keep it up.