How to access bitmap format from plugin id

On 18/06/2015 at 11:00, xxxxxxxx wrote:

Hello,

Is there any ways to get the "text" of the plugin ID?
formatID = rd[c4d.RDATA_FORMAT]

this returns plugin id 1100, how do I get the text "FILTER_TIFF" from it?

Thank you! 🙂
Amy

On 18/06/2015 at 11:38, xxxxxxxx wrote:

Perhaps something like:

  
formatID = rd[c4d.RDATA_FORMAT]   
if formatID == c4d.FILTER_TIFF:   
    print "FILTER_TIFF"   

"FILTER_TIFF" is a variable that points to the value 1100, the two are functionally equivalent.
Cheers,

Donovan

On 18/06/2015 at 12:05, xxxxxxxx wrote:

hmm, so I guess the lookup table has to be created manually to get the text of image format?

Thanks for your reply, Donovan 🙂

On 18/06/2015 at 12:16, xxxxxxxx wrote:

You might be able to load the string shown in the Render Settings using LoadResource: https://developers.maxon.net/docs/Cinema4DPythonSDK/help/modules/c4d.plugins/GeResource/index.html?highlight=resource#GeResource.LoadString

But my initial tests have been unsuccessful.

On 18/06/2015 at 12:31, xxxxxxxx wrote:

I also tried GetString, which was not working. I guess a lookup table is the only way for now.

On 19/06/2015 at 06:33, xxxxxxxx wrote:

Hi,

You can get a bitmap format name from its ID using plugins.FindPlugin() to retrieve the bitmap loader/saver plugin instance:

import c4d
from c4d import plugins
  
...
formatPlug = plugins.FindPlugin(formatID)
formatName = "UNKNOWN"
if formatPlug is not None:
  formatName = formatPlug.GetName()
  print formatName

plugins.FindPlugin() returns a BasePlugin instance which is also a BaseList2D that has the GetName() method.