@ferdinand Thank you very much ! Learned a lot from this.
Posts made by freeze
-
RE: Continuously refresh the render result to the view port
-
RE: Continuously refresh the render result to the view port
@ferdinand Thank you very much for replying a lot ! We do have own view port program for renderer ,but some users would like to see the result in viewport of c4d as using redshift .
And I find that I can send the datas into ShowBitmap to show image in picture viewer, like:AutoAlloc<BaseBitmap> bitmap; CheckState(bitmap); bitmap->Init(500, 500, 32); ShowBitmap(bitmap);
so I wonder if there is similar way to show image on viewport of c4d.I tried to find the answer in SDK DOC BaseDraw part but not get the answer yet.
Great Thanks ! -
Continuously refresh the render result to the view port
I made a VideoPostPlugin to render images ,with Excute method like:
RENDERRESULT SmarayPlugin::Execute(BaseVideoPost* node, VideoPostStruct* vps) { if (!vps || !vps->render) return RENDERRESULT::FAILED; if (vps->vp != VIDEOPOSTCALL::RENDER || !vps->open) return RENDERRESULT::OK; VPBuffer* rgba = vps->render->GetBuffer(VPBUFFER_RGBA, NOTOK); if (!rgba) return RENDERRESULT::OUTOFMEMORY; BaseContainer* data = node->GetDataInstance(); if (!data) return RENDERRESULT::FAILED; //// SOME RENDERER CODES AND SET RENDER RESULT INTO BUFFER LIKE // for (Int32 y = 0; y < height; ++y) // { // rgba->GetLine(0, y, width, buffer.data(), 32, true); // b = buffer.data(); // for (Int32 x = 0; x <= width; x++, b += channels) // { // auto idx = (height - y - 1) * width + x; // b[0] = datas[idx * 4]; // b[1] = datas[idx * 4 + 1]; // b[2] = datas[idx * 4 + 2]; // } // rgba->SetLine(0, y, width, buffer.data(), bitdepth, true); // } ////END return RENDERRESULT::OK; }
Now I've created a CommandPlugin .I want to make this Command to controll a thread which continuously refresh the render result to the view port ,anyway to do this by some APIs or can I find some examples for this?
Many Thanks! -
RE: How to add command plugins' dropdown menu on to c4d main menu bar
@ferdinand Thank you for replying!
-
How to add command plugins' dropdown menu on to c4d main menu bar
How to add command plugins' dropdown menu on to c4d main menu bar or viewport menu bar like redshift ,as the picture shows:
The examples in C++ SDK put them all into the Extensions as default. -
RE: Start IPR rendering in the viewport
@ferdinand Thank you for answering ,I 'll try it.
-
RE: Start IPR rendering in the viewport
Hello @ferdinand ,
I have created a Message method as:Bool SmarayPlugin::Message(GeListNode* node, Int32 type, void* data) { BaseList2D* const item = static_cast<BaseList2D*>(node); if (!item) return false; BaseContainer* renderdata = item->GetDataInstance(); switch (type) { case MSG_DESCRIPTION_COMMAND: { DescriptionCommand* dc = static_cast< DescriptionCommand*>(data); if (dc->_descId[0].id == AOV_MANAGER_BUTTON) { if (aov_dialog) { aov_dialog->Close(); DeleteObj(aov_dialog); } aov_dialog = NewObjClear(UISmarayAOVManager, renderdata); if (aov_dialog) { aov_dialog->Open(DLG_TYPE::ASYNC, 800, 800, 800, 600); } } break; } default: break; } return VideoPostData::Message(node, type, data); }
I use it to get the button clicked event to create dialog for setting the AOVs and I find that it may get different type of Message .So can I just check if it is EVMSG_CHANGE and go through my own logic here?
-
Start IPR rendering in the viewport
I register a VideoPostPlugin as a renderer.Now I can render an image to viewport or picture viewer in c4d with my own renderer plugin.
How can I get the message that the scene changed so I can update the render view with new scene data and display in the viewport of c4d ,just like Redshift Start IPR ,using c++.
Many Thanks! -
RE: Get the random result of Cloner Object
@ferdinand Thank you very much! The problem is solved and now I know the way of MODATA_CLONE used.
-
RE: Get the random result of Cloner Object
@ferdinand I got the transform I need as a result matrix by following code:
Matrix clonerMatrix = clonerObj->GetMg(); Int32 matrixItemsCnt = moData->GetCount(); Matrix* itemsMtxArray = static_cast<Matrix*>(moData->GetArray(MODATA_MATRIX)); for (int matrixIdx = 0; matrixIdx < matrixItemsCnt; matrixIdx++) { auto result = clonerMatrix * itemsMtxArray[matrixIdx]; }
In this case I have 2 objects as children of clonerObj like the picture below:
Now I just want to find out that every result matrix I got before belongs "Cube" or "group" Object. Any way to do this in c++? Thanks! -
RE: Get the random result of Cloner Object
@ferdinand So how can I look into the cache of the cloner in c++ in my case with the clonerObj?I already got the moData and op
-
RE: Get the random result of Cloner Object
@ferdinand Sure,I mean that how can I get the cubes' matrix shown in the scene in the picture I uploaded for example.
-
Get the random result of Cloner Object
I created a Cloner Object and place a cube inside,using Random as clones type.The result clones changed with the order in Cloner Object like below:
But when I try to get the information of the clones like:
Matrix clonerMatrix = clonerObj->GetMg(); BaseTag* motag = clonerObj->GetTag(ID_MOTAGDATA); if (motag == nullptr) return; // populate the GetMoDataMessage instance by sending a MSG_GET_MODATA GetMoDataMessage modataMsg; if (!motag->Message(MSG_GET_MODATA, &modataMsg)) return; if (!modataMsg.modata) return; // access the MoData from the returned GetMoDataMessage and check its validity MoData* moData = modataMsg.modata; if (!moData) return; // retrieve the number of Matrix items as well as the array containing the matrix for each of them Int32 matrixItemsCnt = moData->GetCount(); Matrix* itemsMtxArray = static_cast<Matrix*>(moData->GetArray(MODATA_MATRIX));
the matrixItemsCnt always be 60 ,full of the instances in this case ,same as the Matrix I got.Any way can I just get the clones shown as the random result?Many thanks.
-
RE: How to get the attributes of rsramp node in c++?
@ferdinand
Thank you for the answer! The problem is solved after I try to find the child of the port according to your answer. -
How to get the attributes of rsramp node in c++?
I want to get the value of the knots' color,interpolation,knot position and bias position of a rsramp node .It seems that it is a special data type that I can not get it like "GetOrDefaultmaxon::Float64()".