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