Skip to content

Commit

Permalink
#5585: Expose empty ScriptMaterialStage type to python
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Apr 11, 2021
1 parent 528896d commit 0f1d9fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions plugins/script/interfaces/ShaderSystemInterface.cpp
Expand Up @@ -78,8 +78,9 @@ void ShaderSystemInterface::saveMaterial(const std::string& name)
// IScriptInterface implementation
void ShaderSystemInterface::registerInterface(py::module& scope, py::dict& globals)
{
// Add the declaration for a Material object
// Add the declaration for a Material and Stage object
py::class_<ScriptMaterial> material(scope, "Material");
py::class_<ScriptMaterialStage> stage(scope, "MaterialStage");

// Add the old name as alias
scope.add_object("Shader", material);
Expand Down Expand Up @@ -208,7 +209,7 @@ void ShaderSystemInterface::registerInterface(py::module& scope, py::dict& globa
.value("TRANSLUCENT", Material::MC_TRANSLUCENT)
.export_values();

py::enum_<IShaderLayer::MapType>(material, "MapType")
py::enum_<IShaderLayer::MapType>(stage, "MapType")
.value("Map", IShaderLayer::MapType::Map)
.value("CubeMap", IShaderLayer::MapType::CubeMap)
.value("CameraCubeMap", IShaderLayer::MapType::CameraCubeMap)
Expand Down
17 changes: 13 additions & 4 deletions plugins/script/interfaces/ShaderSystemInterface.h
Expand Up @@ -9,6 +9,19 @@
namespace script
{

class ScriptMaterialStage
{
private:
IShaderLayer::Ptr _layer;

public:
ScriptMaterialStage(const IShaderLayer::Ptr& layer) :
_layer(layer)
{}


};

/**
* This class represents a single Material as seen by the Python script.
*/
Expand All @@ -21,10 +34,6 @@ class ScriptMaterial
_material(material)
{}

operator const MaterialPtr&() const {
return _material;
}

std::string getName() {
return _material ? _material->getName() : "";
}
Expand Down

0 comments on commit 0f1d9fc

Please sign in to comment.