Group Details Private

administrators

  • RE: VolumeObject ReadObject and WriteObject no supported?

    Hi Kent, thanks for reaching out us.

    With regard to your issue, at the moment writing/reading a VolumeObject using the C4DAtom::WriteObject / C4DAtom::ReadObject using an Hyperfile is not supported if the HyperFile object operates on disk.

    At the moment a workaround is represented by using a temporary memory file, write into that, write that to disk. To read/write using MemoryFileStruct please visit here.

    The following code shows how to read/write VolumeObject from/to memory-located HF.

    	iferr_scope;
    	
    	// alloc the VolumeObject to write
    	AutoAlloc<VolumeObject> volObjWrite;
    	if (!volObjWrite)
    		return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
    	
    	// put some data in the VolumeObject
    	const maxon::Int    gridIndex = 0;
    	const maxon::Url volumeUrl ("<your path to a vdb>"_s);
    	const maxon::Volume volume = maxon::VolumeInterface::CreateFromFile(volumeUrl, 1.0, gridIndex) iferr_return;
    
    	// insert volume
    	volObjWrite->SetVolume(volume);
    	
    	// alloc HF
    	AutoAlloc<HyperFile> hf;
    	if (!hf)
    		return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
    	
    	// alloc MemoryFileStruct
    	AutoAlloc<MemoryFileStruct> mfs;
    	if (!mfs)
    		return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
    	
    	// alloc Filename and set to memory
    	Filename fn;
    	fn.SetMemoryWriteMode(mfs);
    	
    	// open HyperFile to write
    	if (!hf->Open(0, fn, FILEOPEN::WRITE, FILEDIALOG::NONE))
    		return maxon::UnknownError(MAXON_SOURCE_LOCATION);
    	
    	// write volume to memory HF
      Bool writeRes = volObjWrite->WriteObject(hf);
    	if (writeRes)
    		DiagnosticOutput("volume written on HF");
    	
    	// close written HF
    	hf->Close();
    
            //... write memory-located HF to disk
            //... do your stuff
            //...read from disk the memory-located HF
    	
    	// open HF to read
    	if (!hf->Open(0, fn, FILEOPEN::READ, FILEDIALOG::NONE))
    		return maxon::UnknownError(MAXON_SOURCE_LOCATION);
    	
    	// alloc the VolumeObject to read
    	AutoAlloc<VolumeObject> volObjRead;
    	if (!volObjRead)
    		return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
    	
    	// read volume from memory HF
    	Bool readRes = volObjRead->ReadObject(hf, true);
    	const maxon::VolumeInterface* volRead = volObjRead->GetVolume();
    	if (readRes && volRead)
    		DiagnosticOutput("volume read from HF");
    	
    	hf->Close();
    	
    	return maxon::OK;
    

    Best, Riccardo

    posted in Cinema 4D Development
  • RE: Vertex Weight Issue

    Good morning OrcunAkman, thanks for reaching out us.

    With regard to the issue, being it not connected with Cinema APIs, we warmly suggest to reach the Cinema 4D support page.

    Best, Riccardo

    posted in Cinema 4D Development
  • RE: First R21 plugin ... memory leaks and dangling references

    Hi Daniel,

    I just wanted to inform you that QA has been able to reproduce the issue. I've filed a bug report (ITEM#306240) and hope this to get solved soon.

    Cheers, R

    posted in Cinema 4D Development
  • RE: how to get all subobject(children) of active object?

    Hi @gheyret, thanks for reaching out us.

    Although @zipit has already provide an exhaustive answer to the topic (thanks man!) , I warmly suggest to look also to this blog post from @fwilleke80 and also to have a look at Navigation in Lists and Trees section on the GeListNode Manual.

    Best, Riccardo

    posted in Cinema 4D Development
  • RE: First R21 plugin ... memory leaks and dangling references

    Thanks Daniel for the extensive following up.

    I'll check with our QA if there's a machine without a discrete graphic card in our testing environment that could confirm your issue. At the same time I'll rise attention of our viewport engineers on the topic.

    Best, R.

    posted in Cinema 4D Development
  • RE: SendModelingCommand Failing

    Hi wuzelwazel, thanks for reaching out us.

    With regard on knowing more about the causes of SendModelingCommand failing on MCOMMAND_ALIGNNORMALS and MCOMMAND_REVERSENORMALS you could :

    • check in the Python Console
    • check the C4D Console started along the main app using passing g_console=true in the command line

    These two are the places where potential messages about the failure might be printed out.

    Finally, as pointed out by @zipit, this looks to me more like a modelling issue rather than an API one. Assuming that nothing gets printed out in both console, I warmly suggest considering to privately share your asset and let us investigate the issue together with the mesh.

    Best, Ricardo

    posted in Cinema 4D Development
  • RE: Critical Stop when deleting a plugin object

    Hi Frank, thanks for reaching out us.

    With regard to the reported issue, since we can easily end up in a lot of guess work, would you mind to privately share (email) the plugin to let us run some tests here?

    Thanks, Riccardo

    posted in Cinema 4D Development
  • RE: Blit to MultipassBitmap GeClipMap not working

    Exactly, that's what I meant by

    initing a GeClipMap with a MultipassBitmap created via AddLayer has some issue"

    Without clipmap->SetDrawMode(GE_CM_DRAWMODE::BLEND, GE_CM_SRC_MAX_OPACITY); you hit a default case in a switch statement which fires a critical stop whilst using it you actually try to blit to the GeClipMap but now you end up in a memory issue.

    I'll get back to you later next week
    Cheers, R

    posted in Cinema 4D Development
  • RE: Blit to MultipassBitmap GeClipMap not working

    Hi Daniel, I should strongly apologize here because due to an overlook of mine I forget to copy the test bitmap in the resource folder resulting in the code not to be executed and the breakpoint not to be hit.

    Sorry about that.

    I've looked more in detail and in order to get it done you have to actually set the draw mode to GE_CM_DRAWMODE::BLEND by calling

    		// use a clipmap for drawing/blitting the bitmap
    		AutoAlloc<GeClipMap> bitmapClipmap;
    		if (!bitmapClipmap)
    			return;
    		if (bitmapClipmap->Init(bitmap) != IMAGERESULT::OK)
    			return;
    		clipmap->SetDrawMode(GE_CM_DRAWMODE::BLEND, GE_CM_SRC_MAX_OPACITY);
    		clipmap->Blit(0, 0, *bitmapClipmap, 0, 0, bitmapClipmap->GetBw() - 1, bitmapClipmap->GetBh() - 1, GE_CM_BLIT::COPY);
    
    

    This will ensure that upon calling the GE_CM_BLIT::COPY the GeClipMap->Blit() function using GE_CM_BLIT::COPY works properly.

    Unfortunately this doesn't completely solve the issue, because it seems that initing a GeClipMap with a MultipassBitmap created via AddLayer has some issue I still need to investigate.

    I'll get back on Monday, hopefully, with more details.

    Again sorry for the confusion and have a nice weekend!

    posted in Cinema 4D Development
  • RE: ProjectTool problems in MacOs Catalina

    Hi c4dmac, thanks for following up here.

    With regard to the issue you've reported you can get fixed by reestablishing the executable bit on the kernel_app file found in the zip archive.
    To sum it up, upon downloading the project tool archive you have to:

    • remove quarantine
    xattr -d "com.apple.quarantine" ./cinema4d_r21_project_tool_20190903.zip
    
    • extract the archive (either via terminal or via finder)
    unzip -d ./cinema4d_r21_project_tool_20190903 ./cinema4d_r21_project_tool_20190903.zip
    
    • re-establish the kernel_app executable bit
    chmod 555 ./cinema4d_r21_project_tool_20190903/kernel_app.app/Contents/MacOS/kernel_app
    

    Best, Riccardo

    posted in Cinema 4D Development