• Formula to calculate cloner radius

    Moved General Talk c++ sdk
    3
    1
    0 Votes
    3 Posts
    820 Views
    mfersaouiM
    @r_gigante Hi Riccardo, thank you for your detailed response. That allowed me to find the exact formula. l / (2 * tan((180 / n) * 3.14159 / 180)) Regards, Mustapha
  • Retrieving Link from Hyperfile

    Cinema 4D SDK python sdk
    3
    1
    0 Votes
    3 Posts
    489 Views
    ?
    Thank you @r_gigante for the reply! Sorry if the intent is unclear: this self-contained script was something I came up with last night to demonstrate an issue I'm having in my plugin which is too many scripts to post to the forums. Since the user can't select an object after the script is running, I added that catch to make sure an object was selected to show what was going wrong. My Goal I am trying to save a link to a scene object and its matrix to a hyperfile so the user can load the hyperfile in another session and restore the link to the object so that I can apply the saved matrix. I don't need the object itself. Update I updated the original script's GetLink() method to pass a reference to the active document, but that did not solve the issue.
  • 0 Votes
    10 Posts
    2k Views
    mfersaouiM
    @m_magalhaes Hello, Thank you so much.
  • GUI Layout Issues

    Cinema 4D SDK python sdk
    4
    2
    0 Votes
    4 Posts
    648 Views
    ?
    @m_adam You are a legend! I've learned a lot about UI in Cinema 4D from this post, thank you very much.
  • Bend Deformer Using C++

    Cinema 4D SDK c++ r19 sdk
    18
    2
    0 Votes
    18 Posts
    4k Views
    M
    Yes because I've done it
  • Building Cinema 4D SDK on Windows

    Cinema 4D SDK r21 c++ sdk windows
    3
    0 Votes
    3 Posts
    661 Views
    W
    Thank you @m_magalhaes! I needed to open the plugins.sln solution instead of the project file. I feel like I've learned something, but I'm not sure what
  • Python: Global Variable vs Plugin ID

    Moved General Talk python sdk
    6
    0 Votes
    6 Posts
    2k Views
    M
    Hi while previous answers give some hints I would like to provide more in-depth answers to these questions. First, what is a global variable? In Python, a global variable is a variable that is stored in the dictionary returned by "globals()". The globals() function returns a dictionary that is local to the current Python Scope. Note that a Python scope only lives for a given time and is not persistent. This means it doesn't save its state or current data to a file so if you restart Cinema 4D, it starts with a fresh new Python Scope) but as long as the host object of the Python Scope is alive the data will be stored. So few things to know about Python implementation within Cinema 4D. Each BaseList2D that implements a Python implementation (Python Generator, Python Scripting Tag, Python Xpresso, Field Layer) has its own Python Scope. That means if I have two Python Generator they don't share the same Python Scope. But they both have a distinct one. Now in a case of a plugin, it's a bit tricky, if you use a global variable let's say in an ObjectData. The global variable will be available for all instances (BaseObject) of this ObjectData. This is because a BaseObject is an instance of an ObjectData implementation. And since there is only one implementation (your ObjectData that uses the global variable) they all use the same global variable. Now when you refer to plugin ID, it's a kind of term abuse. A plugin ID is a unique ID (aka a number who is unique into Cinema 4D context). And can be retrieved from https://developers.maxon.net/forum/pid (you must be logged). So a Plugin ID can be used to register a plugin. When you write BaseObject(100000) Cinema 4D will look at the ObjectData that is registered at the ID 100000 and create a BaseObject that will implement this particular ObjectData. But you can also use a PluginId (or aka a Unique ID) to register a data into a BaseContainer. But what is a BaseContainer? BaseDocument, Objects, tag and pretty much everything a user can find in C4D inherit from BaseList2D, and get a BaseContainer. A BaseContainer is a kind of array (or a dictionary in python), where data are stored according to a given ID. This BaseContainer is owned by the host BaseList2D (seems logical but it's an important point). This way Cinema 4D has a generic way of storing and reading data. So Cinema 4D can automate few things such as saving automatically the data stored in this BaseContainer into a File (aka Cinema 4D File) and read them back when loading the Cinema 4D file. So back to our topic, if we assign a particular value to a "Plugin ID/Unique ID" you can assume that nothing within in Cinema 4D will overwrite this particular value. (Third-party developer can access this data however and may erase them, so that's why we recommend using a Unique ID when you store data in a BaseContainer, this way you are sure to not erase other people data and you're is ok). Of course, this works because everyone plays the game if I can tell. Now back to the initial questions. What's the use case of a global variable in Python in Cinema 4D ecosystem? Storing data across multiple frames. (Can also be done with a BaseContainer, but you have to convert to a DataType that BaseContaienr accept, so list, dict are not supported so you have to "bake" which is slow) Data are only alive for the current lifetime of the host and in maximum the Cinema 4D session. What's the use case of data stored in a BaseContainer in Cinema 4D? Storing data across multiple frames. (See the previous point in some case it may be ineffective). Storing persistent data over multiple Cinema 4D sessions (the data will be stored in the host, e.g. the Python Generator Object by itself, so if you open the file in Cinema 4D, the Python Generator will restore the data in the BaseContainer). Exposing data to others (Maybe other Objects want to know the current value stored in a particular Python Generator Object). Finally, BaseContainer should be primarily chosen but as stated in some condition it makes more sense to use a global variable. And here is how to define a global variable within a Python Generator: import c4d # Checks if the test variables exist in the global dict, if not assign a value of 10 global test if 'test' not in globals(): test = 10 def main(): global test print test return c4d.BaseObject(c4d.Ocube) I hope it answers your questions. Additionally please read BaseContainer Manual. Cheers, Maxime.
  • Undefined symbols

    Cinema 4D SDK r21 sdk
    12
    0 Votes
    12 Posts
    1k Views
    R
    Great, I will do that.
  • Wrong indentation of if ?!?! What is wrong?

    Cinema 4D SDK sdk r21
    5
    0 Votes
    5 Posts
    658 Views
    r_giganteR
    Hi Rui, thanks for reaching out us. With regard to your issue, I confirm that whilst VS is more "tolerant" with regard to code-style check, Xcode is less. The code style check, which is embedded in our source processor, expects tabs rather than spaces for code indentation and it could happen that either Tabs has not be set in Xcode preferences, as preferred indentation method, or that you've copied and pasted some portion of code that was indented with spaces. Please check your indentations for using tabs rather than switching off completely the style check. Best, R
  • String to ASCII value and vice-versa.

    Cinema 4D SDK sdk r21
    4
    0 Votes
    4 Posts
    581 Views
    S
    Hello, just FYI: you find information on how to access individual characters from a string in the manual: String Manual Also, one of our examples includes checking the ASCII value of a given character: streamconversion_impl.cpp If your question has been answered, please mark your thread as a question and set it to "solved". best wishes, Sebastian
  • Use of undeclared identifier 'tmperr_ies'

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    544 Views
    R
    Thank you very much, RIccardo. I will look into it tonight when I get home.
  • Error when trying to compile the R21 SDK

    Cinema 4D SDK sdk r21
    2
    0 Votes
    2 Posts
    358 Views
    r_giganteR
    Hi Rui, thanks for reaching out us. With regard to your question there are a few things to note: /Applications is a folder which requires elevated permission to write in: I recommend to move the SDK in a different location where standard user permission are required; with R21, whether you're using Xcode 10.1 or further revision, it's supposed that you enable the Legacy Build System in the Project Settings: be sure to set it via File -> Project Settings in Xcode. Finally it's recommended, when such building issues are faced, to provide a description of your development environment. Cheers, R
  • Attach XPresso Graph to GUI via Python

    Cinema 4D SDK
    9
    1
    0 Votes
    9 Posts
    2k Views
    DunhouD
    @ashton_fcs_plugindev That is so cool , Is it finish yet? I am new to GeUserArea too , That's a dreamly example to learn GeUserArea.
  • How to add Layers Shader - C++

    Cinema 4D SDK c++ r19 sdk
    6
    0 Votes
    6 Posts
    793 Views
    mfersaouiM
    @s_bach Thank you.
  • Get CustomGUI Data in python

    Cinema 4D SDK python c++ r20 sdk
    9
    0 Votes
    9 Posts
    2k Views
    N
    Hello Sebastian, I now understand what the difference is, thank you very much! With the customdata_customgui example file I actually made both a GUI and a custom DataType. So I only needed to change my resource file and modifiy my data code a bit! Best Regards, Florian
  • 0 Votes
    3 Posts
    825 Views
    M
    Hi @orestiskon SendModelingCommand and especially CurrentStateToObject need the object to be actually in the passed document. So you need to create a temporary doc and use it to operates. As bellow: import c4d def currentState(obj) : return c4d.utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT,[obj],c4d.MODELINGCOMMANDMODE_ALL,c4d.BaseContainer(),obj.GetDocument())[0] def main(): # Retrieve the python generator obj = op.GetDown() if obj is None: return objClone = obj.GetClone() if objClone is None: raise RuntimeError("Failed to clone the object") # Make the children Python Generator disapear obj.Touch() # Creates a temporary document that will be used to evaluate the cache of the object tempDoc = c4d.documents.BaseDocument() if tempDoc is None: raise RuntimeError("Failed to create a temporary doc") # Inserts the child python generator that exists only in memory into our tempo doc tempDoc.InsertObject(objClone) returnedObj = currentState(objClone) return currentState(objClone) Cheers, Maxime.
  • Project Tool Permission Denied

    Cinema 4D SDK
    6
    0 Votes
    6 Posts
    1k Views
    R
    Ok, made it work now. Thank you so much.
  • 0 Votes
    6 Posts
    2k Views
    ferdinandF
    I did that for the same reason @m_adam created a copy in his version: A node can only be member of one document at a time and also only be inserted exactly one time into the same document (long way of saying that Cinema is monohierachical). Cheers zipit
  • How to Open a Dialog Plugin from a Tag Plugin?

    Cinema 4D SDK sdk python
    6
    0 Votes
    6 Posts
    1k Views
    S
    Hello, the important question is, if you want to open a modal or asynchronous dialog. An asynchronous dialog must be hosted by a CommandData plugin (GeDialog Manual) (e.g. py-memory_viewer). As mentioned above, a double-click on a tag can be detected by looking for the MSG_EDIT message (NodeData::Message() Manual). So, when you detect MSG_EDIT, you simply have to execute the command that hosts you dialog. You can simply do that using CallCommand() (Command Utility Manual). Within your dialog, you can find your tag by getting the active tag. best wishes, Sebastian
  • Dynamic VertexMap

    Cinema 4D SDK python sdk r20
    6
    0 Votes
    6 Posts
    1k Views
    N
    Hello Maxime, thanks for your answer! Its too bad that I can't do it without some hacky way, but thanks for your code snipped and example. I'll mark this thread as solved, so thanks! Best Regards, Florian