Navigation

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

    gheyret

    @gheyret

    0
    Reputation
    44
    Posts
    97
    Profile views
    0
    Followers
    4
    Following
    Joined Last Online

    gheyret Follow

    Posts made by gheyret

    • RE: HOW TO BIND KEYBOARD SHORTCUT TO PLUGIN

      @m_magalhaes
      Now i know how to solve my problem!
      Thank you for your reply.
      Cheers!

      posted in Cinema 4D Development
      G
      gheyret
    • HOW TO BIND KEYBOARD SHORTCUT TO PLUGIN

      Hi~
      How can i binding a keyboard shortcut to my CommandData plugin.
      I find c4d.gui.AddShortcut() in sdk , but it's add shortcut every time of start c4d.
      I'm not clear exactly what's wrong.

      here is the simple code:

      import c4d
      from c4d import gui, plugins
      
      class CMDData(plugins.CommandData):
          def Execute(self, doc):
              print "Hello Cinema"
              return True
      
      def set_shortcut():
          bc = c4d.BaseContainer()
          bc.SetInt32(c4d.SHORTCUT_PLUGINID, 121212)
          bc.SetLong(c4d.SHORTCUT_ADDRESS, 0)
          bc.SetLong(c4d.SHORTCUT_OPTIONMODE, 0)
          bc.SetLong(0,0)
          bc.SetLong(1,c4d.KEY_F11)
          return gui.AddShortcut(bc)
      
      
      if __name__=='__main__':
          plugins.RegisterCommandPlugin( 121212, "Shortcut Test", 0, None, "", CMDData())
          set_shortcut()
      
      
      posted in Cinema 4D Development
      G
      gheyret
    • RE: PYSIDE FOR C4D PROBLEMS

      @zipit
      I just read this(Connect C4D with Tkinter) post,It does seem to help me
      Thank you again!

      posted in Cinema 4D Development
      G
      gheyret
    • RE: PYSIDE FOR C4D PROBLEMS

      @zipit
      Thanks to replying me!
      And looks like i need to try it in "CommandData plugin ", hope it works~
      Cheers!

      posted in Cinema 4D Development
      G
      gheyret
    • RE: PYSIDE FOR C4D PROBLEMS

      @gheyret
      Is anyone here?

      posted in Cinema 4D Development
      G
      gheyret
    • RE: PYSIDE FOR C4D PROBLEMS

      @gheyret
      Hello~~

      posted in Cinema 4D Development
      G
      gheyret
    • PYSIDE FOR C4D PROBLEMS

      I need to use pyside for my plugin's GUI.
      And i run Pyside in another C4Dthread.
      It is possible to successfully open the Pyside window in C4D.
      but there seem to be some problems.

      -1.When I opened the Pyside window in C4D, the main thread seemed to be blocked, which made it impossible for me to interact with the C4D scene.

      -2.When I first open the Pyside window, it will open normally, but when I close it and open it again, it will flicker on the screen and open it again, that is to say; After closing the window for the first time, I need to click twice to open the window.

      And this is my code example:

      class Window(QMainWindow):
      
          def __init__(self):
              super(Window,self).__init__()
      
              self.InitUI()
      
          def InitUI(self):
              self.setWindowTitle("Pyside Test")
              self.resize(500,400)
              self.move(200,200)
      
              label = QLabel(self)
              label.setText("Pyside Test")
              label.setAlignment(Qt.AlignCenter)
      
      
      class UIThread(C4DThread):
      
          def Main(self):
              # Put in your code here
              # which you want to run
              # in another thread
              
              app = QApplication.instance()
              if not app:
                  app = QApplication([])
      
              win = Window()
              win.show()
              app.exec_()
      
      def main():
          thread = UIThread()
          thread.Start(c4d.THREADMODE_ASYNC, c4d.THREADPRIORITY_NORMAL)
          
          # Do some other operations here
          thread.Wait(True) # Wait until the main method is done
          
          print "Pyside for c4d"
          
          thread.End(True)
      
      posted in Cinema 4D Development
      G
      gheyret
    • RE: PYTHON GENERATOR ISSUES

      @Cairyn
      Thank you for your reply.
      The "odd result" it's means the scene is empty , no objects were generated.
      According to your explanation, I have solved the problem.
      And it's just an exercise code.
      Thank you again !

      posted in Cinema 4D Development
      G
      gheyret
    • PYTHON GENERATOR ISSUES

      I want to use python generator to return cloner object. and clone object "A" on the object "B" surface, but it's return odd result, I don't know what step is wrong.

      And this is my python code here:

      import c4d
      #Welcome to the world of Python
      
      def main():
          cloner = c4d.BaseObject(1018544)
          sphere = c4d.BaseObject(c4d.Osphere).GetClone(0)
          
          plane = c4d.BaseObject(c4d.Oplane).GetClone(0)
          
          bc = c4d.BaseContainer()
          bc.SetLong(c4d.ID_MG_MOTIONGENERATOR_MODE,0)
          bc.SetLink(c4d.MG_OBJECT_LINK,plane)
          
          cloner.SetData(bc)
          sphere.InsertUnder(cloner)
          
          return cloner
      
      
      posted in Cinema 4D Development
      G
      gheyret