COFFEE: PluginTag::GetIcon



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 08:09, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.012 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi
    I want a tag to change its icon depending on the tag settings the user choose - with XL 7 it works fine, but XL9 seems to cache the bitmaps while loading the coffeescript.

    Any trigger I can pull to do this? (Of course, one icon per object)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 10:13, xxxxxxxx wrote:

    ? Sorry, but afaik it´s not possible to dynamically change any icon during runtime (especially not with COFFEE). How did you do it in XL7?

    Never heard it worked anywhere else (except for the instance object or Clothilde Tag, but these are "hardcoded" and this function is not (hopefully 'yet') available via the SDK).

    Can you elaborate?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 11:34, xxxxxxxx wrote:

    These lines did well in c4d R7:

      
    Scene3dTag::GetIcon() {  
         var container = GetContainer();  
         var i = container->GetInt(3004+offset); // retrieve typeID of the tag - depending on it, the tagicon is changed  
         return icons _;  
    }  
    

    I did get a valid container in R7 and it was updated automaticly when I change the settings (looked very nice!).

    In R9 I got an NULL pointer and I had to add this line:
         if (container==NULL) return icons[0];
    Meaning, the container is null, so this function is called without an object, means, without object specific data - I can only guess, but I think R7 calls GetIcon whenever it is needed to draw the icon. R9 seems to cache the icons during startup.

    I am surprised that RL 9 don't support this in C++ either - This is *very* usefull.

    Any suggestion for a workaround? I mean, in my case, I can write 5 types of plugins that only represent an icon and if the maindata is changed the tag is replaced by anotherone.

    Btw - will COFFEE die someday? The documentation never seems to change, but the interpreter has changed in some ways (I had/have some serious problems). In R8 they removed (partially) the feature "reload during run" which is in my eyes a step backward - developing for COFFEE is now a pain since I always have to restart C4D completly.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 11:35, xxxxxxxx wrote:

    what a *great* board: it cut out the brackets: icons is an array and I am accessing the i'th element of it for returing (arraysize=5)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 23:04, xxxxxxxx wrote:

    [ i ] equals italics in the Forum Codes. This gets parsed even when inside a [ CODE ] [ /CODE ] section. They should fix that since code is never italicized or bolded, right?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/10/2004 at 23:27, xxxxxxxx wrote:

    Ah - I forgot - so this here should work:

      
    Scene3dTag::GetIcon() {  
         var container = GetContainer();  
         var intvalue = container->GetInt(3004+offset); // retrieve typeID of the tag - depending on it, the tagicon is changed  
         return icons[intvalue];  
    }  
    

    HaHARRRR!
    Anyway. I want to use different *tagicons* in c4d... :(



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/10/2004 at 03:33, xxxxxxxx wrote:

    Pure evil hack - or - I am getting insane

    What took me 5 lines and 5 minutes to code for R7 took me the last 4 hours for R9.

    This solution seems to work now - although not nice, but it works.

    I have one Super class that derives from PluginTag.
    There are 5 icons, so I have 5 childs of that class - with the only purpose, to show different icons. Whenever a tag is edited, I am removing the same tag and replace it by another tag with the correct icon (multiple allowed doesn't work for different tags...). I also copy the container from the "old" tag to the "new" tag. And then, I am finished.

    My first attempt was to use a hidden tag and a visible for the different icons, because I thought this would use less code. But it prooved me wrong in the end: First, it is even more then the final solution, second I am unable to watch removemessages from tags that are deleted by the user - I would have to remove the invisible tag too. And this won't work because I don't get a f***** message whenever something important is happening.

    I could have done more important things by now...



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/10/2004 at 11:34, xxxxxxxx wrote:

    There's still a problem left:

    If I copy a take with to another object, it can happen that I get two tags there - depending on the icontype.... Any idea how to solve this? Before insertion I would have to check the taglist of the object... But how can I trigger that?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/10/2004 at 08:37, xxxxxxxx wrote:

    I don't think it's possible to stop the user from copying your tag. Your hack is elegant, but I would have to advise against because of problems like this.
    A workaround would be to port the plugin to C++. From R9 there's a GetOmanagerIcon() function for C++ tags. (This change might be why the C.O.F.F.E.E. behaviour has changed.)
    I'll post a request to the developers for a GetOmanagerIcon() in C.O.F.F.E.E.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/10/2004 at 08:56, xxxxxxxx wrote:

    Maybe you are right - but the visual benifit is far more important to my project, since it makes the development *much* easier:
    _<_img border="0" src= "http://www.strange-phenomenom.de/pmwiki-0.4.25/uploads/pluginsc4d/s3d_coffeeicons.png"_>_
    The plugin is a helper for an export plugin to define special values (it exports a special XML file that is imported by a game engine).
    If every icon would be the same, errorfinding within the c4dfile could be really painfull.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/04/2006 at 02:32, xxxxxxxx wrote:

    Hi there,

    just wanted to know whether there is anything like the GetOmanagerIcon() function in C.O.F.F.E.E. by now?
    I also have a plugin-tag for R7 that changed the icon depending on the tag state, but that does not work for R9 (as described in the previous posts).
    Don't want to do it all again in C++, please :-) .. any news from the developers?

    Juergen


Log in to reply