Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    1. Maxon Developers Forum
    2. matrixloong
    3. Topics
    M
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by matrixloong

    • M

      Frequent updates on Posemorph tag

      Cinema 4D SDK
      • python • • matrixloong
      5
      0
      Votes
      5
      Posts
      902
      Views

      i_mazlovI

      Hi @matrixloong ,

      Please excuse the delayed answer.

      The real-time scenario is one of those that might not go very smoothly in cinema (check the links in my previous message). It was already discussed in the thread: Is it possible to control Camera with keyboard WASD like a FPS game?

      Ferdinand showed there one of the possible solutions to achieve live interactions on the scene using interaction dialog. You can use the simplified version of it below.

      Cheers,
      Ilia

      Run this code from the script manager and select an object in the object manager.

      import c4d, time, math doc: c4d.documents.BaseDocument # The active document class InteractionDialog(c4d.gui.GeDialog): TIMER_DELAY = 40 def CreateLayout(self): return True def InitValues(self): self._doc: c4d.BaseDocument = doc self.SetTimer(InteractionDialog.TIMER_DELAY) self._time = None self._lastTime = None self._angle = 0 return True def Timer(self, msg): # Initialize the time for the first frame a key is being pressed. if self._lastTime is None: self._lastTime = time.time() return None # The delta between now and the last evaluation dt = time.time() - self._lastTime self.DoSomething(dt) self._lastTime = time.time() def DoSomething(self, dt): op: c4d.BaseObject = self._doc.GetActiveObject() if not op: return PI2 = 2 * math.pi angleIncrement = dt * PI2 / 2 self._angle += angleIncrement if self._angle >= PI2: self._angle -= PI2 ml: c4d.Matrix = op.GetMl() bb: c4d.Vector = op.GetRad() pos: c4d.Vector = ml.off pos.x = bb.x * math.sin(self._angle) ml.off = pos op.SetMl(ml) c4d.EventAdd() if __name__ == '__main__': global dialog dialog = InteractionDialog(doc) dialog.Open(c4d.DLG_TYPE_ASYNC)
    • M

      How to control a posemorph tag

      Cinema 4D SDK
      • python • • matrixloong
      4
      0
      Votes
      4
      Posts
      813
      Views

      M

      thanks a lot, your post is working for me.