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. sean
    3. Posts
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 15
    • Best 1
    • Controversial 0
    • Groups 0

    Posts made by sean

    • RE: The console does not correctly recognize object properties

      @zipit

      This plug-in has a twin plug-in that has some properties with the same name, and I suspect that the properties with the same name cause conflicts (even if the ids are different).I made the modification and it is normal now.

      Thank you for your reply

      Cheers

      posted in Cinema 4D SDK
      S
      sean
    • RE: The console does not correctly recognize object properties

      @zipit said in The console does not correctly recognize object properties:

      Hello, thank you for your reply.
      I use C++, in the code, I implemented Init(), and my code can correctly identify the properties, the following two methods are no problem:

      auto a = bc->GetFloat(BEAM_LAMPS_BEAM_LENGTH);
      ApplicationOutput(maxon::String::FloatToString(a));
      

      or

      GeData ge;
      node->GetParameter(BEAM_LAMPS_BEAM_LENGTH, ge, DESCFLAGS_GET::NONE);
      ApplicationOutput(maxon::String::FloatToString(ge.GetFloat()));
      
      posted in Cinema 4D SDK
      S
      sean
    • RE: The console does not correctly recognize object properties

      @Ashton_FCS_PluginDev

      Thank you for your reply. I have tried the method you said, but it didn't work.
      What's more surprising to me is that if I only use the ID of the property, such as xBeamlampsGrid[1001], I can identify it correctly

      posted in Cinema 4D SDK
      S
      sean
    • The console does not correctly recognize object properties

      My program ran fine, but when I dragged the object properties to the console, it returned the wrong value.It's very confusing.
      Please help me, thank you!
      20200301085146.png

      .h file
      enum
      {
          OBeamlampsGrid = 567678546,
          BEAM_LAMPS_GRID_PLANE = 1000,
          BEAM_LAMPS_GRID_PLANE_XZ = 0,
          BEAM_LAMPS_GRID_PLANE_ZY = 1,
          BEAM_LAMPS_GRID_PLANE_XY = 2,
          BEAM_LAMPS_BEAM_LENGTH = 1001,
          BEAM_LAMPS_ANGLE = 1002,
          BEAM_LAMPS_INTENSITY = 1003,
      .....
      
      .res file
      CONTAINER OBeamlampsGrid {
          INCLUDE Obase;
          NAME OBeamlampsGrid;
          GROUP ID_OBJECTPROPERTIES {
              LONG BEAM_LAMPS_GRID_PLANE {
                  CYCLE {
                      BEAM_LAMPS_GRID_PLANE_XZ;
                      BEAM_LAMPS_GRID_PLANE_ZY;
                      BEAM_LAMPS_GRID_PLANE_XY;
                  }
              }
              REAL BEAM_LAMPS_BEAM_LENGTH { DEFAULT 1500.0; CUSTOMGUI REALSLIDER; MIN 500.0; MAX 50000.0; MINSLIDER 500.0; STEP 100.0; UNIT METER; }
              REAL BEAM_LAMPS_ANGLE { DEFAULT 3.0; CUSTOMGUI REALSLIDER; MIN 3.0; MAX 35.0; MINSLIDER 1.0; MAXSLIDER 45.0; STEP 0.5; UNIT DEGREE; }
              REAL BEAM_LAMPS_INTENSITY { DEFAULT 1.0; CUSTOMGUI REALSLIDER; MIN 0.0; MINSLIDER 0.0; MAXSLIDER 100.0; STEP 1.0; UNIT PERCENT; }
      ...
      
      .str file
      STRINGTABLE OBeamlampsGrid {
          OBeamlampsGrid "Beam Lamps Grid";
          BEAM_LAMPS_GRID_PLANE "Plane";
              BEAM_LAMPS_GRID_PLANE_XZ "XZ";
              BEAM_LAMPS_GRID_PLANE_ZY "ZY";
              BEAM_LAMPS_GRID_PLANE_XY "XY";
          BEAM_LAMPS_BEAM_LENGTH "Beam Length";
          BEAM_LAMPS_ANGLE "Beam Angle";
          BEAM_LAMPS_INTENSITY "Beam Intensity";
      ...
      
      posted in Cinema 4D SDK r21 c++
      S
      sean
    • RE: How do I compile a plug-in that is compatible with both R20 and R21

      This way of doing, simply let a person die!

      posted in Cinema 4D SDK
      S
      sean
    • How do I compile a plug-in that is compatible with both R20 and R21

      Hello, I compiled the "cinema4dsdk" project of R21SDK with vs2017 and r21_project_tool. The edited plug-in can be loaded in C4D_R21, but not in C4D_R20.Similarly, the same project that compiled the R20SDK with vs2015, r21_project_tool, cannot be loaded into C4D_R21. Does this mean that my plug-in must be compiled for R20 and R21, respectively?

      posted in Cinema 4D SDK r21 r20 c++
      S
      sean
    • RE: How to properly use OpenSSL for local validation

      @kbar
      Thank you very much for your help!!!

      According to your prompt, I directly copy the OpenSSL compiled by vcpkg to../res/libs/win64, now C4D can load my plug-in.

      Cheers,
      Sean.

      posted in Cinema 4D SDK
      S
      sean
    • How to properly use OpenSSL for local validation

      Hello, I'm writing a local verification signature for Openssl for my plug-in.These functional modules are tested independently, but oddly enough, once compiled with the plug-in's source code, the compiled xdl64 file is not loaded by C4D, even if the plug-in's code does not call these openssl functions.That is, as long as the files are in the plug-in's project folder, C4D cannot load the plug-in.Unless I annotate the Openssl code.

      BIO *bio = BIO_new_file(PUBKEYPATH, "rb");
          if (bio == nullptr)
          {
              std::cout << "The public key file read failed!!!\n";
          }
      
      EC_KEY *ec_key = PEM_read_bio_EC_PUBKEY(bio, NULL, NULL, NULL);
      
      posted in Cinema 4D SDK c++ r21
      S
      sean
    • RE: Unable to insert a key frame for the color attribute of the plugin.

      @m_magalhaes
      Hello, thank you very much for your inspiration. You've been very helpful.

      There is no need to overwrite TranslateDescID(), only two macros HandleDescGetVector and HandleDescSetVector can realize my idea. Thanks again!

      Cheers,
      Sean

      posted in Cinema 4D SDK
      S
      sean
    • RE: Unable to insert a key frame for the color attribute of the plugin.

      @m_magalhaes Hello, your statement is consistent with my imagination, but when you click the little circle in front of the color attribute of the plug-in, how about creating keyframes for both?Can you provide simple code?Ingredient gratitude!

      Cheers,
      Sean

      posted in Cinema 4D SDK
      S
      sean
    • RE: Unable to insert a key frame for the color attribute of the plugin.

      @m_magalhaes Hello, thank you for providing the method, I have already done it. The problem now is that the color properties of the plug-in do route to the color properties of the sub-lights, and the lights have keyframe markers on the timeline, but nothing on the plug-in's timeline.

          def TranslateDescID(self, node, id):
      
              paramID = id[0].id
      
              if paramID == res.AAAAAA_COLOR:
                  light = node.GetDown()
                  if light:
                      desc = light.GetDescription(c4d.DESCFLAGS_DESC_0)
                      if not desc:
                          return False
      
                      descid = c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR))
                      completeid = desc.CheckDescID(descid, None)
      
                      return (True, completeid, light)
      
              return False
      

      微信图片_20191205225400.png 微信图片_20191205225410.png

      posted in Cinema 4D SDK
      S
      sean
    • RE: Unable to insert a key frame for the color attribute of the plugin.

      Please, either pyhton or C++ code, Any ideas would be much appreciated!

      posted in Cinema 4D SDK
      S
      sean
    • Unable to insert a key frame for the color attribute of the plugin.

      Hello, I'm here for help.

      1. I want to insert some keyframes for a color property of the plug-in, and the sub-level light object will change accordingly.The problem now is that I can't insert a keyframe for this color property (the keyframe icon always appears yellow).
      2. In addition, I have another question: where can I listen for the click event of the key frame icon?

      These two problems have been bothering me for two or three days now, either pyhton or C++ code, Any ideas would be much appreciated!

      Thanks,
      Sean

      import c4d
      import os
      
      class res(object):
          AAAAAA_COLOR = 1000
      
      res = res()
      
      def load_bitmap(path):
          path = os.path.join(os.path.dirname(__file__), path)
          bmp = c4d.bitmaps.BaseBitmap()
          if bmp.InitWith(path)[0] != c4d.IMAGERESULT_OK:
              bmp = None
          return bmp
      
      
      class aaaaaaData(c4d.plugins.ObjectData):
      
          PLUGIN_ID = 123566
          PLUGIN_NAME = 'aaaaaa'
          PLUGIN_INFO = 0
          PLUGIN_DESC = 'Oaaaaaa'
          PLUGIN_ICON = load_bitmap('res/icons/aaaaaa.tiff')
          PLUGIN_DISKLEVEL = 0
      
          def __init__(self):
              self.value = c4d.Vector(1, 0, 0)
      
          @classmethod
          def Register(cls):
              return c4d.plugins.RegisterObjectPlugin(
                  cls.PLUGIN_ID, cls.PLUGIN_NAME, cls, cls.PLUGIN_DESC, cls.PLUGIN_INFO,
                  cls.PLUGIN_ICON, cls.PLUGIN_DISKLEVEL)
      
          def Init(self, node):
              #self.InitAttr(node, c4d.Vector(1,0,0), [res.AAAAAA_COLOR])
              node[res.AAAAAA_COLOR] = c4d.Vector(1, 0, 0)
      
              return True
      
          def CreateKey(self, obj, id, value):
              track = obj.FindCTrack(id)
              if not track:
                  track = c4d.CTrack(obj, id)
                  obj.InsertTrackSorted(track)
                  c4d.EventAdd()
      
              curve = track.GetCurve()
              key = curve.AddKey(obj.GetDocument().GetTime())
              if not key:
                  return False
      
              if type(value) == int or type(value) == float:
                  key["key"].SetValue(curve, value)
              else:
                  key["key"].SetGeData(curve, value)
      
              return True
      
          def setColor(self, node, data):
              plugin_color = c4d.DescLevel(res.AAAAAA_COLOR, c4d.DTYPE_COLOR, 0)
              plugin_color_r = c4d.DescLevel(c4d.COLOR_R, c4d.DTYPE_REAL, 0)
              plugin_color_g = c4d.DescLevel(c4d.COLOR_G, c4d.DTYPE_REAL, 0)
              plugin_color_b = c4d.DescLevel(c4d.COLOR_B, c4d.DTYPE_REAL, 0)
              self.CreateKey(node, c4d.DescID(plugin_color, plugin_color_r), data.x)
              self.CreateKey(node, c4d.DescID(plugin_color, plugin_color_g), data.y)
              self.CreateKey(node, c4d.DescID(plugin_color, plugin_color_b), data.z)
      
              light = node.GetDown()
              if light:
                  light[c4d.LIGHT_COLOR] = data
                  light_color = c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_COLOR, 0)
                  light_color_r = c4d.DescLevel(c4d.COLOR_R, c4d.DTYPE_REAL, 0)
                  light_color_g = c4d.DescLevel(c4d.COLOR_G, c4d.DTYPE_REAL, 0)
                  light_color_b = c4d.DescLevel(c4d.COLOR_B, c4d.DTYPE_REAL, 0)
                  self.CreateKey(light, c4d.DescID(
                      light_color, light_color_r), data.x)
                  self.CreateKey(light, c4d.DescID(
                      light_color, light_color_g), data.y)
                  self.CreateKey(light, c4d.DescID(
                      light_color, light_color_b), data.z)
      
          def SetDParameter(self, node, id, data, flags):
              paramID = id[0].id
              if paramID == res.AAAAAA_COLOR:
                  self.setColor(node, data)
                  self.value = data
                  return True, flags | c4d.DESCFLAGS_SET_PARAM_SET
      
          def GetDParameter(self, node, id, flags):
              paramID = id[0].id
              if paramID == res.AAAAAA_COLOR:
                  data = self.value
                  return True, data, flags | c4d.DESCFLAGS_GET_PARAM_GET
      
              return True
      
      
      if __name__ == '__main__':
          aaaaaaData.Register()
      

      未命名图片.png

      posted in Cinema 4D SDK python c++ r19 r20 r21
      S
      sean
    • RE: Cannot modify Lens Effects

      @m_adam Thank you. Thank you very much!

      posted in Cinema 4D SDK
      S
      sean
    • Cannot modify Lens Effects

      I want to change the lens effets Settings, but I can't. I'm using python.
      Why is that? Is there any other way? Can you provide sample code? Thank you very much!

      code:
      
      def main():
          lightObj = op.GetObject()
          
          print "Assignment before: 'col' = ", lightObj[c4d.LIGHT_LENSEFFECTS_GLOW].streak[0]['col']
      
          lightObj[c4d.LIGHT_LENSEFFECTS_GLOW].streak[0]['col'] = c4d.Vector(1, 0, 0)
          
          print "Assignment After: 'col' = ", lightObj[c4d.LIGHT_LENSEFFECTS_GLOW].streak[0]['col']
      
      result:
      
      Assignment before: 'col' =  Vector(0, 0, 0)
      Assignment After: 'col' =  Vector(0, 0, 0)
      
      posted in Cinema 4D SDK
      S
      sean