Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ hostapp_test.hpp
build_utils/output
build_utils/class_descriptions/*.txt
build_utils/class_descriptions/*.md
build/
18 changes: 18 additions & 0 deletions build_utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Instructions how to use the build_utils
## Implement a new class
1. Go to the official SketchUp Ruby API documentation
2. Navigate to your class' page (f.ex. https://ruby.sketchup.com/Sketchup/View.html)
3. Navigate to the text "Instance Method Details"
4. Select every text from that line to the end of the page ("Generated by yard")
5. Copy the selection and paste it into a file named after the class' name (in this case "build_utils/class_descriptions/View.txt")
6. Enter `build_utils/scripts` and execute `./format_files.sh`
7. Create `build_utils/output` directory
8. Build the `parse_ruby_doc` CMake target
9. Enter the directory `build_utils/class_descriptions` and run `{PATH TO parse_ruby_doc}/parse_ruby_doc.exe View.md` (replace "View" with your class' name)
10. Validate the parsing of the documentation, saved in `output/*.hpp`
11. Edit where needed
12. Reuse the header file to craft the source one
- Helpful find & replace regex is `DEFINE_(WRAPPED_METHOD|WRAPPED_METHOD_0)\(` to be replaced with `IMPLEMENT_$1(Sketchup::View, ` (replace "View" with your class' name)
13. Move the header to `hostapp/`
14. Include the header file into `hostapp/implemented_objects.hpp`
14. Include the source file at the bottom of `hostapp/sketchup.hpp`
44 changes: 33 additions & 11 deletions hostapp/dummy_objects.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
#pragma once

class ViewObserver : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::ViewObserver">
{
public:
inline ViewObserver(VALUE obj) : IObject(obj)
{
}
inline ViewObserver(const IObject& obj) : IObject(obj)
{
}
};

class PickHelper : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::PickHelper">
{
public:
inline PickHelper(VALUE obj) : IObject(obj)
{
}
inline PickHelper(const IObject& obj) : IObject(obj)
{
}
};

class Camera : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::Camera">
{
public:
inline Camera(VALUE obj) : IObject(obj)
{
}
inline Camera(const IObject& obj) : IObject(obj)
{
}
};

class ImageRep : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::ImageRep">
{
public:
Expand Down Expand Up @@ -99,17 +132,6 @@ class ComponentDefinition : public RubyUtils::details::IObject, public RubyUtils
}
};

class View : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::View">
{
public:
inline View(VALUE obj) : IObject(obj)
{
}
inline View(const IObject& obj) : IObject(obj)
{
}
};

class Text : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Sketchup::Text">
{
public:
Expand Down
10 changes: 10 additions & 0 deletions hostapp/geom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ class Geom
{
}
};
class Bounds2d : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Geom::Bounds2d">
{
public:
inline Bounds2d(VALUE obj) : IObject(obj)
{
}
inline Bounds2d(const IObject& obj) : IObject(obj)
{
}
};
class Point3d : public RubyUtils::details::IObject, public RubyUtils::details::NamedRubyWrapper<"Geom::Point3d">
{
public:
Expand Down
10 changes: 10 additions & 0 deletions hostapp/implemented_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class DefinitionsObserver;
// https://ruby.sketchup.com/Sketchup/MaterialsObserver.html
class MaterialsObserver;

// https://ruby.sketchup.com/Sketchup/View.html
class DrawOptionSet;
class Draw2dOptionSet;
class DrawTextOptionSet;
class WriteImageOptionSet;
class View;

#include "material.hpp"

#include "materials.hpp"
Expand All @@ -51,6 +58,9 @@ class MaterialsObserver;

#include "entities.hpp"

#include "view_options.hpp"
#include "view.hpp"

#include "observers/makable_interface.hpp"

#include "observers/entities_observer.hpp"
Expand Down
1 change: 1 addition & 0 deletions hostapp/sketchup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace HostApp
#include "material.cc"
#include "materials.cc"
#include "model.cc"
#include "view.cc"
#include "entity.cc"
#include "definition_list.cc"
#include "entities.cc"
Loading