Skip to content

Commit

Permalink
#5585: Expose light flag setters
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 11, 2021
1 parent 434aa35 commit 50653db
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install/scripts/materialtest.py
Expand Up @@ -61,6 +61,8 @@
newMaterial.setSurfaceFlag(dr.Material.SurfaceFlag.NONSOLID)
newMaterial.setSurfaceType(dr.Material.SurfaceType.WOOD)
newMaterial.setSpectrum(5)
newMaterial.setIsFogLight(1)
newMaterial.setIsBlendLight(0)

print('Full Material definition:\n{0}\n{{{1}}}'.format(newMaterial.getName(), newMaterial.getDefinition()))

Expand Down
5 changes: 5 additions & 0 deletions plugins/script/interfaces/ShaderSystemInterface.cpp
Expand Up @@ -218,6 +218,11 @@ void ShaderSystemInterface::registerInterface(py::module& scope, py::dict& globa
material.def("isAmbientLight", &ScriptMaterial::isAmbientLight);
material.def("isBlendLight", &ScriptMaterial::isBlendLight);
material.def("isFogLight", &ScriptMaterial::isFogLight);
material.def("isCubicLight", &ScriptMaterial::isCubicLight);
material.def("setIsAmbientLight", &ScriptMaterial::setIsAmbientLight);
material.def("setIsBlendLight", &ScriptMaterial::setIsBlendLight);
material.def("setIsFogLight", &ScriptMaterial::setIsFogLight);
material.def("setIsCubicLight", &ScriptMaterial::setIsCubicLight);
material.def("isNull", &ScriptMaterial::isNull);
material.def("getEditorImageExpressionString", &ScriptMaterial::getEditorImageExpressionString);
material.def("setEditorImageExpressionFromString", &ScriptMaterial::setEditorImageExpressionFromString);
Expand Down
28 changes: 28 additions & 0 deletions plugins/script/interfaces/ShaderSystemInterface.h
Expand Up @@ -63,6 +63,34 @@ class ScriptMaterial
return _material ? _material->isFogLight() : false;
}

bool isCubicLight() {
return _material ? _material->isCubicLight() : false;
}

void setIsAmbientLight(bool newValue)
{
throwIfMaterialCannotBeModified();
_material->setIsAmbientLight(newValue);
}

void setIsBlendLight(bool newValue)
{
throwIfMaterialCannotBeModified();
_material->setIsBlendLight(newValue);
}

void setIsFogLight(bool newValue)
{
throwIfMaterialCannotBeModified();
_material->setIsFogLight(newValue);
}

void setIsCubicLight(bool newValue)
{
throwIfMaterialCannotBeModified();
_material->setIsCubicLight(newValue);
}

bool isNull() const {
return _material == nullptr;
}
Expand Down

0 comments on commit 50653db

Please sign in to comment.