FreeCAD

Форк
0
/
AppMaterial.cpp 
112 строк · 4.1 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2023 David Carter <dcarter@david.carter.ca>             *
3
 *                                                                         *
4
 *   This file is part of FreeCAD.                                         *
5
 *                                                                         *
6
 *   FreeCAD is free software: you can redistribute it and/or modify it    *
7
 *   under the terms of the GNU Lesser General Public License as           *
8
 *   published by the Free Software Foundation, either version 2.1 of the  *
9
 *   License, or (at your option) any later version.                       *
10
 *                                                                         *
11
 *   FreeCAD is distributed in the hope that it will be useful, but        *
12
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
14
 *   Lesser General Public License for more details.                       *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Lesser General Public      *
17
 *   License along with FreeCAD. If not, see                               *
18
 *   <https://www.gnu.org/licenses/>.                                      *
19
 *                                                                         *
20
 **************************************************************************/
21

22
#include "PreCompiled.h"
23
#ifndef _PreComp_
24
#endif
25

26
#include <Base/Console.h>
27
#include <Base/Interpreter.h>
28
#include <Base/PyObjectBase.h>
29

30
#include <App/CleanupProcess.h>
31

32
#include "MaterialFilterPy.h"
33
#include "MaterialLoader.h"
34
#include "MaterialManagerPy.h"
35
#include "MaterialPy.h"
36
#include "ModelManagerPy.h"
37
#include "ModelPropertyPy.h"
38
#include "ModelPy.h"
39
#include "UUIDsPy.h"
40
#include "PropertyMaterial.h"
41

42
namespace Materials
43
{
44
class Module: public Py::ExtensionModule<Module>
45
{
46
public:
47
    Module()
48
        : Py::ExtensionModule<Module>("Materials")
49
    {
50
        initialize("This module is the Materials module.");  // register with Python
51
    }
52

53
    ~Module() override = default;
54

55
private:
56
};
57

58
PyObject* initModule()
59
{
60
    return Base::Interpreter().addModule(new Module);
61
}
62

63
}  // namespace Materials
64

65
PyMOD_INIT_FUNC(Materials)
66
{
67
#ifdef FC_DEBUG
68
    App::CleanupProcess::registerCleanup([]() {
69
        Materials::MaterialManager::cleanup();
70
        Materials::ModelManager::cleanup();
71
    });
72
#endif
73
    PyObject* module = Materials::initModule();
74

75
    Base::Console().Log("Loading Material module... done\n");
76

77
    Base::Interpreter().addType(&Materials::MaterialManagerPy::Type, module, "MaterialManager");
78
    Base::Interpreter().addType(&Materials::MaterialFilterPy::Type, module, "MaterialFilter");
79
    Base::Interpreter().addType(&Materials::MaterialPy::Type, module, "Material");
80
    Base::Interpreter().addType(&Materials::ModelManagerPy::Type, module, "ModelManager");
81
    Base::Interpreter().addType(&Materials::ModelPropertyPy::Type, module, "ModelProperty");
82
    Base::Interpreter().addType(&Materials::ModelPy::Type, module, "Model");
83
    Base::Interpreter().addType(&Materials::UUIDsPy::Type, module, "UUIDs");
84

85

86
    // clang-format off
87
    // Initialize types
88

89
    Materials::Material                 ::init();
90
    Materials::MaterialFilter           ::init();
91
    Materials::MaterialManager          ::init();
92
    Materials::Model                    ::init();
93
    Materials::ModelManager             ::init();
94
    Materials::ModelUUIDs               ::init();
95

96
    Materials::LibraryBase              ::init();
97
    Materials::MaterialLibrary          ::init();
98
    Materials::ModelLibrary             ::init();
99
    Materials::MaterialExternalLibrary  ::init();
100

101
    Materials::ModelProperty            ::init();
102
    Materials::MaterialProperty         ::init();
103

104
    Materials::MaterialValue            ::init();
105
    Materials::Material2DArray          ::init();
106
    Materials::Material3DArray          ::init();
107

108
    Materials::PropertyMaterial         ::init();
109
    // clang-format on
110

111
    PyMOD_Return(module);
112
}
113

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.