SOLVED GeUserArea Reversed in Arabic Language

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.

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.

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.

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

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

Hello @blastframe,

thank you for closing your topics.

Cheers,
Ferdinand