Navigation

    • Register
    • Login
    • Search
    • Categories
    1. Home
    2. bentraje
    B
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    bentraje

    @bentraje

    9
    Reputation
    504
    Posts
    349
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

    bentraje Follow

    Posts made by bentraje

    • RE: Global variable for Preferences Folder?

      Ah gotcha. Thanks for the heads up! :)

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Global variable for Preferences Folder?

      @C4DS said in Global variable for Preferences Folder?:

      GeGetPluginPath

      Unfortunately, it returns me the following path C:\\Program Files\\Maxon Cinema 4D R21\\corelibs'.
      No worries, I just did the os.path.join(path, "plugins") and it works as expected.

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Global variable for Preferences Folder?

      Lol. Ignore this. Just when I was writing this, stumbled upon the documentation that solves my problem.

      Here is the method.
      c4d.storage.GeGetStartupWritePath()

      posted in Cinema 4D Development
      B
      bentraje
    • Global variable for Preferences Folder?

      Hi,

      Is there a global variable for preferences folder where it automatically retrieves the path of the preferences?

      Currently, I have it hard coded like in the following, but it would be nice a fail-safe of doing it (i.e. global variable).

      def open_folder(path=r'C:\Users\Luke\AppData\Roaming\MAXON\Maxon Cinema 4D R21_64C2B3BD\plugins'): 
          webbrowser.open('file:///' + path)
      
      posted in Cinema 4D Development
      B
      bentraje
    • RE: Iterate over the View/Hotspots of Visual Selector Tag

      RE: This is a limitation you also have with the visual selector

      Not really. You can multiple select hotspots and/or controllers in the visual selector.

      Anyhow, thanks for the response. I guess there is no way around this.

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Iterate over the View/Hotspots of Visual Selector Tag

      @m_magalhaes

      Thanks for the response, especially for the visual selector being old, as currently I find it buggy.
      I check the interaction tag example files here:
      https://help.maxon.net/r21/us/index.html#TINTERACTION

      The main limitation I have found of it is I can only select one control at a time.
      I can't drag and select controls like that of visual selector tag. Correct me if I'm wrong.

      posted in Cinema 4D Development
      B
      bentraje
    • Iterate over the View/Hotspots of Visual Selector Tag

      Hi,

      Is there a way to iterator over the view/hotspots of the visual selector tag?
      According to this thread, it is not possible. But perhaps, there were updates?

      When you move the visual selector to another document, the link field will be lost. My use-case is to automate "inputting" the link field to every hotspots. Something like this:

      for hotspot in hotposts:
          hotspot_name = hotspot.GetName()
          hotspot_obj = doc.SearchObject(hotspot_name) 
          hotspot.SetLink(hotspot_obj)
      
      

      Regards,
      Ben

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Connect C4D with Tkinter (External Application) ?

      @r_gigante

      Thanks for the response and the website reference.
      I was able to work the code with the following revisions:

          def CoreMessage(self, id, bc):
              if id == 1234:
      
                  P1MSG_UN = bc.GetVoid(c4d.BFM_CORE_PAR1)
                  pythonapi.PyCObject_AsVoidPtr.restype = c_int
                  pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]
                  P1MSG_EN = pythonapi.PyCObject_AsVoidPtr(P1MSG_UN)
      
                  # check message and act
                  if (P1MSG_EN == 1):
                      c4d.documents.GetActiveDocument().InsertObject(c4d.BaseObject(c4d.Ocube))
                  elif (P1MSG_EN == 2):
                      c4d.documents.GetActiveDocument().InsertObject(c4d.BaseObject(c4d.Osphere))
      

      Thanks again. Will close this thread now.

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Connect C4D with Tkinter (External Application) ?

      Hi @r_gigante

      Thanks for the response. There is an value error. I tried to solve it but the Cthing is still over my head :(
      It's on line P1MSG_EN1 = pythonapi.PyCapsule_GetPointer(P1MSG_UN1, None)
      with the error of ValueError: PyCapsule_GetPointer called with invalid PyCapsule object

      Just wondering, why do we need to convert the data into C then back into Python ?

      posted in Cinema 4D Development
      B
      bentraje
    • RE: Connect C4D with Tkinter (External Application) ?

      @r_gigante @zipit

      Thanks for the response. Yea, I guess the connection was never made since the socket creation was made after mainloop

      I tried the tkinter code provided by @r_gigante.
      It works, the problem is it only works once. So after clicking next buttons, primitives are not created.
      You can see it here:
      https://www.dropbox.com/s/m2mpk2ctjkizgfc/c4d308_python_socket02.mp4?dl=0

      I can see that the tkinter button works (i.e. prints out the "cube", "plane" etc on every click).
      I guess the problem is the c4d plug-in receives it only once.
      Is there a way to have the SpecialEventAdd() and CoreMessage run every time and not only once?

      posted in Cinema 4D Development
      B
      bentraje