| 713 | } |
| 714 | |
| 715 | FALCOR_SCRIPT_BINDING(RenderGraph) |
| 716 | { |
| 717 | using namespace pybind11::literals; |
| 718 | |
| 719 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Formats) |
| 720 | FALCOR_SCRIPT_BINDING_DEPENDENCY(Resource) |
| 721 | |
| 722 | // RenderPass |
| 723 | pybind11::class_<RenderPass, ref<RenderPass>> renderPass(m, "RenderPass"); |
| 724 | renderPass.def_property_readonly("name", &RenderPass::getName); |
| 725 | renderPass.def_property_readonly("type", &RenderPass::getType); |
| 726 | renderPass.def_property_readonly("desc", &RenderPass::getDesc); |
| 727 | renderPass.def_property_readonly("properties", [](RenderPass& self) { return self.getProperties().toPython(); }); |
| 728 | renderPass.def("set_properties", [](RenderPass& self, pybind11::dict dict) { self.setProperties(Properties(dict)); }); |
| 729 | |
| 730 | // PYTHONDEPRECATED BEGIN |
| 731 | renderPass.def("getDictionary", [](RenderPass& pass) { return pass.getProperties().toPython(); }); |
| 732 | // PYTHONDEPRECATED END |
| 733 | |
| 734 | // RenderGraph |
| 735 | pybind11::class_<RenderGraph, ref<RenderGraph>> renderGraph(m, "RenderGraph"); |
| 736 | renderGraph.def_property("name", &RenderGraph::getName, &RenderGraph::setName); |
| 737 | |
| 738 | renderGraph.def( |
| 739 | "create_pass", |
| 740 | [](RenderGraph& graph, const std::string& pass_name, const std::string& pass_type, pybind11::dict dict = {}) |
| 741 | { return graph.createPass(pass_name, pass_type, Properties(dict)); }, |
| 742 | "pass_name"_a, |
| 743 | "pass_type"_a, |
| 744 | "dict"_a = pybind11::dict() |
| 745 | ); |
| 746 | renderGraph.def("remove_pass", &RenderGraph::removePass, "name"_a); |
| 747 | renderGraph.def( |
| 748 | "update_pass", |
| 749 | [](RenderGraph& graph, const std::string& name, pybind11::dict dict) { graph.updatePass(name, Properties(dict)); }, |
| 750 | "name"_a, |
| 751 | "dict"_a |
| 752 | ); |
| 753 | renderGraph.def("add_edge", &RenderGraph::addEdge, "src"_a, "dst"_a); |
| 754 | renderGraph.def( |
| 755 | "remove_edge", pybind11::overload_cast<const std::string&, const std::string&>(&RenderGraph::removeEdge), "src"_a, "dst"_a |
| 756 | ); |
| 757 | renderGraph.def("mark_output", &RenderGraph::markOutput, "name"_a, "mask"_a = TextureChannelFlags::RGB); |
| 758 | renderGraph.def("unmark_output", &RenderGraph::unmarkOutput, "name"_a); |
| 759 | renderGraph.def("get_pass", &RenderGraph::getPass, "name"_a); |
| 760 | renderGraph.def("__getitem__", [](RenderGraph& self, const std::string& name) { return self.getPass(name); }); |
| 761 | renderGraph.def("get_output", pybind11::overload_cast<const std::string&>(&RenderGraph::getOutput), "name"_a); |
| 762 | |
| 763 | // PYTHONDEPRECATED BEGIN |
| 764 | renderGraph.def( |
| 765 | pybind11::init([](const std::string& name) { return RenderGraph::create(accessActivePythonRenderGraphDevice(), name); }), "name"_a |
| 766 | ); |
| 767 | renderGraph.def_static( |
| 768 | "createFromFile", |
| 769 | [](const std::filesystem::path& path) { return RenderGraph::createFromFile(accessActivePythonRenderGraphDevice(), path); }, |
| 770 | "path"_a |
| 771 | ); |
| 772 |
nothing calls this directly
no test coverage detected