Navigation

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

    pim

    @pim

    10
    Reputation
    220
    Posts
    336
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    pim Follow

    Posts made by pim

    • RE: Scrolling in UA

      Ok, clear. Thank you.

      posted in Cinema 4D Development
      P
      pim
    • RE: Scrolling in UA

      Ok, did some test and what I see is that DrawMsg() is called every time the vertical scroll bar is clicked.
      My understanding was that cinema handles this internally.

      But because DrawMsg() is called I draw all thumbnails and thus not taking into account where the vertical scroll bar is located. So if only the lower 25% must be (is) shown, I redraw all thumbnails.

      Can I calculate which part of the UA must be drawn (where is vertical scroll bar and how large is it)?

      posted in Cinema 4D Development
      P
      pim
    • RE: Scrolling in UA

      I do understand that without some code it is very hard to answer.
      I will try to put only the code, which I think causes the bad performance, in a test plugin.

      Also, you mention "You could maybe parallelize this in C++" and "just draw everything on a GeClipMap". Do you have some examples for these options?
      Also, I do not understand the option "to draw only visible bitmap". All the thumbnails I draw are rectangles (500x500).

      posted in Cinema 4D Development
      P
      pim
    • Scrolling in UA

      I have a folder with a lot of thumbnails.
      I am displaying the thumbnails in a UA with a vertical scrollbar.

      Vertical scrolling is all handled by cinema 4d, I have added no code for scrolling.
      So far so good. For a small number of thumbnails it is working ok, but for more thumbnails the performance is very bad!

      I noticed, after adding some debug statements, that the bad performance seems to be outside DrawMsg().
      DrawMsg() itself seems fast enough, but before anything happens on the screen it takes some time.
      Also when moving the vertical slider, DrawMsg() is called more than once.

      What can I do to increase performance?
      Build my own scrolling functionality?

      Here the basics of DrawMsg()

          def DrawMsg(self, x1, y1, x2, y2, msg):
            
              self.OffScreenOn() 
              self.SetClippingRegion(x1,y1,x2,y2)                    
      
              self.DrawSetPen(c4d.Vector(.4))    
              self.DrawSetTextCol(c4d.Vector(1,1,1), c4d.Vector(.4))   #GeUserArea.DrawSetTextCol(fg, bg)
              self.DrawRectangle(x1, y1, x2, y2)  # Clear UA by Draws the UA rectangle area
      
              # display thumbnails
              ...
              for rows in range(0, self.nrRows):    
                  for colums in range(0, self.nrColumns):  
                      ....
                      self.DrawBitmap(self.bmp, x1, y1, self.thumbnailSize, self.thumbnailSize, 0, 0, 500, 500, c4d.BMP_NORMAL)
                  
              return
      

      Example of the UA,
      13830059-2d7a-4ffb-bb43-149af4a902e8-image.png

      posted in Cinema 4D Development
      P
      pim
    • RE: Content Browser and StrNotFound

      Ok, I found out that the issue is in "c4d_symbols.h"
      There I defined FILE = 1010011.
      After removing the FILE definition, it was ok again.
      Setting FILE = 10002 did not solve the issue.

      So removing it and defining FLE somewhere else, will be ok.

      enum
      {
      ResBasedMenu =  101001,
      MY_CHECKBOX  =  101002,
      CURR_SIZE_STR = 101003,
      NEW_X =         101004,
      NEW_Y =         101005,
      NEW_Z =         101006,
      MY_TEXTBOX =    101007,
      BUTTON_CANCEL = 101008,
      BUTTON_OK =     101009,
      BUTTON_RESET =  1010010,
      // FILE =          1010011,
      // FILE =          10002,
      MYBITMAPBUTTON =1010012,
      IDC_CUSTOM1 = 1010013,
      }
      
      posted in Cinema 4D Development
      P
      pim
    • Content Browser and StrNotFound

      I installed (R23) our plugin (MeshBoolean), but now the File entry of the Content Browser gives a "StrNotFound".
      In R20 it was ok.
      The console shows no warnings or errors.
      Choosing another layout or another Node Space does not help.

      9496d9cc-84ed-46ef-871f-29ea12832bd6-image.png

      But you can still select the 'File' option.
      4282e253-76a7-4314-84ff-6fe844000b44-image.png

      posted in Cinema 4D Development
      P
      pim
    • RE: Different behavior on Mac for Commanddata options

      @m_magalhaes said in Different behavior on Mac for Commanddata options:

      hi,

      thanks for linking the other thread and yes, that's the difference with the mac menu on the osx bar.
      On those menu we can't add the cogwheel so we choose to display the option by default (with was the old behaviors)

      cheers,
      Manuel

      Ok, clear.
      Please mention it in the documentation.

      -Pim

      posted in Cinema 4D Development
      P
      pim
    • RE: Different behavior on Mac for Commanddata options

      What I also notice, is that - on the mac - when I do a customize command and add the plugin as an icon to my interface, the option icon is there and it works like expected.

      posted in Cinema 4D Development
      P
      pim
    • Different behavior on Mac for Commanddata options

      I have a commanddata plugin that has options enabled using the PLUGINFLAG_COMMAND_OPTION_DIALOG flag.
      On the pc everything is ok, I see the option icon in the command and I can select it.
      However, on the mac (Catalina 10.15.6) I do not see the option icon and when I click the command (the commanddata plugin), it goes directly to ExecuteOptionID() and not to Execute()

      Here the stripped code

      import c4d
      import os
      import sys
      from c4d import gui, plugins, bitmaps, documents
      from c4d import utils
      
      
      PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT = 1039980 
      
              
      class MyOptionsDialogSUBSTRACT(gui.GeDialog):
          OK = False
          
          def InitValues(self): 
              return True
              
          def CreateLayout(self):
       
              self.SetTitle("MeshBoolean Command SUBSTRACT Test 01")        
              self.AddDlgGroup(c4d.DLG_OK | c4d.DLG_CANCEL)  
              
              return True
              
          def Command(self, id, msg):
       
              if (id == 1):   
                  self.OK = True
                  self.Close()
                  
              if (id == 2):   
                  self.OK = False
                  self.Close()
                  
              return True
                     
      class MESHBOOLEANSUBSTRACT(plugins.CommandData):
      
          dialog = None
      
          def Execute(self, doc):
              print ("Execute")
              print ("Done test")
              return True         #end plugin
      
          def ExecuteOptionID(self, doc, plugid, subid):
              print ("ExecuteOptionID")
              
              if self.dialog is None: self.dialog = MyOptionsDialogSUBSTRACT()
              self.dialog.Open(dlgtype=c4d.DLG_TYPE_MODAL, pluginid=PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT, defaultw=500, defaulth=120)
              
              print ("OK: ", self.dialog.OK)
              if (self.dialog.OK):
                  self.Execute(doc) 
                  self.dialog.OK = False
              return True
      
      if __name__ == "__main__":
              
          pluginString = "MeshBoolean Command Subtract"    
          bmp = bitmaps.BaseBitmap()
          dir, file = os.path.split(__file__)
          fn = os.path.join(dir, "res", "command subtract.png")
          bmp.InitWith(fn)
          
          okyn = plugins.RegisterCommandPlugin(id=PLUGIN_ID_MESHBOOLEAN_COMMAND_SUBTRACT, str="#$1 " + pluginString, info=c4d.PLUGINFLAG_COMMAND_OPTION_DIALOG, help="MeshBoolean Command", dat=MESHBOOLEANSUBSTRACT(), icon=bmp) 
          if (not okyn): 
              print("Error initializing " + pluginString)
      
      posted in Cinema 4D Development
      P
      pim
    • RE: Compiling my plugin on R23

      Ok, success.
      Copying the plugin folder from pc to mac was the issue!

      posted in Cinema 4D Development
      P
      pim