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

    GeUserArea Reversed in Arabic Language

    Cinema 4D SDK
    s24 python
    3
    5
    530
    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.
    • ?
      A Former User
      last edited by

      Hello,
      I have a plugin that uses a GeUserArea. When I open Cinema 4D with the language set to Arabic, the GeUserArea is reversed, which has broken all of my code determining the GeUserArea positions and mouse interactions. It seems like the x/y origin is now at the top-right corner rather than the top-left. Are there any ways to compensate for this to mimic the UserArea being in left-to-right orientation? Thank you.

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        Hi @blastframe, unfortunately, in Python GeUserArea::IsR2L is not exposed. But you can replicate it yourself.

        import c4d
        import maxon
        import os
        
        def GetDefaultLanguageExtension():
            index = 0
            while True:
                lang = c4d.GeGetLanguage(index)
                if lang is None:
                    break
        
                if lang["default_language"]:
                    return lang["extensions"]
                
                index += 1
        
            raise ValueError("Unable to find the default language")
        
        def IsR2L():
            lang = GetDefaultLanguageExtension()
            resource_path = maxon.Application.GetUrl(maxon.APPLICATION_URLTYPE.RESOURCE_DIR).GetSystemPath()
            str_path = os.path.join(resource_path, "modules", "c4dplugin", f"strings_{lang}", "c4d_r2l.h")
            return os.path.exists(str_path)
        
        def main():
            print(IsR2L())
        
        
        # Execute main()
        if __name__=='__main__':
            main()
        

        Then regarding your assumption about the origin. This is correct when the language is right to left the whole drawing is reversed.
        So it's up to you to reverse your drawing (or inverse x1 and x2 when the drawing IsR2L return True).

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand
          last edited by

          Hello @blastframe,

          without any further questions or replies, we will consider this topic as solved by Wednesday and flag it accordingly.

          Thank you for your understanding,
          Ferdinand

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User
            last edited by

            Sorry @m_adam, I never saw your reply. Thank you! We can close the thread. Thanks @ferdinand !

            1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand
              last edited by

              Hello @blastframe,

              thank you for closing your topics.

              Cheers,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

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