PluginTag GetIcon and a strange NIL-error
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/11/2003 at 18:13, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.207
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;---------
Hello.
I'm totally new to COFFEE-programming. I do have a solid knowledge of C++ and Java, so coding per se isn't a problem - but my experience with the C4D coding environment is absolutely zilch though.
Having said that, here's the beef:
I've got stuck on two very silly problems. I'm almost done coding a small plugin using the tagplugin.cof framework as a template, and everything has been going surprisingly smooth... BUT
1. Using the GetIcon() doesn't work out as expected. I copied some code from the main() in compiler.cof to load and setup the bitmap, using the suggested PLUGINTAG_ICON_SIZE constant and temporarily an icon from DiTools since I know it displays properly (to avoid any simple image format problems) - but the icon just turns out as a black square in the OM.
2. When my plugin initialises during C4D startup, the console reports "(7) NIL is not a function". This also happens when I add the tag to an object. It continues to operate properly though, so it doesn't seem to cause any damage. If I reload the plugin from the console, this error does not occur. I suspect there is some function definition or overload missing somewhere, but I can't figure it out.
So, if anyone has any suggestions how to solve these problems, I'd appreciate it. Given my brief history as a coffee programmer, I'm pretty sure it's mainly a question of stupid newbie mistakes. I have scanned the SDK intensely but only drawn blanks.
Thanks in advance! -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/11/2003 at 11:19, xxxxxxxx wrote:
Don't know about 2 -- perhaps you've misspelt the name of a member function or something..?
This seems to work for icons though:
var map; MyPluginTag::GetIcon() { return map; } main() { map = new(BaseBitmap,24,24); var file = GeGetRootFilename(); if (!file) return; file->RemoveLast(); file->AddLast("ico.tif"); // <- put your filename here map->Load(file); ...
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/11/2003 at 14:26, xxxxxxxx wrote:
Thanks, philronan. Problem 2 went away by itself when I decided to rewrite the code again from scratch - so whatever it was, it is no more.
The icon code is exactly what I've been using... Have to give it another shot. Might be something dumb like a path error or something like that. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/11/2003 at 15:02, xxxxxxxx wrote:
Make sure "map" is defined as a global variable (else the garbage routine might throw it away), and is initialized with suitable dimensions (e.g., new(BaseBitmap,24,24) )
Also, I seem to remember once having some trouble with LZW-compressed TIFF files saved from Photoshop (..or maybe I just imagined it!). Anyway, try saving the icon as an uncompressed TIFF if nothing else works.
Good luck
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/11/2003 at 02:11, xxxxxxxx wrote:
I've solved it now, Phil... It was simply a matter of calling Register() at the right place, i.e. AFTER all the bitmap handling was completed. The first version I used (from Compiler.cof) called Register() earlier, but allthough that seems to work with a menu plugin, it appears not to do so with a tag plugin.
Anyway, it works just fine now. Thanks for your help!