-
首页
-
C4D R23.110 C++ SDK
BaseVideoPost
Manual
内容表
关于
A
BaseVideoPost
object represents a video post effect in the render settings. Such a video post can be a simple filter or a complete render engine. Custom video posts can be created using the
VideoPostData
class.
BaseVideoPost
objects are an instance of
VPbase
.
// This example searches for the "Watermark" post effect and enables it.
// If it does not exist, it is added.
const
Int
watermarkID = 1025462;
RenderData
*
const
renderData = doc->
GetActiveRenderData
();
BaseVideoPost
* videoPost = renderData->
GetFirstVideoPost
();
BaseVideoPost
* watermark =
nullptr
;
// search for the "Watermark" video post
while
(videoPost !=
nullptr
)
{
// check if this is a "Watermark"
if
(videoPost->
GetType
() == watermarkID)
{
watermark = videoPost;
break
;
}
videoPost = videoPost->
GetNext
();
}
// if not found, create the watermark
if
(watermark ==
nullptr
)
{
watermark =
BaseVideoPost::Alloc
(watermarkID);
if
(watermark ==
nullptr
)
return
maxon::OutOfMemoryError(
MAXON_SOURCE_LOCATION
);
renderData->
InsertVideoPost
(watermark);
}
// enable
watermark->
DelBit
(
BIT_VPDISABLED
);
Access
BaseVideoPost
elements are stored in an
RenderData
object:
另请参阅
RenderData Manual
.
Allocation/Deallocation
BaseVideoPost
object are created with the usual tools:
Newly created
BaseVideoPost
objects can be added to the render settings by adding them to the
RenderData
object:
// This example adds the color correction video post to the current render settings.
RenderData
*
const
renderData = doc->
GetActiveRenderData
();
if
(renderData ==
nullptr
)
return
maxon::UnexpectedError(
MAXON_SOURCE_LOCATION
);
BaseVideoPost
*
const
colorCorrection =
BaseVideoPost::Alloc
(
VPcolorcorrection
);
if
(colorCorrection ==
nullptr
)
return
maxon::OutOfMemoryError(
MAXON_SOURCE_LOCATION
);
renderData->
InsertVideoPost
(colorCorrection);
导航
BaseVideoPost
objects are organized in a list. This list can be navigated with:
// This example loops through all video posts and prints their names.
RenderData
*
const
renderData = doc->
GetActiveRenderData
();
BaseVideoPost
* videoPost = renderData->
GetFirstVideoPost
();
while
(videoPost !=
nullptr
)
{
ApplicationOutput
(
"Video post name: "
+ videoPost->
GetName
());
videoPost = videoPost->
GetNext
();
}
特性
The parameters of a video post can be accessed through
C4DAtom::GetParameter()
and
C4DAtom::SetParameter()
. The IDs of these parameters are defined in the header file of the specific video post like
vpxmbsampler.h
,
vppreviewhardware.h
,
vpwatermark.h
etc.
Read-Only Properties
Not every video post can be combined with every render engine. It is needed to ask the
BaseVideoPost
object if it can be used with the given render engine.
// This example checks if the video post can be added to used render engine
RenderData
*
const
renderData = doc->
GetActiveRenderData
();
// check render engine
BaseContainer
& bc = renderData->
GetDataInstanceRef
();
const
Int32
renderEngine = bc.
GetInt32
(
RDATA_RENDERENGINE
);
// create new video post
BaseVideoPost
* watermark =
BaseVideoPost::Alloc
(1025462);
if
(watermark ==
nullptr
)
return
maxon::OutOfMemoryError(
MAXON_SOURCE_LOCATION
);
// check if the video post is compatible with the given render engine
if
(watermark->
RenderEngineCheck
(renderEngine))
{
// insert video post
renderData->
InsertVideoPost
(watermark);
}
else
{
// delete video post
ApplicationOutput
(
"This video post cannot work with the current render engine."
);
BaseVideoPost::Free
(watermark);
}
Stereo
A video post could also handle stereoscopic related functionality. By default the only existing video post that does handle stereoscopic images is the stereo video post (ID
450000225
). To check if a plugin video post handles stereo images check the flag
PLUGINFLAG_VIDEOPOST_STEREO_RENDERING
. The source and target bitmap data is stored as a
BaseBitmap
(见
BaseBitmap Manual
).
// This example merges the two given BaseBitmaps in the src array into a single anaglyph bitmap
AutoAlloc<BaseVideoPost>
stereoVP { 450000225 };
if
(stereoVP ==
nullptr
)
return
maxon::OutOfMemoryError(
MAXON_SOURCE_LOCATION
);
BaseContainer
settings;
设置。
SetInt32
(
RDATA_STEREO_MODE
,
RDATA_STEREO_MODE_ANAGLYPH
);
// merge bitmaps
if
(stereoVP->StereoMergeImages(targetBitmap,
src
, 2, settings,
COLORSPACETRANSFORMATION::NONE
) ==
false
)
return
maxon::UnknownError(
MAXON_SOURCE_LOCATION
);
// show the result image
ShowBitmap
(targetBitmap);
另请参阅
CameraObject Manual
.
Bits
If a videopost is enabed or not is controlled with a bit:
// This example disables the first video post.
RenderData
*
const
rd = doc->
GetActiveRenderData
();
if
(rd ==
nullptr
)
return
maxon::UnexpectedError(
MAXON_SOURCE_LOCATION
);
BaseVideoPost
*
const
vp = rd->
GetFirstVideoPost
();
if
(vp !=
nullptr
)
vp->
SetBit
(
BIT_VPDISABLED
);
延伸阅读
@ RDATA_STEREO_MODE_ANAGLYPH
定义:
drendersettings.h:430
maxon::Int Int
定义:
ge_sys_math.h:62
void SetInt32(Int32 id, Int32 l)
定义:
c4d_basecontainer.h:505
BaseVideoPost * GetFirstVideoPost()
#define MAXON_SOURCE_LOCATION
定义:
memoryallocationbase.h:66
@ RDATA_RENDERENGINE
定义:
drendersettings.h:39
void SetBit(Int32 mask)
定义:
c4d_baselist.h:2200
static BaseVideoPost * Alloc(Int32 type)
void DelBit(Int32 mask)
定义:
c4d_baselist.h:2213
const T & src
定义:
apibase.h:2525
static void Free(BaseVideoPost *&bl)
const BaseContainer & GetDataInstanceRef() const
定义:
c4d_baselist.h:2299
@ RDATA_STEREO_MODE
定义:
drendersettings.h:429
maxon::Int32 Int32
定义:
ge_sys_math.h:58
#define ApplicationOutput(formatString,...)
定义:
debugdiagnostics.h:207
Bool ShowBitmap(const Filename &fn)
#define VPcolorcorrection
Color correction.
定义:
c4d_videopostdata.h:224
#define BIT_VPDISABLED
Videopost is disabled.
定义:
ge_prepass.h:873
BaseVideoPost * GetNext(void)
定义:
c4d_videopost.h:56
RenderData * GetActiveRenderData(void)
Bool RenderEngineCheck(Int32 id)
定义:
c4d_basedocument.h:136
String GetName() const
定义:
c4d_baselist.h:2318
void InsertVideoPost(BaseVideoPost *pvp, BaseVideoPost *pred=nullptr)
Int32 GetType() const
定义:
c4d_baselist.h:1348
Int32 GetInt32(Int32 id, Int32 preset=0) const
定义:
c4d_basecontainer.h:303
定义:
c4d_basecontainer.h:46