Navigation

    • Register
    • Login
        No matches found
    • Search
    1. Home
    2. yaya
    Y

    yaya

    @yaya

    1
    Reputation
    25
    Posts
    5
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Location Ukraine

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    yaya Follow

    Best posts made by yaya

    RE: Replace Plugins in a Running Cinema 4D Instance

    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/Cinema4DCPPSDK/html/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());
    

    😄

    posted in Cinema 4D SDK •

    Latest posts made by yaya

    RE: GetMg() returns not the actual coordinates

    @ferdinand said in GetMg() returns not the actual coordinates:

    If you indeed want a frame/transform/matrix for your ray origin, which would strike me as odd, I would need to see more context.

    I am making the plugin which creates the ragdoll from a user's character.
    The part we are talking about appears from here https://youtu.be/Lz3u3n001bQ?t=100 after clicking the "Create Ragdoll" button:

    So after this step, the code calculates a lot of stuff to create Connectors, tags, colliders etc for the ragdoll structure. And now we are talking about the algorithm for the calculation of the sizes of cube-colliders.
    In basic words it uses the GeRayColliders and calculates the distance from the center of the bone to the character-mesh. And then feeds this distance to a Cube-collider sizes. However It is little bit more complicated than it sounds, but basically I need to receive the ray from the cube-origin by its local X-axis (and Z-axis too) and then use this double-distance in the cube x (and z) size.
    So I need to get the geRayCollider ray direction vector. This vector should be almost the same as the cube's local x-axis (and z) + some random.

    And my problem is when I trying to find the point of the local cube's x-axis using the code snippet above I am receive the shift by the X-axis of parent and not the cube. The axes of cube and its parent may not match. The x-axis of a cube can be the z-axis of its parent, etc. So the problem is something here: cube->GetMg() * Vector(10, 0, 0)

    posted in Cinema 4D SDK •
    RE: GetMg() returns not the actual coordinates

    Hey @ferdinand ,
    My problem is: when I do this:

    const Vector p = cube->GetMg() * Vector(-10, floatrandom(-2, 2), floatrandom(-2, 2));
    

    I get the point shifted by -10 units by X-axis but by parent's X-axis. But I need it in the cube's X-axis.
    Is it expected behavior for Cinema 4D?

    posted in Cinema 4D SDK •
    RE: GetMg() returns not the actual coordinates

    Hi @ferdinand
    Thank you for your answer. I will learn it now carefully and will try to adapt it to C++ and my task.

    I understand that the algebra question is not the case of this forum. I just ran into a problem with the GetMg() command which has returned not the expected world position of the child-cube.

    I will add my code below:

    Vector64 direction = parent->GetMg().off - child->GetMg().off; 
    Vector64 middlePos = parent->GetMg().off - direction / 2;
    // here I get the middlePos. Normally it is the world coordinates of the Cube Rel-position (0, 10, 0), 
    // I need middlePos for the GeRayCollider as its ray source. Next I need to get the ray direction. 
    // I need it 1) be relative to Cube local X-axis, 2) add to it some random to use it in the loop (the second is not the part of the problem)
    // so here where I get the problem
    Matrix shiftX = MatrixMove(Vector(-10, floatrandom(-2, 2), floatrandom(-2, 2)));
    Matrix RayPosX = cube->GetMg() * shiftX; // !!! I don`t understand why this shifts the ray along the parent space (X-axis), but not the Cube's X-axis which might not match?
    Vector rayDirectionX = middlePos + cube->GetMg().off - RayPosX.off; 
    if (colliderX->Intersect(middlePos, rayDirectionX, 555)) 
    // etc.
    

    If I will print the current Cube->GetMg().off and the middlePos - it will be not the same. And in the result the whole code is not working as expected. 9ef14df7-fa1d-4c5a-aff3-0bddf21a702f-image.png

    posted in Cinema 4D SDK •
    GetMg() returns not the actual coordinates

    User Information:
    Cinema 4D Version: R23
    Platform: Windows ;
    Language(s) : C++ ;


    Good day.

    I am creating the Cube as a child of an object. I set its local position as the SetRelPos(0, x, 0) where X = the half of the distance toward the next child-object.
    After the command InsertUnder(), I am trying to find the point which lies on the Cube's local X-axis (+ 10 from its root). And then I need to get the point's:

    1. world coordinates.
    2. coordinates relative to some another object.

    How to achieve this?

    Right now I even can't found the +10 local point. I tried to get it via MatrixMove() and GetMg() but GetMg() returns not the actual Cube coordinates.

    posted in Cinema 4D SDK •
    RE: ssl certificate error in debug console

    Hi @ferdinand, I did not get this problem in R23 and R25 yet. Maybe it exists, but I did not see.
    I got it only in R21. But as @m_magalhaes mentioned: it is known issue and was fixed in later releases, so I leave it.

    posted in Cinema 4D SDK •
    RE: ssl certificate error in debug console

    this is what I got:
    sslConnection.DoHandShake failed while connecting to https://www.mysite.com/myfile.xdl64: SSL_do_handshake returned error: SSL_ERROR_SSL (certificate verify failed Certificate Information: not available)

    posted in Cinema 4D SDK •
    ssl certificate error in debug console

    I have the same problem (C++, R21, Win10).
    this code:

    const maxon::Url url("https://www.mysite.com/myfile.xdl64"_s);
    if (url.IoDetect() != maxon::IODETECT::FILE)
            return;
    

    returns the ssl certificate error in debug console.

    The same code works in R23, R24, R25 (R22 did not check yet).

    posted in Cinema 4D SDK •
    RE: R24 compiling issue (error C2220: the following warning is treated as an error)

    Hi @ferdinand , thank you for your answer.
    I've fixed the problem via a simple disabling "threat warnings as errors" to "No" in Project Properties/C++/General.

    It compiles now, which is cool, but is pretty strange, because I did it early before the asking here.

    About the error reasons I still don't know what was causing the problem. Yes, I checked the console output. The error is from there with no more details. Also this c2220 error appears only in VS-project created for a R24 version of Cinema 4D. The same code has no problem in VS-projects for a R23 and R25. Literally: I just copy and paste the same code from here to here. Every project - with the same project settings, same additional libraries dependencies and same C++ version (17).

    So in case someone comes across this problem, just disable the "Threat warnings as errors" in your project properties. It should help.

    posted in Cinema 4D SDK •
    R24 compiling issue (error C2220: the following warning is treated as an error)

    Hello.
    I have a problem with compiling the plugin for a R24. The same code which compiles and is performed perfectly for R23 and R25, in R24 when I try to build the project throws an error.
    The error is: "error C2220: the following warning is treated as an error".
    The source of an error is almost random. The codeline which throw an error for R24, does not do it for R23 and R25.
    For example the line like so:

    C4DGadget* const textA = AddEditText(3000, BFH_SCALEFIT, 0, 10, 0);
    

    If I delete it at all and hit the "build project", the same error appears in entirely another place:

    for (Int32 i = 0; i < linkBoxesIDs.size(); ++i) {}
    

    if I delete it too, the error starts to appear another place:

    BaseContainer* data = op->GetDataInstance();
    

    etc.

    I've check the version of the project tool, sdk(the same as a version of c4d) and my Visual Studio (it is 2019).

    The plugin file which was compiled for a R23, shows up in R24. And I would use it in a R24 version of Cinema 4D, but my plugin uses some python code from a C++ and due to some differences in include files for the python in r23 and r24, this python code does not work in R24. So I need to recompile the plugin for the correct version.

    Is this a known issue?

    posted in Cinema 4D SDK •
    RE: Replace Plugins in a Running Cinema 4D Instance

    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/Cinema4DCPPSDK/html/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());
    

    😄

    posted in Cinema 4D SDK •