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. merkvilson
    3. Topics
    • Profile
    • Following 0
    • Followers 6
    • Topics 42
    • Posts 114
    • Best 8
    • Controversial 0
    • Groups 0

    Topics created by merkvilson

    • merkvilsonM

      Plugins Search Path from Preferences

      Cinema 4D SDK
      • python • • merkvilson
      3
      0
      Votes
      3
      Posts
      611
      Views

      merkvilsonM

      Thanks @ferdinand

      I wrote this little script for those who want to add one plugin path via the C4D script. I will update it later.
      It will NOT overwrite existing paths. Restart is required for instant result.

      import c4d import os import json def add_plugin_path(path, restart = False): if os.path.exists(path): new_path = path.replace("\\", "/") else: print("Path does not exists") return prefs_folder = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_PREFS) prefs_path = os.path.dirname(prefs_folder) plugins_json_path = os.path.join(prefs_path, 'plugins.json') if os.path.exists(plugins_json_path): with open(plugins_json_path,'r',encoding="utf-8-sig") as plugins: plugins_json_raw = plugins.read() plugins_dict = json.loads(plugins_json_raw) content_dict = plugins_dict["content"]["_impl"]["_data"][1]["content"] # Check if the new path is already in Plugins Path for content_path in content_dict: if os.path.normpath(content_path["_0"]["_path"]) == os.path.normpath(new_path): print(f"'{new_path}' is already in Plugins Path.") return else: plugins_dict = { 'identification': 'plugins', 'content': { 'referenceDataType': 'net.maxon.interface.datadictionary-C', '_impl': { '_mode': 2, '_data': [ { 'dataType': 'net.maxon.datatype.id', 'content': 'searchPaths' }, { 'dataType': '(net.maxon.interface.url-C,bool)', 'isArray': True, 'content': []}]}}} # Create new path content new_content = { "_0": { "referenceIndex": len(plugins_dict["content"]["_impl"]["_data"][1]["content"]), "referenceDataType": "net.maxon.interface.url-C", "_scheme": "file", "_path": new_path, "_authority": {}, "_data": {} }, "_1": True } # Append the new path to the list of paths plugins_dict["content"]["_impl"]["_data"][1]["content"].append(new_content) # Convert the dictionary back to a JSON string updated_plugins_dict = json.dumps(plugins_dict, indent=4) # Write the updated dictionary back to a JSON file with open(plugins_json_path, 'w') as plugins_json: plugins_json.write(updated_plugins_dict) if restart: c4d.RestartMe() custom_path = r"/Path/To/Plugin/Directory/" add_plugin_path(path = custom_path, restart = False)
    • merkvilsonM

      Dialog window with palette

      Cinema 4D SDK
      • python • • merkvilson
      3
      0
      Votes
      3
      Posts
      606
      Views

      merkvilsonM

      Is it possible to save and load the group window in a way similar to the l4d files?

    • merkvilsonM

      Sound effector - Volume

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      458
      Views

      ferdinandF

      Hello @merkvilson,

      Thank you for reaching out to us. Please put more effort into making yourself understood. While we prefer short and precise questions we do not want to guess what users mean.

      I assume you are talking here about the "Sound group" of the Sound Effector. But it has no "Volume" parameter, neither in this "Sound group", nor somewhere else in the object. The catch is here that "Sound" is not just a foldable group. Because we can select it (see screen below), we know it must be data type.

      25f548d1-cc2a-40c8-9e26-af1b080e8da2-image.png

      Being set is here a c4d.SoundEffectorData instance, with it you can control the details in this sound section.

      To discover parameter values, please follow our Python Console: Parameter Drag & Drop manual.

      Cheers,
      Ferdinand

    • merkvilsonM

      C4D crashes when removing node via MSG_MENUPREPARE

      Cinema 4D SDK
      • python • • merkvilson
      3
      0
      Votes
      3
      Posts
      628
      Views

      M

      Hi @merkvilson I would say what you are trying to do is not well supported and MSG_MENUPREPARE was never designed for the current node to be removed.

      The correct way to do so, is to return False within your NodeData.Init method, this way the object is not created and therefor you do not have to remove it.

      Cheers,
      Maxime.

    • merkvilsonM

      Prevent selection

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      598
      Views

      i_mazlovI

      Hi @merkvilson ,

      If I understand your goal correctly, you would like to have your object/tag plugin being "unselectable" in the object manager, such that any previously selected objects would stay selected. Unfortunately, this is not directly possible. What you would like to have is the same behavior of your plugin like it was on a locked layer. There was already an adjacent discussion about this: How to hide object local coordinates.

      However, you can theoretically emulate such behavior by tracking current selection in cinema and catching the event of your plugin being selected. At this point you could "undo" the selection by unselecting your plugin and selecting back what was selected before. However, for that you would need a SceneHook, which is only available in the C++ SDK. What is more, such approach does not sound like something robust and reliable, especially when used with some 3rd party plugins that you're not aware of beforehand.

      Cheers,
      Ilia

    • merkvilsonM

      Material node plugin

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      442
      Views

      ferdinandF

      Hello @merkvilson,

      Thank you for reaching out to us. No, that is not possible and we are currently not planning to change that.

      You cannot implement materials in Python, you cannot implement GraphView (i.e., Xpresso) nodes, and you also cannot implement Nodes API nodes, i.e., Node Editor nodes, including the material nodes.

      But you can do all this in the C++ API Nodes API. But that is not nothing you do on the side, even as an experienced C++ developer.

      What you can do however, is implement a node using the Node Editor itself, i.e., you can just plug something together using existing nodes and the Resource Editor to give your node a more finished feeling. To ship that node, you would have to save it into an asset database and then ship that database.

      Cheers,
      Ferdinand

    • merkvilsonM

      Can't generate Plugin ID

      General Talk
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      670
      Views

      ferdinandF

      Hello @merkvilson,

      Thank you for reaching out to us. This topic is not Cinema 4D SDK related I therefore moved it.

      But I can't log in to my account on the plugin cafe forum. I tried to change the password but it changed only the current account password.

      I assume this means that the reason for not being able to login is that you lost your password. But I am not quite sure what you mean by "current account" password. While this forum cloned the user settings and data from the old forum (Plugin Café), they are still two separate forums. So, if you want to reset your Plugin Café account, you would have to do it on https://plugincafe.maxon.net/. There is no need to keep passwords of both forums 'in sync'.

      I have forcibly logged you out from Plugin Café and manually sent you a password reset e-mail. I also sent you five plugin IDs you can use via PM.

      Cheers,
      Ferdinand

    • merkvilsonM

      GUI Bitmap Button Properties

      Cinema 4D SDK
      • python • • merkvilson
      6
      0
      Votes
      6
      Posts
      983
      Views

      ferdinandF

      @merkvilson said in GUI Bitmap Button Properties:

      @ferdinand said in GUI Bitmap Button Properties:

      How to change BITMAPBUTTON_BACKCOLOR via the Command?

      I am not sure if I am understanding your question here correctly. You want to change the background color of a button after CreateLayout ran? That is not possible. You can flush layout groups and rebuild them at runtime (with buttons with a new color for example). I showed here once the pattern of a dynamic dialog.

      Is it possible to change the background color based on the toggle state?

      Thanks for your answers!

      It depends on how you define 'possible'. Dialogs in itself are static GUIs, you cannot change any of the settings you have set in CreateLayout after the method ran. It does not matter if it is the spacing of a group, the width of a text field, or the background color of a bitmap toggle button.

      What you can do in addition to defining the 2nd icon of the toggle button, is flush a layout group and then rebuild that group with a button which has the color you like. So, you wrap all your buttons in a group, and whenever a button is toggled on or off, you change a color in an array of button colors and then flush the buttons and rebuild them using your array of colors to set the background colors (and you also have to reapply the states then). The posting I linked to in my previous example lines out the details of how to do such dynamic dialog GUIs.

      Cheers,
      Ferdinand

    • merkvilsonM

      c4d.gui.ShowPopupDialog Hide search entry

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      382
      Views

      i_mazlovI

      Hi @merkvilson,

      Please give more information about your setup and provide a code snippet that shows your issue. I'm not able to reproduce your issue using the code snippet below in C4D 2024.2

      There's a c4d.POPUP_ALLOW_FILTERING flag that you can pass to the ShowPopupDialog() function to allow showing the filtering entry in your menu:

      c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300, flags=c4d.POPUP_ALLOW_FILTERING)

      Cheers,
      Ilia

      import c4d def main() -> None: menu = c4d.BaseContainer() for idx in range(5): menu.InsData(c4d.FIRST_POPUP_ID + idx, f"Item {idx}") c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300) # c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=400, y=300, flags=c4d.POPUP_ALLOW_FILTERING) if __name__ == '__main__': main()

      03915845-5d04-4cf4-a79c-1cb342e2aa60-image.png

    • merkvilsonM

      Display points

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      542
      Views

      ferdinandF

      Hello @merkvilson,

      thank you for reaching out to us. It would have been helpful to indicate what you would consider older and the latest version of Cinema 4D in this context, but I assume your problem is caused by you using a pre-S22 TagData plugin which implements TagData.Draw in a S22+ version.

      With S22, the flag TAG_IMPLEMENTS_DRAW_FUNCTION has been added to c4d.plugins.RegisterTagPlugin. You must pass it, when you want the method to be called.

      I would also point out that ptList = op.GetCache().GetAllPoints() is rather risky, as is assumes op to always have a cache which is a point object. Objects can have no caches and caches can contain other things than point objects. You should be a bit more defensive here, even if you intend to only use the plugin 'in this one scenario where this will work'.

      Cheers,
      Ferdinand

    • merkvilsonM

      urllib2.HTTPError: HTTP Error 403

      Cinema 4D SDK
      • python • • merkvilson
      4
      0
      Votes
      4
      Posts
      1.3k
      Views

      ManuelM

      hello,

      we did run a couple of test and seems that the "issue" is on Patreon side.

      HTTP Error 403: Forbidden

      We did try with other url, it work.
      We did try adding header-agent or things like that, it failed.

      They probably changed something on their server that doesn't allow to connect with python with default parameters.
      You have to contact them in order to know what you have to do.

      Cheers
      Manuel

    • merkvilsonM

      DrawMultipleHUDText issue

      Cinema 4D SDK
      • python • • merkvilson
      9
      0
      Votes
      9
      Posts
      1.9k
      Views

      merkvilsonM

      OK. Now I get it. 👌

      Thank you very much! I really appreciate what you've done. 😁

      Have a good day! 💙

      -Merk

    • merkvilsonM

      merge BaceCointainer from one object to another.

      Cinema 4D SDK
      • python • • merkvilson
      6
      0
      Votes
      6
      Posts
      1.1k
      Views

      ManuelM

      yea, sometime a direct approach is better.

      By the way, and for those who are reading this post, you can use the ids found in Ospline.h
      (i'm pretty sure you found them but just in case)

      SPLINEOBJECT_INTERPOLATION_NONE SPLINEOBJECT_INTERPOLATION_NATURAL SPLINEOBJECT_INTERPOLATION_UNIFORM SPLINEOBJECT_INTERPOLATION_ADAPTIVE SPLINEOBJECT_INTERPOLATION_SUBDIV

      Cheers
      Manuel

    • merkvilsonM

      Find C4D's directory without C4D

      Cinema 4D SDK
      • python • • merkvilson
      9
      0
      Votes
      9
      Posts
      4.4k
      Views

      merkvilsonM

      Thanks, buddy! 🙂
      But the problem is that the most current one is not a way to go.

      If the user installed the plugin for R16, then the installer should open R16 itself.

      I'm trying to find and open it by the name, but the name is always different. It can be Cinema 4D / Cinema 4D R16 / Cinema 4D R16 Demo / Cinema 4D Demo / etc.
      Well. This is considerably easier on windows since I can check if it exists by using os.path.exists() function, but I have no Idea how to do this on Mac.

    • merkvilsonM

      How to output BaseBitmap with ShaderData plugin

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      525
      Views

      r_giganteR

      Hi Merkvilson, thanks for reaching out us.

      If the final intent is to simply get BaseBitmapinformation to be returned by your shader, rather than sampling a Xbitmap shader I suggest instead to simply query the color information by using BaseBitmap::GetPixel and eventually apply color space transformation.

      def Output(self, sh, cd) : x = int(cd.p.x * self.bitmap.GetBw()) y = int(cd.p.y * self.bitmap.GetBh()) col = self.bitmap.GetPixel(x, y) return c4d.Vector(float(col[0]/256.0), float(col[1]/256.0), float(col[2]/256.0))

      Best, Riccardo

    • merkvilsonM

      GeDialog.GetType() Missing Link

      Cinema 4D SDK
      • python • • merkvilson
      2
      0
      Votes
      2
      Posts
      478
      Views

      M

      Hi, @merkvilson thanks for pointing this function is private and have no use case since its return the type of a c4d.gui.Gadget which is only used internally.

      Cheers,
      Maxime.

    • merkvilsonM

      3rd party APIs into pyp/pypv file

      Cinema 4D SDK
      • python • • merkvilson
      7
      0
      Votes
      7
      Posts
      4.0k
      Views

      M

      Hi see Cinema 4d R23 MacOs Pip Install Broken.

    • merkvilsonM

      Drive one parameter with another and vice versa

      Cinema 4D SDK
      • python • • merkvilson
      3
      0
      Votes
      3
      Posts
      697
      Views

      merkvilsonM

      Thanks, Andreas! 💙
      This is a really interesting approach.

    • merkvilsonM

      Request UAC from pyp/pypv

      General Talk
      • python • • merkvilson
      4
      0
      Votes
      4
      Posts
      1.2k
      Views

      a_blockA

      Hi,

      no worries, the first line is so big because of a stray "=" on the next line, underlining the first to be interpreted as a heading.

      I'll move this thread to the General Programming & Plugin Discussions category, because in the end C4D does not provide any means to provoke UAC, nor do we deem it necessary inside our API as it is a pretty system specific thing. Yet, the discussion might lead back to C4D related questions, and then I'll either happily move it back or we'll have a new thread in the Cinema 4D Development category.

      In general I think, it would probably be better to convince your users to install the plugin into either the plugins folder in the "user folder" or even (assuming R20+) a completely separate directory added to the users prefs.

      Another thought, while definitely possible with Python, I'd say an update mechanism should change/replace files while the main application is running. After all you can not be completely sure, which files the application decides to lock at certain points off time, in which case your updater would probably run into issues. My recommendation is to rather update by restarting the main app (for C++ it's inevitable anyway).

      Cheers,
      Andreas