Hello! Sorry for not providing any specific info about the problem, it was not really aything to provide in fact. Your last guess about document related stuff is absolutely correct. There is a piece of code responsible for handling a license which was indeed using documents. Thanks!
Posts made by Danchyg1337
-
RE: Plugin causes Render Region to turn black
-
Plugin causes Render Region to turn black
Hello! We have an OBJECT_MODIFIER plugin which already works fine, but with one minor problem. When you enable render region, it's just black. The plugin modifies an object, but render region turns black the moment you add the plugin to a scene, even when it has no object to modify. Did someone encounter this before or has any clues where to look at in the code?
-
Symbol not found: ___chkstk_darwin
Hello! Such error happens on Mac OS 10.13 High Sierra, Cinema 4D R23.
The plugin was written in C++. It happens in a funtion that calls python to get the machine ID. Something like this:
value = os.popen("ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)'").read().split()[-1][1:-1]
Any ideas what might be the solution?
-
R25 Json Parser Usage
Hello! I'm currently trying to transfer S24 plugin code into R25. As i see in changelog, parser_json.h is replaced with parser.h. But the usage is not clear. In the code, i was reading the string with
jsonParser.Read(result, maxon::JSONPARSERFLAGS::NONE, dd) iferr_return;
and jsonParser is
maxon::JsonParserRef jsonParser;
created like this
auto jsonCRes = maxon::JsonParserRef::Create(); if (jsonCRes == maxon::FAILED) MessageDialog("JSON parser create fail"_s); jsonParser = jsonCRes.GetValue();
I couldn't find anything similar to such creation in the new parser. Could you breafly explain how to create a valid ParserRef and call ReadString to convert string into dictionary?
Thanks! -
RE: Get viewport image of inactive document.
@m_adam Thanks for your help. That made things clear.
-
RE: Get viewport image of inactive document.
@m_adam Unfortunately, we are looking for real-time performance. RenderDocument is fast only on light projects.
We are also looking for a workaround.
We are trying to create plugin which tracks switching between documents. What is the most efficient way to catch last image of document viewport before switching the document? There is MSG_DOCUMENTINFO_TYPE_SETACTIVE, but as i understand, it will be too late to get viewport image after that event. -
RE: Get viewport image of inactive document.
@m_adam Thanks for your reply.
As many as there opened documents.
Context is CommandData. -
Get viewport image of inactive document.
Hello! I asked about GetViewportImage() in this topic few days ago. Code worked as it should, but it seems like it only gets image from active document, even tho BaseDraw is different.
Here is my code.BaseDocument* doc = GetFirstDocument(); while (doc) { BaseDraw* bd = doc->GetActiveBaseDraw(); if (!bd) { doc = doc->GetNext(); continue; } AutoAlloc<BaseBitmap> bitmap; // Get the viewport image from the viewport renderer maxon::ImageRef img; bd->GetViewportImage(img); if (img == nullptr) { doc = doc->GetNext(); continue; } // Transform ImageRef to BaseBitmap in order to show it in the PictureViewer const Int w = img.GetWidth(); const Int h = img.GetHeight(); maxon::PixelFormat rgbf = img.GetPixelFormat(); Int32 bitsPerColor = (Int32)(rgbf.GetBitsPerPixel().Get() / rgbf.GetChannelCount()); bitmap->Init((Int32)w, (Int32)h, bitsPerColor == 32 ? 96 : 32); maxon::BaseArray<UChar> line; line.Resize(w * rgbf.GetBitsPerPixel().GetBytes()).GetValue(); maxon::PixelMutableBuffer imageBuffer(line.GetFirst(), rgbf.GetBitsPerPixel()); maxon::GetPixelHandlerStruct getpixel = img.GetPixelHandler(rgbf, rgbf.GetChannelOffsets(), maxon::ColorProfile(), maxon::GETPIXELHANDLERFLAGS::NONE, nullptr).GetValue(); for (Int y = 0; y < h; y++) { getpixel.GetPixel(maxon::ImagePos(0, y, w), imageBuffer, maxon::GETPIXELFLAGS::NONE).GetValue(); bitmap->SetPixelCnt(0, (Int32)y, (Int32)w, line.GetFirst(), (Int32)rgbf.GetBitsPerPixel().GetBytes(), bitsPerColor == 32 ? COLORMODE::RGBf : COLORMODE::RGB, PIXELCNT::NONE); } ShowBitmap(bitmap); doc = doc->GetNext(); }
Each showed bitmap contains only active document viewport.
I also tried to switch document with SetActiveDocument() and then call DrawViews() before getting viewport image, but that didnt work.
Is there a way to get viewpirt image of inactive documents? -
RE: Using GetViewportImage()
@m_magalhaes Thanks a lot! That makes things clear.
-
Using GetViewportImage()
Hello! In R23 we got an interesting feature to play with, but there is not much of an info about how to use it properly. Im talking about BaseDraw::GetViewportImage().
This is what i tried.
AutoAlloc<BaseBitmap> bmp; maxon::ImageRef imgr = maxon::ImageClasses::IMAGE().Create() iferr_return; const maxon::PixelFormat rgbFormat = maxon::PixelFormats::RGB::U8(); const auto storageType = maxon::ImagePixelStorageClasses::Normal(); imgr.Init(optW, optH, storageType, rgbFormat) iferr_return; bmp->Init(optW, optH); bmp->GetImageRef(SAVEBIT::NONE, true, imgr); doc->GetActiveBaseDraw()->GetViewportImage(imgr); ShowBitmap(bmp);
Bitmap is just black, which leads me to conclusion that im using it the wrong way.
How to use this new function properly and save to bitmap? -
Accessing object container in C++.
Hello! How can i do the same in C++?
The point is to set specific data by DescID. In python i can simply do what is on screenshot.But for C++ case isn't that simple.
What i've tried already:GetDataInstance();
In this case i can only accessObject Properties
container, but notCoordinates
.
GetDescription();
Also tried to useGetDescription();
and go through usingGetNext();
, but the problem is that BaseContaner isconst
, so i can't modify it.
How to properly access any container of object?
Thanks! -
Possibility of using ExecuteSubID with ToolData.
Hello! I'm looking for a way to launch my ToolData plugin with preset.
Example:
How can i do it? Should i create and register CommandData plugin in my ToolData plugin project? Or there is another way to do it?
Thanks!
-
RE: TreeView Multiple Selection With LMB
@m_adam Now i see the problem. Thanks alot for helping!
-
RE: TreeView Multiple Selection With LMB
@m_adam Yes. I just checked that. A select few items with shift+click, and unselect with ctrl+click. Everything works fine.
I want to provide you my code, but there is a messy structure like this
typedef std::tuple<DescID, Int32, BaseContainer> MainMapCellArrayCell; typedef std::list<MainMapCellArrayCell> MainMapCellArray; typedef std::list<std::pair<MainMapCellArray, BaseContainer>> MainMap; typedef std::pair<MainMapCellArray, BaseContainer> MainMapCell;
And i'm not sure it will be efficient way to help. Can i send you whole project to email?
-
RE: TreeView Multiple Selection With LMB
@m_adam Maybe i'm little misunderstood you. I meant not exactly third case. But a case, when you start holding your mouse at empty space and selecting objects with outcoming rectangle.
-
RE: TreeView Multiple Selection With LMB
@m_adam I select them with third case, by clicking on one, holding, dragging and releasing mouse.
Thanks for useful information, i'm gonna try everything what you suggesed and answer on my results here. -
RE: TreeView Multiple Selection With LMB
@m_adam Here are required functions:
void* Tree::GetFirst(void* root, void* userdata) { TreeNode* obj = (TreeNode*)root; return obj; } void* Tree::GetNext(void* root, void* userdata, void* obj) { TreeNode* res = (TreeNode*)obj; if (res && res->next) return res->next; return NULL; } void* Tree::GetPred(void* root, void* userdata, void* obj) { TreeNode* res = (TreeNode*)obj; if (res && res->pred) return res->pred; return NULL; } void* Tree::GetDown(void* root, void* userdata, void* obj) { TreeNode* res = (TreeNode*)obj; if (res && res->root && res->down) return res->down; return NULL; } String Tree::GetName(void* root, void* userdata, void* obj) { if (!obj) return ""; TreeNode* res = (TreeNode*)obj; if (res->root) { String name = res->cell->second.GetString(OBJSET_NAME); if (res->cell->second.GetInt32(OBJSET_ID)) return name; else { Filename fn(name); return fn.GetFile().GetString(); } } return std::get<2>(*(res->arrayCell)).GetString(DESCPREF_NAME); } Int Tree::GetId(void* root, void* userdata, void* obj) { return (Int)obj; } Bool Tree::IsSelected(void* root, void* userdata, void* obj) { TreeNode* res = (TreeNode*)obj; if (!res) return false; if (res->root) return std::find(parent->objID.begin(), parent->objID.end(), &(*res->cell)) != parent->objID.end(); return std::find(parent->clickID.begin(), parent->clickID.end(), &(*res->arrayCell)) != parent->clickID.end(); }
And
Select()
from post above. None of my attempts to check for nullptr helped, so nothing new to provide for that function.
My code with stuff like&(*res->cell))
and&(*res->arrayCell))
may look unsafe, but it works as intended. If i select with clicking and holding SHIFT button, everything works fine, but when i try to drag LMB i get instant crash even when there are no objects in drag rectangle.Thanks!
-
RE: TreeView Multiple Selection With LMB
@m_adam Thanks for the reply! About
SelectObject(&(*res->cell));
. Inside ofSelectObject()
i check for a nullptr at the very start, and i hope thisTreeNode* res = (TreeNode*)obj; if (!res) return;
is enogh to prevent nullptr in
Select
. Maybe i just misunderstood you about nullptr, correct me then please.I'm not sure what should i send you as simpified version, because there is a bunch of code and i don't know which function causes it. I supposed it was Select, but aparently problen is not in it. What about my virtual functions? Could i miss some important virtual function?
-
TreeView Multiple Selection With LMB
Hello! I have a problem with TreeViewFunctions. When i try to select multiple lines with my mouse i get instant crash.
Here is my Select function:void Tree::Select(void* root, void* userdata, void* obj, Int32 mode) { TreeNode* res = (TreeNode*)obj; if (!res) return; if (!res->root) { switch (mode) { case SELECTION_NEW: parent->clickID.clear(); parent->SelectClick(&(*res->arrayCell)); break; case SELECTION_ADD: parent->SelectClick(&(*res->arrayCell)); break; case SELECTION_SUB: parent->clickID.erase(std::find(parent->clickID.begin(), parent->clickID.end(), &(*res->arrayCell))); break; } } else { switch (mode) { case SELECTION_NEW: parent->objID.clear(); parent->SelectObject(&(*res->cell)); break; case SELECTION_ADD: parent->SelectObject(&(*res->cell)); break; case SELECTION_SUB: parent->objID.erase(std::find(parent->objID.begin(), parent->objID.end(), &(*res->cell))); break; } } }
And Tree class with TreeNode:
class TreeNode { public: Bool root = false, open = false; MainMap::iterator cell; MainMapCellArray::iterator arrayCell; TreeNode* next = nullptr; TreeNode* pred = nullptr; TreeNode* down = nullptr; }; class Tree : public TreeViewFunctions { public: ManageDialog* parent; MainMap* lst; Int32 currObj; Int32 level = 0; virtual void* GetFirst(void* root, void* userdata); virtual void* GetNext(void* root, void* userdata, void* obj); virtual void* GetDown(void* root, void* userdata, void* obj); virtual void DrawCell(void* root, void* userdata, void* obj, Int32 col, DrawInfo* drawinfo, const GeData& bgColor); virtual Bool IsSelected(void* root, void* userdata, void* obj); virtual Bool IsOpened(void* root, void* userdata, void* obj); virtual String GetName(void* root, void* userdata, void* obj); virtual Int GetId(void* root, void* userdata, void* obj); virtual void* GetPred(void* root, void* userdata, void* obj); virtual void CreateContextMenu(void* root, void* userdata, void* obj, Int32 lColumn, BaseContainer* bc); virtual Bool ContextMenuCall(void* root, void* userdata, void* obj, Int32 lColumn, Int32 lCommand); virtual void Select(void* root, void* userdata, void* obj, Int32 mode); virtual void Open(void* root, void* userdata, void* obj, Bool onoff); virtual void InsertObject(void* root, void* userdata, void* obj, Int32 dragtype, void* dragobject, Int32 insertmode, Bool bCopy); virtual Int32 AcceptDragObject(void* root, void* userdata, void* obj, Int32 dragtype, void* dragobject, Bool& bAllowCopy); virtual Int32 GetDragType(void* root, void* userdata, void* obj); virtual Int32 GetHeaderColumnWidth(void* root, void* userdata, Int32 col, GeUserArea* area); virtual void SetName(void* root, void* userdata, void* obj, const maxon::String& str); virtual Int32 DoubleClick(void* root, void* userdata, void* obj, Int32 col, MouseInfo* mouseinfo); };
Few questions:
When i select with mouse drag, what does Select get asobj
? Is that an array of TreeNodes or TreeView recursively calls Select for each element?When i do
return;
at start of Select i still get crash, i suppose problem can be in something else. What should i do to make it work properly?Thanks!