Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Is GetParameter(c4d.MPBTYPE_DPI) broken?

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 661 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 13/02/2018 at 16:24, xxxxxxxx wrote:

      I've been using a script in R18 for sometime now and went to use it today in R19 and ran into an error. When I get to this command, GetParameter(c4d.MPBTYPE_DPI), it returns 0.0 which then throws up an error i my script as that measurement can't be zero.

      I tried it again in R18 and it works fine. Went back to 19 and it fails to return the dpi.

      Is this a known issue?

      thanks,
      .del

      Texture = c4d.bitmaps.BaseBitmap()
      width, height = Texture.GetSize()
      mbp = c4d.bitmaps.MultipassBitmap.AllocWrapper(Texture)
      dpi = mbp.GetParameter(c4d.MPBTYPE_DPI)
      width = width/float(dpi)
      height = height/float(dpi)
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 15/02/2018 at 02:51, xxxxxxxx wrote:

        Hi del, thanks for writing us.

        Given that MPBTYPE_DPI is marked as private and accessing the data pointed by this ID is not granted to be valid nor officially allowed, in R19 the default value of 72dpi (which I presume was returned in your execution on R18) is no longer returned. It's instead returned 0.0 or the dpi value set by MultipassBitmap::SetParameter(MPBTYPE_DPI).

        Best, Riccardo

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 15/02/2018 at 07:45, xxxxxxxx wrote:

          What do you mean that it's marked as private? I'm looking at the SDK and I don't see anything that says not to use it. How do we know if we can or can't use things listed in the SDK?

          MultipassBitmap.GetParameter(id)

          Uses a description ID as a key into the container, and retrieves the stored data.
          Parameters:| id  (int) – 
          Parameter ID:

          MPBTYPE_SHOW bool Determines if the layer will be shown in the external render window. (The Cinema 4D renderer modifies this value itself.)
          MPBTYPE_SAVE bool Determines if the layer is saved with the image or not if SAVEBIT_USESELECTEDLAYERS is used.
          MPBTYPE_PERCENT float The blend parameter, between 0.0 and 1.0.
          MPBTYPE_BLENDMODE int The blend mode. (LAYER_NORMAL, LAYER_DISSOLVE etc. from from bplayer.h.)
          MPBTYPE_COLORMODE int The color mode: See COLORMODE.
          MPBTYPE_BITMAPTYPE int The bitmap type. Cannot be set with MultipassBitmap.SetParameter().
          MPBTYPE_NAME str The layer name. Only a PaintLayerBmp or PaintLayerFolder can have a name.
          MPBTYPE_DPI int The resolution in DPI.
          MPBTYPE_USERID int The user ID for the layer. In the renderer this is VPBUFFER_xxx.
          MPBTYPE_USERSUBID int The user sub-ID for the layer. In the renderer this is used for blend channels for instance.
          MPBTYPE_FORCEBLEND int The special mode used to force blend layers.

          _<_t_>__/t>

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 15/02/2018 at 09:09, xxxxxxxx wrote:

            Hi del, looks like the you've hit an inconsistency in our Python documentation which will be fixed in the future.

            I apologize for any inconvenience cause so far,  but if you check in the C++ doc (as pointed out in my previous post) you see that it's actually marked as private.

            Best, Riccardo

            1 Reply Last reply Reply Quote 0
            • First post
              Last post