sekme-31
whitesmoke
600
#dd3333
# Load scene from a file.
renderer.load(os.path.join(SCENE_PATH, "intro.vrscene"))
# Fill the VFB layers settings from the SettingsVFB plugin to the VFB Layer Manager
renderer.vfb.applySettingsVFB()
lm = renderer.vfb.layerManager
# Lock the layers so it will be a thread-safe batch operation.
lm.lockLayers()
# Get a handle to the Display Correction (DC) layer.
dcLayer = lm.getDisplayCorrectionLayer()
# Create a cc exposure layer as a child of the DC layer.
# All of the creatable class name you can get as a list by calling the getCreatableLayerClasses method.
dcExpLayer = lm.createLayer("chaos.cc.exposure", dcLayer)
# Check validity of the handle. On an error, empty handles are returned.
if dcExpLayer.isValid():
# Set some properties of the exposure layer.
# All the methods may throw exceptions if an error occurs.
dcExpLayer.setBlendMode("BlendMode_Exclusion")
# All of the properties of a layer you can get as a list by calling getLayerPropertyNames.
dcExpLayer.hilight_burn = 0.5
# Create a MultiMatte mask layer whose parent is the exposure layer.
dcExpMMMaskLayer = lm.createLayer("chaos.ref.re.colormask", dcExpLayer)
if dcExpMMMaskLayer.isValid():
# If you are not sure whether a property exists, you can search it by getting a list of all
# modifiable layer fields.
propsNames = dcExpMMMaskLayer.getLayerPropertiesOfType("Bool")
for propName in propsNames:
if propName == "use_intensity":
dcExpMMMaskLayer.use_intensity = True
# Never forget to unlock the layers. Otherwise, the whole VFB freezes.
lm.unlockLayers()
# Fill the VFB layers settings from the VFB Layer Manager to the SettingsVFB plugin.
renderer.vfb.fillSettingsVFB()
# Start rendering.
renderer.startSync()
# Wait some time.
time.sleep(3)
# Lock the layers, so the user cannot access them from the UI.
lm.lockLayers()
# Get a new handle to the DC layer. The old one is invalid after the beginning of the rendering.
dcLayer = lm.getDisplayCorrectionLayer()
# Change the current DC profile to Gamma 2.2.
typeProfile = dcLayer.getLayerPropertyType("profile")
if typeProfile == "IntEnum":
# You can know all the properties of an enumerable by calling getLayerPropertyIntEnumValues.
dcLayer.profile = "Gamma 2.2"
# Delete all mask layers.
masks = lm.findAllLayersWithLayerClass("chaos.ref.re.colormask")
for mask in masks:
if mask.canDelete():
lm.deleteLayer(mask)
# Set some Stamp layer parameters.
stampLayer = lm.getStampLayer()
stampLayer.stamp_font = {
"fontFamily": "stampFontFamily_modern",
"fontStyle": "stampFontStyle_italic",
}
stampLayer.stamp_string = "Incredible CCs"
stampLayer.stamp_color = vray.Color(1.0, 0.6, 0.6)
stampLayer.setEnabled(True)
# Never forget to unlock the layers. Otherwise the whole VFB freezes.
lm.unlockLayers()
# Wait for rendering to end.
renderer.waitForRenderEnd()
# If you want the changes you made while rendering to the layers to be saved to the vrscene.
renderer.vfb.fillSettingsVFB()
renderer.export("intro2.vrscene")
// Load scene from a file.
renderer.load("intro.vrscene");
// Fill the VFB layers settings from the SettingsVFB plugin to the VFB Layer Manager.
renderer.vfb.applySettingsVFB();
VRayRenderer::VFB::LayerManager& lm = renderer.vfb.layerManager;
// Lock the layers so it will be a thread-safe batch operation.
lm.lockLayers();
// Get a handle to the Display Correction (DC) layer.
VRayRenderer::VFB::Layer dcLayer = lm.getDisplayCorrectionLayer();
// Create a cc exposure layer as a child of the DC layer.
// All of the creatable class name you can get as a list by calling the getCreatableLayerClasses method.
VRayRenderer::VFB::Layer dcExpLayer = lm.createLayer("chaos.cc.exposure", dcLayer);
// Check validity of the handle. On an error, empty handles are returned.
if (dcExpLayer.isValid()) {
// Set some properties of the exposure layer.
// You can check if the operation has been successful by getting the return value.
dcExpLayer.setBlendMode(VFBLayerProperty::BlendMode::BlendMode_Exclusion);
// All of the properties of a layer you can get as a list by calling getLayerPropertyNames.
dcExpLayer.setLayerPropertyFloatValue("hilight_burn", 0.5f);
// Create a MultiMatte mask layer whose parent is the exposure layer.
VRayRenderer::VFB::Layer dcExpMMMaskLayer = lm.createLayer("chaos.ref.re.colormask", dcExpLayer);
if (dcExpMMMaskLayer.isValid()) {
// If you are not sure whether a property exists, you can search it by getting a list of all
// modifiable layer fields.
StringList propsNames;
if (dcExpMMMaskLayer.getLayerPropertiesOfType(VFBLayerProperty::Type::Bool, propsNames) == 0) {
for (size_t i = 0; i < propsNames.size(); i++) {
if (propsNames[i] == "use_intensity") {
dcExpMMMaskLayer.setLayerPropertyBoolValue("use_intensity", true);
}
}
}
}
}
// Never forget to unlock the layers. Otherwise, the whole VFB freezes.
lm.unlockLayers();
// Fill the VFB layers settings from the VFB Layer Manager to the SettingsVFB plugin.
renderer.vfb.fillSettingsVFB();
// Start rendering.
renderer.startSync();
// Wait some time.
Sleep(3000);
// Lock the layers, so the user cannot access them from the UI.
lm.lockLayers();
// Get a new handle to the DC layer. The old one is invalid after the beginning of the rendering.
dcLayer = lm.getDisplayCorrectionLayer();
// Change the current DC profile to Gamma 2.2.
VFBLayerProperty::Type type;
dcLayer.getLayerPropertyType("profile", type);
if (type == VFBLayerProperty::Type::IntEnum) {
// # You can know all the properties of an enumerable by calling getLayerPropertyIntEnumValues.
dcLayer.setLayerPropertyIntByEnumLabel("profile", "Gamma 2.2");
}
// Delete all mask layers.
vector<VRayRenderer::VFB::Layer> masks = lm.findAllLayersWithLayerClass("chaos.ref.re.colormask");
for (size_t i = 0; i < masks.size(); i++) {
bool isDeletable;
masks[i].canDelete(isDeletable);
if (isDeletable) {
lm.deleteLayer(masks[i]);
}
}
// Set some Stamp layer parameters.
VRayRenderer::VFB::Layer stampLayer = lm.getStampLayer();
VFBLayerProperty::StampFontDesc desc;
stampLayer.getLayerPropertyStampFontDescValue("stamp_font", desc);
desc.fontFamily = VFBLayerProperty::StampFontFamily::stampFontFamily_modern;
desc.fontStyle = VFBLayerProperty::StampFontStyle::stampFontStyle_italic;
stampLayer.setLayerPropertyStampFontDescValue("stamp_font", desc);
stampLayer.setLayerPropertyStampRawStringValue("stamp_string", "Incredible CCs");
stampLayer.setLayerPropertyColorValue("stamp_color", Color(1.0, 0.6, 0.6));
stampLayer.setEnabled(true);
// Never forget to unlock the layers. Otherwise the whole VFB freezes.
lm.unlockLayers();
// Wait for rendering to end.
renderer.waitForRenderEnd();
// If you want the changes you made while rendering to the layers to be saved to the vrscene.
renderer.vfb.fillSettingsVFB();
renderer.exportScene("intro2.vrscene");
// Load scene from a file.
renderer.Load("intro.vrscene");
// Fill the VFB layers settings from the SettingsVFB plugin to the VFB Layer Manager.
renderer.Vfb.ApplySettingsVFB();
VFB.VFBLayerManager lm = renderer.Vfb.LayerManager;
// Lock the layers so it will be a thread-safe batch operation.
lm.LockLayers();
// Get a handle to the Display Correction (DC) layer.
VFB.Layer dcLayer = lm.GetDisplayCorrectionLayer();
// Create a cc exposure layer as a child of the DC layer.
// All of the creatable class name you can get as a list by calling the GetCreatableLayerClasses method.
VFB.Layer dcExpLayer = lm.CreateLayer("chaos.cc.exposure", dcLayer);
// Check validity of the handle. On an error, empty handles are returned.
if (dcExpLayer.IsValid())
{
// Set some properties of the exposure layer.
// All the methods may throw exceptions if an error occurs.
dcExpLayer.SetBlendMode(VRay.VFBLayerProperty.BlendMode.Exclusion);
// All of the properties of a layer you can get as a list by calling GetLayerPropertyNames.
dcExpLayer.SetLayerPropertyFloatValue("hilight_burn", 0.5f);
// Create a MultiMatte mask layer whose parent is the exposure layer.
VFB.Layer dcExpMMMaskLayer = lm.CreateLayer("chaos.ref.re.colormask", dcExpLayer);
if (dcExpMMMaskLayer.IsValid())
{
// If you are not sure whether a property exists, you can search it by getting a list of all
// modifiable layer fields.
IEnumerable<string> propsNames = dcExpMMMaskLayer.GetLayerPropertiesOfType(VRay.VFBLayerProperty.Type.Bool);
foreach (var propName in propsNames)
{
if (propName == "use_intensity")
{
dcExpMMMaskLayer.SetLayerPropertyBoolValue("use_intensity", true);
}
}
}
}
// Never forget to unlock the layers. Otherwise, the whole VFB freezes.
lm.UnlockLayers();
// Fill the VFB layers settings from the VFB Layer Manager to the SettingsVFB plugin.
renderer.Vfb.FillSettingsVFB();
// Start rendering.
renderer.StartSync();
// Wait some time.
System.Threading.Thread.Sleep(3000);
// Lock the layers, so the user cannot access them from the UI.
lm.LockLayers();
// Get a new handle to the DC layer. The old one is invalid after the beginning of the rendering.
dcLayer = lm.GetDisplayCorrectionLayer();
// Change the current DC profile to Gamma 2.2.
VRay.VFBLayerProperty.Type type = dcLayer.GetLayerPropertyType("profile");
if (type == VRay.VFBLayerProperty.Type.IntEnum)
{
// You can know all the properties of an enumerable by calling GetLayerPropertyIntEnumValues.
dcLayer.SetLayerPropertyIntByEnumLabel("profile", "Gamma 2.2");
}
// Delete all mask layers.
IEnumerable<VFB.Layer> masks = lm.FindAllLayersWithLayerClass("chaos.ref.re.colormask");
foreach (var mask in masks)
{
if (mask.CanDelete())
{
lm.DeleteLayer(mask);
}
}
// Set some Stamp layer parameters.
VFB.Layer stampLayer = lm.GetStampLayer();
VRay.VFBLayerProperty.StampFontDesc desc = stampLayer.GetLayerPropertyStampFontDescValue("stamp_font");
desc.fontFamily = VRay.VFBLayerProperty.StampFontFamily.Modern;
desc.fontStyle = VRay.VFBLayerProperty.StampFontStyle.Italic;
stampLayer.SetLayerPropertyStampFontDescValue("stamp_font", desc);
stampLayer.SetLayerPropertyStampRawStringValue("stamp_string", "Incredible CCs");
stampLayer.SetLayerPropertyColorValue("stamp_color", new Color(1.0, 0.6, 0.6));
stampLayer.SetEnabled(true);
// Never forget to unlock the layers. Otherwise the whole VFB freezes.
lm.UnlockLayers();
// Wait for rendering to end.
renderer.WaitForRenderEnd();
// If you want the changes you made while rendering to the layers to be saved to the vrscene.
renderer.Vfb.FillSettingsVFB();
renderer.Export("intro2.vrscene");
// Load scene from a file asynchronously.
renderer.load('intro.vrscene', function (err) {
if (err) {
// Scene was not loaded.
throw err;
}
// Fill the VFB layers settings from the SettingsVFB plugin to the VFB Layer Manager
renderer.vfb.applySettingsVFB()
var lm = renderer.vfb.layerManager;
// Lock the layers so it will be a thread-safe batch operation.
lm.lockLayers();
// Get a handle to the Display Correction (DC) layer.
var dcLayer = lm.getDisplayCorrectionLayer();
// Create a cc exposure layer as a child of the DC layer.
// All of the creatable class name you can get as a list by calling the getCreatableLayerClasses method.
var dcExpLayer = lm.createLayer("chaos.cc.exposure", dcLayer);
// Check validity of the handle. On an error, empty handles are returned.
if (dcExpLayer.isValid()) {
// Set some properties of the exposure layer.
// All the methods may throw exceptions if an error occurs.
dcExpLayer.setBlendMode("BlendMode_Exclusion");
// All of the properties of a layer you can get as a list by calling getLayerPropertyNames.
dcExpLayer.hilight_burn = 0.5;
// Create a MultiMatte mask layer whose parent is the exposure layer.
var dcExpMMMaskLayer = lm.createLayer("chaos.ref.re.colormask", dcExpLayer);
if (dcExpMMMaskLayer.isValid()) {
// If you are not sure whether a property exists, you can search it by getting a list of all
// modifiable layer fields.
var propsNames = dcExpMMMaskLayer.getLayerPropertiesOfType("Bool");
for (var propName of propsNames) {
if (propName === "use_intensity") {
dcExpMMMaskLayer.use_intensity = true;
}
}
}
}
// Never forget to unlock the layers. Otherwise, the whole VFB freezes.
lm.unlockLayers();
// Fill the VFB layers settings from the VFB Layer Manager to the SettingsVFB plugin.
renderer.vfb.fillSettingsVFB();
// Start rendering.
renderer.start(function (err) {
if (err) {
// Couldn't start rendering.
throw err;
}
// Wait some time.
setTimeout(function () {
// Lock the layers, so the user cannot access them from the UI.
lm.lockLayers();
// Get a new handle to the DC layer. The old one is invalid after the beginning of the rendering.
dcLayer = lm.getDisplayCorrectionLayer();
// Change the current DC profile to Gamma 2.2.
var type = dcLayer.getLayerPropertyType("profile");
if (type === "IntEnum") {
// You can know all the properties of an enumerable by calling getLayerPropertyIntEnumValues.
dcLayer.profile = "Gamma 2.2";
}
// Delete all mask layers.
var masks = lm.findAllLayersWithLayerClass("chaos.ref.re.colormask");
for (var mask of masks) {
if (mask.canDelete()) {
lm.deleteLayer(mask);
}
}
// Set some Stamp layer parameters.
var stampLayer = lm.getStampLayer();
stampLayer.stamp_font = { "fontFamily": "stampFontFamily_modern", "fontStyle": "stampFontStyle_italic" };
stampLayer.stamp_string = "Incredible CCs";
stampLayer.stamp_color = vray.Color(1.0, 0.6, 0.6);
stampLayer.setEnabled(true);
// Never forget to unlock the layers. Otherwise the whole VFB freezes.
lm.unlockLayers();
// Wait for rendering to end.
renderer.waitForRenderEnd(function () {
// If you want the changes you made while rendering to the layers to be saved to the vrscene.
renderer.vfb.fillSettingsVFB();
renderer.export("intro2.vrscene", function () {
// Some other work if any and then renderer.close().
});
});
}, 3000);
});
});