Blender V4.3
ScenePrettyPrinter.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include <fstream>
13#include <iostream>
14#include <string>
15
16#include "SceneVisitor.h"
17
18using namespace std;
19
20namespace Freestyle {
21
23 public:
24 ScenePrettyPrinter(const string &filename = "SceneLog.txt") : SceneVisitor()
25 {
26 if (!filename.empty()) {
27 _ofs.open(filename.c_str());
28 }
29 if (!_ofs.is_open()) {
30 cerr << "Warning, unable to open file \"" << filename << "\"" << endl;
31 }
32 _space = "";
33 }
34
36 {
37 if (_ofs.is_open()) {
38 _ofs.close();
39 }
40 }
41
42 //
43 // visitClass methods
44 //
46
53
59
60 virtual void visitNodeShapeBefore(NodeShape &);
61 virtual void visitNodeShapeAfter(NodeShape &);
62 virtual void visitNodeGroupBefore(NodeGroup &);
63 virtual void visitNodeGroupAfter(NodeGroup &);
68
69 protected:
71 {
72 _space += " ";
73 }
74
76 {
77 _space.erase(0, 2);
78 }
79
80 private:
81 ofstream _ofs;
82 string _space;
83};
84
85} /* namespace Freestyle */
Class to visit (without doing anything) a scene graph structure.
virtual void visitNodeGroupBefore(NodeGroup &)
ScenePrettyPrinter(const string &filename="SceneLog.txt")
virtual void visitNodeDrawingStyleBefore(NodeDrawingStyle &)
virtual void visitNodeShapeBefore(NodeShape &)
virtual void visitNodeDrawingStyleAfter(NodeDrawingStyle &)
virtual void visitNodeShapeAfter(NodeShape &)
virtual void visitNodeGroupAfter(NodeGroup &)
VISIT_DECL(NodeDrawingStyle)
virtual void visitNodeTransformBefore(NodeTransform &)
virtual void visitNodeTransformAfter(NodeTransform &)
inherits from class Rep
Definition AppCanvas.cpp:20