DistanceBlur
Attributes
-
ENGLISH NAME : DepthofField
-
NAME : DB_NAME
-
INCLUDE : VPbase
-
PATH : advanced_render/description/distanceblur.res
-
PLUGIN : advanced_render
-
MAXON online help (may not exist): DISTANCEBLUR
Elements
Example Code
The following code does not use the correct values when setting the data. You should check directly in C4D for the correct values that you should use in place of the ones that are shown.
This code is just to show you how to access the values for getting and setting the parameters.
Python
import c4d
from c4d import gui
def main():
videoPost = c4d.BaseVideoPost(c4d.DistanceBlur)
#You can set parameters two different ways.
#First way
videoPost[c4d.DB_FBLUR] = 0.1
videoPost[c4d.DB_DBLURON] = True
videoPost[c4d.DB_DBLUR] = 0.1
videoPost[c4d.DB_BBLURON] = True
videoPost[c4d.DB_BBLUR] = 0.1
videoPost[c4d.DB_DOFON] = True
videoPost[c4d.DB_DOF] = 0.1
videoPost[c4d.DB_AFOCUSON] = True
videoPost[c4d.DB_AFOCUS] = 0.1
videoPost[c4d.DB_RANGE_USE] = True
videoPost[c4d.DB_SHARP] = 0.1
videoPost[c4d.DB_MINT] = 0.1
videoPost[c4d.DB_REFTYPE] = c4d.CIRCULAR
videoPost[c4d.DB_ROT] = 0.1
videoPost[c4d.DB_TINT_USE] = True
videoPost[c4d.DB_TINT_USERANGE] = True
videoPost[c4d.DB_TINT_USECAM] = True
videoPost[c4d.DB_TINT_FSTART] = 0.1
videoPost[c4d.DB_TINT_BSTART] = 0.1
videoPost[c4d.DB_TINT_FEND] = 0.1
videoPost[c4d.DB_TINT_BEND] = 0.1
#Second way, using the base container.
bc = videoPost.GetDataInstance()
bc.SetFloat(c4d.DB_FBLUR,0.1)
bc.SetBool(c4d.DB_DBLURON,True)
bc.SetFloat(c4d.DB_DBLUR,0.1)
bc.SetBool(c4d.DB_BBLURON,True)
bc.SetFloat(c4d.DB_BBLUR,0.1)
bc.SetBool(c4d.DB_DOFON,True)
bc.SetFloat(c4d.DB_DOF,0.1)
bc.SetBool(c4d.DB_AFOCUSON,True)
bc.SetFloat(c4d.DB_AFOCUS,0.1)
bc.SetBool(c4d.DB_RANGE_USE,True)
bc.SetFloat(c4d.DB_SHARP,0.1)
bc.SetFloat(c4d.DB_MINT,0.1)
bc.SetInt32(c4d.DB_REFTYPE,c4d.CIRCULAR)
bc.SetFloat(c4d.DB_ROT,0.1)
bc.SetBool(c4d.DB_TINT_USE,True)
bc.SetBool(c4d.DB_TINT_USERANGE,True)
bc.SetBool(c4d.DB_TINT_USECAM,True)
bc.SetFloat(c4d.DB_TINT_FSTART,0.1)
bc.SetFloat(c4d.DB_TINT_BSTART,0.1)
bc.SetFloat(c4d.DB_TINT_FEND,0.1)
bc.SetFloat(c4d.DB_TINT_BEND,0.1)
if __name__=='__main__':
main()
C++
#include "c4d.h"
#include "../advanced_render/description/distanceblur.h"
void SampleFunction()
{
BaseDocument *pDoc = GetActiveDocument();
BaseVideoPost *pVideoPost = BaseVideoPost::Alloc(DistanceBlur);
//You can set parameters two different ways.
//First way
//Some objects do not store all their data in the container. You need to use GetParameter()/SetParameter() instead.
DESCFLAGS_SET flags = DESCFLAGS_SET_PARAM_SET;
pVideoPost->SetParameter(DescID(DB_FBLUR),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_DBLURON),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_DBLUR),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_BBLURON),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_BBLUR),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_DOFON),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_DOF),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_AFOCUSON),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_AFOCUS),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_RANGE_USE),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_SHARP),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_MINT),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_REFTYPE),GeData(CIRCULAR),flags);
pVideoPost->SetParameter(DescID(DB_ROT),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_TINT_USE),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_TINT_USERANGE),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_TINT_USECAM),GeData(true),flags);
pVideoPost->SetParameter(DescID(DB_TINT_FSTART),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_TINT_BSTART),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_TINT_FEND),GeData(0.1),flags);
pVideoPost->SetParameter(DescID(DB_TINT_BEND),GeData(0.1),flags);
pVideoPost->Message(MSG_UPDATE);
//Second way, using the base container.
BaseContainer *bc = pVideoPost->GetDataInstance();
bc->SetFloat(DB_FBLUR,0.1);
bc->SetBool(DB_DBLURON,true);
bc->SetFloat(DB_DBLUR,0.1);
bc->SetBool(DB_BBLURON,true);
bc->SetFloat(DB_BBLUR,0.1);
bc->SetBool(DB_DOFON,true);
bc->SetFloat(DB_DOF,0.1);
bc->SetBool(DB_AFOCUSON,true);
bc->SetFloat(DB_AFOCUS,0.1);
bc->SetBool(DB_RANGE_USE,true);
bc->SetFloat(DB_SHARP,0.1);
bc->SetFloat(DB_MINT,0.1);
bc->SetInt32(DB_REFTYPE,CIRCULAR);
bc->SetFloat(DB_ROT,0.1);
bc->SetBool(DB_TINT_USE,true);
bc->SetBool(DB_TINT_USERANGE,true);
bc->SetBool(DB_TINT_USECAM,true);
bc->SetFloat(DB_TINT_FSTART,0.1);
bc->SetFloat(DB_TINT_BSTART,0.1);
bc->SetFloat(DB_TINT_FEND,0.1);
bc->SetFloat(DB_TINT_BEND,0.1);
pVideoPost->Message(MSG_UPDATE);
}
Gradients
This node has gradients. Gradients can manually be edited by calling the following code
Python
C++
#include "customgui_gradient.h"
DB_RANGE_FGRAD
GeData data;
pVideoPost->GetParameter(DescID(DB_RANGE_FGRAD),data,DESCFLAGS_GET_PARAM_GET));
Gradient *pGradient = (Gradient*)data.GetCustomDataType(CUSTOMDATATYPE_GRADIENT);
if(pGradient)
{
//must be set before any knot is set
pGradient->SetData(GRADIENT_MODE, GeData(GRADIENTMODE_ALPHA));
GradientKnot k1, k2;
k1.col = Vector(0.0, 0.0, 1.0);
k1.pos = 0.0;
k2.col = 1.0;
k2.pos = 1.0;
pGradient->InsertKnot(k1);
pGradient->InsertKnot(k2);
}
pVideoPost->SetParameter(DescID(DB_RANGE_FGRAD),data,DESCFLAGS_SET_PARAM_SET));
DB_RANGE_BGRAD
pVideoPost->GetParameter(DescID(DB_RANGE_BGRAD),data,DESCFLAGS_GET_PARAM_GET));
DB_TINT_FGRAD
pVideoPost->GetParameter(DescID(DB_TINT_FGRAD),data,DESCFLAGS_GET_PARAM_GET));
DB_TINT_BGRAD
pVideoPost->GetParameter(DescID(DB_TINT_BGRAD),data,DESCFLAGS_GET_PARAM_GET));