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. C4DS
    • Profile
    • Following 0
    • Followers 1
    • Topics 96
    • Posts 404
    • Best 51
    • Controversial 0
    • Groups 0

    C4DS

    @C4DS

    67
    Reputation
    391
    Profile views
    404
    Posts
    1
    Followers
    0
    Following
    Joined Last Online
    Location Rupelmonde Age 55

    C4DS Unfollow Follow

    Best posts made by C4DS

    • RE: Send message to tooldata

      If I remember correctly we did discuss the other way (from CommandData to ToolData) quite a while ago (see https://developers.maxon.net/forum/topic/10044/13513_using-objectmessage). But I guess using this same technique could still be applicable to your current request.

      Most important is to understand that a CoreMessage is not captured by a ToolData. This type of message can only be captured by a MessageData plugin, where you then could "translate" it into a message that actually is sent to the ToolData.

      What I have been successful in using is, performing following from the "transmitter":

      BasePlugin* tool = FindPlugin(TOOL_PLUGIN_ID, PLUGINTYPE::TOOL);
      if (tool)
      	tool->Message(TOOL_MSG_PREPAREDATA);
      
      

      Where TOOL_PLUGIN_ID is the plugin ID of the ToolData, and TOOL_MSG_PREPAREDATA is a custom defined message, using a unique plugin ID.

      And then using following in the "receiver" ToolData:

      Bool MyToolData::Message(BaseDocument *doc, BaseContainer &data, Int32 type, void *t_data)
      {
      	if (type == TOOL_MSG_PREPAREDATA)
      	{
      		PrepareData();
      	}
      
      	return DescriptionToolData::Message(doc, data, type, t_data);
      }
      
      
      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Shortcuts for buttons from gui.GeDialog

      You cannot assign shortcuts to buttons.
      An alternative solution (which I have used in the past) is to create a CommandData plugin for each button, and let the CommandData::Execute call the button. Or instead of a CommandData plugin you could also create a separate script for each button.
      Either way, these can then be assigned a shortcut.

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Bug on GetActiveObjects() on R20.057?

      @bentraje said in Bug on GetActiveObjects() on R20.057?:

      objSel = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
      print objSel[0]
      print objSel[1]

      Works fine by me.

      I have a cube and a plane primitive. With the two selected, I get a printout for both. No out of range.
      Running 20.057 (on Windows).

      <c4d.BaseObject object called 'Plane/Plane' with ID 5168 at 0x0000004C44847570>
      <c4d.BaseObject object called 'Cube/Cube' with ID 5159 at 0x0000004C448476D0>
      
      

      When I only select a single object then I get an out of range (obviously):

      IndexError: list index out of range
      

      EDIT:
      Hang on, when I make one the child of the other and have both selected, I do get an out of range.
      But this is obvious, since your active objects flag doesn't mention children. As such, you do only have a single parent object selected.

      To take children into account as being detected as selected, you need:

       objSel = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER | c4d.GETACTIVEOBJECTFLAGS_CHILDREN )
      
      
      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Toggle Attribute Manager from Tool to Object Mode and Vice Versa
      import c4d
      
      def main():
          c4d.gui.ActiveObjectManager_SetObject(c4d.ACTIVEOBJECTMODE_OBJECT, op, 0, c4d.ACTIVEOBJECTMANAGER_SETOBJECTS_OPEN)
      
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Recent spam boom

      spam frenzy all over again, lately.

      posted in General Talk
      C4DSC
      C4DS
    • RE: detect the selection of an object

      I have been in need of something similar as well. And if I remember correctly it has been discussed a few years ago.
      Reason is that a ToolData or DescriptionToolData might need to initialize some stuff depending the currently active object. When the user selects a different object in the ObjectManager, the ToolData might need to reinitialize some stuff.

      The solution proposed in the past was to use a MessageData and listen to EVMSG_CHANGE to check if a different object has been selected using the object's "unique" id and then trigger the ToolData by sending a SpecialEvent ... or something.

      It is quite a complex implementation that seems to work, but probably is very error prone.
      I wish we would have had some kind of message telling the active object selection was changed (from inside the ToolData), not via-via. And definitely not using such a hacky and complex solution.
      It has been a while, but I seem to remember that the whole use of the object's unique id was rather flawed as the id didn't exactly seem to be that unique after all.

      Anyway, I am still hoping for a nice solution to detect when user changes the current active object. But it seems to not be possible after all.

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • Best Wishes to the team

      I am less active since a few months, and this will probably not change any time soon, but let that not restrict me for sending Best Wishes for 2021 to everyone of the SDK team.
      Not only to those more present and visible in the forums, but also to those behind the scenes that keep everything running.

      Thank you for your 2020 support and best wishes for 2021.

      posted in General Talk
      C4DSC
      C4DS
    • RE: Calling a Tool (Naming Tool) and Modify the Parameters

      You need to obtain the tool's data in order to be able to modify/set it.
      The callcommand just activates the tool.

      import c4d
      
      def main():
      
          # activate the command
          c4d.CallCommand(1019952)
      
          # change its settings
          nTool = c4d.plugins.GetToolData(doc, 1019952)
          nTool[c4d.ID_CA_JOINT_NAMING_REPLACE] = "_L_"
          nTool[c4d.ID_CA_JOINT_NAMING_REPLACE_WITH] = "_R_"
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Calling a Tool (Naming Tool) and Modify the Parameters

      In the above code "nTool" is a BaseContainer, that won't work.

      I also found the following in the legacy forum

      import c4d
      
      def main():
          
          toolID = 1019952
          c4d.CallCommand(toolID) 
      
          tool=c4d.plugins.FindPlugin(toolID, c4d.PLUGINTYPE_TOOL)  
          tool[c4d.ID_CA_JOINT_NAMING_REPLACE] = "_L_" 
          tool[c4d.ID_CA_JOINT_NAMING_REPLACE_WITH]= "_R_"
          c4d.CallButton(tool, c4d.ID_CA_JOINT_NAMING_REPLACE_APPLY)  
          
          c4d.EventAdd()
      
      

      Another take on modifying the settings, since the "tool" returned from FindPlugin is a BasePlugin which is derived from BaseList2D, exactly what we need for the CallButton

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Unusual Remove() Results

      The geometry of an object is stored in hidden tags (points and polygons, namely)
      These are not visible, nor selectable ... and thus can theoretically not be deleted by user. But you still can access these via Python, or C++. As such, when removing all tags you also remove critical ones, that are needed by the object in order to exist.

      posted in Cinema 4D SDK
      C4DSC
      C4DS

    Latest posts made by C4DS

    • RE: PYP script doesn't show up in extensions

      A file with extension .pyp is not a script but a plugin.
      As far as I understand the script manager will only list scripts with extension .py
      The .pyp file you have should be located in the plugins folder, and should then show up in the Extensions menu of Cinema4D.
      You cannot make a plugin run from within the script manager.

      posted in Bugs
      C4DSC
      C4DS
    • RE: Detect CTRL + RightMouseButton in SceneHook

      Thanks for taking the time to respond, even during the weekend.
      I must say this is quite embarrassing: I already had forgotten about the response in the other thread, and it's not even 3 weeks old.
      I sincerely apologize for wasting your time with this duplicate thread.

      I can confirm the GetInputState is working fine, no need to waste more of your time trying it out.
      Thanks again.

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • Detect CTRL + RightMouseButton in SceneHook

      As the topic title says, I am trying to detect a CTRL + RightMouseButton in a scenehook.
      I managed to get this working in R20, as was discussed here:

      https://developers.maxon.net/forum/topic/14149/detect-ctrl-rightmousebutton-in-scenehook

      Trying the same with version 2023, still using the same code:

      if (msg.GetInt32(BFM_INPUT_CHANNEL) == BFM_INPUT_MOUSERIGHT)
      {
      	BaseContainer keyChannels;
      	if (GetInputEvent(BFM_INPUT_KEYBOARD, keyChannels))
      	{
      		Bool ctrlModifier = (keyChannels.GetInt32(BFM_INPUT_QUALIFIER) & QCTRL) != 0;
      		if (ctrlModifier)
      		{
      			ApplicationOutput("SceneHook - MouseInput: RMB + CTRL was pressed");
      			return true;
      		}
      	}
      }
      

      Unfortunately, the 'GetInputEvent' does not seem to get any result.
      Tested with R25 and version 2023.1.3
      I am using priority value of 2001.

      posted in Cinema 4D SDK r25 c++ 2023
      C4DSC
      C4DS
    • RE: How to detect CTRL being pressed in a GeDialog

      Thanks @m_adam
      I can confirm that the following does work with R20, R23 and 2023

      Int32 MyDialog::Message(const BaseContainer& msg, BaseContainer& result)
      {
      	BaseContainer keyChannels;
      	if (GetInputState(BFM_INPUT_KEYBOARD, QCTRL, keyChannels))
      	{
      		Bool ctrlModifier = (keyChannels.GetInt32(BFM_INPUT_QUALIFIER) & QCTRL) != 0;
      
      
      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • RE: Removing IsolateObjects document

      I was reading the original R20 documentation, when the above question popped up.
      Luckily, the latest online SDK documentation contains a BaseDocument Manual, where it mentions (if I understand it correctly) that KillDocument is to be called to remove a BaseDocument from the list.
      Which means KillDocument should only be used if a BaseDocument was created and inserted in the list (via InsertBaseDocument).

      So, as long as I use IsolateObjects without performing an InsertBaseDocument I should be fine with calling BaseDocument::Free to free the obtained basedocument.
      If I perform an IsolateObjects and subsequently call InsertBaseDocument then I should use KillDocument.
      Correct?

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • Removing IsolateObjects document

      I am using IsolateObjects to copy an object into a separate document in order to render a preview of the isolated object.

      The documentation mentions "The caller owns the pointed document."
      Do I simply need to perform a BaseDocument::Free on the obtained document?
      Or do I need to call KillDocument?

      posted in Cinema 4D SDK r23 r25 c++ 2023 r20
      C4DSC
      C4DS
    • RE: Can we add a folding option for the code block when searching

      see also
      https://developers.maxon.net/forum/topic/13376/search-results

      posted in General Talk
      C4DSC
      C4DS
    • RE: How to detect CTRL being pressed in a GeDialog

      The following works in R20

      Int32 MyDialog::Message(const BaseContainer& msg, BaseContainer& result)
      {
      	BaseContainer keyChannels;
      	if (GetInputEvent(BFM_INPUT_KEYBOARD, keyChannels))
      	{
      		const Int32 qualifier = keyChannels.GetInt32(BFM_INPUT_QUALIFIER);
      		ApplicationOutput("qualifier @", qualifier);
      	}
      

      It shows a value '2' when I press CTRL key, '0' when I let go.

      But in R23 (and above), I don't get any output in console window.

      posted in Cinema 4D SDK
      C4DSC
      C4DS
    • How to detect CTRL being pressed in a GeDialog

      I am in a GeDialog and have a button that is by default disabled.
      I want to enable it as long as CTRL key is being pressed.

      posted in Cinema 4D SDK r23 r25 2023 c++
      C4DSC
      C4DS
    • RE: Notify CommandData Plugin from a PreferenceData Plugin

      I ma not familiar with PreferenceData, but maybe the following might help you:
      https://developers.maxon.net/forum/topic/13379/send-message-to-commanddata

      In short: you let the PreferenceData call your CommandData's ExecuteSubID via a specific unique ID (similarly obtained from plugincafe as a pluginID).
      The CommandData knows if that specific subID is called that it should react to a change of preferences.

      Not the most elegant solution, and maybe there are ways to do this directly from PreferenceData, but as said I am not familiar with it.

      posted in Cinema 4D SDK
      C4DSC
      C4DS