Problem solved! Thank you!
Latest posts made by hazzzel
-
RE: Using "config" plugins to modify the loading queue in R19
-
Using "config" plugins to modify the loading queue in R19
Hi all,
I want to use a "config" plugins to read the loading queue in R19. A QueryStartupOrder() function works well in R20 and R21, but it seems like that it is not supported in R19. So, is there a way around it? Thanks!
-
RE: get bitmap of shader in r20
Thank you for your reply, the BaseShader::Sample() helps me solve this problem. (Except that when the layer shader use transform layer, scale transformation is not automatically handled.) Anyway, thanks a lot!
-
get bitmap of shader in r20
Hi,
I'm working on r20, and I found I can't use BaseShader::BakeShaderIntoBaseBitmap() because it is a new feature in r21. Trying find a way around, I want to extract the bitmap of the layer shader. However, my code does not work.
BaseBitmap* diffuseBitmap ; GeData gd; BaseShader* shader = bm->GetChannel(CHANNEL_DIFFUSION)->GetShader(); if (shader->GetType() == Xlayer) { LayerShader* layerShader = static_cast<LayerShader*>(shader); LayerShaderLayer* layerShaderLayer = layerShader->GetFirstLayer(); while (layerShaderLayer != NULL) { if (layerShaderLayer->GetType() == LayerType::TypeShader) { Bool res = layerShaderLayer->GetParameter(LAYER_S_PARAM_SHADER_LINK, gd); // diffuseBitmap = layerShaderLayer->GetPreview(); // this does not work, too! BaseLink *bl = gd.GetBaseLink(); // program stop here, and I can't see why BaseShader *thisShader = static_cast<BaseShader*>(bl->GetLinkAtom(bd)); thisShader->InitRender(irs); diffuseBitmap = thisShader->GetBitmap(); thisShader->FreeRender(); break; } layerShaderLayer = layerShaderLayer->GetNext(); } } else { // ... } ShowBitmap(diffuseBitmap); // can't see anything here when using 'layerShaderLayer->GetPreview()' diffuseBitmap->Save(fn, FILTER_JPG, nullptr, SAVEBIT::NONE); // fail when using 'GetPreview()'
Could anyone kindly explain where I am doing wrong? Thanks a lot!
-
How to bake shader into basebitmap?
Hi all,
I'm trying to use BaseShader::BakeShaderIntoBaseBitmap() to get a 2D representation of the shader. However, I couldn't get the correct result.
BaseDocument* bd = GetActiveDocument(); InitRenderStruct irs{ bd }; BaseBitmap* bit = BaseBitmap::Alloc(); BaseShader* shader = mat->GetChannel(CHANNEL_DIFFUSION)->GetShader(); shader->BakeShaderIntoBaseBitmap(*bit, *bd, irs.thread, false, irs.document_colorprofile, irs.linear_workflow, true, 0, 1000, 0, 1000) ShowBitmap(bit);
I have read 'BaseShader Manual', but I'm not sure where to get a parentThread, so I used irs.thread...
Any ideas or examples?