@m_adam Thanks for your help. That made things clear.

Danchyg1337
@Danchyg1337
Posts made by Danchyg1337
-
RE: Get viewport image of inactive document.
-
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!