• 0 Votes
    3 Posts
    985 Views
    ferdinandF
    Hello @davidweidemann, Thank you for reaching out to us and solving your own question :). To give a bit of background information, parameters can be composed in Cinema 4D. The simplest example is a parameter of type c4d.Vector. You can access the relative position of an object like this: >>> Cube[c4d.ID_BASEOBJECT_REL_POSITION] Vector(0, 0, 0) But as users might want to access and animate the components of that vector individually, the vector is dealt with and represented as a parameter actually as a set of sub-channels, one for each of its components. >>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] 0.0 >>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y] 0.0 >>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z] 0.0 >>> This is why DescId are composed out of up to three DescLevel. To access the component of a vector you need two DescLevel, e.g., c4d.ID_BASEOBJECT_REL_POSITION and c4d.VECTOR_X. And while you might not be able to deal with the enclosing parameter, you might be able to deal with its subchannels. The input and output ports of an RSColorAbs Redshift node are of type RsColorAlpha, a parameter type that is composed of a Vector and a float, so it is effectively a four-component vector. This parameter type is not exposed to the Python API, so the API has no clue what to do with it. But it can deal with the subchannels. # Python has no clue about that parameter type at REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT. >>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT] Traceback (most recent call last): File "console", line 1, in <module> AttributeError: Parameter value not accessible (object unknown in Python) # But we can access the subchannels which are standard types. This is a two DescLevel access >>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT,c4d.REDSHIFT_COLORALPHA_COLOR] Vector(0, 0, 0) # We can even reach into the subchannels of a subchannel, here for example to access the red # component of the RGBA vector tuple that is represented by the type RsColorAlpha. >>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT,c4d.REDSHIFT_COLORALPHA_COLOR, c4d.VECTOR_X] 0.0 Cheers, Ferdinand
  • R25 project tool

    Cinema 4D SDK c++ windows project tool r25 sdk
    6
    0 Votes
    6 Posts
    982 Views
    ManuelM
    hxx files are created by the preprocesssor when you compile.They are created in the Generate subfolder of each project. Frameworks should work out of the box (even if sometimes, we have some bugs_ Cheers, manuel
  • UserData

    Moved Cinema 4D SDK python r25 windows
    4
    1
    0 Votes
    4 Posts
    949 Views
    ferdinandF
    Hello @bokibo, without any further questions or postings, we will consider this thread as solved by Friday the 4th, February 2022. Thank you for your understanding, Ferdinand
  • 0 Votes
    5 Posts
    1k Views
    H
    Many thanks for your help and thorough explanations, Ferdinand! Much appreciated! I'll go create a temp document and clones, and don't expect much more resistance from this particular issue. Thanks again, and have a happy holiday season!
  • RS Reference Node in Python

    Cinema 4D SDK s24 python windows
    3
    0 Votes
    3 Posts
    504 Views
    ferdinandF
    Hello @kverhaar, without any further questions or postings, we will consider this thread as solved by Friday the 4th, February 2022. Thank you for your understanding, Ferdinand
  • How to traverse a GeListNode tree

    Cinema 4D SDK python r25 r23 s24 windows macos
    5
    0 Votes
    5 Posts
    1k Views
    ferdinandF
    Hello @WDP, without any further questions we will consider this topic as solved by Friday, December the 17th. Thank you for your understanding, Ferdinand
  • 0 Votes
    5 Posts
    871 Views
    ManuelM
    @thomasb said in Help needed * .res files, dialogs etc...Plugin beginner: but can I do my own init function? yes you can, specially if you want to initialize some variable. But you should not create any geometry there and return this geometry in GVO (get virtual object). About the group, there's a note about it here. Each NodeType have a "parent" group. Glad that it is working now. Cheers, Manuel
  • Changing VideoPost leads to TypeError

    Cinema 4D SDK r25 windows python
    4
    0 Votes
    4 Posts
    463 Views
    ?
    @m_magalhaes Yes, I think the error was because Octane was the result of rdata.GetFirstVideoPost() and those symbols don't exist in it. If I check for the Viewport Renderer, it seems to work fine. Thanks for the reply and symbol tip!
  • How to Rotate an Object

    Cinema 4D SDK r25 s24 r23 python macos windows
    7
    0 Votes
    7 Posts
    2k Views
    ferdinandF
    Hello @WDP, this question would technically also be a new topic, please follow these rules. There is no formal notion of an object axis in the sense of a moveable entity in the API. Objects have their matrices (the global and the local one), which are effectively their own coordinate system opposed to the world coordinate system (or transform or frame when you prefer these terms over coordinate system). So, when you want to reproduce what is possible in the app, and move, rotate, or scale the axes of an object, without moving the geomtery of the object itself, then you will have to transform the vertices of that object. So, when the object has the world offset (0, 0, 0) and you want to move the axes to (100, 0, 0), you must first set the global object matrix to an offset of (100, 0, 0) and then apply the inverse of a transform that translates by (100, 0, 0) to all its vertices. I would recommend reading the matrix manual I did post in my first answer here. This will however only be possible for editable point objects, e.g., a c4d.PolygonObject. You are showing a generator object, i.e., a c4d.BaseObject with some cached geometry in your screenshot. You cannot move the axes for these objects, neither in the SDK nor in the app itself. We had recently this topic which dealt with moving the axes of a polygon object. Cheers, Ferdinand
  • 1 Votes
    8 Posts
    3k Views
    A
    @ferdinand Wow,thank you so much ferdinand!
  • Python Objekte X Y Z

    Moved Cinema 4D SDK python r21 windows macos
    8
    0 Votes
    8 Posts
    2k Views
    W
    Thank you very much!
  • 0 Votes
    12 Posts
    3k Views
    Y
    Oh! Forget guys my message above! The calling of Python code from C++ plugin in @kbar 's advice does the trick! If someone from the future who will read this thread will need the code example, I just use the code snippet from here: https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_python.html and feed to it this code: // call it from somewhere String code = "import c4d\nimport maxon\nimport os "; code+= "\n\nprint(f'This is simple message')"; code += "\nos.rename('C:/Code/sdk/plugins/myPlugin/myPlugin.xdl64', 'C:/Code/sdk/plugins/myPlugin/old_myPlugin.old')"; ExecutePythonScript(code, GetActiveDocument());
  • How to set a Shader for Roughness ????

    Cinema 4D SDK windows python r23
    7
    0 Votes
    7 Posts
    1k Views
    B
    @Dunhou @ferdinand Gotcha. Thanks for the confirmation and illustration links.
  • GeDialog Button Highlighted By Default

    Cinema 4D SDK r25 python sdk windows
    3
    1
    1 Votes
    3 Posts
    333 Views
    ferdinandF
    Hello @blastframe , we will set this topic to 'Solved' when there are no further questions or replies until Monday, November the 22th. Thank you for your understanding, Ferdinand
  • 0 Votes
    5 Posts
    2k Views
    ferdinandF
    Hello @HolgerBiebrach, we will set this topic to 'Solved' when there are no further questions or replies until Monday, November the 22th. Thank you for your understanding, Ferdinand
  • Effector Updates

    Cinema 4D SDK c++ windows r25 sdk
    2
    0 Votes
    2 Posts
    487 Views
    ferdinandF
    Hello @JohnTerenece, thank you for reaching out to us. Unfortunately, our answer is mostly the same as it was for the previous topic on this plugin of yours. You are using the MoData tags in a way not intended by us. It is not supported by our SDK to implement a custom MoGraph generator and you are therefore not intended to populate and manage your own MoData tags. There is nothing preventing you from doing it anyways, this however will then be out of scope of support as declared in our Forum Guidelines under "Scope of Support". We cannot debug your code for you, especially when the employed techniques are a violation of point one listed here. This is also outlined in "Scope of Support". You are also misusing the maxon API. Specifically, the error system, as you cannot just step over all errors which are returned. Which is what you do when you store them in some fields attached to your plugin implementation; never to be used or looked at again. Which can introduce all sorts of problems. The cases I saw do look unlikely to go wrong, but this is still a fundamental misuse of our API. See the end of my posting for details. Finally, about your question. I would look at your CheckDirty(), since this is the likely culprit for your problems. But we cannot debug that for you. When you can show us that something is not being flagged as dirty what was flagged before, we will be glad to provide a context for that. Please also note that example code should be condensed as also outlined in our Forum Guidelines. I understand that this is not the support you did hope for, but these limitations of scope of support must be enforced by us to a certain degree, as it would otherwise become a boundless task. Thank you for your understanding, Ferdinand maxon::Result Example What you do: void EffectorTestClass::CheckDirty(BaseObject *op, BaseDocument *doc) { // ... if (op->GetDown() != nullptr) // This could fail and you just step over it. resultBaseObject = objArray.Append(op->GetDown()); // ... flags = data->GetFlags(doc, object); if ((flags & 1) == 1) { // This could fail and you just step over it. resultBaseObject = objArray.Append(object); } // ... } What you should do: void EffectorTestClass::CheckDirty(BaseObject *op, BaseDocument *doc) { // An error scope handler that brings the classic and maxon API together. iferr_scope_handler { // you could also write to one of the loggers here, e.g. ApplicationOutput("Error in CheckDirty() @", err); return false; } // ... if (op->GetDown() != nullptr) objArray.Append(op->GetDown()) iferr_return; // ... flags = data->GetFlags(doc, object); if ((flags & 1) == 1) { objArray.Append(object) iferr_return; } // ... }
  • Implementing a watermark on render

    Cinema 4D SDK c++ windows r21
    6
    0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hello @dunhou, Thank you for reaching out to us. Please read our Forum Guidelines regarding the scope of topics, your question does not seem to be a valid follow-up question to me, and therefore should be its own topic. I also struggle to see how this is an API question, as you seem to report an end-user problem which has nothing to do with one of our APIs. Please contact user support via the Support Center for such questions. Cheers, Ferdinand
  • 0 Votes
    7 Posts
    759 Views
    ThomasBT
    @m_magalhaes yes thanks that was my idea, too , I created a temporary object, in my case a spline with 0 points and 0 segments and simply exchanged it, thanks.....
  • 0 Votes
    2 Posts
    506 Views
    ferdinandF
    Hello @thomasb, thank you for reaching out to us. Please remember to open a new thread for new questions of yours. It is fine to ask follow-up questions in a topic, but when the threshold to a new topic is being crossed, a new thread should be opened. I have done this for you here. In principle this is at least partially possible. You can determine the visibility for a user data description element with the description field DESC_HIDE, see example at the end of the posting for details. It is not possible to gray-out, i.e., disable, user data description elements. It is also a bit a case of an unusual workflow for user data, since you would have to rebuild the user data container every time you want to hide or show and element in it. You could overwrite for example message() in a Python scripting tag and then react to when a user clicks a button, drags a slider, etc. in the user data and rebuild the user data based on that. Which would give you the dynamic GUI feeling you are probably after. I have done this in the past, but more as a hack for fun to see how far I can push user data. I would not recommend doing it as it will complicate things like animation and can lead to "janky" interfaces. Being bound to the execution order of expressions can also lead to problems. If you want dynamic GUIs, you should implement a plugin. There you can overwrite NodeData.GetDDescription() to modify the description, e.g., add, remove, or hide stuff. To disable stuff, i.e., gray it out, you must overwrite NodeData.GetDEnabling(). Cheers, Ferdinand """Example for adding a hidden user data element. """ import c4d def main(): """Adds a hidden check box and a visible integer element to the user data of the selected object. """ if op is None: raise ArgumentError("Please select an object for running this script.") datenDesc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_BOOL) datenDesc[c4d.DESC_NAME] = "Daten" datenDesc[c4d.DESC_HIDE] = True # Element will be hidden stepsDesc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG) stepsDesc[c4d.DESC_NAME] = "steps" stepsDesc[c4d.DESC_HIDE] = False # Element will be visible op.AddUserData(datenDesc) op.AddUserData(stepsDesc) c4d.EventAdd() if __name__ == '__main__': main()
  • Get a Deformed Point Position Over Time

    Cinema 4D SDK windows python s24
    7
    0 Votes
    7 Posts
    656 Views
    ferdinandF
    Hello @blastframe, yes, there is a loop in that script which is like my pseudo-code one. If they are doing the same thing is a bit a point of view. The script evaluates each frame to do something each frame, while my pseudo code evaluates all frames to do something after that. So, for clarity again as pseudo code: # Evaluate all frames and do something for each frame, i.e., what Maxime's # script does. for frame in FRAMES: for item in document: item = evaluate(item, frame) DoSomthing(item) # Evaluate all frames and after that do something, i.e., what I am proposing. # From a more abstract point of view, both are doing the same thing. The only # difference here is that we are not interested in the intermediate results, # only in updating an item with is prior state: `item = evaluate(item, frame)` for frame in FRAMES: for item in document: item = evaluate(item, frame) DoSomthing(someItem) If you say, you are fine with not respecting this than this will simplify things. And most things that impact (deform) caches, won't be impacted by that. But there are direct cases which are affected, e.g. cloth simulations, some deformers like for example the collision the deformer and more. And indirect cases like when you have a particle system whose state over three corners will impact some deformation. And yes, this is very taxing to do, because you must evaluate a lot of stuff each frame. And you will have likely to execute all passes (animation, expressions, and caches); in the end it depends on how a specific scene is setup. The performant way to do this is cache the required data yourself. Like for example the collision deformer can do it; i.e., you click a button and then all data is calculated which then later is only played back. I would not say that it is impossible to do this in Python, but you will lack some important types to store such data in Python that are exposed in our C++ API. Python is also in general not well suited for such task, due to its inherent slowness of iteration. But that does not mean that with some smart thinking you could not make it work in Python in a performant way. This all depends on what you are exactly trying to do and is more of a general complexity of an algorithm or project design question (and therefore out of scope of support). The bottom line is that your initial question of Get a Deformed Point Position Over Time might contain more complexity than anticipated by you, because it implies something is the recursive function itself and time. Which is always a pain in the *** to handle. Cheers, Ferdinand