• 0 Votes
    17 Posts
    2k Views
    M
    Glad you found a way and yes I think it's safe now I guess there is no more open pint? If so I let you define your topic as solved (see Forum Structure and Features - Ask as Question If you don't know how to do it). Just in case a BaseContainer can also store a BaseContainer. so you could store your own BaseContainer at the ID_PLUGIN And in this BaseContainer at ID 0 stores, the obj counts, and then you can safely iterate over it. Cheers, Maxime.
  • Setting up global plugin structs

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    426 Views
    WickedPW
    Hi Manuel, what you say rings a bell. I was sure it was because the vector hadn't allocated anything yet. Global possibly wasn't the best way admittedly, it just started like that for convenience. But it ended up being a bit complex, there's a lot of things accessing it, so I didn't want to change it (for now). @m_magalhaes said in Setting up global plugin structs: create a pointer and in pluginstart and pluginend take care of assign memory and free it hadn't thought of that. Seems to work - I'll go with that! Thanks WP.
  • BaseDraw::DrawHUDText() - setting color ?

    Cinema 4D SDK r23 sdk
    3
    0 Votes
    3 Posts
    649 Views
    WTools3DW
    Works like a charm! It's much more flexible than I hoped;) Thanks a lot!
  • Compiling material nodegraph to shaders

    Cinema 4D SDK r23 sdk maxon api c++
    4
    0 Votes
    4 Posts
    680 Views
    r_giganteR
    @ECHekman said in Compiling material nodegraph to shaders: I take it this also means its not possible to manually convert node ourselves? Right.
  • 0 Votes
    4 Posts
    2k Views
    M
    @m_adam Thanks for the clarification. Regards, Georgi.
  • Cannot set ID_BASEOBJECT_USECOLOR to a child object.

    Cinema 4D SDK
    4
    0 Votes
    4 Posts
    665 Views
    M
    @m_adam Yay thank you very much! Was almost ready to compromise with the default color. Will use the Q&A functionality, excuse me for the posts so far. Warm regards, Georgi.
  • 0 Votes
    8 Posts
    2k Views
    WTools3DW
    @m_magalhaes Thanks Manuel! When I fill-in only Inner edges in NgonBase::BuildNgon, then it surprisingly works I don't know why I tested all combinations except this one There are still some minor glitches, some inner edges are randomly not hidden, but ngons created are valid for all the cases I have tested. Random glitches are easily fixable with forcing all inner edges to be hidden. I will test it more, but this seems to be reliable for now. NGONS import - read outer edges directly from Pgon::*m_Edge array NGONS export - with NgonBase::BuildNgon(), filling Inner edges only, and force hide inner edges on quads. Thanks a lot Manuel, Your help has been very valuable to me. Regards, Viktor.
  • Loft incorrectly returning input objects

    Cinema 4D SDK sdk r20 c++
    10
    3
    0 Votes
    10 Posts
    2k Views
    ferdinandF
    Hi, without further feedback, we will consider this thread as solved by Monday and flag it accordingly. Cheers, Ferdinand
  • Images missing in C++ SDK docs

    Cinema 4D SDK sdk c++
    4
    0 Votes
    4 Posts
    434 Views
    fwilleke80F
    Nice
  • Adding an Icon to a GeDialog Menu Group

    Cinema 4D SDK python sdk windows
    10
    1
    0 Votes
    10 Posts
    1k Views
    ?
    @zipit Thank you, Ferdinand, for looking into it!
  • 0 Votes
    16 Posts
    2k Views
    r_giganteR
    As already told by @zipit, I'm terribly sorry for coming so late here. I've prepared a full example showing how to fill a VertexColorTag in the ObjectData::GetVirtualObjects() and use this values to color the triangles shown up in the ObjectData::Draw() method. My code actually uses the VertexColorTag::SetColor()/GetColor(). [image: 1605105495571-5b4213d8-e4b4-434a-ad71-5ef0d69be6ea-image.png] The VertexColorTag in this case is not specify to each vertex of the triangle but specifies the color for the whole triangle: this is because the tag is created in the ObjectData::GetVirtualObjects() and store color for each point of the cloud, but then it's used in the ObjectData::Draw() method to specify the ObjectColorProperty used to color the drawn PolygonObject. As far as I know the BaseDraw::DrawPolygonObject() ignores any VertexColorTag assigned to the PolygonObject to be drawn. BaseObject* PC_12974::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh) { // check cache before continue BaseObject* cache = op->GetCache(); if (cache) return cache; // init the random gen and get a arbitrary number of tris _rndGen.Init(GeGetTimer()); _randomTrisCnt = (SAFEINT32(_rndGen.Get01() * (1 + _max - _min)) + _min); // allocate a PolygonObject and fill it with points randomly PolygonObject* po = PolygonObject::Alloc(_randomTrisCnt, 0); if (!po) return BaseObject::Alloc(Onull); // fill the points array with random positions Vector* points = po->GetPointW(); for (Int32 i = 0; i < _randomTrisCnt; i++) points[i] = Vector (100.0 * _rndGen.Get11(), 100.0 * _rndGen.Get11(), 100.0 * _rndGen.Get11()); // look for VertexColor tag BaseTag* tag = po->GetTag(Tvertexcolor); // if not existing just create a new one VertexColorTag* vcTag = nullptr; if (!tag) { tag = VertexColorTag::Alloc(_randomTrisCnt); po->InsertTag(tag); } vcTag = static_cast<VertexColorTag*>(tag); vcTag->SetPerPointMode(true); VertexColorHandle handle = vcTag->GetDataAddressW(); // fill the vertexcolor tag with random values for (Int32 i = 0; handle && i < _randomTrisCnt; i++) VertexColorTag::SetColor(handle, nullptr, nullptr, i, maxon::Color32(_rndGen.Get01(), _rndGen.Get01(), _rndGen.Get01())); // update host object po->Message(MSG_UPDATE); return po; } Bool PC_12974::TriangleOnPoint(const Vector &pos, PolygonObject& po) { // given a point create a triangle centered over there. Vector* points = po.GetPointW(); const Matrix poMG = po.GetMg(); const Vector posMG = poMG * pos; if (!points) return false; // set vertexes positions for the triangle. points[0] = Vector(0, 0, _triangleRad) + posMG; points[1] = Vector(_triangleRad * Cos(-PI / 6), 0, _triangleRad * Sin(-PI / 6)) + posMG; points[2] = Vector(_triangleRad * Cos(-PI * 5 / 6), 0, _triangleRad * Sin(-PI * 5 / 6)) + posMG; // create the polygon CPolygon* polys = po.GetPolygonW(); if (!polys) return false; polys[0] = CPolygon(0, 1, 2); return true; } DRAWRESULT PC_12974::Draw (BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh) { // skip anything but OBJECT drawpass if (drawpass != DRAWPASS::OBJECT) return DRAWRESULT::SKIP; // check for the object and its cache if (op && op->GetCache()) { // get the PolygonObject from the cache PolygonObject* opPO = static_cast<PolygonObject*>(op->GetCache()); // look for the attached VertexColor Tag BaseTag* const tag = opPO->GetTag(Tvertexcolor); if (!tag) return DRAWRESULT::SKIP; VertexColorTag* const vcTag = static_cast<VertexColorTag*>(tag); // retrieve the read-only handle ConstVertexColorHandle vcTagHandleR = vcTag->GetDataAddressR(); // get the points and iterate over the VertexColor to set the color // of each triangle drawn maxon::Int pointCnt = opPO->GetPointCount(); Vector const *points = opPO->GetPointR(); for (maxon::Int i = 0; i < pointCnt; i++) { maxon::Color32 vtxCol(0.0); // get the color if (vcTagHandleR && vcTag->IsPerPointColor()) vtxCol = VertexColorTag::GetColor(vcTagHandleR, nullptr, nullptr, (Int32)i); // set the color in the ObjectColorProperties ObjectColorProperties colProp; colProp.usecolor = ID_BASEOBJECT_USECOLOR_ALWAYS; colProp.color.x = vtxCol.r; colProp.color.y = vtxCol.g; colProp.color.z = vtxCol.b; colProp.xray = false; // allocate the temp triangle PolygonObject* tri = PolygonObject::Alloc(3, 1); // set the color prop, create the tri and draw! tri->SetColorProperties(&colProp); if (TriangleOnPoint(op->GetMg() * points[i], *tri)) bd->DrawPolygonObject(bh, tri, DRAWOBJECT::NONE, nullptr); // free the tri PolygonObject::Free(tri); } } return DRAWRESULT::OK; } Feel free to comment and again sorry for the silence. Riccardo
  • 1 Votes
    4 Posts
    469 Views
    ferdinandF
    Hi, I did not really expect an answer, I just did put it up to make you guys aware. Regarding your reply, I agree with most of it and am aware that there a some hurdles to overcome in mapping C++ interfaces to Python, i.e. that you do run into problems in general when you want to express overloaded methods in Python. But as @mp5gosu pointed out, my major point was that the function does not accept named arguments at all. Which is mainly a problem because the docs tell you explicitly otherwise in two ways. First of all the docs say explicitly that all arguments are optional which implies for Python usually that I can pick and choose in which arguments I can pass by passing named arguments. And secondly, you print out the signature as Vector.__init__(x=0.0, y=0.0, z=0.0) which implies the same. I would have probably ignored all this and booked it under "that's for me to know and for you to find out", if it wasn't for the fact that the method does not raise a TypeError on attempts of feeding it with such unknown named arguments. Which can make this quite critical IMHO. Cheers, zipit
  • Ability to set DLG_TYPE_ASYNC Width & Height

    Cinema 4D SDK
    8
    1 Votes
    8 Posts
    1k Views
    DunhouD
    @m_adam Thanks for you reply , and there is nothing worry about the time, you are much busier than me I already try the defaultX and nothing changed, the dialog is always bigger than I set , it seems the dialog is considering teh hiden element size or something , the code is bit long for the forum ( maybe we should add a folding option to the code block in the forum ), and I sent an copy to ferdinand , and newest version has nothing changed for the UI part, Is that convenient for you to get a copy from ferdinand or post your email I can send you emails to, Cheers~
  • 'SetRealTag' Request

    Cinema 4D SDK
    3
    0 Votes
    3 Posts
    463 Views
    ?
    @m_magalhaes Hi Manuel! Thanks for the update.
  • 0 Votes
    6 Posts
    913 Views
    M
    Hi @lasselauch sorry for the late reply, I asked about the developer responsible for it. On Windows we use the WebView control of the last iteration of iexplore MS shipped for 8.1 - Internet Explorer 11 (user-agent ID: "Trident"). It supports >most< things other modern browsers do, but sadly not everything... Especially the JS support has become a problem since IE11 is missing parts of the ECMA 6 standard and needs 'polyfills' to emulate those. Many JS frameworks / libraries don't offer IE11 compatibility and instead rely on the developer to add those polyfills themselves. One of the improvements IE11 received back then was the developer console+tools so the user could use those to track > down the JS issues and resolve them." I also forwarded your request about the ability to disable Javascript, but so far nothing planned atm, so the only workaround I see is either fix your javascript framework (maybe a huge task) or you can disable your javascript based on the user agent and if it's an IE11. Hope this help, Cheers, Maxime.
  • OBJECT_INPUT Child Updating

    Cinema 4D SDK sdk r20 c++
    13
    0 Votes
    13 Posts
    2k Views
    r_giganteR
    Hi @JohnThomas , the data passed in the method is actually carrying the destination object. The code should look like ... if (type == MSG_EDITABLE_END) { BaseObject* dstObject = static_cast<BaseObject*>(data); if (!dstObject) return false; BaseObject* child = dstObject->GetDown(); if (child) { child->Remove(); BaseObject::Free(child); } } ... Cheers, R
  • Edge To Spline Modeling Command

    Cinema 4D SDK sdk r20 c++
    3
    0 Votes
    3 Posts
    916 Views
    J
    Thanks for the response, that was exactly what I needed. John Thomas
  • Compiling my plugin on R23

    Cinema 4D SDK
    6
    1
    0 Votes
    6 Posts
    1k Views
    P
    Ok, success. Copying the plugin folder from pc to mac was the issue!
  • Retrieving Viewport Camera Matrix

    Cinema 4D SDK r20 sdk c++
    9
    0 Votes
    9 Posts
    2k Views
    J
    Thanks for the detailed response @r_gigante, sorry about the late post. I wasn't trying to move an object into the camera view, I was just trying to get the information about a cameras perspective so that if necessary I could create an object that would have an orientation parallel to it. John Thomas