Navigation

    • Register
    • Login
    • Search
    1. Home
    2. Danchyg1337
    Danchyg1337

    Danchyg1337

    @Danchyg1337

    3
    Reputation
    44
    Posts
    59
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

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

    Best posts made by Danchyg1337

    Cinema 4D R20 plugin's conflict with Redshift

    Hello!
    My plugin is conflicting with Redshift 3.0.20. Cinema 4D loads infinitely until i disable Redshift, then it loads and plugin works.
    alt text
    Commandline.exe doesn't show any error, each plugin loaded.
    Project was compiled with Visual Studio 2017 v141 std17 in Release, Windows 10. Plugin has it's own unique ID from plugincafe.
    How can i find out where conflicting part is?

    posted in Cinema 4D SDK •
    Isoparm in Deformer plugin

    Hello! I have a problem with my deformer plugin.
    Plugin not only deforms shape of an object, but also adds new polygons and points to it.
    Problem appears when i try to use isoparms mode.
    What i figured out:
    Problem was in SendModelingCommand(). It was solved by making new document, executing passes and copy to original object.

    Bool DeformerPlugin::Disconnect(BaseObject* main, BaseThread* thread) {
    	BaseSelect* select = ToPoly(main)->GetPolygonS();
    	select->DeselectAll();
    	AutoAlloc<BaseDocument> basedocBuffer;
    	BaseObject* clonedOp = (BaseObject*)main->GetClone(COPYFLAGS::NONE, nullptr);
    	basedocBuffer->InsertObject(clonedOp, nullptr, nullptr);
    	basedocBuffer->ExecutePasses(thread, true, true, true, BUILDFLAGS::INTERNALRENDERER);
    	ModelingCommandData mcd;
    	BaseContainer bc;
    	bc.SetData(MDATA_DISCONNECT_PRESERVEGROUPS, false);
    	mcd.doc = clonedOp->GetDocument();
    	mcd.op = clonedOp;
    	mcd.mode = MODELINGCOMMANDMODE::POLYGONSELECTION;
    	mcd.flags = MODELINGCOMMANDFLAGS::NONE;
    	mcd.bc = &bc;
    
    	if (!SendModelingCommand(MCOMMAND_DISCONNECT, mcd)) {
    		ApplicationOutput("Disconnect error.");
    		return false;
    	}
    	clonedOp->CopyTo(main, COPYFLAGS::NONE, nullptr);
    	clonedOp->CopyMatrixTo(main);
    	clonedOp->CopyTagsTo(main, NOTOK, NOTOK, NOTOK, nullptr);
    	return true;
    }
    

    I should mention that plugin works well with polygon mesh objects and problem appears only with generator objects in isoparm mode.
    I guess problem is in Isoparm lines. I've tried to use BUILDFLAGS::ISOPARMS. I cannot use it with non-generator plugin. But i saw few plugins that change count of polygons and still work good. And due to my logic in code i cannot change plugin type to generator.

    Although creating a temporary document has been a solution, it still doesn't work good. Cinema4d crash appears randomly while i'm testing it. Usually it happens when i reduce amount of detail, i guess it is something with caches.

    What isoparms even are? Why should i use it and how to prevent cinema from crash?
    And what about SetIsoparm()? Can i use it in deformer plugin somehow? And should i?

    posted in Cinema 4D SDK •
    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.

    posted in Cinema 4D SDK •

    Latest posts made by Danchyg1337

    RE: Plugin causes Render Region to turn black

    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!

    posted in Cinema 4D SDK •
    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?

    posted in Cinema 4D SDK •
    Symbol not found: ___chkstk_darwin

    Hello! Such error happens on Mac OS 10.13 High Sierra, Cinema 4D R23.
    661c3b06-69c2-4345-9635-ef1e5130b87c-image.png

    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?

    posted in Cinema 4D SDK •
    RE: R25 Json Parser Usage

    @m_magalhaes Thank you!

    posted in Cinema 4D SDK •
    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!

    posted in Cinema 4D SDK •
    RE: Get viewport image of inactive document.

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

    posted in General Talk •
    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.

    posted in General Talk •
    RE: Get viewport image of inactive document.

    @m_adam Thanks for your reply.
    As many as there opened documents.
    Context is CommandData.

    posted in General Talk •
    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?

    posted in General Talk •
    RE: Using GetViewportImage()

    @m_magalhaes Thanks a lot! That makes things clear.

    posted in General Talk •