• 0 Votes
    3 Posts
    807 Views
    S
    @ferdinand Thank you, I got the script I wanted using the answer code!
  • Get alls ID User Data of Object

    Cinema 4D SDK 2024 python windows
    2
    0 Votes
    2 Posts
    474 Views
    ferdinandF
    Hey @pyxelrigger, Thank you for reaching out to us. BaseList2D.GetUserDataContainer should do the trick. Cheers, Ferdinand
  • Comparing render settings

    Cinema 4D SDK windows 2024 python
    2
    0 Votes
    2 Posts
    756 Views
    ferdinandF
    Hello @hoganXYZ, Welcome to the Maxon developers forum and its community, it is great to have you with us! Getting Started Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules. Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment. Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support. Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads. It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions. About your First Question While you obviously have put a lot of effort in your posting, the somewhat brutal truth is that it is too long and does not pose a specific question, or that it is at least very hard to pinpoint them. I would recommend having a look at the support procedures lined out above and the section for how to ask good questions. The briefer the better and the question should be ideally in the first sentence. So, when I read here a bit between the lines, you want to access the data container of a node, for example for the render data. You somehow landed there on description access, but that is a little bit backwards way of doing things. I tried to untangle a few things in the code example shown below. I hope this helps. Cheers, Ferdinand Code """Demonstrates how to access the parameter data of a node at the example of the active render data. """ import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ # Get the active render data for the document. rdata: c4d.documents.RenderData = doc.GetActiveRenderData() # Each scene element (e.g. objects, materials, tags, etc.) has a a data container and a # description. The data container holds the actual data, while the description holds the # UI data for that data. We get here an instance of the data container, i.e., all changes # made to #data will be reflected in the actual render data. data: c4d.BaseContainer = rdata.GetDataInstance() description: c4d.Description = rdata.GetDescription(c4d.DESCFLAGS_DESC_0) # Data containers are realized as c4d.BaseContainer objects. They are a list of key-value pairs # where the key is an integer and the value is one of the many types a BaseContainer can hold. # For these integer values then exist symbols to make things a bit more readable. We can iterate # over a container, but unlike for descriptions this will not unfold nested containers. for key, value in data: print(f"Key: {key}, Type: {type(value)}, Value: {value}") # Key: 6014, Type: <class 'int'>, Value: 1 # Key: 5008, Type: <class 'float'>, Value: 1280.0 # Key: 5009, Type: <class 'float'>, Value: 720.0 # Key: 6004, Type: <class 'float'>, Value: 72.0 # Key: 6006, Type: <class 'float'>, Value: 1.7777777777777777 # ... # Or we can use a symbol to access a value directly, here with __getitem__ syntax (the square # brackets) unique to Python (there are also GetInt32, GetFloat, GetString, etc. methods). print(f"{data[c4d.RDATA_XRES] = }") # data[c4d.RDATA_XRES] = 1280.0 print ("\n", "-" * 100, "\n") # A description is the somewhat GUI counter part to the data container of a node, it holds for # example the name of a parameter (in the currently active language) and also its API symbol # (when there is one, not all parameters have one). Descriptions also expose more data "entries" # then a data container, as we will also see here things like groups and basic parameters shared # by all nodes. descData: c4d.BaseContainer # The data container of the currently yielded parameter. pid: int # The ID of the currently yielded parameter. # Iterate over all parameters in the description, this will unfold nested data. for descData, pid, _ in description: label: str = descData[c4d.DESC_NAME] # Get the label of the parameter as seen in Cinema 4D. # One of the more fringe values of a description are the API symbol strings. Here we better # use a getter function as there is no guarantee that these symbols are actually present. apiSymbol: str | None = descData.GetString(c4d.DESC_IDENT, None) if not apiSymbol: apiSymbol = descData.GetString(c4d.DESC_IDENT_ORIGIN, None) # The value for the parameter can be accessed with the yielded DescID and and the node itself, # (not the data container). We use here C4DAtom.GetParameter() which in Python is again # wrapped as __getitem__ (in this case as GeListNode.__getitem__ for some reason and not as # C4DAtom.__getitem__). # We have to be however a bit cautious as not all parameter values are wrapped for Python # and accessing them will then fail. Other than the data container, the description will # relentlessly iterate over everything in that node, intended for public consumption or not. value: any = "Inaccessible in Python" try: value: any = rdata[pid] except Exception as e: pass print (f"Label: {label}, API Symbol: {apiSymbol}, Value: {value}") # Label: Basic Properties, API Symbol: Obaselist, Value: Inaccessible in Python # Label: Icon, API Symbol: ID_BASELIST_ICON_SETTINGS_GROUP, Value: Inaccessible in Python # Label: Icon File / ID, API Symbol: ID_BASELIST_ICON_FILE, Value: # Label: Icon Color, API Symbol: None, Value: 0 # Label: Color, API Symbol: ID_BASELIST_ICON_COLOR, Value: Vector(1, 0.9, 0.4) # For more details about description containers see: # https://developers.maxon.net/docs/py/2024_4_0a/modules/c4d/Description/ # What to do here from here on out is up to you. You could technically accumulate all # parameter values that have an API symbol and then store them in a dictionary but the # question would be "why?" as that is not how Cinema 4D works. If you just want to store # aka serialize some Cinema 4D data, you should HyperFile as it can store things like a # BaseContainer directly. # # Finally, regarding the unsupported types when accessing parameters, you will run into # this a lot when working with Redshift as it does not expose its specialized data # types to Python. The somewhat counter intuitive answer to that is then multi-level # DescIDs. Parameters can be nested in Cinema 4D and while you might not have access to # # myNode[c4d.RS_FANCY_PARAM] # # which returns FancyType, you might have access to # # myNode[c4d.RS_FANCY_PARAM, c4d.RS_STRING_COMPONENT] # # I.e., a string component within the FancyType. This is a bit of a rabbit hole and you # should open a new thread if you run into this issue. if __name__ == '__main__': main() Full output (yikes!): Key: 6014, Type: <class 'int'>, Value: 1 Key: 5008, Type: <class 'float'>, Value: 1280.0 Key: 5009, Type: <class 'float'>, Value: 720.0 Key: 6004, Type: <class 'float'>, Value: 72.0 Key: 6006, Type: <class 'float'>, Value: 1.7777777777777777 Key: 6025, Type: <class 'int'>, Value: 1 Key: 6002, Type: <class 'int'>, Value: 0 Key: 6008, Type: <class 'float'>, Value: 1.0 Key: 5300, Type: <class 'int'>, Value: 1036219 Key: 5002, Type: <class 'int'>, Value: 1 Key: 6016, Type: <class 'int'>, Value: 1 Key: 6017, Type: <class 'int'>, Value: 1 Key: 6018, Type: <class 'int'>, Value: 1 Key: 6019, Type: <class 'int'>, Value: 1 Key: 6020, Type: <class 'int'>, Value: 0 Key: 6021, Type: <class 'int'>, Value: 0 Key: 6027, Type: <class 'int'>, Value: 0 Key: 5007, Type: <class 'int'>, Value: 2 Key: 5010, Type: <class 'int'>, Value: 0 Key: 5011, Type: <class 'float'>, Value: 320.0 Key: 5012, Type: <class 'float'>, Value: 240.0 Key: 5013, Type: <class 'float'>, Value: 1.0 Key: 5014, Type: <class 'float'>, Value: 1.0 Key: 5016, Type: <class 'int'>, Value: 1 Key: 5081, Type: <class 'int'>, Value: 1 Key: 5017, Type: <class 'c4d.BaseTime'>, Value: <c4d.BaseTime object at 0x7f8364192080> Key: 5018, Type: <class 'c4d.BaseTime'>, Value: <c4d.BaseTime object at 0x7f8364190a00> Key: 5019, Type: <class 'int'>, Value: 0 Key: 5020, Type: <class 'float'>, Value: 30.0 Key: 5021, Type: <class 'int'>, Value: 0 Key: 5022, Type: <class 'int'>, Value: 1 Key: 5024, Type: <class 'int'>, Value: 1 Key: 5025, Type: <class 'int'>, Value: 15 Key: 5026, Type: <class 'int'>, Value: 15 Key: 5027, Type: <class 'float'>, Value: 0.001 Key: 5028, Type: <class 'float'>, Value: 0.5 Key: 28508, Type: <class 'float'>, Value: 2.0 Key: 28509, Type: <class 'float'>, Value: 2.0 Key: 28510, Type: <class 'int'>, Value: 0 Key: 5061, Type: <class 'float'>, Value: 1.0 Key: 5063, Type: <class 'int'>, Value: 5 Key: 5064, Type: <class 'int'>, Value: 1 Key: 5033, Type: <class 'int'>, Value: 1100 Key: 5035, Type: <class 'int'>, Value: 0 Key: 5076, Type: <class 'int'>, Value: 1 Key: 5077, Type: <class 'int'>, Value: 0 Key: 5036, Type: <class 'int'>, Value: 0 Key: 5038, Type: <class 'int'>, Value: 0 Key: 5039, Type: <class 'int'>, Value: 0 Key: 5219, Type: <class 'int'>, Value: 0 Key: 5040, Type: <class 'int'>, Value: 0 Key: 5065, Type: <class 'int'>, Value: 320 Key: 5066, Type: <class 'int'>, Value: 240 Key: 5041, Type: <class 'str'>, Value: Key: 5043, Type: <class 'int'>, Value: 36 Key: 5044, Type: <class 'float'>, Value: 0.0 Key: 5045, Type: <class 'float'>, Value: 6.283185307179586 Key: 5046, Type: <class 'int'>, Value: 19 Key: 5047, Type: <class 'float'>, Value: 1.5707963267948966 Key: 5048, Type: <class 'float'>, Value: -1.5707963267948966 Key: 5052, Type: <class 'int'>, Value: 1 Key: 5079, Type: <class 'int'>, Value: 0 Key: 5080, Type: <class 'int'>, Value: 0 Key: 5069, Type: <class 'int'>, Value: 1 Key: 5071, Type: <class 'float'>, Value: 0.1 Key: 5078, Type: <class 'float'>, Value: 0.5 Key: 5070, Type: <class 'int'>, Value: 0 Key: 5072, Type: <class 'int'>, Value: 0 Key: 5073, Type: <class 'int'>, Value: 2 Key: 5074, Type: <class 'int'>, Value: 1 Key: 5082, Type: <class 'int'>, Value: 0 Key: 5075, Type: <class 'int'>, Value: 1 Key: 5200, Type: <class 'int'>, Value: 1 Key: 5201, Type: <class 'int'>, Value: 1 Key: 5606, Type: <class 'int'>, Value: 0 Key: 5211, Type: <class 'int'>, Value: 0 Key: 9200, Type: <class 'int'>, Value: 0 Key: 5212, Type: <class 'int'>, Value: 0 Key: 5202, Type: <class 'int'>, Value: 1 Key: 5203, Type: <class 'int'>, Value: 1106 Key: 5205, Type: <class 'int'>, Value: 0 Key: 5206, Type: <class 'str'>, Value: Key: 5207, Type: <class 'int'>, Value: 1 Key: 5208, Type: <class 'int'>, Value: 2 Key: 5210, Type: <class 'int'>, Value: 1 Key: 5401, Type: <class 'int'>, Value: 1 Key: 5301, Type: <class 'int'>, Value: 0 Key: 5603, Type: <class 'float'>, Value: 1.0 Key: 5604, Type: <class 'int'>, Value: 1 Key: 6023, Type: <class 'int'>, Value: 0 Key: 6024, Type: <class 'int'>, Value: 1 Key: 5502, Type: <class 'float'>, Value: 128.0 Key: 6013, Type: <class 'int'>, Value: 1 Key: 6012, Type: <class 'int'>, Value: 1 Key: 7002, Type: <class 'int'>, Value: 1 Key: 7000, Type: <class 'int'>, Value: 64 Key: 7001, Type: <class 'int'>, Value: 64 Key: 7003, Type: <class 'int'>, Value: 0 Key: 7004, Type: <class 'int'>, Value: 0 Key: 7005, Type: <class 'int'>, Value: 0 Key: 7006, Type: <class 'int'>, Value: 0 Key: 7007, Type: <class 'int'>, Value: 0 Key: 7008, Type: <class 'int'>, Value: 0 Key: 6003, Type: <class 'int'>, Value: 0 Key: 6005, Type: <class 'int'>, Value: 1 Key: 28507, Type: <class 'c4d.bitmaps.ColorProfile'>, Value: sRGB IEC61966-2.1 Key: 5204, Type: <class 'c4d.BaseContainer'>, Value: <c4d.BaseContainer object at 0x7f836ac2c700> Key: 5702, Type: <class 'c4d.BaseContainer'>, Value: <c4d.BaseContainer object at 0x7f836ac2ca80> Key: 8000, Type: <class 'int'>, Value: 0 Key: 8018, Type: <class 'int'>, Value: 0 Key: 8001, Type: <class 'int'>, Value: 2 Key: 8023, Type: <class 'int'>, Value: 1 Key: 8002, Type: <class 'int'>, Value: 0 Key: 8003, Type: <class 'int'>, Value: 0 Key: 8004, Type: <class 'int'>, Value: 2 Key: 8007, Type: <class 'int'>, Value: 0 Key: 8005, Type: <class 'int'>, Value: 4 Key: 8006, Type: <class 'int'>, Value: 0 Key: 8013, Type: <class 'int'>, Value: 0 Key: 8014, Type: <class 'c4d.Vector'>, Value: Vector(1, 0, 0) Key: 8015, Type: <class 'c4d.Vector'>, Value: Vector(0, 1, 0) Key: 8009, Type: <class 'int'>, Value: 0 Key: 8011, Type: <class 'int'>, Value: 0 Key: 8010, Type: <class 'int'>, Value: 0 Key: 8012, Type: <class 'int'>, Value: 0 Key: 8017, Type: <class 'int'>, Value: 0 Key: 8021, Type: <class 'int'>, Value: 1 Key: 8022, Type: <class 'int'>, Value: 0 Key: 8500, Type: <class 'int'>, Value: 0 Key: 8501, Type: <class 'int'>, Value: 0 Key: 8502, Type: <class 'int'>, Value: 0 Key: 9000, Type: <class 'int'>, Value: 1 Key: 9001, Type: <class 'int'>, Value: 1 Key: 9002, Type: <class 'int'>, Value: 1 Key: 9003, Type: <class 'int'>, Value: 0 Key: 9004, Type: <class 'int'>, Value: 1 Key: 10002, Type: <class 'int'>, Value: 1 Key: 10003, Type: <class 'c4d.InExcludeData'>, Value: <c4d.InExcludeData object at 0x7f836ac0f300> Key: 10004, Type: <class 'int'>, Value: 0 Key: 10006, Type: <class 'int'>, Value: 0 Key: 10007, Type: <class 'int'>, Value: 1 Key: 10008, Type: <class 'int'>, Value: 0 Key: 10011, Type: <class 'int'>, Value: 1 Key: 10012, Type: <class 'int'>, Value: 1 Key: 10013, Type: <class 'int'>, Value: 1 Key: 10015, Type: <class 'int'>, Value: 1 Key: 10000, Type: <class 'int'>, Value: 0 Key: 10001, Type: <class 'NoneType'>, Value: None Key: 1041671, Type: <class 'c4d.Vector'>, Value: Vector(1, 0.9, 0.4) data[c4d.RDATA_XRES] = 1280.0 ---------------------------------------------------------------------------------------------------- Label: Basic Properties, API Symbol: Obaselist, Value: Inaccessible in Python Label: Icon, API Symbol: ID_BASELIST_ICON_SETTINGS_GROUP, Value: Inaccessible in Python Label: Icon File / ID, API Symbol: ID_BASELIST_ICON_FILE, Value: Label: Icon Color, API Symbol: None, Value: 0 Label: Color, API Symbol: ID_BASELIST_ICON_COLOR, Value: Vector(1, 0.9, 0.4) Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: ID_BASELIST_ICON_PRESET_BUTTONS, Value: Inaccessible in Python Label: Name, API Symbol: ID_BASELIST_NAME, Value: My Render Setting Label: Layer, API Symbol: ID_LAYER_LINK, Value: None Label: Node Space, API Symbol: ID_BASELIST_NODESPACE_ADD_REMOVE_GROUP, Value: Inaccessible in Python Label: , API Symbol: ID_BASELIST_NODESPACE_ADD_REMOVE_BUTTONS, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Save, API Symbol: RDATA_GLOBALSAVE, Value: 1 Label: Enable Multi-Pass Rendering, API Symbol: RDATA_MULTIPASS_ENABLE, Value: 1 Label: Enable Stereoscopic Rendering, API Symbol: RDATA_STEREO, Value: 0 Label: Material Override, API Symbol: RDATA_MATERIAL_OVERRIDE, Value: 0 Label: , API Symbol: None, Value: Inaccessible in Python Label: Renderer, API Symbol: RDATA_RENDERENGINE, Value: 1036219 Label: Enable Magic Bullet Looks, API Symbol: None, Value: 0 Label: None, API Symbol: None, Value: Inaccessible in Python Label: Enable Post Effects Pass, API Symbol: None, Value: 1 Label: Output, API Symbol: RDATA_GROUP_OUTPUT, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: RDATA_PRESET, Value: None Label: , API Symbol: RDATA_PRESETTEXT, Value: Preset: 1280 x 720 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: Width, API Symbol: RDATA_XRES, Value: 1280.0 Label: Width, API Symbol: RDATA_XRES_VIRTUAL, Value: 1280.0 Label: , API Symbol: RDATA_SIZEUNIT, Value: 0 Label: , API Symbol: None, Value: Label: Height, API Symbol: RDATA_YRES, Value: 720.0 Label: Height, API Symbol: RDATA_YRES_VIRTUAL, Value: 720.0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Lock Ratio, API Symbol: RDATA_LOCKRATIO, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Adapt Data Rate, API Symbol: RDATA_ADAPT_DATARATE, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Resolution, API Symbol: RDATA_PIXELRESOLUTION, Value: 72.0 Label: Resolution, API Symbol: RDATA_PIXELRESOLUTION_VIRTUAL, Value: 72.0 Label: , API Symbol: RDATA_PIXELRESOLUTIONUNIT, Value: 1 Label: , API Symbol: None, Value: Label: Image Resolution: , API Symbol: RDATA_INFOTEXT, Value: 1280 x 720 Pixel Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Warning:, API Symbol: RDATA_PIXELRESOLUTION_WARNING, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Render Region, API Symbol: RDATA_RENDERREGION, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Left Border, API Symbol: RDATA_RENDERREGION_LEFT, Value: 0 Label: Copy from IRR, API Symbol: RDATA_FROMIRR, Value: Inaccessible in Python Label: , API Symbol: RDATA_FROMIRR_STATICTEXT, Value: Label: , API Symbol: None, Value: Label: Top Border, API Symbol: RDATA_RENDERREGION_TOP, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Right Border, API Symbol: RDATA_RENDERREGION_RIGHT, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Bottom Border, API Symbol: RDATA_RENDERREGION_BOTTOM, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Film Aspect, API Symbol: RDATA_FILMASPECT, Value: 1.7777777777777777 Label: , API Symbol: RDATA_FILMPRESET, Value: 3 Label: , API Symbol: None, Value: Label: Pixel Aspect, API Symbol: RDATA_PIXELASPECT, Value: 1.0 Label: , API Symbol: RDATA_PIXELPRESET, Value: 1 Label: , API Symbol: None, Value: Label: Frame Rate, API Symbol: RDATA_FRAMERATE, Value: 30.0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Frame Range, API Symbol: RDATA_FRAMESEQUENCE, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: From, API Symbol: RDATA_FRAMEFROM, Value: <c4d.BaseTime object at 0x7f836ab60500> Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: To, API Symbol: RDATA_FRAMETO, Value: <c4d.BaseTime object at 0x7f836ab60500> Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Frame Step, API Symbol: RDATA_FRAMESTEP, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Fields, API Symbol: RDATA_FIELD, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Frames: , API Symbol: RDATA_FRAMEOUTPUT, Value: 1 (from 0 to 0) Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Annotations, API Symbol: RDATA_HELPTEXT, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Save, API Symbol: RDATA_GROUP_SAVE, Value: Inaccessible in Python Label: Regular Image, API Symbol: RDATA_GROUP_SAVEIMAGE, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Save, API Symbol: RDATA_SAVEIMAGE, Value: 1 Label: , API Symbol: None, Value: Label: File, API Symbol: RDATA_PATH, Value: Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: Format, API Symbol: RDATA_FORMAT, Value: 1100 Label: , API Symbol: None, Value: Label: Warning:, API Symbol: RDATA_FORMAT_WARNING, Value: Label: , API Symbol: None, Value: Label: Options..., API Symbol: RDATA_SAVEOPTIONS, Value: <c4d.BaseList2D object called with ID 300001078 at 140202407763456> Label: , API Symbol: None, Value: Label: Depth, API Symbol: RDATA_FORMATDEPTH, Value: 0 Label: , API Symbol: None, Value: Label: Name, API Symbol: RDATA_NAMEFORMAT, Value: 0 Label: , API Symbol: None, Value: Label: Image Color Profile, API Symbol: RDATA_IMAGECOLORPROFILE, Value: sRGB IEC61966-2.1 Label: , API Symbol: None, Value: Label: Alpha Channel, API Symbol: RDATA_ALPHACHANNEL, Value: 0 Label: , API Symbol: None, Value: Label: Straight Alpha, API Symbol: RDATA_STRAIGHTALPHA, Value: 0 Label: , API Symbol: None, Value: Label: Separate Alpha, API Symbol: RDATA_SEPARATEALPHA, Value: 0 Label: , API Symbol: None, Value: Label: 8 Bit Dithering, API Symbol: RDATA_TRUECOLORDITHERING, Value: 1 Label: , API Symbol: None, Value: Label: Include Sound, API Symbol: RDATA_INCLUDESOUND, Value: 0 Label: , API Symbol: None, Value: Label: Bake View Transform, API Symbol: RDATA_BAKE_OCIO_VIEW_TRANSFORM, Value: 0 Label: , API Symbol: None, Value: Label: QuickTime VR Options, API Symbol: RDATA_GROUP_QUICKTIMEVR, Value: Inaccessible in Python Label: Generate File, API Symbol: RDATA_VRGENERATE, Value: 0 Label: Horizontal Steps, API Symbol: RDATA_HSTEPS, Value: 36 Label: Start Angle, API Symbol: RDATA_HSTART, Value: 0.0 Label: End Angle, API Symbol: RDATA_HEND, Value: 6.283185307179586 Label: Vertical Steps, API Symbol: RDATA_VSTEPS, Value: 19 Label: Start Angle, API Symbol: RDATA_VSTART, Value: 1.5707963267948966 Label: End Angle, API Symbol: RDATA_VEND, Value: -1.5707963267948966 Label: Default X Resolution, API Symbol: RDATA_VRDEFAULTX, Value: 320 Label: Default Y Resolution, API Symbol: RDATA_VRDEFAULTY, Value: 240 Label: Multi-Pass Image, API Symbol: RDATA_GROUP_SAVEMULTIPASSIMAGE, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Save, API Symbol: RDATA_MULTIPASS_SAVEIMAGE, Value: 1 Label: , API Symbol: None, Value: Label: File, API Symbol: RDATA_MULTIPASS_FILENAME, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: Format, API Symbol: RDATA_MULTIPASS_SAVEFORMAT, Value: 1106 Label: , API Symbol: None, Value: Label: Warning:, API Symbol: RDATA_MULTIPASS_SAVEFORMAT_WARNING, Value: Label: , API Symbol: None, Value: Label: Options..., API Symbol: RDATA_MULTIPASS_SAVEOPTIONS, Value: <c4d.BaseList2D object called with ID 300001078 at 140202407771904> Label: , API Symbol: None, Value: Label: Depth, API Symbol: RDATA_MULTIPASS_SAVEDEPTH, Value: 1 Label: , API Symbol: None, Value: Label: Multi-Layer File, API Symbol: RDATA_MULTIPASS_SAVEONEFILE, Value: 1 Label: , API Symbol: None, Value: Label: Layer Name as Suffix, API Symbol: RDATA_MULTIPASS_SUFFIX, Value: 1 Label: , API Symbol: None, Value: Label: User Defined Layer Name, API Symbol: RDATA_MULTIPASS_USERNAMES, Value: 0 Label: , API Symbol: None, Value: Label: Straight Alpha, API Symbol: RDATA_MULTIPASS_STRAIGHTALPHA, Value: 0 Label: , API Symbol: None, Value: Label: Compositing Project File, API Symbol: RDATA_GROUP_PROJECTFILE, Value: Inaccessible in Python Label: Save, API Symbol: RDATA_PROJECTFILE, Value: 0 Label: Target Application, API Symbol: RDATA_PROJECTFILETYPE, Value: 0 Label: Relative, API Symbol: RDATA_PROJECTFILELOCAL, Value: 0 Label: Include Timeline Marker, API Symbol: RDATA_PROJECTFILEMARKER, Value: 0 Label: Include 3D Data, API Symbol: RDATA_PROJECTFILEDATA, Value: 0 Label: Save FBX File, API Symbol: RDATA_PROJECTFILEFBX, Value: 0 Label: Save Alembic File, API Symbol: RDATA_PROJECTFILEABC, Value: 0 Label: Save Project File..., API Symbol: RDATA_PROJECTFILESAVE, Value: Inaccessible in Python Label: Multi-Pass, API Symbol: RDATA_GROUP_MULTIPASS, Value: Inaccessible in Python Label: Separate Lights, API Symbol: RDATA_MULTIPASS_LIGHTS, Value: 0 Label: Mode, API Symbol: RDATA_MULTIPASS_LIGHTMODE, Value: 2 Label: Shadow Correction, API Symbol: RDATA_MULTIPASS_SHADOWCORRECTION, Value: 0 Label: Anti-Aliasing, API Symbol: RDATA_GROUP_ANTIALIASING, Value: Inaccessible in Python Label: Anti-Aliasing, API Symbol: RDATA_ANTIALIASING, Value: 1 Label: , API Symbol: None, Value: Label: Min Level, API Symbol: RDATA_AAMINLEVEL, Value: 0 Label: , API Symbol: None, Value: Label: Max Level, API Symbol: RDATA_AAMAXLEVEL, Value: 2 Label: , API Symbol: None, Value: Label: Threshold, API Symbol: RDATA_AATHRESHOLD, Value: 0.1 Label: , API Symbol: None, Value: Label: Use Object Properties, API Symbol: RDATA_AAOBJECTPROPERTIES, Value: 1 Label: , API Symbol: None, Value: Label: Consider Multi-Passes, API Symbol: RDATA_AACONSIDERMULTIPASSES, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: Filter, API Symbol: RDATA_AAFILTER, Value: 0 Label: , API Symbol: None, Value: Label: Custom Size, API Symbol: RDATA_AACUSTOMFILTERSIZE, Value: 0 Label: , API Symbol: None, Value: Label: Filter Width, API Symbol: RDATA_AAFILTERSIZEX, Value: 2.0 Label: , API Symbol: None, Value: Label: Filter Height, API Symbol: RDATA_AAFILTERSIZEY, Value: 2.0 Label: , API Symbol: None, Value: Label: Clip Negative Component, API Symbol: RDATA_AACLIPNEGATIVE, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: MIP Scale, API Symbol: RDATA_AAMIPGLOBAL, Value: 0.5 Label: , API Symbol: None, Value: Label: Small Fragments, API Symbol: RDATA_SMALLFRAGMENTS, Value: 0 Label: Material Override, API Symbol: RDATA_GROUP_OVERRIDEMAT, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Custom Material, API Symbol: RDATA_MATERIAL_OVERRIDE_LINK, Value: None Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Mode, API Symbol: RDATA_MATERIAL_OVERRIDE_EXCLUSION_MODE, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Materials, API Symbol: RDATA_MATERIAL_OVERRIDE_EXCLUSION_LIST, Value: <c4d.InExcludeData object at 0x7f836ab66f80> Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Preserve, API Symbol: RDATA_GROUP_OVERRIDEMAT_PRESERVE, Value: Inaccessible in Python Label: Diffuse Color, API Symbol: RDATA_MATERIAL_OVERRIDE_COLOR, Value: 0 Label: Luminance, API Symbol: RDATA_MATERIAL_OVERRIDE_LUMINANCE, Value: 0 Label: Transparency, API Symbol: RDATA_MATERIAL_OVERRIDE_TRANS, Value: 1 Label: Reflectance, API Symbol: RDATA_MATERIAL_OVERRIDE_REFL, Value: 0 Label: Bump, API Symbol: RDATA_MATERIAL_OVERRIDE_BUMP, Value: 1 Label: Normal, API Symbol: RDATA_MATERIAL_OVERRIDE_NORM, Value: 1 Label: Alpha, API Symbol: RDATA_MATERIAL_OVERRIDE_ALPHA, Value: 1 Label: Displacement, API Symbol: RDATA_MATERIAL_OVERRIDE_DSPL, Value: 1 Label: The node materials are not supported., API Symbol: RDATA_GROUP_OVERRIDEMAT_PRESERVE_STR, Value: Label: Options, API Symbol: RDATA_GROUP_OPTIONS, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Transparency, API Symbol: RDATA_OPTION_TRANSPARENCY, Value: 1 Label: Ray Threshold, API Symbol: RDATA_THRESHOLD, Value: 0.001 Label: , API Symbol: None, Value: Label: Refraction, API Symbol: RDATA_OPTION_REFRACTION, Value: 1 Label: Ray Depth, API Symbol: RDATA_RAYDEPTH, Value: 15 Label: , API Symbol: None, Value: Label: Reflection, API Symbol: RDATA_OPTION_REFLECTION, Value: 1 Label: Reflection Depth, API Symbol: RDATA_REFLECTIONDEPTH, Value: 5 Label: , API Symbol: None, Value: Label: Shadow, API Symbol: RDATA_OPTION_SHADOW, Value: 1 Label: Shadow Depth, API Symbol: RDATA_SHADOWDEPTH, Value: 15 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Limit Reflections to Floor/Sky, API Symbol: RDATA_LIMITREFLECTION, Value: 0 Label: Level of Detail, API Symbol: RDATA_LOD, Value: 1.0 Label: , API Symbol: None, Value: Label: Blurriness, API Symbol: RDATA_ENABLEBLURRY, Value: 1 Label: Global Brightness, API Symbol: RDATA_GLOBALBRIGHTNESS, Value: 1.0 Label: , API Symbol: None, Value: Label: Limit Shadows to Soft, API Symbol: RDATA_LIMITSHADOW, Value: 0 Label: Motion Scale, API Symbol: RDATA_MOTIONLENGTH, Value: 128.0 Label: , API Symbol: None, Value: Label: Cache Shadow Maps, API Symbol: RDATA_CACHESHADOWMAPS, Value: 0 Label: , API Symbol: None, Value: Label: Active Object Only, API Symbol: RDATA_ACTIVEOBJECTONLY, Value: 0 Label: , API Symbol: None, Value: Label: Default Light, API Symbol: RDATA_AUTOLIGHT, Value: 1 Label: , API Symbol: None, Value: Label: Textures, API Symbol: RDATA_TEXTURES, Value: 1 Label: , API Symbol: None, Value: Label: Show Texture Errors, API Symbol: RDATA_TEXTUREERROR, Value: 1 Label: , API Symbol: None, Value: Label: Volumetric Lighting, API Symbol: RDATA_VOLUMETRICLIGHTING, Value: 1 Label: , API Symbol: None, Value: Label: Use Display Tag LOD, API Symbol: RDATA_USELOD, Value: 0 Label: , API Symbol: None, Value: Label: Render HUD, API Symbol: RDATA_SHOWHUD, Value: 0 Label: , API Symbol: None, Value: Label: Render Doodle, API Symbol: RDATA_RENDERDOODLE, Value: 1 Label: , API Symbol: None, Value: Label: Sub Polygon Displacement, API Symbol: RDATA_ENABLESPD, Value: 1 Label: , API Symbol: None, Value: Label: Post Effects, API Symbol: RDATA_POSTEFFECTS_ENABLE, Value: 1 Label: , API Symbol: None, Value: Label: Identical Noise Distribution, API Symbol: RDATA_NOISE_LOCK, Value: 0 Label: , API Symbol: None, Value: Label: Subsurface Scattering, API Symbol: RDATA_SSS, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Inaccessible in Python Label: Bucket Sequence, API Symbol: RDATA_BUCKETSEQUENCE, Value: 0 Label: , API Symbol: None, Value: Label: Automatic Size, API Symbol: RDATA_AUTOMATICBUCKETSIZE, Value: 1 Label: , API Symbol: None, Value: Label: Bucket Width, API Symbol: RDATA_BUCKETSIZEX, Value: 64 Label: , API Symbol: None, Value: Label: Bucket Height, API Symbol: RDATA_BUCKETSIZEY, Value: 64 Label: , API Symbol: None, Value: Label: Stereoscopic, API Symbol: RDATA_GROUP_STEREO, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: Calculate Stereoscopic Images, API Symbol: RDATA_STEREO_CALCRESULT, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Single Channel, API Symbol: RDATA_STEREO_SINGLECHANNEL, Value: 1 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Non-Stereoscopic Image, API Symbol: RDATA_STEREO_CALCULATE_ORIGINAL, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Use Folder for Saving, API Symbol: RDATA_STEREO_SAVE_FOLDER, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Channels, API Symbol: RDATA_STEREO_CHANNELS, Value: 2 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Mode, API Symbol: RDATA_STEREO_MODE, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Additional Parallax (pixel), API Symbol: RDATA_STEREO_PARALLAX, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Swap Left/Right, API Symbol: RDATA_STEREO_SWAP, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Anaglyph, API Symbol: RDATA_GROUP_STEREO_ANA, Value: Inaccessible in Python Label: , API Symbol: None, Value: Inaccessible in Python Label: System, API Symbol: RDATA_STEREO_ANAGLYPH_SYSTEM_FULL, Value: 2 Label: System, API Symbol: RDATA_STEREO_ANAGLYPH_SYSTEM_NON_FULL, Value: 0 Label: , API Symbol: None, Value: Inaccessible in Python Label: Left, API Symbol: RDATA_STEREO_ANAGLYPH_COL_LEFT, Value: Vector(1, 0, 0) Label: Right, API Symbol: RDATA_STEREO_ANAGLYPH_COL_RIGHT, Value: Vector(0, 1, 0) Label: Method, API Symbol: RDATA_STEREO_ANAGLYPH_METHOD, Value: 4 Label: Side-by-Side, API Symbol: RDATA_GROUP_STEREO_SBS, Value: Inaccessible in Python Label: Alignment, API Symbol: RDATA_STEREO_SBS_ALIGN, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Left Mirror X, API Symbol: RDATA_STEREO_SBS_LEFT_MX, Value: 0 Label: Left Mirror Y, API Symbol: RDATA_STEREO_SBS_LEFT_MY, Value: 0 Label: , API Symbol: None, Value: Label: Right Mirror X, API Symbol: RDATA_STEREO_SBS_RIGHT_MX, Value: 0 Label: Right Mirror Y, API Symbol: RDATA_STEREO_SBS_RIGHT_MY, Value: 0 Label: , API Symbol: None, Value: Label: Interlaced, API Symbol: RDATA_GROUP_STEREO_INTER, Value: Inaccessible in Python Label: Type, API Symbol: RDATA_STEREO_INTERLACED_TYPE, Value: 0 Label: , API Symbol: None, Value: Label: , API Symbol: None, Value: Label: Team Render, API Symbol: RDATA_GROUP_NET, Value: Inaccessible in Python Label: Single Image, API Symbol: RDATA_GROUP_NET_SINGLEIMAGE, Value: Inaccessible in Python Label: Distribute Subsurface Caches, API Symbol: RDATA_NET_CACHES_SSS, Value: 1 Label: Distribute Ambient Occlusion Caches, API Symbol: RDATA_NET_CACHES_AO, Value: 1 Label: Distribute Irradiance Caches, API Symbol: RDATA_NET_CACHES_GI, Value: 1 Label: Distribute Light Mapping Caches, API Symbol: RDATA_NET_CACHES_LM, Value: 1 Label: Distribute Radiosity Map Caches, API Symbol: RDATA_NET_CACHES_RM, Value: 0 Label: Magic Bullet Looks, API Symbol: None, Value: <c4d.documents.BaseVideoPost object called Magic Bullet Looks/Magic Bullet Looks with ID 1054755 at 140202407811328> Label: Magic Bullet Looks, API Symbol: None, Value: <c4d.documents.BaseVideoPost object called Magic Bullet Looks/Magic Bullet Looks with ID 1054755 at 140202407811584> Label: Redshift, API Symbol: None, Value: <c4d.documents.BaseVideoPost object called Redshift/Redshift with ID 1036219 at 140202407811072> Label: Redshift, API Symbol: None, Value: <c4d.documents.BaseVideoPost object called Redshift/Redshift with ID 1036219 at 140202407811328> Label: Post Effects Pass, API Symbol: None, Value: <c4d.BaseList2D object called Post Effects/Post Effects with ID 300001048 at 140202407811584> Label: Post Effects, API Symbol: None, Value: <c4d.BaseList2D object called Post Effects/Post Effects with ID 300001048 at 140202407811072>
  • 0 Votes
    5 Posts
    1k Views
    K
    @John_Do said in CommandData.Message() implementation and Message concepts: seasoned baselislienhanMO
  • 0 Votes
    1 Posts
    881 Views
    No one has replied
  • issue with inserting fieldlayers in r2024

    Moved Bugs windows python 2024
    4
    0 Votes
    4 Posts
    2k Views
    M
    Hey thanks for the report, I indeed fix one issue with the InsertLayer but in your case it was another one, sadly there is no workaround for you (except the one you found). The fix will be provided in the next release. Cheers, Maxime.
  • 0 Votes
    2 Posts
    519 Views
    M
    Hi @pyxelrigger there is no real way to execute a script outside of Cinema 4D without Cinema 4D. The only option is to execute c4dpy which is a complete Cinema 4D instance run as a python interpreter. For more information about it, please read c4dpy manual. Note that you have the same limitation as a standalone Cinema 4D so you can't execute multiple c4dpy instance at the same time or they need to be in different folders. Except that note that tkinter does not come by default with Cinema 4D, so you will need to install manually and don't really officially support, so it may or may not works, but from our personal experience in the SDK team, it should work. Cheers, Maxime.
  • 0 Votes
    2 Posts
    803 Views
    ferdinandF
    Hey @ThomasB, Thank you for reaching out to us. Without your code we cannot really help you, we are not the oracle of Delphi There are many things which could go wrong in your plugin. But in general what you are doing is correct; add a dummy point object with your snap points to your cache, when you want to introduce special snapping points for your custom generator object. Snapping onto the points of the returned geometry should work out of the box (but snapping sometimes struggles a bit with deep caches). There is however only limited support for adding special snapping points, as it is not really intended to add you own snap logic in that manner. The snapping module both in Python and C++ does not allow you to implement your own snapping logic, you can just read some data. You should also keep in mind that the snapping is an older part of Cinema 4D which has its flaws. You should check if your problem also does occur when you try to snap onto the converted cache of your object (current state to object). If that is the case, you know it is not something your plugin does, but simply the fact that the snapping struggles with that specific geometry/scenario. Cheers, Ferdinand
  • 0 Votes
    3 Posts
    714 Views
    pyxelriggerP
    Thanks, buddy! It worked. To be honest, I never really understood what Message(c4d.MSG_UPDATE) was all about, and now ExecutePasses is new to me
  • 0 Votes
    4 Posts
    1k Views
    ferdinandF
    Good to hear!
  • 2024.4.0 SDK Release

    News & Information news cinema 4d c++ python sdk
    7
    2
    1 Votes
    7 Posts
    10k Views
    ferdinandF
    Hey, so, I fixed this now, in the sense that the TOC is now back in these classic API type and module pages. [image: 1713774613887-c2f5944c-90e4-49f9-a194-44f7be96b281-image-resized.png] I renamed the old a bit wordily named "Functions Signatures" and "Functions Documentation" to Overview and Functions (or Methods for classes) . Opposed to the old pre 2024.3 TOCs (which were completely broken in many ways), these categories now also show up in the TOC: [image: 1713775118359-adcc5c03-d5fd-4f97-b206-7d69cef2d81e-image-resized.png] [image: 1713774646259-bc7bac63-8959-487a-8aa7-81e729fcc92a-image-resized.png] The old Types and Inheritance section has been merged into root element as I do not see a good reason why it should appear in the middle of the page. The obvious thing would be to now add links to the individual elements on a page, so that you can quick-jump to a particular function. But that turned out to be not so easy with the mess we made there before and stubborn docutils. As evident by the C4DAtom example and other cases our TOC trees are very broken in this part of the docs and I now already almost spent two days with fixing things to this state. This will be shipped in the current state with the next release of Cinema 4D. When I have some time to waste, I will try to add the function links. The manual and maxon API TOCs are unaffected by this, they continue to work as intended. The classic API does its own thing here (as always ) which why this is such a mess. Cheers, Ferdinand
  • Copy children to selection with GetClone()

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    795 Views
    John_DoJ
    Hi @ferdinand, thanks for the feedback, I've got it working with your suggestion. The method B was correct but the undo part was wrong ( the undo step was applied on the original objects instead of the new ones, thus leading to a mess when performing an undo). I also added the bit part to keep new objects folded in the OM. Here is the code : # CopyDeformers import c4d doc = c4d.documents.GetActiveDocument() def main(): doc.StartUndo() objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER) if len(objs) >= 2: # Get the last selected object active = objs.pop(-1) # Get the deformers deformers = [i for i in active.GetChildren()] # Copy deformers to selection if deformers: for o in objs: for d in deformers[::-1]: dcopy = d.GetClone(c4d.COPYFLAGS_NO_BITS) doc.InsertObject(dcopy, parent=o) doc.AddUndo(c4d.UNDOTYPE_NEW, dcopy) o.SetBit(c4d.BIT_MFOLD) doc.EndUndo() c4d.EventAdd() if __name__ == '__main__': main()
  • fieldlayer with variable tag

    Cinema 4D SDK windows python 2023
    2
    1
    0 Votes
    2 Posts
    551 Views
    D
    found the solution ... the corresponding type is called: FLweight
  • 0 Votes
    2 Posts
    841 Views
    ferdinandF
    Hello @seora, Thank you for reaching out to us. There is noch such functionality to encrypt Python scripting elements. You can encrypt Python plugins, but not things like a Python tag or generator object. I have moved this thread since its is not about the Python API but a feature of Cinema 4D. Cheers, Ferdiand
  • How to LoadDocument from string in memory? 🤔

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    1k Views
    mikeudinM
    Cool! Thank you!
  • 0 Votes
    2 Posts
    582 Views
    ferdinandF
    Hey @BretBays, Thank you for reaching out to us. You might want to have a look at the Python Libraries Manual. Since Cinema 4D 2024.0 there is also mxutils.LocalImportPath which automates injecting module paths and reloading such imported modules (I probably should update the Python libraries manual). The "flaw" of all these approaches is that while you still encrypt your plugins pyp file, the imported module(s) py file(s) will not and cannot be encrypted. You can either ship your common functions unencrypted or develop your plugin as a multi module solution (so that you do not have to replicate your code across plugins) and then package up the plugin into a singular file. There are some Python tools like pysconcat and pymerger which can help you with that. But you should be aware that these can fail when you have complex dependencies. You could also serve the py-cache of your modules, but that will not really stop anyone who wants to read your code. Cheers, Ferdinand
  • Create folder in Volume Builder

    Cinema 4D SDK windows python 2023
    3
    0 Votes
    3 Posts
    705 Views
    D
    hi @i_mazlov, thanks for the answer. good to know about this status / limitation. for my current case I found a solution without folders..
  • Plugins Search Path from Preferences

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    820 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)
  • 0 Votes
    3 Posts
    1k Views
    T
    Hi Adam, thanks for the update and the workaround!
  • Get information about renderer plugin via Python

    Moved General Talk 2024 python 2023
    6
    0 Votes
    6 Posts
    2k Views
    ferdinandF
    Hello @hSchoenberger, Sorry, but this is a C4D SDK question! It is NOT about the Octane SDK. "How can I list all installed renderer plugins in C4D with their version?" Although you have put your sentence into quotes, that was not what you asked, your questions were: Is there any way to get some information about renderer plugins? I want to get the version of the Octane plugin. So how I can loop through all plugins loaded and get some information from the plugins like the version? And I answered that: There is no public interface with which you could get the version of a plugin. And when plugins provide version information on their own, you must ask their vendors about that. You can access the flags a plugin has been registered with BasePlugin.GetInfo, the disk-level is in-accessible for you. You can detect installed render engines by looping over all video post data plugins and check if they have PLUGINFLAG_VIDEOPOST_ISRENDERER set (this assumes that the to be detected render engine sets this flag on registration - which is usually unavoidable as you otherwise cannot hook in the render system of Cinema 4D, but there might be 'rogue' render engines out there which side step things). import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ plugin: c4d.plugins.BasePlugin for plugin in c4d.plugins.FilterPluginList(c4d.PLUGINTYPE_VIDEOPOST, True): if (plugin.GetInfo() & c4d.PLUGINFLAG_VIDEOPOST_ISRENDERER): print (plugin.GetName()) if __name__ == '__main__': main() # Example output for a vanilla installation. Physical Redshift Viewport Renderer Cheers, Ferdinand